#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Objects.TextMark
(
TextMark(..) ,
IsTextMark ,
toTextMark ,
noTextMark ,
#if ENABLE_OVERLOADING
TextMarkGetBufferMethodInfo ,
#endif
textMarkGetBuffer ,
#if ENABLE_OVERLOADING
TextMarkGetDeletedMethodInfo ,
#endif
textMarkGetDeleted ,
#if ENABLE_OVERLOADING
TextMarkGetLeftGravityMethodInfo ,
#endif
textMarkGetLeftGravity ,
#if ENABLE_OVERLOADING
TextMarkGetNameMethodInfo ,
#endif
textMarkGetName ,
#if ENABLE_OVERLOADING
TextMarkGetVisibleMethodInfo ,
#endif
textMarkGetVisible ,
textMarkNew ,
#if ENABLE_OVERLOADING
TextMarkSetVisibleMethodInfo ,
#endif
textMarkSetVisible ,
#if ENABLE_OVERLOADING
TextMarkLeftGravityPropertyInfo ,
#endif
constructTextMarkLeftGravity ,
getTextMarkLeftGravity ,
#if ENABLE_OVERLOADING
textMarkLeftGravity ,
#endif
#if ENABLE_OVERLOADING
TextMarkNamePropertyInfo ,
#endif
constructTextMarkName ,
getTextMarkName ,
#if ENABLE_OVERLOADING
textMarkName ,
#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.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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Objects.TextBuffer as Gtk.TextBuffer
newtype TextMark = TextMark (ManagedPtr TextMark)
foreign import ccall "gtk_text_mark_get_type"
c_gtk_text_mark_get_type :: IO GType
instance GObject TextMark where
gobjectType _ = c_gtk_text_mark_get_type
class GObject o => IsTextMark o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError TextMark a) =>
IsTextMark a
#endif
instance IsTextMark TextMark
instance GObject.Object.IsObject TextMark
toTextMark :: (MonadIO m, IsTextMark o) => o -> m TextMark
toTextMark = liftIO . unsafeCastTo TextMark
noTextMark :: Maybe TextMark
noTextMark = Nothing
#if ENABLE_OVERLOADING
type family ResolveTextMarkMethod (t :: Symbol) (o :: *) :: * where
ResolveTextMarkMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveTextMarkMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveTextMarkMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveTextMarkMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveTextMarkMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveTextMarkMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveTextMarkMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveTextMarkMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveTextMarkMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveTextMarkMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveTextMarkMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveTextMarkMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveTextMarkMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveTextMarkMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveTextMarkMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveTextMarkMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveTextMarkMethod "getBuffer" o = TextMarkGetBufferMethodInfo
ResolveTextMarkMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveTextMarkMethod "getDeleted" o = TextMarkGetDeletedMethodInfo
ResolveTextMarkMethod "getLeftGravity" o = TextMarkGetLeftGravityMethodInfo
ResolveTextMarkMethod "getName" o = TextMarkGetNameMethodInfo
ResolveTextMarkMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveTextMarkMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveTextMarkMethod "getVisible" o = TextMarkGetVisibleMethodInfo
ResolveTextMarkMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveTextMarkMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveTextMarkMethod "setVisible" o = TextMarkSetVisibleMethodInfo
ResolveTextMarkMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTextMarkMethod t TextMark, O.MethodInfo info TextMark p) => O.IsLabelProxy t (TextMark -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTextMarkMethod t TextMark, O.MethodInfo info TextMark p) => O.IsLabel t (TextMark -> 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
#endif
getTextMarkLeftGravity :: (MonadIO m, IsTextMark o) => o -> m Bool
getTextMarkLeftGravity obj = liftIO $ getObjectPropertyBool obj "left-gravity"
constructTextMarkLeftGravity :: (IsTextMark o) => Bool -> IO (GValueConstruct o)
constructTextMarkLeftGravity val = constructObjectPropertyBool "left-gravity" val
#if ENABLE_OVERLOADING
data TextMarkLeftGravityPropertyInfo
instance AttrInfo TextMarkLeftGravityPropertyInfo where
type AttrAllowedOps TextMarkLeftGravityPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint TextMarkLeftGravityPropertyInfo = (~) Bool
type AttrBaseTypeConstraint TextMarkLeftGravityPropertyInfo = IsTextMark
type AttrGetType TextMarkLeftGravityPropertyInfo = Bool
type AttrLabel TextMarkLeftGravityPropertyInfo = "left-gravity"
type AttrOrigin TextMarkLeftGravityPropertyInfo = TextMark
attrGet _ = getTextMarkLeftGravity
attrSet _ = undefined
attrConstruct _ = constructTextMarkLeftGravity
attrClear _ = undefined
#endif
getTextMarkName :: (MonadIO m, IsTextMark o) => o -> m (Maybe T.Text)
getTextMarkName obj = liftIO $ getObjectPropertyString obj "name"
constructTextMarkName :: (IsTextMark o) => T.Text -> IO (GValueConstruct o)
constructTextMarkName val = constructObjectPropertyString "name" (Just val)
#if ENABLE_OVERLOADING
data TextMarkNamePropertyInfo
instance AttrInfo TextMarkNamePropertyInfo where
type AttrAllowedOps TextMarkNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint TextMarkNamePropertyInfo = (~) T.Text
type AttrBaseTypeConstraint TextMarkNamePropertyInfo = IsTextMark
type AttrGetType TextMarkNamePropertyInfo = (Maybe T.Text)
type AttrLabel TextMarkNamePropertyInfo = "name"
type AttrOrigin TextMarkNamePropertyInfo = TextMark
attrGet _ = getTextMarkName
attrSet _ = undefined
attrConstruct _ = constructTextMarkName
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList TextMark
type instance O.AttributeList TextMark = TextMarkAttributeList
type TextMarkAttributeList = ('[ '("leftGravity", TextMarkLeftGravityPropertyInfo), '("name", TextMarkNamePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
textMarkLeftGravity :: AttrLabelProxy "leftGravity"
textMarkLeftGravity = AttrLabelProxy
textMarkName :: AttrLabelProxy "name"
textMarkName = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList TextMark = TextMarkSignalList
type TextMarkSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_text_mark_new" gtk_text_mark_new ::
CString ->
CInt ->
IO (Ptr TextMark)
textMarkNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (T.Text)
-> Bool
-> m TextMark
textMarkNew name leftGravity = liftIO $ do
maybeName <- case name of
Nothing -> return nullPtr
Just jName -> do
jName' <- textToCString jName
return jName'
let leftGravity' = (fromIntegral . fromEnum) leftGravity
result <- gtk_text_mark_new maybeName leftGravity'
checkUnexpectedReturnNULL "textMarkNew" result
result' <- (wrapObject TextMark) result
freeMem maybeName
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "gtk_text_mark_get_buffer" gtk_text_mark_get_buffer ::
Ptr TextMark ->
IO (Ptr Gtk.TextBuffer.TextBuffer)
textMarkGetBuffer ::
(B.CallStack.HasCallStack, MonadIO m, IsTextMark a) =>
a
-> m Gtk.TextBuffer.TextBuffer
textMarkGetBuffer mark = liftIO $ do
mark' <- unsafeManagedPtrCastPtr mark
result <- gtk_text_mark_get_buffer mark'
checkUnexpectedReturnNULL "textMarkGetBuffer" result
result' <- (newObject Gtk.TextBuffer.TextBuffer) result
touchManagedPtr mark
return result'
#if ENABLE_OVERLOADING
data TextMarkGetBufferMethodInfo
instance (signature ~ (m Gtk.TextBuffer.TextBuffer), MonadIO m, IsTextMark a) => O.MethodInfo TextMarkGetBufferMethodInfo a signature where
overloadedMethod _ = textMarkGetBuffer
#endif
foreign import ccall "gtk_text_mark_get_deleted" gtk_text_mark_get_deleted ::
Ptr TextMark ->
IO CInt
textMarkGetDeleted ::
(B.CallStack.HasCallStack, MonadIO m, IsTextMark a) =>
a
-> m Bool
textMarkGetDeleted mark = liftIO $ do
mark' <- unsafeManagedPtrCastPtr mark
result <- gtk_text_mark_get_deleted mark'
let result' = (/= 0) result
touchManagedPtr mark
return result'
#if ENABLE_OVERLOADING
data TextMarkGetDeletedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTextMark a) => O.MethodInfo TextMarkGetDeletedMethodInfo a signature where
overloadedMethod _ = textMarkGetDeleted
#endif
foreign import ccall "gtk_text_mark_get_left_gravity" gtk_text_mark_get_left_gravity ::
Ptr TextMark ->
IO CInt
textMarkGetLeftGravity ::
(B.CallStack.HasCallStack, MonadIO m, IsTextMark a) =>
a
-> m Bool
textMarkGetLeftGravity mark = liftIO $ do
mark' <- unsafeManagedPtrCastPtr mark
result <- gtk_text_mark_get_left_gravity mark'
let result' = (/= 0) result
touchManagedPtr mark
return result'
#if ENABLE_OVERLOADING
data TextMarkGetLeftGravityMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTextMark a) => O.MethodInfo TextMarkGetLeftGravityMethodInfo a signature where
overloadedMethod _ = textMarkGetLeftGravity
#endif
foreign import ccall "gtk_text_mark_get_name" gtk_text_mark_get_name ::
Ptr TextMark ->
IO CString
textMarkGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsTextMark a) =>
a
-> m (Maybe T.Text)
textMarkGetName mark = liftIO $ do
mark' <- unsafeManagedPtrCastPtr mark
result <- gtk_text_mark_get_name mark'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr mark
return maybeResult
#if ENABLE_OVERLOADING
data TextMarkGetNameMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsTextMark a) => O.MethodInfo TextMarkGetNameMethodInfo a signature where
overloadedMethod _ = textMarkGetName
#endif
foreign import ccall "gtk_text_mark_get_visible" gtk_text_mark_get_visible ::
Ptr TextMark ->
IO CInt
textMarkGetVisible ::
(B.CallStack.HasCallStack, MonadIO m, IsTextMark a) =>
a
-> m Bool
textMarkGetVisible mark = liftIO $ do
mark' <- unsafeManagedPtrCastPtr mark
result <- gtk_text_mark_get_visible mark'
let result' = (/= 0) result
touchManagedPtr mark
return result'
#if ENABLE_OVERLOADING
data TextMarkGetVisibleMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsTextMark a) => O.MethodInfo TextMarkGetVisibleMethodInfo a signature where
overloadedMethod _ = textMarkGetVisible
#endif
foreign import ccall "gtk_text_mark_set_visible" gtk_text_mark_set_visible ::
Ptr TextMark ->
CInt ->
IO ()
textMarkSetVisible ::
(B.CallStack.HasCallStack, MonadIO m, IsTextMark a) =>
a
-> Bool
-> m ()
textMarkSetVisible mark setting = liftIO $ do
mark' <- unsafeManagedPtrCastPtr mark
let setting' = (fromIntegral . fromEnum) setting
gtk_text_mark_set_visible mark' setting'
touchManagedPtr mark
return ()
#if ENABLE_OVERLOADING
data TextMarkSetVisibleMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsTextMark a) => O.MethodInfo TextMarkSetVisibleMethodInfo a signature where
overloadedMethod _ = textMarkSetVisible
#endif