    {-# LINE 2 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) CellRenderer TreeView
    --
    -- Author : Axel Simon
    --
    -- Created: 23 May 2001
    --
    -- Copyright (C) 1999-2006 Axel Simon
    --
    -- 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)
    --
    -- An object for rendering a cell in a list, icon or combo box widget.
    --
    module Graphics.UI.Gtk.ModelView.CellRenderer (
    -- * Detail
    --
    -- | The 'CellRenderer' is a base class of a set of objects used for rendering
    -- a cell to a 'Drawable'. These objects are used primarily by the 'TreeView'
    -- widget, though they aren't tied to them in any specific way. It is worth
    -- noting that 'CellRenderer' is not a 'Widget' and cannot be treated as such.
    --
    -- The primary use of a 'CellRenderer' is for drawing a certain graphical
    -- elements on a 'Drawable'. Typically, one cell renderer is used to draw many
    -- cells on the screen. To this extent, it isn't expected that a
    -- 'CellRenderer' keep any permanent state around. Instead, any state is set
    -- just prior to use by changing the attributes of the cell. Then, the cell is
    -- measured and rendered in the correct location.
    --
    -- Beyond merely rendering a cell, cell renderers can optionally provide
    -- active user interface elements. A cell renderer can be activatable like
    -- 'Graphics.UI.Gtk.ModelView.CellRendererToggle', which toggles when it gets
    -- activated by a mouse click, or it can be editable like
    -- 'Graphics.UI.Gtk.ModelView.CellRendererText', which allows the user to edit
    -- the text using a 'Graphics.UI.Gtk.Entry.Entry'.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'Object'
    -- | +----CellRenderer
    -- | +----'CellRendererText'
    -- | +----'CellRendererPixbuf'
    -- | +----'CellRendererProgress'
    -- | +----'CellRendererCombo'
    -- | +----'CellRendererToggle'
    -- @

    -- * Types
      CellRenderer,
      CellRendererClass,
      castToCellRenderer, gTypeCellRenderer,
      toCellRenderer,
      CellRendererMode(..),

    -- * Methods

      cellRendererStopEditing,

      cellRendererGetFixedSize,
      cellRendererSetFixedSize,

    -- * Attributes
      cellMode,
      cellVisible,
      cellSensitive,
      cellXAlign,
      cellYAlign,
      cellXPad,
      cellYPad,
      cellWidth,
      cellHeight,
      cellIsExpander,
      cellIsExpanded,
      cellBackground,

      cellBackgroundSet,

    -- * Signals

      editingStarted,

      editingCanceled,

    -- * Deprecated
    {-# LINE 114 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}
      ) where

    import System.Glib.FFI
    import System.Glib.UTFString
    import System.Glib.Attributes ( Attr, WriteAttr )
    import System.Glib.Properties
    import Graphics.UI.Gtk.Types
    {-# LINE 121 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}

    import Graphics.UI.Gtk.Signals
    {-# LINE 125 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}
    import Graphics.UI.Gtk.ModelView.Types
    {-# LINE 126 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}

    {-# LINE 128 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}

    data CellRendererMode = CellRendererModeInert
                          | CellRendererModeActivatable
                          | CellRendererModeEditable
                          deriving (Int -> CellRendererMode
    CellRendererMode -> Int
    CellRendererMode -> [CellRendererMode]
    CellRendererMode -> CellRendererMode
    CellRendererMode -> CellRendererMode -> [CellRendererMode]
    CellRendererMode
    -> CellRendererMode -> CellRendererMode -> [CellRendererMode]
    (CellRendererMode -> CellRendererMode)
    -> (CellRendererMode -> CellRendererMode)
    -> (Int -> CellRendererMode)
    -> (CellRendererMode -> Int)
    -> (CellRendererMode -> [CellRendererMode])
    -> (CellRendererMode -> CellRendererMode -> [CellRendererMode])
    -> (CellRendererMode -> CellRendererMode -> [CellRendererMode])
    -> (CellRendererMode
        -> CellRendererMode -> CellRendererMode -> [CellRendererMode])
    -> Enum CellRendererMode
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: CellRendererMode -> CellRendererMode
    succ :: CellRendererMode -> CellRendererMode
    $cpred :: CellRendererMode -> CellRendererMode
    pred :: CellRendererMode -> CellRendererMode
    $ctoEnum :: Int -> CellRendererMode
    toEnum :: Int -> CellRendererMode
    $cfromEnum :: CellRendererMode -> Int
    fromEnum :: CellRendererMode -> Int
    $cenumFrom :: CellRendererMode -> [CellRendererMode]
    enumFrom :: CellRendererMode -> [CellRendererMode]
    $cenumFromThen :: CellRendererMode -> CellRendererMode -> [CellRendererMode]
    enumFromThen :: CellRendererMode -> CellRendererMode -> [CellRendererMode]
    $cenumFromTo :: CellRendererMode -> CellRendererMode -> [CellRendererMode]
    enumFromTo :: CellRendererMode -> CellRendererMode -> [CellRendererMode]
    $cenumFromThenTo :: CellRendererMode
    -> CellRendererMode -> CellRendererMode -> [CellRendererMode]
    enumFromThenTo :: CellRendererMode
    -> CellRendererMode -> CellRendererMode -> [CellRendererMode]
    Enum,CellRendererMode -> CellRendererMode -> Bool
    (CellRendererMode -> CellRendererMode -> Bool)
    -> (CellRendererMode -> CellRendererMode -> Bool)
    -> Eq CellRendererMode
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: CellRendererMode -> CellRendererMode -> Bool
    == :: CellRendererMode -> CellRendererMode -> Bool
    $c/= :: CellRendererMode -> CellRendererMode -> Bool
    /= :: CellRendererMode -> CellRendererMode -> Bool
    Eq)

    {-# LINE 130 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}

    -- %hash c:75b3 d:45ca
    -- | Informs the cell renderer that the editing is stopped. If @canceled@ is
    -- @True@, the cell renderer will emit the 'editingCanceled' signal.
    --
    -- * Available since Gtk+ version 2.6
    --
    cellRendererStopEditing :: CellRendererClass self => self
     -> Bool -- ^ @canceled@ - @True@ if the editing has been canceled
     -> IO ()
    cellRendererStopEditing :: forall self. CellRendererClass self => self -> Bool -> IO ()
    cellRendererStopEditing self
    self Bool
    canceled =
      (\(CellRenderer ForeignPtr CellRenderer
    arg1) CInt
    arg2 -> ForeignPtr CellRenderer -> (Ptr CellRenderer -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr CellRenderer
    arg1 ((Ptr CellRenderer -> IO ()) -> IO ())
    -> (Ptr CellRenderer -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CellRenderer
    argPtr1 ->Ptr CellRenderer -> CInt -> IO ()
    gtk_cell_renderer_stop_editing Ptr CellRenderer
    argPtr1 CInt
    arg2)
    {-# LINE 144 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}
        (toCellRenderer self)
        (Bool -> CInt
    forall a. Num a => Bool -> a
    fromBool Bool
    canceled)

    -- %hash c:6d51 d:dc3e
    -- | Returns @(width, height)@ denoting the size of the fixed size of
    -- @cell@. If no fixed size is set, returns @-1@ for that value.
    --
    cellRendererGetFixedSize :: CellRendererClass self => self
     -> IO (Int, Int) -- ^ @(width, height)@
    cellRendererGetFixedSize :: forall self. CellRendererClass self => self -> IO (Int, Int)
    cellRendererGetFixedSize self
    self =
      (Ptr CInt -> IO (Int, Int)) -> IO (Int, Int)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO (Int, Int)) -> IO (Int, Int))
    -> (Ptr CInt -> IO (Int, Int)) -> IO (Int, Int)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    widthPtr ->
      (Ptr CInt -> IO (Int, Int)) -> IO (Int, Int)
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr CInt -> IO (Int, Int)) -> IO (Int, Int))
    -> (Ptr CInt -> IO (Int, Int)) -> IO (Int, Int)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CInt
    heightPtr ->
      (\(CellRenderer ForeignPtr CellRenderer
    arg1) Ptr CInt
    arg2 Ptr CInt
    arg3 -> ForeignPtr CellRenderer -> (Ptr CellRenderer -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr CellRenderer
    arg1 ((Ptr CellRenderer -> IO ()) -> IO ())
    -> (Ptr CellRenderer -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CellRenderer
    argPtr1 ->Ptr CellRenderer -> Ptr CInt -> Ptr CInt -> IO ()
    gtk_cell_renderer_get_fixed_size Ptr CellRenderer
    argPtr1 Ptr CInt
    arg2 Ptr CInt
    arg3)
    {-# LINE 158 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}
        (toCellRenderer self)
        Ptr CInt
    widthPtr
        Ptr CInt
    heightPtr IO () -> IO CInt -> IO CInt
    forall a b. IO a -> IO b -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >>
      Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    widthPtr IO CInt -> (CInt -> IO (Int, Int)) -> IO (Int, Int)
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \CInt
    width ->
      Ptr CInt -> IO CInt
    forall a. Storable a => Ptr a -> IO a
    peek Ptr CInt
    heightPtr IO CInt -> (CInt -> IO (Int, Int)) -> IO (Int, Int)
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \CInt
    height ->
      (Int, Int) -> IO (Int, Int)
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (CInt -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral CInt
    width, CInt -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral CInt
    height)

    -- %hash c:85dc d:5fd4
    -- | Sets the renderer size to be explicit, independent of the properties set.
    --
    cellRendererSetFixedSize :: CellRendererClass self => self
     -> Int -- ^ @width@ - the width of the cell renderer, or -1
     -> Int -- ^ @height@ - the height of the cell renderer, or -1
     -> IO ()
    cellRendererSetFixedSize :: forall self. CellRendererClass self => self -> Int -> Int -> IO ()
    cellRendererSetFixedSize self
    self Int
    width Int
    height =
      (\(CellRenderer ForeignPtr CellRenderer
    arg1) CInt
    arg2 CInt
    arg3 -> ForeignPtr CellRenderer -> (Ptr CellRenderer -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr CellRenderer
    arg1 ((Ptr CellRenderer -> IO ()) -> IO ())
    -> (Ptr CellRenderer -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CellRenderer
    argPtr1 ->Ptr CellRenderer -> CInt -> CInt -> IO ()
    gtk_cell_renderer_set_fixed_size Ptr CellRenderer
    argPtr1 CInt
    arg2 CInt
    arg3)
    {-# LINE 174 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}
        (toCellRenderer self)
        (Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    width)
        (Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    height)

    --------------------
    -- Attributes

    -- | Editable mode of the CellRenderer.
    --
    -- Default value: 'CellRendererModeInert'
    --
    cellMode :: CellRendererClass self => Attr self CellRendererMode
    cellMode :: forall self. CellRendererClass self => Attr self CellRendererMode
    cellMode = String -> GType -> Attr self CellRendererMode
    forall gobj enum.
    (GObjectClass gobj, Enum enum) =>
    String -> GType -> Attr gobj enum
    newAttrFromEnumProperty String
    "mode"
      GType
    gtk_cell_renderer_mode_get_type
    {-# LINE 188 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}

    -- | Display the cell.
    --
    -- Default value: @True@
    --
    cellVisible :: CellRendererClass self => Attr self Bool
    cellVisible :: forall self. CellRendererClass self => Attr self Bool
    cellVisible = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "visible"

    -- | Display the cell sensitive.
    --
    -- Default value: @True@
    --
    cellSensitive :: CellRendererClass self => Attr self Bool
    cellSensitive :: forall self. CellRendererClass self => Attr self Bool
    cellSensitive = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "sensitive"

    -- | The x-align.
    --
    -- Allowed values: @[0,1]@
    --
    -- Default value: @0.5@
    --
    cellXAlign :: CellRendererClass self => Attr self Float
    cellXAlign :: forall self. CellRendererClass self => Attr self Float
    cellXAlign = String -> Attr self Float
    forall gobj. GObjectClass gobj => String -> Attr gobj Float
    newAttrFromFloatProperty String
    "xalign"

    -- | The y-align.
    --
    -- Allowed values: @[0,1]@
    --
    -- Default value: @0.5@
    --
    cellYAlign :: CellRendererClass self => Attr self Float
    cellYAlign :: forall self. CellRendererClass self => Attr self Float
    cellYAlign = String -> Attr self Float
    forall gobj. GObjectClass gobj => String -> Attr gobj Float
    newAttrFromFloatProperty String
    "yalign"

    -- | The xpad.
    --
    -- Default value: @0@
    --
    cellXPad :: CellRendererClass self => Attr self Int
    cellXPad :: forall self. CellRendererClass self => Attr self Int
    cellXPad = String -> Attr self Int
    forall gobj. GObjectClass gobj => String -> Attr gobj Int
    newAttrFromUIntProperty String
    "xpad"

    -- | The ypad.
    --
    -- Default value: @0@
    --
    cellYPad :: CellRendererClass self => Attr self Int
    cellYPad :: forall self. CellRendererClass self => Attr self Int
    cellYPad = String -> Attr self Int
    forall gobj. GObjectClass gobj => String -> Attr gobj Int
    newAttrFromUIntProperty String
    "ypad"

    -- | The fixed width.
    --
    -- Allowed values: @>= -1@
    --
    -- Default value: @-1@
    --
    cellWidth :: CellRendererClass self => Attr self Int
    cellWidth :: forall self. CellRendererClass self => Attr self Int
    cellWidth = String -> Attr self Int
    forall gobj. GObjectClass gobj => String -> Attr gobj Int
    newAttrFromIntProperty String
    "width"

    -- | The fixed height.
    --
    -- Allowed values: @>= -1@
    --
    -- Default value: @-1@
    --
    cellHeight :: CellRendererClass self => Attr self Int
    cellHeight :: forall self. CellRendererClass self => Attr self Int
    cellHeight = String -> Attr self Int
    forall gobj. GObjectClass gobj => String -> Attr gobj Int
    newAttrFromIntProperty String
    "height"

    -- | Row has children.
    --
    -- Default value: @False@
    --
    cellIsExpander :: CellRendererClass self => Attr self Bool
    cellIsExpander :: forall self. CellRendererClass self => Attr self Bool
    cellIsExpander = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "is-expander"

    -- | Row is an expander row, and is expanded.
    --
    -- Default value: @False@
    --
    cellIsExpanded :: CellRendererClass self => Attr self Bool
    cellIsExpanded :: forall self. CellRendererClass self => Attr self Bool
    cellIsExpanded = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "is-expanded"

    -- | Cell background color as a string.
    --
    -- Default value: @\"\"@
    --
    cellBackground :: (CellRendererClass self, GlibString string) => WriteAttr self string
    cellBackground :: forall self string.
    (CellRendererClass self, GlibString string) =>
    WriteAttr self string
    cellBackground = String -> WriteAttr self string
    forall gobj string.
    (GObjectClass gobj, GlibString string) =>
    String -> WriteAttr gobj string
    writeAttrFromStringProperty String
    "cell-background"
    {-# LINE 283 "./Graphics/UI/Gtk/ModelView/CellRenderer.chs" #-}
    -- | Whether the 'cellBackground' \/ 'cellBackgroundColor' attribute is set.
    --
    -- You can use this to reset the attribute to its default.
    --
    -- Default value: @False@
    --
    cellBackgroundSet :: CellRendererClass self => Attr self Bool
    cellBackgroundSet :: forall self. CellRendererClass self => Attr self Bool
    cellBackgroundSet = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "cell-background-set"

    --------------------
    -- Signals

    -- %hash c:eff4 d:fc12
    -- | This signal gets emitted when the user cancels the process of editing a
    -- cell. For example, an editable cell renderer could be written to cancel
    -- editing when the user presses Escape.
    --
    -- * Available since Gtk+ version 2.4
    --
    editingCanceled :: CellRendererClass self => Signal self (IO ())
    editingCanceled :: forall self. CellRendererClass self => Signal self (IO ())
    editingCanceled = (Bool -> self -> IO () -> IO (ConnectId self))
    -> Signal self (IO ())
    forall object handler.
    (Bool -> object -> handler -> IO (ConnectId object))
    -> Signal object handler
    Signal (String -> Bool -> self -> IO () -> IO (ConnectId self)
    forall obj.
    GObjectClass obj =>
    String -> Bool -> obj -> IO () -> IO (ConnectId obj)
    connect_NONE__NONE String
    "editing-canceled")

    -- %hash c:41f0 d:49f
    -- | This signal gets emitted when a cell starts to be edited. The intended
    -- use of this signal is to do special setup on @editable@, e.g. adding a
    -- 'EntryCompletion' or setting up additional columns in a 'ComboBox'.
    --
    -- * The widget that is passed to the handler contains the widget that is used
    -- by the 'CellRenderer' to interact with the user. The widget must be
    -- casted to the appropriate widget. For instance, a
    -- 'Graphics.UI.Gtk.ModelView.CellRendererText' uses an
    -- 'Graphics.UI.Gtk.Entry.Entry' widget, while a
    -- 'Graphics.UI.Gtk.ModelView.CellRendererCombo' uses a
    -- 'Graphics.UI.Gtk.ModelView.ComboBox.ComboBox' (if
    -- 'Graphics.UI.Gtk.ModelView.CellRendererCombo.cellComboHasEntry' is
    -- @False@) or a 'Graphics.UI.Gtk.ModelView.ComboBoxEntry.ComboBoxEntry' (if
    -- 'Graphics.UI.Gtk.ModelView.CellRendererCombo.cellComboHasEntry' is
    -- @True@).
    --
    -- * Available since Gtk+ version 2.6
    --
    editingStarted :: CellRendererClass self =>
                      Signal self (Widget -> TreePath -> IO ())
    editingStarted :: forall self.
    CellRendererClass self =>
    Signal self (Widget -> TreePath -> IO ())
    editingStarted = (Bool
     -> self -> (Widget -> TreePath -> IO ()) -> IO (ConnectId self))
    -> Signal self (Widget -> TreePath -> IO ())
    forall object handler.
    (Bool -> object -> handler -> IO (ConnectId object))
    -> Signal object handler
    Signal Bool
    -> self -> (Widget -> TreePath -> IO ()) -> IO (ConnectId self)
    forall {t} {obj}.
    (GObjectClass t, GObjectClass obj) =>
    Bool -> obj -> (t -> TreePath -> IO ()) -> IO (ConnectId obj)
    editingStartedInternal

    editingStartedInternal :: Bool -> obj -> (t -> TreePath -> IO ()) -> IO (ConnectId obj)
    editingStartedInternal Bool
    after obj
    cr t -> TreePath -> IO ()
    act =
     String
    -> Bool
    -> obj
    -> (t -> DefaultGlibString -> IO ())
    -> IO (ConnectId obj)
    forall a' b' obj.
    (GObjectClass a', GlibString b', GObjectClass obj) =>
    String -> Bool -> obj -> (a' -> b' -> IO ()) -> IO (ConnectId obj)
    connect_OBJECT_GLIBSTRING__NONE String
    "editing-started" Bool
    after obj
    cr
     ((t -> DefaultGlibString -> IO ()) -> IO (ConnectId obj))
    -> (t -> DefaultGlibString -> IO ()) -> IO (ConnectId obj)
    forall a b. (a -> b) -> a -> b
    $ \t
    ce DefaultGlibString
    path -> t -> TreePath -> IO ()
    act t
    ce (DefaultGlibString -> TreePath
    stringToTreePath DefaultGlibString
    path)

    --------------------
    -- Deprecated Signals

    foreign import ccall safe "gtk_cell_renderer_stop_editing"
      gtk_cell_renderer_stop_editing :: ((Ptr CellRenderer) -> (CInt -> (IO ())))

    foreign import ccall safe "gtk_cell_renderer_get_fixed_size"
      gtk_cell_renderer_get_fixed_size :: ((Ptr CellRenderer) -> ((Ptr CInt) -> ((Ptr CInt) -> (IO ()))))

    foreign import ccall safe "gtk_cell_renderer_set_fixed_size"
      gtk_cell_renderer_set_fixed_size :: ((Ptr CellRenderer) -> (CInt -> (CInt -> (IO ()))))

    foreign import ccall unsafe "gtk_cell_renderer_mode_get_type"
      gtk_cell_renderer_mode_get_type :: CULong