    {-# LINE 2 "./Graphics/UI/Gtk/ModelView/CellRendererCombo.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget CellRendererCombo
    --
    -- Author : Duncan Coutts
    --
    -- Created: 2 November 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)
    --
    -- Renders a combo box in a cell
    --
    -- * Module available since Gtk+ version 2.6
    --
    module Graphics.UI.Gtk.ModelView.CellRendererCombo (
    -- * Detail
    --
    -- | 'CellRendererCombo' renders text in a cell like
    -- 'Graphics.UI.Gtk.ModelView.CellRendererText' from which it is derived. But
    -- while 'Graphics.UI.Gtk.ModelView.CellRendererText' offers a simple entry to
    -- edit the text, 'CellRendererCombo' offers a
    -- 'Graphics.UI.Gtk.ModelView.ComboBox' or
    -- 'Graphics.UI.Gtk.ModelView.ComboBoxEntry' widget to edit the text. The
    -- values to display in the combo box are taken from the tree model specified
    -- in the model property.
    --
    -- The combo cell renderer takes care of adding a text cell renderer to the
    -- combo box and sets it to display the column specified by its
    -- 'cellTextModel' property. Further cell renderers can be added in a handler
    -- for the 'Graphics.UI.Gtk.ModelView.CellRenderer.editingStarted' signal.

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

    -- * Types
      CellRendererCombo,
      CellRendererComboClass,
      castToCellRendererCombo, gTypeCellRendererCombo,
      toCellRendererCombo,

    -- * Constructors
      cellRendererComboNew,

    -- * Attributes
      cellComboHasEntry,
      cellComboTextModel

      ) where

    import Control.Monad (liftM)

    import System.Glib.FFI
    import System.Glib.UTFString
    import System.Glib.Attributes (Attr, WriteAttr, writeAttr)
    import System.Glib.Properties
    import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
    import Graphics.UI.Gtk.Types
    {-# LINE 81 "./Graphics/UI/Gtk/ModelView/CellRendererCombo.chs" #-}
    import Graphics.UI.Gtk.ModelView.Types
    {-# LINE 82 "./Graphics/UI/Gtk/ModelView/CellRendererCombo.chs" #-}
    import Graphics.UI.Gtk.ModelView.TreeModel
    {-# LINE 83 "./Graphics/UI/Gtk/ModelView/CellRendererCombo.chs" #-}

    {-# LINE 85 "./Graphics/UI/Gtk/ModelView/CellRendererCombo.chs" #-}

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

    -- | Creates a new 'CellRendererCombo'. This 'Renderer' allows for displaying
    -- a fixed set of options the user can choose from.
    --
    cellRendererComboNew :: IO CellRendererCombo
    cellRendererComboNew :: IO CellRendererCombo
    cellRendererComboNew = do
      (ForeignPtr CellRendererCombo -> CellRendererCombo,
     FinalizerPtr CellRendererCombo)
    -> IO (Ptr CellRendererCombo) -> IO CellRendererCombo
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr CellRendererCombo -> CellRendererCombo,
     FinalizerPtr CellRendererCombo)
    forall {a}.
    (ForeignPtr CellRendererCombo -> CellRendererCombo, FinalizerPtr a)
    mkCellRendererCombo (IO (Ptr CellRendererCombo) -> IO CellRendererCombo)
    -> IO (Ptr CellRendererCombo) -> IO CellRendererCombo
    forall a b. (a -> b) -> a -> b
    $
             (Ptr CellRenderer -> Ptr CellRendererCombo)
    -> IO (Ptr CellRenderer) -> IO (Ptr CellRendererCombo)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr CellRenderer -> Ptr CellRendererCombo
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr CellRenderer -> Ptr CellRendererCombo) (IO (Ptr CellRenderer) -> IO (Ptr CellRendererCombo))
    -> IO (Ptr CellRenderer) -> IO (Ptr CellRendererCombo)
    forall a b. (a -> b) -> a -> b
    $
             IO (Ptr CellRenderer)
    gtk_cell_renderer_combo_new
    {-# LINE 98 "./Graphics/UI/Gtk/ModelView/CellRendererCombo.chs" #-}

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

    -- | If @True@, the cell renderer will allow the user to enter
    -- values other than the ones in the popup list.
    --
    -- Default value: @True@
    --
    cellComboHasEntry :: CellRendererComboClass self => Attr self Bool
    cellComboHasEntry :: forall self. CellRendererComboClass self => Attr self Bool
    cellComboHasEntry = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "has-entry"

    -- | The tuple containing a model and a column in this model that determine
    -- the possible strings that can be shown in the combo box. Note that this
    -- tree model can be a datum in the tree model that is used to populate the
    -- view in which the 'CellRendererCombo' is part of. In other words, it is
    -- possible that every 'CellRendererCombo' can show a different set of
    -- options on each row.
    --
    cellComboTextModel :: ( TreeModelClass (model row),
                            TypedTreeModelClass model,
                            CellRendererComboClass self,
                            GlibString string) =>
                            WriteAttr self (model row, ColumnId row string)
    cellComboTextModel :: forall (model :: * -> *) row self string.
    (TreeModelClass (model row), TypedTreeModelClass model,
     CellRendererComboClass self, GlibString string) =>
    WriteAttr self (model row, ColumnId row string)
    cellComboTextModel = (self -> (model row, ColumnId row string) -> IO ())
    -> WriteAttr self (model row, ColumnId row string)
    forall o b. (o -> b -> IO ()) -> WriteAttr o b
    writeAttr self -> (model row, ColumnId row string) -> IO ()
    forall {o} {gobj} {row} {ty}.
    (TreeModelClass o, GObjectClass gobj) =>
    gobj -> (o, ColumnId row ty) -> IO ()
    setter
      where
      setter :: gobj -> (o, ColumnId row ty) -> IO ()
    setter gobj
    cr (o
    model, ColumnId row ty
    col) = do
        String -> gobj -> Int -> IO ()
    forall gobj. GObjectClass gobj => String -> gobj -> Int -> IO ()
    objectSetPropertyInt String
    "text-column" gobj
    cr
          ((Int -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Int -> Int) -> (ColumnId row ty -> Int) -> ColumnId row ty -> Int
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . ColumnId row ty -> Int
    forall row ty. ColumnId row ty -> Int
    columnIdToNumber) ColumnId row ty
    col)
        GType -> String -> gobj -> TreeModel -> IO ()
    forall gobj gobj'.
    (GObjectClass gobj, GObjectClass gobj') =>
    GType -> String -> gobj -> gobj' -> IO ()
    objectSetPropertyGObject GType
    gtk_tree_model_get_type
    {-# LINE 128 "./Graphics/UI/Gtk/ModelView/CellRendererCombo.chs" #-}
          "model" gobj
    cr (o -> TreeModel
    forall o. TreeModelClass o => o -> TreeModel
    toTreeModel o
    model)

    foreign import ccall safe "gtk_cell_renderer_combo_new"
      gtk_cell_renderer_combo_new :: (IO (Ptr CellRenderer))

    foreign import ccall unsafe "gtk_tree_model_get_type"
      gtk_tree_model_get_type :: CULong