module Graphics.UI.Gtk.ModelView.CellView (
CellView,
CellViewClass,
castToCellView, gTypeCellView,
toCellView,
cellViewNew,
cellViewNewWithMarkup,
cellViewNewWithPixbuf,
cellViewNewWithText,
cellViewSetModel,
cellViewGetSizeOfRow,
cellViewSetBackgroundColor,
cellViewGetCellRenderers,
cellViewBackground
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties (writeAttrFromStringProperty)
import System.Glib.GList
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.ModelView.Types
import Graphics.UI.Gtk.General.Structs (Color, Requisition)
cellViewNew :: IO CellView
cellViewNew =
makeNewObject mkCellView $
liftM (castPtr :: Ptr Widget -> Ptr CellView) $
gtk_cell_view_new
cellViewNewWithMarkup ::
String
-> IO CellView
cellViewNewWithMarkup markup =
makeNewObject mkCellView $
liftM (castPtr :: Ptr Widget -> Ptr CellView) $
withUTFString markup $ \markupPtr ->
gtk_cell_view_new_with_markup
markupPtr
cellViewNewWithPixbuf ::
Pixbuf
-> IO CellView
cellViewNewWithPixbuf pixbuf =
makeNewObject mkCellView $
liftM (castPtr :: Ptr Widget -> Ptr CellView) $
(\(Pixbuf arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_cell_view_new_with_pixbuf argPtr1)
pixbuf
cellViewNewWithText ::
String
-> IO CellView
cellViewNewWithText text =
makeNewObject mkCellView $
liftM (castPtr :: Ptr Widget -> Ptr CellView) $
withUTFString text $ \textPtr ->
gtk_cell_view_new_with_text
textPtr
cellViewSetModel :: (CellViewClass self, TreeModelClass model) => self
-> Maybe model
-> IO ()
cellViewSetModel self model =
(\(CellView arg1) (TreeModel arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_cell_view_set_model argPtr1 argPtr2)
(toCellView self)
(maybe (TreeModel nullForeignPtr) toTreeModel model)
cellViewGetSizeOfRow :: CellViewClass self => self
-> TreePath
-> IO Requisition
cellViewGetSizeOfRow self path =
alloca $ \requisitionPtr ->
withTreePath path $ \path -> do
(\(CellView arg1) (NativeTreePath arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->gtk_cell_view_get_size_of_row argPtr1 arg2 arg3)
(toCellView self)
path
(castPtr requisitionPtr)
peek requisitionPtr
cellViewSetBackgroundColor :: CellViewClass self => self
-> Color
-> IO ()
cellViewSetBackgroundColor self color =
with color $ \colorPtr ->
(\(CellView arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_cell_view_set_background_color argPtr1 arg2)
(toCellView self)
(castPtr colorPtr)
cellViewGetCellRenderers :: CellViewClass self => self -> IO [CellRenderer]
cellViewGetCellRenderers self =
(\(CellView arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_cell_view_get_cell_renderers argPtr1)
(toCellView self)
>>= fromGList
>>= mapM (\elemPtr -> makeNewObject mkCellRenderer (return elemPtr))
cellViewBackground :: CellViewClass self => WriteAttr self String
cellViewBackground = writeAttrFromStringProperty "background"
foreign import ccall safe "gtk_cell_view_new"
gtk_cell_view_new :: (IO (Ptr Widget))
foreign import ccall safe "gtk_cell_view_new_with_markup"
gtk_cell_view_new_with_markup :: ((Ptr CChar) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_cell_view_new_with_pixbuf"
gtk_cell_view_new_with_pixbuf :: ((Ptr Pixbuf) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_cell_view_new_with_text"
gtk_cell_view_new_with_text :: ((Ptr CChar) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_cell_view_set_model"
gtk_cell_view_set_model :: ((Ptr CellView) -> ((Ptr TreeModel) -> (IO ())))
foreign import ccall safe "gtk_cell_view_get_size_of_row"
gtk_cell_view_get_size_of_row :: ((Ptr CellView) -> ((Ptr NativeTreePath) -> ((Ptr ()) -> (IO CInt))))
foreign import ccall safe "gtk_cell_view_set_background_color"
gtk_cell_view_set_background_color :: ((Ptr CellView) -> ((Ptr ()) -> (IO ())))
foreign import ccall safe "gtk_cell_view_get_cell_renderers"
gtk_cell_view_get_cell_renderers :: ((Ptr CellView) -> (IO (Ptr ())))