module Graphics.UI.Gtk.SourceView.SourceMarkAttributes (
SourceMarkAttributes,
SourceMarkAttributesClass,
castToSourceMarkAttributes,
sourceMarkAttributesNew,
sourceMarkAttributesSetBackground,
sourceMarkAttributesGetBackground,
sourceMarkAttributesSetIconName,
sourceMarkAttributesGetIconName,
sourceMarkAttributesSetPixbuf,
sourceMarkAttributesGetPixbuf,
sourceMarkAttributesRenderIcon,
sourceMarkAttributesGetTooltipText,
sourceMarkAttributesGetTooltipMarkup,
sourceMarkAttributesBackground,
sourceMarkAttributesIconName,
sourceMarkAttributesPixbuf,
queryTooltipMarkup,
queryTooltipText
) where
import Control.Monad (liftM)
import System.Glib.GObject (makeNewGObject)
import System.Glib.Attributes
import System.Glib.FFI
import System.Glib.UTFString
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk (RGBA)
import Graphics.UI.Gtk.SourceView.Signals
import Graphics.UI.Gtk.SourceView.Types
sourceMarkAttributesNew :: IO SourceMarkAttributes
sourceMarkAttributesNew = makeNewObject mkSourceMarkAttributes $ liftM castPtr
gtk_source_mark_attributes_new
sourceMarkAttributesSetBackground :: SourceMarkAttributesClass attributes => attributes -> Maybe RGBA -> IO ()
sourceMarkAttributesSetBackground attributes background =
maybeWith with background $ \ backgroundPtr ->
(\(SourceMarkAttributes arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_source_mark_attributes_set_background argPtr1 arg2)
(toSourceMarkAttributes attributes)
(castPtr backgroundPtr)
sourceMarkAttributesGetBackground :: SourceMarkAttributesClass attributes => attributes -> IO (Maybe RGBA)
sourceMarkAttributesGetBackground attributes =
alloca $ \ rgbaPtr -> do
isSet <- (\(SourceMarkAttributes arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_source_mark_attributes_get_background argPtr1 arg2)
(toSourceMarkAttributes attributes)
(castPtr rgbaPtr)
if isSet /= 0 then Just <$> peek rgbaPtr else return Nothing
sourceMarkAttributesSetIconName :: (SourceMarkAttributesClass attributes, GlibString iconName)
=> attributes
-> Maybe iconName
-> IO ()
sourceMarkAttributesSetIconName attributes iconName =
maybeWith withUTFString iconName $ \iconNamePtr ->
(\(SourceMarkAttributes arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_source_mark_attributes_set_icon_name argPtr1 arg2)
(toSourceMarkAttributes attributes)
iconNamePtr
sourceMarkAttributesGetIconName :: (SourceMarkAttributesClass attributes, GlibString iconName)
=> attributes
-> IO (Maybe iconName)
sourceMarkAttributesGetIconName attributes =
(\(SourceMarkAttributes arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_source_mark_attributes_get_icon_name argPtr1)
(toSourceMarkAttributes attributes)
>>= maybePeek peekUTFString
sourceMarkAttributesSetPixbuf :: SourceMarkAttributesClass attributes
=> attributes
-> Maybe Pixbuf
-> IO ()
sourceMarkAttributesSetPixbuf attributes pixbuf =
(\(SourceMarkAttributes arg1) (Pixbuf arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_source_mark_attributes_set_pixbuf argPtr1 argPtr2)
(toSourceMarkAttributes attributes)
(maybe (Pixbuf nullForeignPtr) id pixbuf)
sourceMarkAttributesGetPixbuf :: SourceMarkAttributesClass attributes
=> attributes
-> IO (Maybe Pixbuf)
sourceMarkAttributesGetPixbuf attributes =
maybeNull (makeNewGObject mkPixbuf) $
(\(SourceMarkAttributes arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_source_mark_attributes_get_pixbuf argPtr1)
(toSourceMarkAttributes attributes)
sourceMarkAttributesRenderIcon :: (SourceMarkAttributesClass attributes, WidgetClass widget)
=> attributes
-> widget
-> Int
-> IO (Maybe Pixbuf)
sourceMarkAttributesRenderIcon attributes widget size =
maybeNull (makeNewGObject mkPixbuf) $
(\(SourceMarkAttributes arg1) (Widget arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_source_mark_attributes_render_icon argPtr1 argPtr2 arg3)
(toSourceMarkAttributes attributes)
(toWidget widget)
(fromIntegral size)
sourceMarkAttributesGetTooltipText :: (SourceMarkAttributesClass attributes, SourceMarkClass mark, GlibString text)
=> attributes
-> mark
-> IO (Maybe text)
sourceMarkAttributesGetTooltipText attributes mark =
(\(SourceMarkAttributes arg1) (SourceMark arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_source_mark_attributes_get_tooltip_text argPtr1 argPtr2)
(toSourceMarkAttributes attributes)
(toSourceMark mark)
>>= maybePeek readUTFString
sourceMarkAttributesGetTooltipMarkup :: (SourceMarkAttributesClass attributes, SourceMarkClass mark, GlibString markup)
=> attributes
-> mark
-> IO (Maybe markup)
sourceMarkAttributesGetTooltipMarkup attributes mark =
(\(SourceMarkAttributes arg1) (SourceMark arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_source_mark_attributes_get_tooltip_markup argPtr1 argPtr2)
(toSourceMarkAttributes attributes)
(toSourceMark mark)
>>= maybePeek readUTFString
sourceMarkAttributesBackground :: SourceMarkAttributesClass attributes => Attr attributes (Maybe RGBA)
sourceMarkAttributesBackground = newAttr sourceMarkAttributesGetBackground sourceMarkAttributesSetBackground
sourceMarkAttributesIconName :: (SourceMarkAttributesClass attributes, GlibString iconName) => Attr attributes (Maybe iconName)
sourceMarkAttributesIconName = newAttr sourceMarkAttributesGetIconName sourceMarkAttributesSetIconName
sourceMarkAttributesPixbuf :: SourceMarkAttributesClass attributes => Attr attributes (Maybe Pixbuf)
sourceMarkAttributesPixbuf = newAttr sourceMarkAttributesGetPixbuf sourceMarkAttributesSetPixbuf
queryTooltipMarkup :: (SourceMarkAttributesClass self, GlibString markup) => Signal self (SourceMark -> IO markup)
queryTooltipMarkup = Signal (connect_OBJECT__GLIBSTRING "query-tooltip-markup")
queryTooltipText :: (SourceMarkAttributesClass self, GlibString text) => Signal self (SourceMark -> IO text)
queryTooltipText = Signal (connect_OBJECT__GLIBSTRING "query-tooltip-text")
foreign import ccall unsafe "gtk_source_mark_attributes_new"
gtk_source_mark_attributes_new :: (IO (Ptr SourceMarkAttributes))
foreign import ccall unsafe "gtk_source_mark_attributes_set_background"
gtk_source_mark_attributes_set_background :: ((Ptr SourceMarkAttributes) -> ((Ptr ()) -> (IO ())))
foreign import ccall safe "gtk_source_mark_attributes_get_background"
gtk_source_mark_attributes_get_background :: ((Ptr SourceMarkAttributes) -> ((Ptr ()) -> (IO CInt)))
foreign import ccall safe "gtk_source_mark_attributes_set_icon_name"
gtk_source_mark_attributes_set_icon_name :: ((Ptr SourceMarkAttributes) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_source_mark_attributes_get_icon_name"
gtk_source_mark_attributes_get_icon_name :: ((Ptr SourceMarkAttributes) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_source_mark_attributes_set_pixbuf"
gtk_source_mark_attributes_set_pixbuf :: ((Ptr SourceMarkAttributes) -> ((Ptr Pixbuf) -> (IO ())))
foreign import ccall safe "gtk_source_mark_attributes_get_pixbuf"
gtk_source_mark_attributes_get_pixbuf :: ((Ptr SourceMarkAttributes) -> (IO (Ptr Pixbuf)))
foreign import ccall safe "gtk_source_mark_attributes_render_icon"
gtk_source_mark_attributes_render_icon :: ((Ptr SourceMarkAttributes) -> ((Ptr Widget) -> (CInt -> (IO (Ptr Pixbuf)))))
foreign import ccall safe "gtk_source_mark_attributes_get_tooltip_text"
gtk_source_mark_attributes_get_tooltip_text :: ((Ptr SourceMarkAttributes) -> ((Ptr SourceMark) -> (IO (Ptr CChar))))
foreign import ccall safe "gtk_source_mark_attributes_get_tooltip_markup"
gtk_source_mark_attributes_get_tooltip_markup :: ((Ptr SourceMarkAttributes) -> ((Ptr SourceMark) -> (IO (Ptr CChar))))