    {-# LINE 2 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget CellView
    --
    -- Author : Duncan Coutts
    --
    -- Created: 4 April 2005
    --
    -- Copyright (C) 2005 Duncan Coutts
    --
    -- This library is free software; you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation; either
    -- version 2.1 of the License, or (at your option) any later version.
    --
    -- This library is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    -- Lesser General Public License for more details.
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- A widget displaying a single row of a 'TreeModel'
    --
    -- * Module available since Gtk+ version 2.6
    --
    module Graphics.UI.Gtk.ModelView.CellView (
    -- * Detail
    --
    -- | A 'CellView' displays a single row of a 'TreeModel', using cell renderers
    -- just like 'TreeView'. 'CellView' doesn't support some of the more complex
    -- features of 'TreeView', like cell editing and drag and drop.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'Object'
    -- | +----'Widget'
    -- | +----CellView
    -- @

    -- * Types
      CellView,
      CellViewClass,
      castToCellView, gTypeCellView,
      toCellView,

    -- * Constructors
      cellViewNew,
      cellViewNewWithMarkup,
      cellViewNewWithPixbuf,
      cellViewNewWithText,

    -- * Methods
      cellViewSetModel,
      cellViewGetSizeOfRow,
      cellViewSetBackgroundColor,

    -- * Attributes
      cellViewBackground

      ) where

    import Control.Monad (liftM)
    import System.Glib.FFI
    import System.Glib.UTFString
    import System.Glib.Attributes
    import System.Glib.Properties (writeAttrFromStringProperty)

    import Graphics.UI.Gtk.Types
    {-# LINE 81 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
    import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
    import Graphics.UI.Gtk.ModelView.Types
    {-# LINE 83 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
    import Graphics.UI.Gtk.General.Structs (Color, Requisition)

    {-# LINE 86 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}

    --------------------
    -- Constructors

    -- | Creates a new 'CellView' widget.
    --
    cellViewNew :: IO CellView
    cellViewNew :: IO CellView
    cellViewNew =
      (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    forall {a}. (ForeignPtr CellView -> CellView, FinalizerPtr a)
    mkCellView (IO (Ptr CellView) -> IO CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr CellView)
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr CellView
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr CellView) (IO (Ptr Widget) -> IO (Ptr CellView))
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall a b. (a -> b) -> a -> b
    $
      IO (Ptr Widget)
    gtk_cell_view_new
    {-# LINE 98 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}

    -- | Creates a new 'CellView' widget, adds a 'CellRendererText' to it, and
    -- makes its show @markup@. The text can be marked up with the Pango
    -- text markup language.
    --
    cellViewNewWithMarkup :: GlibString string
     => string -- ^ @markup@ - the text to display in the cell view
     -> IO CellView
    cellViewNewWithMarkup :: forall string. GlibString string => string -> IO CellView
    cellViewNewWithMarkup string
    markup =
      (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    forall {a}. (ForeignPtr CellView -> CellView, FinalizerPtr a)
    mkCellView (IO (Ptr CellView) -> IO CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr CellView)
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr CellView
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr CellView) (IO (Ptr Widget) -> IO (Ptr CellView))
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall a b. (a -> b) -> a -> b
    $
      string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    markup ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \CString
    markupPtr ->
      CString -> IO (Ptr Widget)
    gtk_cell_view_new_with_markup
    {-# LINE 111 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
        markupPtr

    -- | Creates a new 'CellView' widget, adds a 'CellRendererPixbuf' to it, and
    -- makes its show @pixbuf@.
    --
    cellViewNewWithPixbuf ::
        Pixbuf -- ^ @pixbuf@ - the image to display in the cell view
     -> IO CellView
    cellViewNewWithPixbuf :: Pixbuf -> IO CellView
    cellViewNewWithPixbuf Pixbuf
    pixbuf =
      (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    forall {a}. (ForeignPtr CellView -> CellView, FinalizerPtr a)
    mkCellView (IO (Ptr CellView) -> IO CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr CellView)
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr CellView
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr CellView) (IO (Ptr Widget) -> IO (Ptr CellView))
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall a b. (a -> b) -> a -> b
    $
      (\(Pixbuf ForeignPtr Pixbuf
    arg1) -> ForeignPtr Pixbuf
    -> (Ptr Pixbuf -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Pixbuf
    arg1 ((Ptr Pixbuf -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (Ptr Pixbuf -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \Ptr Pixbuf
    argPtr1 ->Ptr Pixbuf -> IO (Ptr Widget)
    gtk_cell_view_new_with_pixbuf Ptr Pixbuf
    argPtr1)
    {-# LINE 123 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
        pixbuf

    -- | Creates a new 'CellView' widget, adds a 'CellRendererText' to it, and
    -- makes its show @text@.
    --
    cellViewNewWithText :: GlibString string
     => string -- ^ @text@ - the text to display in the cell view
     -> IO CellView
    cellViewNewWithText :: forall string. GlibString string => string -> IO CellView
    cellViewNewWithText string
    text =
      (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr CellView -> CellView, FinalizerPtr CellView)
    forall {a}. (ForeignPtr CellView -> CellView, FinalizerPtr a)
    mkCellView (IO (Ptr CellView) -> IO CellView)
    -> IO (Ptr CellView) -> IO CellView
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr CellView)
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr CellView
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr CellView) (IO (Ptr Widget) -> IO (Ptr CellView))
    -> IO (Ptr Widget) -> IO (Ptr CellView)
    forall a b. (a -> b) -> a -> b
    $
      string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    text ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \CString
    textPtr ->
      CString -> IO (Ptr Widget)
    gtk_cell_view_new_with_text
    {-# LINE 136 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
        textPtr

    --------------------
    -- Methods

    -- | Sets the model for @cellView@. If @cellView@ already has a model set, it
    -- will remove it before setting the new model. If @model@ is @Nothing@, then
    -- it will unset the old model.
    --
    cellViewSetModel :: (CellViewClass self, TreeModelClass model) => self
     -> Maybe model -- ^ @model@ - a 'TreeModel'
     -> IO ()
    cellViewSetModel :: forall self model.
    (CellViewClass self, TreeModelClass model) =>
    self -> Maybe model -> IO ()
    cellViewSetModel self
    self Maybe model
    model =
      (\(CellView ForeignPtr CellView
    arg1) (TreeModel ForeignPtr TreeModel
    arg2) -> ForeignPtr CellView -> (Ptr CellView -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr CellView
    arg1 ((Ptr CellView -> IO ()) -> IO ())
    -> (Ptr CellView -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CellView
    argPtr1 ->ForeignPtr TreeModel -> (Ptr TreeModel -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr TreeModel
    arg2 ((Ptr TreeModel -> IO ()) -> IO ())
    -> (Ptr TreeModel -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr TreeModel
    argPtr2 ->Ptr CellView -> Ptr TreeModel -> IO ()
    gtk_cell_view_set_model Ptr CellView
    argPtr1 Ptr TreeModel
    argPtr2)
    {-# LINE 150 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
        (toCellView self)
        (TreeModel -> (model -> TreeModel) -> Maybe model -> TreeModel
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe (ForeignPtr TreeModel -> TreeModel
    TreeModel ForeignPtr TreeModel
    forall a. ForeignPtr a
    nullForeignPtr) model -> TreeModel
    forall o. TreeModelClass o => o -> TreeModel
    toTreeModel Maybe model
    model)

    -- | Returns the size needed by the cell view to display the model
    -- row pointed to by @path@.
    --
    cellViewGetSizeOfRow :: CellViewClass self => self
     -> TreePath -- ^ @path@ - a 'TreePath'
     -> IO Requisition -- ^ returns the size requisition
    cellViewGetSizeOfRow :: forall self.
    CellViewClass self =>
    self -> TreePath -> IO Requisition
    cellViewGetSizeOfRow self
    self TreePath
    path =
      (Ptr Requisition -> IO Requisition) -> IO Requisition
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr Requisition -> IO Requisition) -> IO Requisition)
    -> (Ptr Requisition -> IO Requisition) -> IO Requisition
    forall a b. (a -> b) -> a -> b
    $ \Ptr Requisition
    requisitionPtr ->
      TreePath -> (NativeTreePath -> IO Requisition) -> IO Requisition
    forall a. TreePath -> (NativeTreePath -> IO a) -> IO a
    withTreePath TreePath
    path ((NativeTreePath -> IO Requisition) -> IO Requisition)
    -> (NativeTreePath -> IO Requisition) -> IO Requisition
    forall a b. (a -> b) -> a -> b
    $ \NativeTreePath
    path -> do
      (\(CellView ForeignPtr CellView
    arg1) (NativeTreePath Ptr NativeTreePath
    arg2) Ptr ()
    arg3 -> ForeignPtr CellView -> (Ptr CellView -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr CellView
    arg1 ((Ptr CellView -> IO CInt) -> IO CInt)
    -> (Ptr CellView -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr CellView
    argPtr1 ->Ptr CellView -> Ptr NativeTreePath -> Ptr () -> IO CInt
    gtk_cell_view_get_size_of_row Ptr CellView
    argPtr1 Ptr NativeTreePath
    arg2 Ptr ()
    arg3)
    {-# LINE 163 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
        (toCellView self)
        NativeTreePath
    path
        (Ptr Requisition -> Ptr ()
    forall a b. Ptr a -> Ptr b
    castPtr Ptr Requisition
    requisitionPtr)
      Ptr Requisition -> IO Requisition
    forall a. Storable a => Ptr a -> IO a
    peek Ptr Requisition
    requisitionPtr

    -- | Sets the background color of @view@.
    --
    cellViewSetBackgroundColor :: CellViewClass self => self
     -> Color -- ^ @color@ - the new background color
     -> IO ()
    cellViewSetBackgroundColor :: forall self. CellViewClass self => self -> Color -> IO ()
    cellViewSetBackgroundColor self
    self Color
    color =
      Color -> (Ptr Color -> IO ()) -> IO ()
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with Color
    color ((Ptr Color -> IO ()) -> IO ()) -> (Ptr Color -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Color
    colorPtr ->
      (\(CellView ForeignPtr CellView
    arg1) Ptr ()
    arg2 -> ForeignPtr CellView -> (Ptr CellView -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr CellView
    arg1 ((Ptr CellView -> IO ()) -> IO ())
    -> (Ptr CellView -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CellView
    argPtr1 ->Ptr CellView -> Ptr () -> IO ()
    gtk_cell_view_set_background_color Ptr CellView
    argPtr1 Ptr ()
    arg2)
    {-# LINE 176 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
        (toCellView self)
        (Ptr Color -> Ptr ()
    forall a b. Ptr a -> Ptr b
    castPtr Ptr Color
    colorPtr)
    {-# LINE 191 "./Graphics/UI/Gtk/ModelView/CellView.chs" #-}
    --------------------
    -- Attributes

    -- | Background color as a string.
    --
    -- Default value: @\"\"@
    --
    cellViewBackground :: (CellViewClass self, GlibString string) => WriteAttr self string
    cellViewBackground :: forall self string.
    (CellViewClass self, GlibString string) =>
    WriteAttr self string
    cellViewBackground = String -> WriteAttr self string
    forall gobj string.
    (GObjectClass gobj, GlibString string) =>
    String -> WriteAttr gobj string
    writeAttrFromStringProperty String
    "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 ())))