gi-gtk-0.3.18.13: GI/Gtk/Structs/TextAttributes.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
Using #GtkTextAttributes directly should rarely be necessary.
It’s primarily useful with gtk_text_iter_get_attributes().
As with most GTK+ structs, the fields in this struct should only
be read, never modified directly.
-}
module GI.Gtk.Structs.TextAttributes
(
-- * Exported types
TextAttributes(..) ,
newZeroTextAttributes ,
noTextAttributes ,
-- * Methods
-- ** textAttributesCopy
TextAttributesCopyMethodInfo ,
textAttributesCopy ,
-- ** textAttributesCopyValues
TextAttributesCopyValuesMethodInfo ,
textAttributesCopyValues ,
-- ** textAttributesNew
textAttributesNew ,
-- ** textAttributesRef
TextAttributesRefMethodInfo ,
textAttributesRef ,
-- ** textAttributesUnref
TextAttributesUnrefMethodInfo ,
textAttributesUnref ,
-- * Properties
-- ** Appearance
textAttributesReadAppearance ,
-- ** BgFullHeight
textAttributesReadBgFullHeight ,
-- ** Direction
textAttributesReadDirection ,
-- ** Editable
textAttributesReadEditable ,
-- ** Font
textAttributesReadFont ,
-- ** FontScale
textAttributesReadFontScale ,
-- ** Indent
textAttributesReadIndent ,
-- ** Invisible
textAttributesReadInvisible ,
-- ** Justification
textAttributesReadJustification ,
-- ** Language
textAttributesReadLanguage ,
-- ** LeftMargin
textAttributesReadLeftMargin ,
-- ** LetterSpacing
textAttributesReadLetterSpacing ,
-- ** NoFallback
textAttributesReadNoFallback ,
-- ** PixelsAboveLines
textAttributesReadPixelsAboveLines ,
-- ** PixelsBelowLines
textAttributesReadPixelsBelowLines ,
-- ** PixelsInsideWrap
textAttributesReadPixelsInsideWrap ,
-- ** RightMargin
textAttributesReadRightMargin ,
-- ** Tabs
textAttributesReadTabs ,
-- ** WrapMode
textAttributesReadWrapMode ,
) 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.Pango as Pango
newtype TextAttributes = TextAttributes (ForeignPtr TextAttributes)
foreign import ccall "gtk_text_attributes_get_type" c_gtk_text_attributes_get_type ::
IO GType
instance BoxedObject TextAttributes where
boxedType _ = c_gtk_text_attributes_get_type
-- | Construct a `TextAttributes` struct initialized to zero.
newZeroTextAttributes :: MonadIO m => m TextAttributes
newZeroTextAttributes = liftIO $ callocBoxedBytes 168 >>= wrapBoxed TextAttributes
noTextAttributes :: Maybe TextAttributes
noTextAttributes = Nothing
textAttributesReadAppearance :: TextAttributes -> IO TextAppearance
textAttributesReadAppearance s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 4) :: IO (Ptr TextAppearance)
val' <- (newPtr 48 TextAppearance) val
return val'
textAttributesReadJustification :: TextAttributes -> IO Justification
textAttributesReadJustification s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 52) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
textAttributesReadDirection :: TextAttributes -> IO TextDirection
textAttributesReadDirection s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 56) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
textAttributesReadFont :: TextAttributes -> IO Pango.FontDescription
textAttributesReadFont s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 64) :: IO (Ptr Pango.FontDescription)
val' <- (newBoxed Pango.FontDescription) val
return val'
textAttributesReadFontScale :: TextAttributes -> IO Double
textAttributesReadFontScale s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 72) :: IO CDouble
let val' = realToFrac val
return val'
textAttributesReadLeftMargin :: TextAttributes -> IO Int32
textAttributesReadLeftMargin s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 80) :: IO Int32
return val
textAttributesReadRightMargin :: TextAttributes -> IO Int32
textAttributesReadRightMargin s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 84) :: IO Int32
return val
textAttributesReadIndent :: TextAttributes -> IO Int32
textAttributesReadIndent s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 88) :: IO Int32
return val
textAttributesReadPixelsAboveLines :: TextAttributes -> IO Int32
textAttributesReadPixelsAboveLines s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 92) :: IO Int32
return val
textAttributesReadPixelsBelowLines :: TextAttributes -> IO Int32
textAttributesReadPixelsBelowLines s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 96) :: IO Int32
return val
textAttributesReadPixelsInsideWrap :: TextAttributes -> IO Int32
textAttributesReadPixelsInsideWrap s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 100) :: IO Int32
return val
textAttributesReadTabs :: TextAttributes -> IO Pango.TabArray
textAttributesReadTabs s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 104) :: IO (Ptr Pango.TabArray)
val' <- (newBoxed Pango.TabArray) val
return val'
textAttributesReadWrapMode :: TextAttributes -> IO WrapMode
textAttributesReadWrapMode s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 112) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
textAttributesReadLanguage :: TextAttributes -> IO Pango.Language
textAttributesReadLanguage s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 120) :: IO (Ptr Pango.Language)
val' <- (newBoxed Pango.Language) val
return val'
textAttributesReadInvisible :: TextAttributes -> IO Word32
textAttributesReadInvisible s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 136) :: IO Word32
return val
textAttributesReadBgFullHeight :: TextAttributes -> IO Word32
textAttributesReadBgFullHeight s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 140) :: IO Word32
return val
textAttributesReadEditable :: TextAttributes -> IO Word32
textAttributesReadEditable s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 144) :: IO Word32
return val
textAttributesReadNoFallback :: TextAttributes -> IO Word32
textAttributesReadNoFallback s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 148) :: IO Word32
return val
textAttributesReadLetterSpacing :: TextAttributes -> IO Int32
textAttributesReadLetterSpacing s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 160) :: IO Int32
return val
-- method TextAttributes::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : TInterface "Gtk" "TextAttributes"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_text_attributes_new" gtk_text_attributes_new ::
IO (Ptr TextAttributes)
textAttributesNew ::
(MonadIO m) =>
m TextAttributes -- result
textAttributesNew = liftIO $ do
result <- gtk_text_attributes_new
checkUnexpectedReturnNULL "gtk_text_attributes_new" result
result' <- (wrapBoxed TextAttributes) result
return result'
-- method TextAttributes::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gtk" "TextAttributes", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Gtk" "TextAttributes"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_text_attributes_copy" gtk_text_attributes_copy ::
Ptr TextAttributes -> -- _obj : TInterface "Gtk" "TextAttributes"
IO (Ptr TextAttributes)
textAttributesCopy ::
(MonadIO m) =>
TextAttributes -- _obj
-> m TextAttributes -- result
textAttributesCopy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- gtk_text_attributes_copy _obj'
checkUnexpectedReturnNULL "gtk_text_attributes_copy" result
result' <- (wrapBoxed TextAttributes) result
touchManagedPtr _obj
return result'
data TextAttributesCopyMethodInfo
instance (signature ~ (m TextAttributes), MonadIO m) => MethodInfo TextAttributesCopyMethodInfo TextAttributes signature where
overloadedMethod _ = textAttributesCopy
-- method TextAttributes::copy_values
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gtk" "TextAttributes", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dest", argType = TInterface "Gtk" "TextAttributes", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_text_attributes_copy_values" gtk_text_attributes_copy_values ::
Ptr TextAttributes -> -- _obj : TInterface "Gtk" "TextAttributes"
Ptr TextAttributes -> -- dest : TInterface "Gtk" "TextAttributes"
IO ()
textAttributesCopyValues ::
(MonadIO m) =>
TextAttributes -- _obj
-> TextAttributes -- dest
-> m () -- result
textAttributesCopyValues _obj dest = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let dest' = unsafeManagedPtrGetPtr dest
gtk_text_attributes_copy_values _obj' dest'
touchManagedPtr _obj
touchManagedPtr dest
return ()
data TextAttributesCopyValuesMethodInfo
instance (signature ~ (TextAttributes -> m ()), MonadIO m) => MethodInfo TextAttributesCopyValuesMethodInfo TextAttributes signature where
overloadedMethod _ = textAttributesCopyValues
-- method TextAttributes::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gtk" "TextAttributes", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TInterface "Gtk" "TextAttributes"
-- throws : False
-- Skip return : False
foreign import ccall "gtk_text_attributes_ref" gtk_text_attributes_ref ::
Ptr TextAttributes -> -- _obj : TInterface "Gtk" "TextAttributes"
IO (Ptr TextAttributes)
textAttributesRef ::
(MonadIO m) =>
TextAttributes -- _obj
-> m TextAttributes -- result
textAttributesRef _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- gtk_text_attributes_ref _obj'
checkUnexpectedReturnNULL "gtk_text_attributes_ref" result
result' <- (wrapBoxed TextAttributes) result
touchManagedPtr _obj
return result'
data TextAttributesRefMethodInfo
instance (signature ~ (m TextAttributes), MonadIO m) => MethodInfo TextAttributesRefMethodInfo TextAttributes signature where
overloadedMethod _ = textAttributesRef
-- method TextAttributes::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Gtk" "TextAttributes", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "gtk_text_attributes_unref" gtk_text_attributes_unref ::
Ptr TextAttributes -> -- _obj : TInterface "Gtk" "TextAttributes"
IO ()
textAttributesUnref ::
(MonadIO m) =>
TextAttributes -- _obj
-> m () -- result
textAttributesUnref _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
gtk_text_attributes_unref _obj'
touchManagedPtr _obj
return ()
data TextAttributesUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo TextAttributesUnrefMethodInfo TextAttributes signature where
overloadedMethod _ = textAttributesUnref
type family ResolveTextAttributesMethod (t :: Symbol) (o :: *) :: * where
ResolveTextAttributesMethod "copy" o = TextAttributesCopyMethodInfo
ResolveTextAttributesMethod "copyValues" o = TextAttributesCopyValuesMethodInfo
ResolveTextAttributesMethod "ref" o = TextAttributesRefMethodInfo
ResolveTextAttributesMethod "unref" o = TextAttributesUnrefMethodInfo
ResolveTextAttributesMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveTextAttributesMethod t TextAttributes, MethodInfo info TextAttributes p) => IsLabelProxy t (TextAttributes -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTextAttributesMethod t TextAttributes, MethodInfo info TextAttributes p) => IsLabel t (TextAttributes -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif