{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) /No description available in the introspection data./ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.GtkSource.Objects.Mark ( -- * Exported types Mark(..) , IsMark , toMark , noMark , -- * Methods -- ** getCategory #method:getCategory# #if ENABLE_OVERLOADING MarkGetCategoryMethodInfo , #endif markGetCategory , -- ** new #method:new# markNew , -- ** next #method:next# #if ENABLE_OVERLOADING MarkNextMethodInfo , #endif markNext , -- ** prev #method:prev# #if ENABLE_OVERLOADING MarkPrevMethodInfo , #endif markPrev , -- * Properties -- ** category #attr:category# {- | The category of the 'GI.GtkSource.Objects.Mark.Mark', classifies the mark and controls which pixbuf is used and with which priority it is drawn. -} #if ENABLE_OVERLOADING MarkCategoryPropertyInfo , #endif constructMarkCategory , getMarkCategory , #if ENABLE_OVERLOADING markCategory , #endif ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GI.GObject.Objects.Object as GObject.Object import qualified GI.Gtk.Objects.TextMark as Gtk.TextMark -- | Memory-managed wrapper type. newtype Mark = Mark (ManagedPtr Mark) foreign import ccall "gtk_source_mark_get_type" c_gtk_source_mark_get_type :: IO GType instance GObject Mark where gobjectType = c_gtk_source_mark_get_type -- | Type class for types which can be safely cast to `Mark`, for instance with `toMark`. class (GObject o, O.IsDescendantOf Mark o) => IsMark o instance (GObject o, O.IsDescendantOf Mark o) => IsMark o instance O.HasParentTypes Mark type instance O.ParentTypes Mark = '[Gtk.TextMark.TextMark, GObject.Object.Object] -- | Cast to `Mark`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toMark :: (MonadIO m, IsMark o) => o -> m Mark toMark = liftIO . unsafeCastTo Mark -- | A convenience alias for `Nothing` :: `Maybe` `Mark`. noMark :: Maybe Mark noMark = Nothing #if ENABLE_OVERLOADING type family ResolveMarkMethod (t :: Symbol) (o :: *) :: * where ResolveMarkMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveMarkMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveMarkMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveMarkMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveMarkMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolveMarkMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveMarkMethod "next" o = MarkNextMethodInfo ResolveMarkMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveMarkMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveMarkMethod "prev" o = MarkPrevMethodInfo ResolveMarkMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolveMarkMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveMarkMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveMarkMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveMarkMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveMarkMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveMarkMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolveMarkMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveMarkMethod "getBuffer" o = Gtk.TextMark.TextMarkGetBufferMethodInfo ResolveMarkMethod "getCategory" o = MarkGetCategoryMethodInfo ResolveMarkMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveMarkMethod "getDeleted" o = Gtk.TextMark.TextMarkGetDeletedMethodInfo ResolveMarkMethod "getLeftGravity" o = Gtk.TextMark.TextMarkGetLeftGravityMethodInfo ResolveMarkMethod "getName" o = Gtk.TextMark.TextMarkGetNameMethodInfo ResolveMarkMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveMarkMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveMarkMethod "getVisible" o = Gtk.TextMark.TextMarkGetVisibleMethodInfo ResolveMarkMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveMarkMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveMarkMethod "setVisible" o = Gtk.TextMark.TextMarkSetVisibleMethodInfo ResolveMarkMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveMarkMethod t Mark, O.MethodInfo info Mark p) => OL.IsLabel t (Mark -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif #endif -- VVV Prop "category" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Just False,Nothing) {- | Get the value of the “@category@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' mark #category @ -} getMarkCategory :: (MonadIO m, IsMark o) => o -> m T.Text getMarkCategory obj = liftIO $ checkUnexpectedNothing "getMarkCategory" $ B.Properties.getObjectPropertyString obj "category" {- | Construct a `GValueConstruct` with valid value for the “@category@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructMarkCategory :: (IsMark o) => T.Text -> IO (GValueConstruct o) constructMarkCategory val = B.Properties.constructObjectPropertyString "category" (Just val) #if ENABLE_OVERLOADING data MarkCategoryPropertyInfo instance AttrInfo MarkCategoryPropertyInfo where type AttrAllowedOps MarkCategoryPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint MarkCategoryPropertyInfo = (~) T.Text type AttrBaseTypeConstraint MarkCategoryPropertyInfo = IsMark type AttrGetType MarkCategoryPropertyInfo = T.Text type AttrLabel MarkCategoryPropertyInfo = "category" type AttrOrigin MarkCategoryPropertyInfo = Mark attrGet _ = getMarkCategory attrSet _ = undefined attrConstruct _ = constructMarkCategory attrClear _ = undefined #endif #if ENABLE_OVERLOADING instance O.HasAttributeList Mark type instance O.AttributeList Mark = MarkAttributeList type MarkAttributeList = ('[ '("category", MarkCategoryPropertyInfo), '("leftGravity", Gtk.TextMark.TextMarkLeftGravityPropertyInfo), '("name", Gtk.TextMark.TextMarkNamePropertyInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING markCategory :: AttrLabelProxy "category" markCategory = AttrLabelProxy #endif #if ENABLE_OVERLOADING type instance O.SignalList Mark = MarkSignalList type MarkSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) #endif -- method Mark::new -- method type : Constructor -- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Name of the #GtkSourceMark, can be NULL when not using a name", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "is used to classify marks according to common characteristics\n(e.g. all the marks representing a bookmark could belong to the \"bookmark\"\ncategory, or all the marks representing a compilation error could belong to\n\"error\" category).", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Mark"})) -- throws : False -- Skip return : False foreign import ccall "gtk_source_mark_new" gtk_source_mark_new :: CString -> -- name : TBasicType TUTF8 CString -> -- category : TBasicType TUTF8 IO (Ptr Mark) {- | Creates a text mark. Add it to a buffer using 'GI.Gtk.Objects.TextBuffer.textBufferAddMark'. If name is NULL, the mark is anonymous; otherwise, the mark can be retrieved by name using 'GI.Gtk.Objects.TextBuffer.textBufferGetMark'. Normally marks are created using the utility function 'GI.GtkSource.Objects.Buffer.bufferCreateSourceMark'. /Since: 2.2/ -} markNew :: (B.CallStack.HasCallStack, MonadIO m) => T.Text {- ^ /@name@/: Name of the 'GI.GtkSource.Objects.Mark.Mark', can be NULL when not using a name -} -> T.Text {- ^ /@category@/: is used to classify marks according to common characteristics (e.g. all the marks representing a bookmark could belong to the \"bookmark\" category, or all the marks representing a compilation error could belong to \"error\" category). -} -> m Mark {- ^ __Returns:__ a new 'GI.GtkSource.Objects.Mark.Mark' that can be added using 'GI.Gtk.Objects.TextBuffer.textBufferAddMark'. -} markNew name category = liftIO $ do name' <- textToCString name category' <- textToCString category result <- gtk_source_mark_new name' category' checkUnexpectedReturnNULL "markNew" result result' <- (wrapObject Mark) result freeMem name' freeMem category' return result' #if ENABLE_OVERLOADING #endif -- method Mark::get_category -- method type : OrdinaryMethod -- Args : [Arg {argCName = "mark", argType = TInterface (Name {namespace = "GtkSource", name = "Mark"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceMark.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "gtk_source_mark_get_category" gtk_source_mark_get_category :: Ptr Mark -> -- mark : TInterface (Name {namespace = "GtkSource", name = "Mark"}) IO CString {- | Returns the mark category. /Since: 2.2/ -} markGetCategory :: (B.CallStack.HasCallStack, MonadIO m, IsMark a) => a {- ^ /@mark@/: a 'GI.GtkSource.Objects.Mark.Mark'. -} -> m T.Text {- ^ __Returns:__ the category of the 'GI.GtkSource.Objects.Mark.Mark'. -} markGetCategory mark = liftIO $ do mark' <- unsafeManagedPtrCastPtr mark result <- gtk_source_mark_get_category mark' checkUnexpectedReturnNULL "markGetCategory" result result' <- cstringToText result touchManagedPtr mark return result' #if ENABLE_OVERLOADING data MarkGetCategoryMethodInfo instance (signature ~ (m T.Text), MonadIO m, IsMark a) => O.MethodInfo MarkGetCategoryMethodInfo a signature where overloadedMethod _ = markGetCategory #endif -- method Mark::next -- method type : OrdinaryMethod -- Args : [Arg {argCName = "mark", argType = TInterface (Name {namespace = "GtkSource", name = "Mark"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceMark.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a string specifying the mark category, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Mark"})) -- throws : False -- Skip return : False foreign import ccall "gtk_source_mark_next" gtk_source_mark_next :: Ptr Mark -> -- mark : TInterface (Name {namespace = "GtkSource", name = "Mark"}) CString -> -- category : TBasicType TUTF8 IO (Ptr Mark) {- | Returns the next 'GI.GtkSource.Objects.Mark.Mark' in the buffer or 'Nothing' if the mark was not added to a buffer. If there is no next mark, 'Nothing' will be returned. If /@category@/ is 'Nothing', looks for marks of any category. /Since: 2.2/ -} markNext :: (B.CallStack.HasCallStack, MonadIO m, IsMark a) => a {- ^ /@mark@/: a 'GI.GtkSource.Objects.Mark.Mark'. -} -> Maybe (T.Text) {- ^ /@category@/: a string specifying the mark category, or 'Nothing'. -} -> m (Maybe Mark) {- ^ __Returns:__ the next 'GI.GtkSource.Objects.Mark.Mark', or 'Nothing'. -} markNext mark category = liftIO $ do mark' <- unsafeManagedPtrCastPtr mark maybeCategory <- case category of Nothing -> return nullPtr Just jCategory -> do jCategory' <- textToCString jCategory return jCategory' result <- gtk_source_mark_next mark' maybeCategory maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject Mark) result' return result'' touchManagedPtr mark freeMem maybeCategory return maybeResult #if ENABLE_OVERLOADING data MarkNextMethodInfo instance (signature ~ (Maybe (T.Text) -> m (Maybe Mark)), MonadIO m, IsMark a) => O.MethodInfo MarkNextMethodInfo a signature where overloadedMethod _ = markNext #endif -- method Mark::prev -- method type : OrdinaryMethod -- Args : [Arg {argCName = "mark", argType = TInterface (Name {namespace = "GtkSource", name = "Mark"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceMark.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "category", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a string specifying the mark category, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "Mark"})) -- throws : False -- Skip return : False foreign import ccall "gtk_source_mark_prev" gtk_source_mark_prev :: Ptr Mark -> -- mark : TInterface (Name {namespace = "GtkSource", name = "Mark"}) CString -> -- category : TBasicType TUTF8 IO (Ptr Mark) {- | Returns the previous 'GI.GtkSource.Objects.Mark.Mark' in the buffer or 'Nothing' if the mark was not added to a buffer. If there is no previous mark, 'Nothing' is returned. If /@category@/ is 'Nothing', looks for marks of any category /Since: 2.2/ -} markPrev :: (B.CallStack.HasCallStack, MonadIO m, IsMark a) => a {- ^ /@mark@/: a 'GI.GtkSource.Objects.Mark.Mark'. -} -> T.Text {- ^ /@category@/: a string specifying the mark category, or 'Nothing'. -} -> m (Maybe Mark) {- ^ __Returns:__ the previous 'GI.GtkSource.Objects.Mark.Mark', or 'Nothing'. -} markPrev mark category = liftIO $ do mark' <- unsafeManagedPtrCastPtr mark category' <- textToCString category result <- gtk_source_mark_prev mark' category' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject Mark) result' return result'' touchManagedPtr mark freeMem category' return maybeResult #if ENABLE_OVERLOADING data MarkPrevMethodInfo instance (signature ~ (T.Text -> m (Maybe Mark)), MonadIO m, IsMark a) => O.MethodInfo MarkPrevMethodInfo a signature where overloadedMethod _ = markPrev #endif