{-# LINE 2 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
module Graphics.UI.Gtk.Selectors.FontSelection (
FontSelection,
FontSelectionClass,
castToFontSelection, gTypeFontSelection,
toFontSelection,
fontSelectionNew,
fontSelectionGetFontName,
fontSelectionSetFontName,
fontSelectionGetPreviewText,
fontSelectionSetPreviewText,
fontSelectionFontName,
fontSelectionPreviewText,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
{-# LINE 83 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
{-# LINE 85 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
fontSelectionNew :: IO FontSelection
fontSelectionNew :: IO FontSelection
fontSelectionNew =
(ForeignPtr FontSelection -> FontSelection,
FinalizerPtr FontSelection)
-> IO (Ptr FontSelection) -> IO FontSelection
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr FontSelection -> FontSelection,
FinalizerPtr FontSelection)
forall {a}.
(ForeignPtr FontSelection -> FontSelection, FinalizerPtr a)
mkFontSelection (IO (Ptr FontSelection) -> IO FontSelection)
-> IO (Ptr FontSelection) -> IO FontSelection
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr FontSelection)
-> IO (Ptr Widget) -> IO (Ptr FontSelection)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr FontSelection
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr FontSelection) (IO (Ptr Widget) -> IO (Ptr FontSelection))
-> IO (Ptr Widget) -> IO (Ptr FontSelection)
forall a b. (a -> b) -> a -> b
$
IO (Ptr Widget)
gtk_font_selection_new
{-# LINE 96 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
fontSelectionGetFontName :: (FontSelectionClass self, GlibString string) => self
-> IO (Maybe string)
fontSelectionGetFontName :: forall self string.
(FontSelectionClass self, GlibString string) =>
self -> IO (Maybe string)
fontSelectionGetFontName self
self =
(\(FontSelection ForeignPtr FontSelection
arg1) -> ForeignPtr FontSelection
-> (Ptr FontSelection -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr FontSelection
arg1 ((Ptr FontSelection -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr FontSelection -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr FontSelection
argPtr1 ->Ptr FontSelection -> IO (Ptr CChar)
gtk_font_selection_get_font_name Ptr FontSelection
argPtr1)
{-# LINE 107 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
(toFontSelection self)
IO (Ptr CChar)
-> (Ptr CChar -> IO (Maybe string)) -> IO (Maybe string)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Ptr CChar -> IO string) -> Ptr CChar -> IO (Maybe string)
forall a b. (Ptr a -> IO b) -> Ptr a -> IO (Maybe b)
maybePeek Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
readUTFString
fontSelectionSetFontName :: (FontSelectionClass self, GlibString string) => self
-> string
-> IO Bool
fontSelectionSetFontName :: forall self string.
(FontSelectionClass self, GlibString string) =>
self -> string -> IO Bool
fontSelectionSetFontName self
self string
fontname =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
string -> (Ptr CChar -> IO CInt) -> IO CInt
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
fontname ((Ptr CChar -> IO CInt) -> IO CInt)
-> (Ptr CChar -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
fontnamePtr ->
(\(FontSelection ForeignPtr FontSelection
arg1) Ptr CChar
arg2 -> ForeignPtr FontSelection
-> (Ptr FontSelection -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr FontSelection
arg1 ((Ptr FontSelection -> IO CInt) -> IO CInt)
-> (Ptr FontSelection -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr FontSelection
argPtr1 ->Ptr FontSelection -> Ptr CChar -> IO CInt
gtk_font_selection_set_font_name Ptr FontSelection
argPtr1 Ptr CChar
arg2)
{-# LINE 119 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
(toFontSelection self)
Ptr CChar
fontnamePtr
fontSelectionGetPreviewText :: (FontSelectionClass self, GlibString string) => self -> IO string
fontSelectionGetPreviewText :: forall self string.
(FontSelectionClass self, GlibString string) =>
self -> IO string
fontSelectionGetPreviewText self
self =
(\(FontSelection ForeignPtr FontSelection
arg1) -> ForeignPtr FontSelection
-> (Ptr FontSelection -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr FontSelection
arg1 ((Ptr FontSelection -> IO (Ptr CChar)) -> IO (Ptr CChar))
-> (Ptr FontSelection -> IO (Ptr CChar)) -> IO (Ptr CChar)
forall a b. (a -> b) -> a -> b
$ \Ptr FontSelection
argPtr1 ->Ptr FontSelection -> IO (Ptr CChar)
gtk_font_selection_get_preview_text Ptr FontSelection
argPtr1)
{-# LINE 127 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
(toFontSelection self)
IO (Ptr CChar) -> (Ptr CChar -> IO string) -> IO string
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
peekUTFString
fontSelectionSetPreviewText :: (FontSelectionClass self, GlibString string) => self -> string -> IO ()
fontSelectionSetPreviewText :: forall self string.
(FontSelectionClass self, GlibString string) =>
self -> string -> IO ()
fontSelectionSetPreviewText self
self string
text =
string -> (Ptr CChar -> IO ()) -> IO ()
forall a. string -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
withUTFString string
text ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
textPtr ->
(\(FontSelection ForeignPtr FontSelection
arg1) Ptr CChar
arg2 -> ForeignPtr FontSelection -> (Ptr FontSelection -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr FontSelection
arg1 ((Ptr FontSelection -> IO ()) -> IO ())
-> (Ptr FontSelection -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr FontSelection
argPtr1 ->Ptr FontSelection -> Ptr CChar -> IO ()
gtk_font_selection_set_preview_text Ptr FontSelection
argPtr1 Ptr CChar
arg2)
{-# LINE 136 "./Graphics/UI/Gtk/Selectors/FontSelection.chs" #-}
(toFontSelection self)
Ptr CChar
textPtr
fontSelectionFontName :: (FontSelectionClass self, GlibString string) => Attr self string
fontSelectionFontName :: forall self string.
(FontSelectionClass self, GlibString string) =>
Attr self string
fontSelectionFontName = String -> Attr self string
forall gobj string.
(GObjectClass gobj, GlibString string) =>
String -> Attr gobj string
newAttrFromStringProperty String
"font_name"
fontSelectionPreviewText :: (FontSelectionClass self, GlibString string) => Attr self string
fontSelectionPreviewText :: forall self string.
(FontSelectionClass self, GlibString string) =>
Attr self string
fontSelectionPreviewText = (self -> IO string)
-> (self -> string -> IO ()) -> ReadWriteAttr self string string
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO string
forall self string.
(FontSelectionClass self, GlibString string) =>
self -> IO string
fontSelectionGetPreviewText
self -> string -> IO ()
forall self string.
(FontSelectionClass self, GlibString string) =>
self -> string -> IO ()
fontSelectionSetPreviewText
foreign import ccall unsafe "gtk_font_selection_new"
gtk_font_selection_new :: (IO (Ptr Widget))
foreign import ccall unsafe "gtk_font_selection_get_font_name"
gtk_font_selection_get_font_name :: ((Ptr FontSelection) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_font_selection_set_font_name"
gtk_font_selection_set_font_name :: ((Ptr FontSelection) -> ((Ptr CChar) -> (IO CInt)))
foreign import ccall unsafe "gtk_font_selection_get_preview_text"
gtk_font_selection_get_preview_text :: ((Ptr FontSelection) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_font_selection_set_preview_text"
gtk_font_selection_set_preview_text :: ((Ptr FontSelection) -> ((Ptr CChar) -> (IO ())))