module Graphics.UI.Gtk.Multiline.TextTagTable (
TextTagTable,
TextTagTableClass,
castToTextTagTable, gTypeTextTagTable,
toTextTagTable,
textTagTableNew,
textTagTableAdd,
textTagTableRemove,
textTagTableLookup,
textTagTableForeach,
textTagTableGetSize
) where
import Control.Monad (liftM, void)
import System.Glib.FFI (withForeignPtr, nullPtr, Ptr(..), CInt(..), CChar(..), FunPtr(..), maybeNull)
import System.Glib.UTFString
import Graphics.UI.Gtk.Types
textTagTableNew :: IO TextTagTable
textTagTableNew =
wrapNewGObject mkTextTagTable $
gtk_text_tag_table_new
textTagTableAdd :: (TextTagTableClass self, TextTagClass tag) => self -> tag -> IO ()
textTagTableAdd self tag = void $
(\(TextTagTable arg1) (TextTag arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_text_tag_table_add argPtr1 argPtr2)
(toTextTagTable self)
(toTextTag tag)
textTagTableRemove :: (TextTagTableClass self, TextTagClass tag) => self -> tag -> IO ()
textTagTableRemove self tag =
(\(TextTagTable arg1) (TextTag arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_text_tag_table_remove argPtr1 argPtr2)
(toTextTagTable self)
(toTextTag tag)
textTagTableLookup :: (TextTagTableClass self, GlibString string) => self
-> string
-> IO (Maybe TextTag)
textTagTableLookup self name =
maybeNull (makeNewGObject mkTextTag) $
withUTFString name $ \namePtr ->
(\(TextTagTable arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_text_tag_table_lookup argPtr1 arg2)
(toTextTagTable self)
namePtr
textTagTableForeach :: TextTagTableClass self => self
-> (TextTag -> IO ())
-> IO ()
textTagTableForeach self func = do
funcPtr <- mkTextTagTableForeach (\tagPtr _ -> do
tag <- makeNewGObject mkTextTag (return tagPtr)
func tag)
(\(TextTagTable arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_text_tag_table_foreach argPtr1 arg2 arg3)
(toTextTagTable self)
funcPtr
nullPtr
type TextTagTableForeach = FunPtr (((Ptr TextTag) -> ((Ptr ()) -> (IO ()))))
foreign import ccall "wrapper" mkTextTagTableForeach ::
(Ptr TextTag -> Ptr () -> IO ()) -> IO TextTagTableForeach
textTagTableGetSize :: TextTagTableClass self => self -> IO Int
textTagTableGetSize self =
liftM fromIntegral $
(\(TextTagTable arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_text_tag_table_get_size argPtr1)
(toTextTagTable self)
foreign import ccall unsafe "gtk_text_tag_table_new"
gtk_text_tag_table_new :: (IO (Ptr TextTagTable))
foreign import ccall safe "gtk_text_tag_table_add"
gtk_text_tag_table_add :: ((Ptr TextTagTable) -> ((Ptr TextTag) -> (IO ())))
foreign import ccall safe "gtk_text_tag_table_remove"
gtk_text_tag_table_remove :: ((Ptr TextTagTable) -> ((Ptr TextTag) -> (IO ())))
foreign import ccall unsafe "gtk_text_tag_table_lookup"
gtk_text_tag_table_lookup :: ((Ptr TextTagTable) -> ((Ptr CChar) -> (IO (Ptr TextTag))))
foreign import ccall safe "gtk_text_tag_table_foreach"
gtk_text_tag_table_foreach :: ((Ptr TextTagTable) -> ((FunPtr ((Ptr TextTag) -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> (IO ()))))
foreign import ccall unsafe "gtk_text_tag_table_get_size"
gtk_text_tag_table_get_size :: ((Ptr TextTagTable) -> (IO CInt))