{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gtk.Objects.TextMark ( -- * Exported types TextMark(..) , TextMarkK , toTextMark , noTextMark , -- * Methods -- ** textMarkGetBuffer textMarkGetBuffer , -- ** textMarkGetDeleted textMarkGetDeleted , -- ** textMarkGetLeftGravity textMarkGetLeftGravity , -- ** textMarkGetName textMarkGetName , -- ** textMarkGetVisible textMarkGetVisible , -- ** textMarkNew textMarkNew , -- ** textMarkSetVisible textMarkSetVisible , -- * Properties -- ** LeftGravity TextMarkLeftGravityPropertyInfo , constructTextMarkLeftGravity , getTextMarkLeftGravity , -- ** Name TextMarkNamePropertyInfo , constructTextMarkName , getTextMarkName , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gtk.Types import GI.Gtk.Callbacks import qualified GI.GObject as GObject newtype TextMark = TextMark (ForeignPtr TextMark) foreign import ccall "gtk_text_mark_get_type" c_gtk_text_mark_get_type :: IO GType type instance ParentTypes TextMark = TextMarkParentTypes type TextMarkParentTypes = '[GObject.Object] instance GObject TextMark where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_gtk_text_mark_get_type class GObject o => TextMarkK o instance (GObject o, IsDescendantOf TextMark o) => TextMarkK o toTextMark :: TextMarkK o => o -> IO TextMark toTextMark = unsafeCastTo TextMark noTextMark :: Maybe TextMark noTextMark = Nothing -- VVV Prop "left-gravity" -- Type: TBasicType TBoolean -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getTextMarkLeftGravity :: (MonadIO m, TextMarkK o) => o -> m Bool getTextMarkLeftGravity obj = liftIO $ getObjectPropertyBool obj "left-gravity" constructTextMarkLeftGravity :: Bool -> IO ([Char], GValue) constructTextMarkLeftGravity val = constructObjectPropertyBool "left-gravity" val data TextMarkLeftGravityPropertyInfo instance AttrInfo TextMarkLeftGravityPropertyInfo where type AttrAllowedOps TextMarkLeftGravityPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint TextMarkLeftGravityPropertyInfo = (~) Bool type AttrBaseTypeConstraint TextMarkLeftGravityPropertyInfo = TextMarkK type AttrGetType TextMarkLeftGravityPropertyInfo = Bool type AttrLabel TextMarkLeftGravityPropertyInfo = "TextMark::left-gravity" attrGet _ = getTextMarkLeftGravity attrSet _ = undefined attrConstruct _ = constructTextMarkLeftGravity -- VVV Prop "name" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] getTextMarkName :: (MonadIO m, TextMarkK o) => o -> m T.Text getTextMarkName obj = liftIO $ getObjectPropertyString obj "name" constructTextMarkName :: T.Text -> IO ([Char], GValue) constructTextMarkName val = constructObjectPropertyString "name" val data TextMarkNamePropertyInfo instance AttrInfo TextMarkNamePropertyInfo where type AttrAllowedOps TextMarkNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint TextMarkNamePropertyInfo = (~) T.Text type AttrBaseTypeConstraint TextMarkNamePropertyInfo = TextMarkK type AttrGetType TextMarkNamePropertyInfo = T.Text type AttrLabel TextMarkNamePropertyInfo = "TextMark::name" attrGet _ = getTextMarkName attrSet _ = undefined attrConstruct _ = constructTextMarkName type instance AttributeList TextMark = TextMarkAttributeList type TextMarkAttributeList = ('[ '("left-gravity", TextMarkLeftGravityPropertyInfo), '("name", TextMarkNamePropertyInfo)] :: [(Symbol, *)]) type instance SignalList TextMark = TextMarkSignalList type TextMarkSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method TextMark::new -- method type : Constructor -- Args : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "left_gravity", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "left_gravity", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "TextMark" -- throws : False -- Skip return : False foreign import ccall "gtk_text_mark_new" gtk_text_mark_new :: CString -> -- name : TBasicType TUTF8 CInt -> -- left_gravity : TBasicType TBoolean IO (Ptr TextMark) textMarkNew :: (MonadIO m) => Maybe (T.Text) -> -- name Bool -> -- left_gravity m TextMark textMarkNew name left_gravity = liftIO $ do maybeName <- case name of Nothing -> return nullPtr Just jName -> do jName' <- textToCString jName return jName' let left_gravity' = (fromIntegral . fromEnum) left_gravity result <- gtk_text_mark_new maybeName left_gravity' checkUnexpectedReturnNULL "gtk_text_mark_new" result result' <- (wrapObject TextMark) result freeMem maybeName return result' -- method TextMark::get_buffer -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "TextBuffer" -- throws : False -- Skip return : False foreign import ccall "gtk_text_mark_get_buffer" gtk_text_mark_get_buffer :: Ptr TextMark -> -- _obj : TInterface "Gtk" "TextMark" IO (Ptr TextBuffer) textMarkGetBuffer :: (MonadIO m, TextMarkK a) => a -> -- _obj m TextBuffer textMarkGetBuffer _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_text_mark_get_buffer _obj' checkUnexpectedReturnNULL "gtk_text_mark_get_buffer" result result' <- (newObject TextBuffer) result touchManagedPtr _obj return result' -- method TextMark::get_deleted -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "gtk_text_mark_get_deleted" gtk_text_mark_get_deleted :: Ptr TextMark -> -- _obj : TInterface "Gtk" "TextMark" IO CInt textMarkGetDeleted :: (MonadIO m, TextMarkK a) => a -> -- _obj m Bool textMarkGetDeleted _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_text_mark_get_deleted _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method TextMark::get_left_gravity -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "gtk_text_mark_get_left_gravity" gtk_text_mark_get_left_gravity :: Ptr TextMark -> -- _obj : TInterface "Gtk" "TextMark" IO CInt textMarkGetLeftGravity :: (MonadIO m, TextMarkK a) => a -> -- _obj m Bool textMarkGetLeftGravity _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_text_mark_get_left_gravity _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method TextMark::get_name -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "gtk_text_mark_get_name" gtk_text_mark_get_name :: Ptr TextMark -> -- _obj : TInterface "Gtk" "TextMark" IO CString textMarkGetName :: (MonadIO m, TextMarkK a) => a -> -- _obj m T.Text textMarkGetName _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_text_mark_get_name _obj' checkUnexpectedReturnNULL "gtk_text_mark_get_name" result result' <- cstringToText result touchManagedPtr _obj return result' -- method TextMark::get_visible -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "gtk_text_mark_get_visible" gtk_text_mark_get_visible :: Ptr TextMark -> -- _obj : TInterface "Gtk" "TextMark" IO CInt textMarkGetVisible :: (MonadIO m, TextMarkK a) => a -> -- _obj m Bool textMarkGetVisible _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- gtk_text_mark_get_visible _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method TextMark::set_visible -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "setting", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "TextMark", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "setting", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_text_mark_set_visible" gtk_text_mark_set_visible :: Ptr TextMark -> -- _obj : TInterface "Gtk" "TextMark" CInt -> -- setting : TBasicType TBoolean IO () textMarkSetVisible :: (MonadIO m, TextMarkK a) => a -> -- _obj Bool -> -- setting m () textMarkSetVisible _obj setting = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let setting' = (fromIntegral . fromEnum) setting gtk_text_mark_set_visible _obj' setting' touchManagedPtr _obj return ()