From: Axel S. <si...@co...> - 2008-09-07 12:31:41
|
Sun Sep 7 08:19:58 EDT 2008 A....@ke... * Make the new ModelView API the default. hunk ./Makefile.am 529 + gtk/Graphics/UI/Gtk/TreeList.hs \ hunk ./Makefile.am 554 - gtk/Graphics/UI/Gtk/ModelView/ComboBox.chs.pp \ - gtk/Graphics/UI/Gtk/ModelView/ComboBoxEntry.chs.pp \ hunk ./Makefile.am 555 - gtk/Graphics/UI/Gtk/ModelView/EntryCompletion.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs.pp 98 - module Graphics.UI.Gtk.TreeList.TreeModel, - module Graphics.UI.Gtk.TreeList.TreeSelection, --- module Graphics.UI.Gtk.TreeList.CellLayout, - module Graphics.UI.Gtk.TreeList.TreeViewColumn, - module Graphics.UI.Gtk.TreeList.TreeView, - module Graphics.UI.Gtk.TreeList.IconView, - module Graphics.UI.Gtk.TreeList.CellView, --- module TreeSortable, - module Graphics.UI.Gtk.TreeList.TreeModelSort, - module Graphics.UI.Gtk.TreeList.CellRenderer, --- module CellEditable, - module Graphics.UI.Gtk.TreeList.CellRendererPixbuf, - module Graphics.UI.Gtk.TreeList.CellRendererText, - module Graphics.UI.Gtk.TreeList.CellRendererToggle, --- module Graphics.UI.Gtk.TreeList.CellRendererProgress, --- module Graphics.UI.Gtk.TreeList.CellRendererCombo, - module Graphics.UI.Gtk.TreeList.ListStore, - module Graphics.UI.Gtk.TreeList.TreeStore, + module Graphics.UI.Gtk.ModelView.CellLayout, + module Graphics.UI.Gtk.ModelView.CellRenderer, + module Graphics.UI.Gtk.ModelView.CellRendererCombo, + module Graphics.UI.Gtk.ModelView.CellRendererPixbuf, + module Graphics.UI.Gtk.ModelView.CellRendererProgress, + module Graphics.UI.Gtk.ModelView.CellRendererText, + module Graphics.UI.Gtk.ModelView.CellRendererToggle, + module Graphics.UI.Gtk.ModelView.CellView, + module Graphics.UI.Gtk.ModelView.CustomStore, + module Graphics.UI.Gtk.ModelView.IconView, + module Graphics.UI.Gtk.ModelView.ListStore, + module Graphics.UI.Gtk.ModelView.TreeDrag, + module Graphics.UI.Gtk.ModelView.TreeModel, + module Graphics.UI.Gtk.ModelView.TreeModelSort, + module Graphics.UI.Gtk.ModelView.TreeSortable, + module Graphics.UI.Gtk.ModelView.TreeRowReference, + module Graphics.UI.Gtk.ModelView.TreeSelection, + module Graphics.UI.Gtk.ModelView.TreeStore, + module Graphics.UI.Gtk.ModelView.TreeView, + module Graphics.UI.Gtk.ModelView.TreeViewColumn, hunk ./gtk/Graphics/UI/Gtk.hs.pp 288 -import Graphics.UI.Gtk.TreeList.TreeModel hiding ( - gtk_tree_model_get_iter_from_string) -import Graphics.UI.Gtk.TreeList.TreeSelection ---import Graphics.UI.Gtk.TreeList.CellLayout -import Graphics.UI.Gtk.TreeList.TreeViewColumn -import Graphics.UI.Gtk.TreeList.TreeView -import Graphics.UI.Gtk.TreeList.IconView -import Graphics.UI.Gtk.TreeList.CellView ---import TreeSortable -import Graphics.UI.Gtk.TreeList.TreeModelSort -import Graphics.UI.Gtk.TreeList.CellRenderer ---import CellEditable -import Graphics.UI.Gtk.TreeList.CellRendererPixbuf -import Graphics.UI.Gtk.TreeList.CellRendererText -import Graphics.UI.Gtk.TreeList.CellRendererToggle ---import Graphics.UI.Gtk.TreeList.CellRendererProgress ---import Graphics.UI.Gtk.TreeList.CellRendererCombo -import Graphics.UI.Gtk.TreeList.ListStore -import Graphics.UI.Gtk.TreeList.TreeStore +import Graphics.UI.Gtk.ModelView.CellLayout +import Graphics.UI.Gtk.ModelView.CellRenderer +import Graphics.UI.Gtk.ModelView.CellRendererCombo +import Graphics.UI.Gtk.ModelView.CellRendererPixbuf +import Graphics.UI.Gtk.ModelView.CellRendererProgress +import Graphics.UI.Gtk.ModelView.CellRendererText +import Graphics.UI.Gtk.ModelView.CellRendererToggle +import Graphics.UI.Gtk.ModelView.CellView +import Graphics.UI.Gtk.ModelView.CustomStore +import Graphics.UI.Gtk.ModelView.IconView +import Graphics.UI.Gtk.ModelView.ListStore +import Graphics.UI.Gtk.ModelView.TreeDrag +import Graphics.UI.Gtk.ModelView.TreeModel +import Graphics.UI.Gtk.ModelView.TreeModelSort +import Graphics.UI.Gtk.ModelView.TreeSortable +import Graphics.UI.Gtk.ModelView.TreeRowReference +import Graphics.UI.Gtk.ModelView.TreeSelection +import Graphics.UI.Gtk.ModelView.TreeStore +import Graphics.UI.Gtk.ModelView.TreeView +import Graphics.UI.Gtk.ModelView.TreeViewColumn hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 8 --- Copyright (C) 2004-2005 Duncan Coutts +-- Copyright (C) 2004-2007 Duncan Coutts, Axel Simon hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 25 --- A widget used to choose from a list of items +-- A widget used to choose from a list of items. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 30 + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 32 --- [_$_] +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 42 --- tree model, and the display of the choices can be adapted to the data in the --- model by using cell renderers, as you would in a tree view. This is possible --- since 'ComboBox' implements the 'CellLayout' interface. The tree model --- holding the valid choices is not restricted to a flat list, it can be a real --- tree, and the popup will reflect the tree structure. +-- tree model, and the display of the choices can be adapted to the data in +-- the model by using cell renderers, as you would in a tree view. This is +-- possible since 'ComboBox' implements the 'CellLayout' interface. The tree +-- model holding the valid choices is not restricted to a flat list, it can be +-- a real tree, and the popup will reflect the tree structure. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 48 --- In addition to the model-view API, 'ComboBox' offers a simple API which --- is suitable for text-only combo boxes, and hides the complexity of managing --- the data in a model. It consists of the functions 'comboBoxNewText', --- 'comboBoxAppendText', 'comboBoxInsertText', 'comboBoxPrependText', --- 'comboBoxRemoveText' and 'comboBoxGetActiveText'. +-- In addition to the general model-view API, 'ComboBox' offers the function +-- 'comboBoxNewText' which creates a text-only combo box. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 52 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 77 +#if GTK_CHECK_VERSION(2,6,0) + comboBoxGetWrapWidth, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 81 +#if GTK_CHECK_VERSION(2,6,0) + comboBoxGetRowSpanColumn, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 85 +#if GTK_CHECK_VERSION(2,6,0) + comboBoxGetColumnSpanColumn, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 95 - comboBoxAppendText, - comboBoxInsertText, - comboBoxPrependText, - comboBoxRemoveText, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 98 - comboBoxGetWrapWidth, - comboBoxGetRowSpanColumn, - comboBoxGetColumnSpanColumn, - comboBoxGetActiveText, + comboBoxSetRowSeparatorSource, hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 101 +#if GTK_CHECK_VERSION(2,10,0) + comboBoxSetTitle, + comboBoxGetTitle, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 110 -#if GTK_CHECK_VERSION(2,6,0) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 112 +#if GTK_CHECK_VERSION(2,6,0) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 115 +#endif + comboBoxActive, +#if GTK_CHECK_VERSION(2,6,0) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 121 +#if GTK_CHECK_VERSION(2,10,0) + comboBoxTearoffTitle, + comboBoxPopupShown, + comboBoxTitle, +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 129 + changed, + popupShownNotify, + [_$_] +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 137 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 147 -import System.Glib.GObject (makeNewGObject) -{#import Graphics.UI.Gtk.Types#} +import System.Glib.GObject (makeNewGObject, + mkFunPtrDestroyNotify) +{#import Graphics.UI.Gtk.Types#} hiding (ListStore) +{#import Graphics.UI.Gtk.ModelView.Types#} (TypedTreeModelClass, + TreeIter, + receiveTreeIter) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 154 -{#import Graphics.UI.Gtk.TreeList.TreeIter#} (TreeIter(..), receiveTreeIter) - +{#import Graphics.UI.Gtk.ModelView.CustomStore#} [_$_] +import Graphics.UI.Gtk.ModelView.ListStore ( ListStore, listStoreNew ) +import Graphics.UI.Gtk.ModelView.CellLayout ( cellLayoutSetAttributes, + cellLayoutPackStart ) +import Graphics.UI.Gtk.ModelView.CellRendererText ( cellRendererTextNew, [_$_] + cellText) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 176 --- text combo box, you should only manipulate its data source with the --- following convenience functions: 'comboBoxAppendText', 'comboBoxInsertText', --- 'comboBoxPrependText' and 'comboBoxRemoveText'. +-- text combo box, you can supply the @id@ function as first argument. In this +-- case 'comboBoxNewText' will return a @'Graphics.UI.Gtk.ModelView.ListStore' +-- String@ containing the initial list of strings. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 180 -comboBoxNewText :: IO ComboBox -comboBoxNewText = - makeNewObject mkComboBox $ - liftM (castPtr :: Ptr Widget -> Ptr ComboBox) $ - {# call gtk_combo_box_new_text #} +comboBoxNewText :: + (a -> String) -- ^ a function to extract elements from a the store + -> [a] -- ^ the initial contents of the store + -> IO (ComboBox, ListStore a) -- the resulting combo box and the store +comboBoxNewText extract initial = do + store <- listStoreNew initial + combo <- comboBoxNewWithModel store + ren <- cellRendererTextNew + cellLayoutPackStart combo ren True + cellLayoutSetAttributes combo ren store (\a -> [cellText := extract a]) + return (combo, store) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 192 +-- %hash c:2570 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 195 -comboBoxNewWithModel :: TreeModelClass model => [_$_] - model -- ^ @model@ - A 'TreeModel'. +comboBoxNewWithModel :: TreeModelClass model => + model -- ^ @model@ - A 'TreeModel'. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 201 - {# call gtk_combo_box_new_with_model #} (toTreeModel model) + {# call gtk_combo_box_new_with_model #} + (toTreeModel model) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 207 +#if GTK_CHECK_VERSION(2,6,0) +-- %hash d:566e +-- | Returns the wrap width which is used to determine the number of columns +-- for the popup menu. If the wrap width is larger than 1, the combo box is in +-- table mode. +-- +-- * Available since Gtk+ version 2.6 +-- +comboBoxGetWrapWidth :: ComboBoxClass self => self -> IO Int +comboBoxGetWrapWidth self = + liftM fromIntegral $ + {# call gtk_combo_box_get_wrap_width #} + (toComboBox self) +#endif + hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 224 --- layed out in a table. +-- laid out in a table. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 232 --- | Sets the column with row span information for the combo box to be @rowSpan@. +#if GTK_CHECK_VERSION(2,6,0) +-- | Gets the column with row span information for @comboBox@. +-- +-- * Available since Gtk+ version 2.6 +-- +comboBoxGetRowSpanColumn :: ComboBoxClass self => self -> IO (ColumnId row Int) +comboBoxGetRowSpanColumn self = + liftM (makeColumnIdInt . fromIntegral) $ + {# call gtk_combo_box_get_row_span_column #} + (toComboBox self) +#endif + +-- %hash d:f80b +-- | Sets the column with row span information for @comboBox@ to be @rowSpan@. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 249 -comboBoxSetRowSpanColumn :: ComboBoxClass self => self -> Int -> IO () +comboBoxSetRowSpanColumn :: ComboBoxClass self => self -> ColumnId row Int -> IO () hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 253 - (fromIntegral rowSpan) + ((fromIntegral . columnIdToNumber) rowSpan) + +#if GTK_CHECK_VERSION(2,6,0) +-- | Gets the source of the column span information for the combo box. +-- +-- * Available since Gtk+ version 2.6 +-- +comboBoxGetColumnSpanColumn :: ComboBoxClass self => self -> IO (ColumnId row Int) +comboBoxGetColumnSpanColumn self = + liftM (makeColumnIdInt . fromIntegral) $ + {# call gtk_combo_box_get_column_span_column #} + (toComboBox self) +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 267 --- | Sets the column with column span information for the combo box to be --- @columnSpan@. The column span column contains integers which indicate how --- many columns an item should span. +-- %hash d:4303 +-- | Sets the source of the column span information for the combo box. The +-- column span source contains integers which indicate how many columns an +-- item should span. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 272 -comboBoxSetColumnSpanColumn :: ComboBoxClass self => self -> Int -> IO () +comboBoxSetColumnSpanColumn :: ComboBoxClass self => self -> ColumnId row Int -> IO () hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 276 - (fromIntegral columnSpan) + ((fromIntegral . columnIdToNumber) columnSpan) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 278 --- | Returns the index of the currently active item, or @Nothing@ if --- there's no active item. If the model is a non-flat treemodel, and --- the active item is not an immediate child of the root of the tree, --- this function returns @'treePathGetIndices' path !! 0@, where --- @path@ is the 'Graphics.UI.Gtk.TreeList.TreePath' of the active --- item. +-- %hash c:e719 d:e6a +-- | Returns the index of the currently active item, or -1 if there's no +-- active item. If the model is a non-flat treemodel, and the active item is +-- not an immediate child of the root of the tree, this function returns +-- @'treePathGetIndices' path !! 0@, where @path@ is the 'TreePath' of the +-- active item. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 286 - -> IO (Maybe Int) -- ^ returns An integer which is the index of the currently - -- active item, or @Nothing@ if there's no active item. + -> IO Int -- ^ returns An integer which is the index of the currently active + -- item, or -1 if there's no active item. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 289 + liftM fromIntegral $ hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 292 - >>= \index -> if index == -1 - then return Nothing - else return (Just $ fromIntegral index) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 293 --- | Sets the active item of the combo box to be the item at @index@. +-- %hash c:3572 d:fbed +-- | Sets the active item of @comboBox@ to be the item at @index@. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 297 - -> Int -- ^ @index@ - An index in the model passed during construction, or - -- -1 to have no active item. + -> Int -- ^ @index@ - An index in the model passed during construction, or -1 + -- to have no active item. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 305 --- | Returns a 'TreeIter' that points to the current active item, if it exists, --- or @Nothing@ if there is no current active item. +-- %hash c:744a d:e897 +-- | Returns a 'TreeIter' that points to the current active item, if it +-- exists, or @Nothing@ if there is no current active item. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 316 +-- %hash c:9a70 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 329 --- | Returns the 'TreeModel' which is acting as data source for the combo box. +-- %hash c:2460 +-- | Returns the 'TreeModel' which is acting as data source for @comboBox@. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 332 -comboBoxGetModel :: ComboBoxClass self => self - -> IO (Maybe TreeModel) -- ^ returns the 'TreeModel' which was passed during +comboBoxGetModel :: ComboBoxClass self + => self + -> IO (Maybe TreeModel) -- ^ returns A 'TreeModel' which was passed during hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 338 - {# call gtk_combo_box_get_model #} + {# call unsafe gtk_combo_box_get_model #} hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 341 +-- %hash c:f5d0 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 346 --- Note that this function does not clear the cell renderers, you have to --- call 'comboBoxCellLayoutClear' yourself if you need to set up different cell +-- Note that this function does not clear the cell renderers, you have to call +-- 'comboBoxCellLayoutClear' yourself if you need to set up different cell hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 357 --- | Appends the given string to the list of strings stored in the combo box. --- Note that you can only use this function with combo boxes constructed with --- 'comboBoxNewText'. --- -comboBoxAppendText :: ComboBoxClass self => self -> String -> IO () -comboBoxAppendText self text = - withUTFString text $ \textPtr -> - {# call gtk_combo_box_append_text #} - (toComboBox self) - textPtr - --- | Inserts @text@ at @position@ in the list of strings stored in the --- combo box. Note that you can only use this function with combo boxes --- constructed with 'comboBoxNewText'. --- -comboBoxInsertText :: ComboBoxClass self => self - -> Int -- ^ @position@ - An index to insert @text@. - -> String -- ^ @text@ - -> IO () -comboBoxInsertText self position text = - withUTFString text $ \textPtr -> - {# call gtk_combo_box_insert_text #} - (toComboBox self) - (fromIntegral position) - textPtr - --- | Prepends the given string to the list of strings stored in the combo box. --- Note that you can only use this function with combo boxes constructed with --- 'comboBoxNewText'. --- -comboBoxPrependText :: ComboBoxClass self => self -> String -> IO () -comboBoxPrependText self text = - withUTFString text $ \textPtr -> - {# call gtk_combo_box_prepend_text #} - (toComboBox self) - textPtr - --- | Removes the string at @position@ from the combo box. Note that you can --- only use this function with combo boxes constructed with 'comboBoxNewText'. --- -comboBoxRemoveText :: ComboBoxClass self => self - -> Int -- ^ @position@ - Index of the item to remove. - -> IO () -comboBoxRemoveText self position = - {# call gtk_combo_box_remove_text #} - (toComboBox self) - (fromIntegral position) - hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 367 --- | Hides the menu or dropdown list of the combo box. +-- %hash c:32a4 d:463e +-- | Hides the menu or dropdown list of @comboBox@. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 379 --- | Returns the wrap width which is used to determine the number of columns --- for the popup menu. If the wrap width is larger than 1, the combo box is in --- table mode. +-- %hash c:6fec d:a050 +-- | Installs a mapping from the model to a row separator flag, which is used +-- to determine whether a row should be drawn as a separator. If the row +-- separator mapping is @Nothing@, no separators are drawn. This is the +-- default value. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 387 -comboBoxGetWrapWidth :: ComboBoxClass self => self -> IO Int -comboBoxGetWrapWidth self = - liftM fromIntegral $ - {# call gtk_combo_box_get_wrap_width #} - (toComboBox self) +comboBoxSetRowSeparatorSource :: (ComboBoxClass self, + TreeModelClass (model row), + TypedTreeModelClass model) + => self -- ^ the 'ComboBox' widget + -> Maybe (model row, row -> Bool) + -- ^ The model and a function to extract a Boolean from it. + -> IO () +comboBoxSetRowSeparatorSource self Nothing = + {# call gtk_combo_box_set_row_separator_func #} + (toComboBox self) nullFunPtr nullPtr nullFunPtr +comboBoxSetRowSeparatorSource self (Just (model, extract)) = do + funPtr <- mkRowSeparatorFunc $ \_ iterPtr -> do + iter <- peek iterPtr + value <- treeModelGetRow model iter + return (extract value) + desPtr <- mkFunPtrDestroyNotify funPtr + {# call gtk_combo_box_set_row_separator_func #} + (toComboBox self) funPtr nullPtr desPtr hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 406 --- | Returns the column with row span information for @comboBox@. --- --- * Available since Gtk+ version 2.6 --- -comboBoxGetRowSpanColumn :: ComboBoxClass self => self -> IO Int -comboBoxGetRowSpanColumn self = - liftM fromIntegral $ - {# call gtk_combo_box_get_row_span_column #} - (toComboBox self) +{#pointer TreeViewRowSeparatorFunc#} hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 408 --- | Returns the column with column span information for @comboBox@. --- --- * Available since Gtk+ version 2.6 --- -comboBoxGetColumnSpanColumn :: ComboBoxClass self => self -> IO Int -comboBoxGetColumnSpanColumn self = - liftM fromIntegral $ - {# call gtk_combo_box_get_column_span_column #} - (toComboBox self) - --- | Returns the currently active string in @comboBox@ or @Nothing@ if none is --- selected. Note that you can only use this function with combo boxes --- constructed with 'comboBoxNewText' and with 'ComboBoxEntry's. --- --- * Available since Gtk+ version 2.6 --- -comboBoxGetActiveText :: ComboBoxClass self => self -> IO (Maybe String) -comboBoxGetActiveText self = - {# call gtk_combo_box_get_active_text #} - (toComboBox self) - >>= maybePeek readUTFString +foreign import ccall "wrapper" mkRowSeparatorFunc :: + (Ptr TreeModel -> Ptr TreeIter -> IO Bool) -> IO TreeViewRowSeparatorFunc hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 411 +-- %hash c:5bf8 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 417 - -> Bool -- ^ @addTearoffs@ - @True@ to add tearoff menu items + -> Bool -- ^ @addTearoffs@ - @True@ to add tearoff menu items hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 432 +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:64db d:ecde +-- | Sets the menu's title in tearoff mode. +-- +-- * Available since Gtk+ version 2.10 +-- +comboBoxSetTitle :: ComboBoxClass self => self + -> String -- ^ @title@ - a title for the menu in tearoff mode. + -> IO () +comboBoxSetTitle self title = + withUTFString title $ \titlePtr -> + {# call gtk_combo_box_set_title #} + (toComboBox self) + titlePtr + +-- %hash c:9f54 d:e396 +-- | Gets the current title of the menu in tearoff mode. See +-- 'comboBoxSetAddTearoffs'. +-- +-- * Available since Gtk+ version 2.10 +-- +comboBoxGetTitle :: ComboBoxClass self => self + -> IO String -- ^ returns the menu's title in tearoff mode. +comboBoxGetTitle self = + {# call gtk_combo_box_get_title #} + (toComboBox self) + >>= peekUTFString +#endif + +-- %hash c:fe18 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 478 +-- %hash c:9168 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 491 +#else +foreign import ccall "wrapper" dummyForStub :: (CInt -> IO ()) -> IO (FunPtr (CInt -> IO ())) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 498 -#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:c23c hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 501 -comboBoxModel :: (ComboBoxClass self, TreeModelClass model) => ReadWriteAttr self (Maybe TreeModel) (Maybe model) -comboBoxModel = newAttr - comboBoxGetModel - comboBoxSetModel +comboBoxModel :: (ComboBoxClass self, TreeModelClass treeModel) => ReadWriteAttr self TreeModel treeModel +comboBoxModel = newAttrFromObjectProperty "model" + {# call pure unsafe gtk_tree_model_get_type #} hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 505 +-- %hash c:ea5e hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 514 -comboBoxWrapWidth = newAttr - comboBoxGetWrapWidth - comboBoxSetWrapWidth +comboBoxWrapWidth = newAttrFromIntProperty "wrap-width" hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 516 --- | If this is set to a non-negative value, it must be the index of a column --- of type @G_TYPE_INT@ in the model. --- --- The values of that column are used to determine how many rows a value in +#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:a445 +-- | The values of that column are used to determine how many rows a value in hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 522 --- Allowed values: >= -1 +-- Default value: 'invalidColumnId' hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 524 --- Default value: -1 +-- * Available since Gtk+ version 2.6 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 526 -comboBoxRowSpanColumn :: ComboBoxClass self => Attr self Int +comboBoxRowSpanColumn :: ComboBoxClass self => Attr self (ColumnId row Int) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 531 --- | If this is set to a non-negative value, it must be the index of a column --- of type @G_TYPE_INT@ in the model. --- --- The values of that column are used to determine how many columns a value +-- %hash c:7ec7 +-- | The values of that column are used to determine how many columns a value hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 535 --- Allowed values: >= -1 +-- Default value: 'invalidColumnId' hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 537 --- Default value: -1 +-- * Available since Gtk+ version 2.6 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 539 -comboBoxColumnSpanColumn :: ComboBoxClass self => Attr self Int +comboBoxColumnSpanColumn :: ComboBoxClass self => Attr self (ColumnId row Int) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 543 +#endif + +-- %hash c:f777 d:507b +-- | The item which is currently active. This value only makes sense for +-- a list model. +-- +comboBoxActive :: ComboBoxClass self => Attr self Int +comboBoxActive = newAttrFromIntProperty "active" hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 552 +#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:585b d:2096 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 561 +-- * Available since Gtk+ version 2.6 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 564 -comboBoxAddTearoffs = newAttr - comboBoxGetAddTearoffs - comboBoxSetAddTearoffs +comboBoxAddTearoffs = newAttrFromBoolProperty "add-tearoffs" hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 566 +-- %hash d:94cc hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 572 +-- * Available since Gtk+ version 2.6 +-- hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 576 +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 578 +-- %hash c:4808 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 584 -comboBoxFocusOnClick = newAttr - comboBoxGetFocusOnClick - comboBoxSetFocusOnClick +comboBoxFocusOnClick = newAttrFromBoolProperty "focus-on-click" + +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:c1e3 d:ddac +-- | A title that may be displayed by the window manager when the popup is +-- torn-off. +-- +-- Default value: \"\" +-- +-- * Available since Gtk+ version 2.10 +-- +comboBoxTearoffTitle :: ComboBoxClass self => Attr self String +comboBoxTearoffTitle = newAttrFromStringProperty "tearoff-title" + +-- %hash c:efa9 d:89e5 +-- | Whether the combo boxes dropdown is popped up. Note that this property is +-- mainly useful because it allows you to connect to notify::popup-shown. +-- +-- Default value: @False@ +-- +-- * Available since Gtk+ version 2.10 +-- +comboBoxPopupShown :: ComboBoxClass self => ReadAttr self Bool +comboBoxPopupShown = readAttrFromBoolProperty "popup-shown" + +-- %hash c:52a1 d:79e8 +-- | \'title\' property. See 'comboBoxGetTitle' and 'comboBoxSetTitle' +-- +-- * Available since Gtk+ version 2.10 +-- +comboBoxTitle :: ComboBoxClass self => Attr self String +comboBoxTitle = newAttr + comboBoxGetTitle + comboBoxSetTitle hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 623 --- | The changed signal gets emitted when the active item is changed. This can --- be due to the user selecting a different item from the list, or due to a --- call to 'comboBoxSetActiveIter'. +-- %hash c:4cee d:36c9 +-- | The changed signal is emitted when the active item is changed. The can be +-- due to the user selecting a different item from the list, or due to a call +-- to 'comboBoxSetActiveIter'. It will also be emitted while typing into a +-- 'ComboBoxEntry', as well as when selecting an item from the +-- 'ComboBoxEntry''s list. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 630 -onChanged, afterChanged :: ComboBoxClass self => self +changed :: ComboBoxClass self => Signal self (IO ()) +changed = Signal (connect_NONE__NONE "changed") + +-- | The combo box was dropped down or collapsed. +-- +popupShownNotify :: ComboBoxClass self => Signal self (IO ()) +popupShownNotify = Signal (connect_NONE__NONE "notify::popup-shown") + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED +-- %hash c:c149 +onChanged :: ComboBoxClass self => self hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 647 +{-# DEPRECATED onChanged "instead of 'onChanged obj' use 'on obj changed'" #-} + +-- %hash c:5e28 +afterChanged :: ComboBoxClass self => self + -> IO () + -> IO (ConnectId self) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 654 +{-# DEPRECATED afterChanged "instead of 'afterChanged obj' use 'after obj changed'" #-} +#endif hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 37 --- In contrast to a 'ComboBox', the underlying model of a --- 'ComboBoxEntry' must always have a text column (see --- 'comboBoxEntrySetTextColumn'), and the entry will show the content --- of the text column in the selected row. To get the text from the --- entry, use --- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxGetActiveText'. +-- In contrast to a 'ComboBox', the underlying model of a 'ComboBoxEntry' +-- must always have a text column (see 'comboBoxEntrySetTextColumn'), and the +-- entry will show the content of the text column in the selected row. To get +-- the text from the entry, use 'comboBoxGetActiveText'. +-- +-- The changed signal will be emitted while typing into a 'ComboBoxEntry', +-- as well as when selecting an item from the 'ComboBoxEntry''s list. Use +-- 'comboBoxGetActive' or 'comboBoxGetActiveIter' to discover whether an item +-- was actually selected from the list. +-- +-- Connect to the activate signal of the 'Entry' (use 'binGetChild') to +-- detect when the user actually finishes entering text. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 50 --- The convenience API to construct simple text-only 'ComboBox'es can also --- be used with 'ComboBoxEntry's which have been constructed with --- 'comboBoxEntryNewText'. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 89 -{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Types#} hiding ( ListStore ) +import Graphics.UI.Gtk.ModelView.Types +import Graphics.UI.Gtk.ModelView.ComboBox +import Graphics.UI.Gtk.ModelView.CellRendererText +import Graphics.UI.Gtk.ModelView.CellLayout +{#import Graphics.UI.Gtk.ModelView.CustomStore#} +import Graphics.UI.Gtk.ModelView.ListStore ( ListStore, listStoreNew ) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 104 --- construction, you should set a model using --- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxSetModel' and a +-- construction, you should set a model using 'comboBoxSetModel' and a hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 113 --- | Creates a new 'ComboBoxEntry' which has a 'Entry' as child and a --- list of strings as popup. You can get the 'Entry' from a --- 'ComboBoxEntry' using --- 'Graphics.UI.Gtk.Abstract.Bin.binGetChild'. To add and remove --- strings from the list, just modify @model@ using its data --- manipulation API. +-- | Creates a new 'ComboBoxEntry' which has a 'Entry' as child and a list of +-- strings as popup. You can get the 'Entry' from a 'ComboBoxEntry' using +-- 'binGetChild'. To add and remove strings from the list, just modify @model@ +-- using its data manipulation API. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 119 - model -- ^ @model@ - A 'TreeModel'. - -> Int -- ^ @textColumn@ - A column in @model@ to get the - -- strings from. + model -- ^ @model@ - A 'CustomStore'. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 121 -comboBoxEntryNewWithModel model textColumn = - makeNewObject mkComboBoxEntry $ - liftM (castPtr :: Ptr Widget -> Ptr ComboBoxEntry) $ - {# call gtk_combo_box_entry_new_with_model #} - (toTreeModel model) - (fromIntegral textColumn) +comboBoxEntryNewWithModel model = do + combo <- comboBoxEntryNew + comboBoxSetModel combo (Just model) + return combo hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 126 --- | Convenience function which constructs a new editable text combo --- box, which is a 'ComboBoxEntry' just displaying strings. If you use --- this function to create a text combo box, you should only --- manipulate its data source with the following convenience --- functions: --- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxAppendText', --- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxInsertText', --- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxPrependText' and --- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxRemoveText'. +-- | Convenience function which constructs a new editable text combo box, +-- which is a 'ComboBoxEntry' just displaying strings. Note that this +-- function does not setup any functionality to insert newly typed +-- text into the model. See the module introduction for information +-- about this. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 132 -comboBoxEntryNewText :: IO ComboBoxEntry -comboBoxEntryNewText = - makeNewObject mkComboBoxEntry $ - liftM (castPtr :: Ptr Widget -> Ptr ComboBoxEntry) $ - {# call gtk_combo_box_entry_new_text #} +comboBoxEntryNewText :: + (a -> String) -- ^ a function to extract elements from a the store + -> [a] -- ^ the initial entries in the 'ComboBoxEntry' + -> IO (ComboBoxEntry, ListStore a) +comboBoxEntryNewText extract initial = do + store <- listStoreNew initial + let colId = makeColumnIdString 0 + treeModelSetColumn store colId extract + combo <- makeNewObject mkComboBoxEntry $ + liftM (castPtr :: Ptr Widget -> Ptr ComboBoxEntry) $ + {# call gtk_combo_box_entry_new_with_model #} + (toTreeModel store) + (fromIntegral (columnIdToNumber colId)) + return (combo, store) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 150 --- | Sets the model column which the entry box should use to get strings from to +-- %hash c:b7d7 d:2818 +-- | Sets the model column should be use to get strings from to hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 155 - -> Int -- ^ @textColumn@ - A column in the model to get the strings from. + -> ColumnId row String -- ^ @textColumn@ - A column in @model@ to get the strings from. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 160 - (fromIntegral textColumn) + (fromIntegral (columnIdToNumber textColumn)) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 162 --- | Returns the column which the entry box is using to get the strings from. +-- %hash c:a3e3 d:6441 +-- | Returns the column which is used to get the strings from. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 166 - -> IO Int -- ^ returns a column in the data source model of the entry box. + -> IO (ColumnId row String) -- ^ returns A column in the data source model of @entryBox@. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 168 - liftM fromIntegral $ + liftM (makeColumnIdString . fromIntegral) $ hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 175 +-- %hash c:84ff d:be07 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 178 --- Allowed values: >= -1 +-- Allowed values: >= 0 hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 180 --- Default value: -1 +-- Default value: 'Graphics.UI.Gtk.ModelView.CustomStore.invalidColumnId' hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 182 -comboBoxEntryTextColumn :: ComboBoxEntryClass self => Attr self Int +comboBoxEntryTextColumn :: ComboBoxEntryClass self => Attr self (ColumnId row String) hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 186 + hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 27 --- This just re-exports the Graphics.UI.Gtk.* modules. +-- This just re-exports the Graphics.UI.Gtk.ModelView.* modules. hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 29 --- * Note: In the next version of Gtk2Hs this system will be the default --- so it will not be necessary to explicitly import this module in future. +-- * Note: From this version of Gtk2Hs this system will be the default +-- so it will not be necessary to explicitly import this module. hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 41 - module Graphics.UI.Gtk.ModelView.ComboBox, - module Graphics.UI.Gtk.ModelView.ComboBoxEntry, + module Graphics.UI.Gtk.MenuComboToolbar.ComboBox, + module Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry, hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 44 - module Graphics.UI.Gtk.ModelView.EntryCompletion, + module Graphics.UI.Gtk.Entry.EntryCompletion, hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 66 -import Graphics.UI.Gtk.ModelView.ComboBox -import Graphics.UI.Gtk.ModelView.ComboBoxEntry +import Graphics.UI.Gtk.MenuComboToolbar.ComboBox -- these moved back to MenuComboToolbar +import Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 69 -import Graphics.UI.Gtk.ModelView.EntryCompletion +import Graphics.UI.Gtk.Entry.EntryCompletion -- this moved back to Entry hunk ./gtk/Graphics/UI/Gtk/ModelView/ComboBox.chs.pp 1 --- -*-haskell-*- --- GIMP Toolkit (GTK) Widget ComboBox --- --- Author : Duncan Coutts --- --- Created: 25 April 2004 --- --- Copyright (C) 2004-2007 Duncan Coutts, 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 : gtk...@li... --- Stability : provisional --- Portability : portable (depends on GHC) --- --- A widget used to choose from a list of items. --- --- * Module available since Gtk+ version 2.4 --- -module Graphics.UI.Gtk.ModelView.ComboBox ( - --- * Detail --- --- | A 'ComboBox' is a widget that allows the user to choose from a list of --- valid choices. The 'ComboBox' displays the selected choice. When activated, --- the 'ComboBox' displays a popup which allows the user to make a new choice. --- The style in which the selected value is displayed, and the style of the --- popup is determined by the current theme. It may be similar to a --- 'OptionMenu', or similar to a Windows-style combo box. --- --- Unlike its predecessors 'Combo' and 'OptionMenu', the 'ComboBox' uses the --- model-view pattern; the list of valid choices is specified in the form of a --- tree model, and the display of the choices can be adapted to the data in --- the model by using cell renderers, as you would in a tree view. This is --- possible since 'ComboBox' implements the 'CellLayout' interface. The tree --- model holding the valid choices is not restricted to a flat list, it can be --- a real tree, and the popup will reflect the tree structure. --- --- In addition to the general model-view API, 'ComboBox' offers the function --- 'comboBoxNewText' which creates a text-only combo box. - --- * Class Hierarchy --- --- | --- @ --- | 'GObject' --- | +----'Object' --- | +----'Widget' --- | +----'Container' --- | +----'Bin' --- | +----ComboBox --- | +----'ComboBoxEntry' --- @ - -#if GTK_CHECK_VERSION(2,4,0) --- * Types - ComboBox, - ComboBoxClass, - castToComboBox, - toComboBox, - --- * Constructors - comboBoxNew, - comboBoxNewText, - comboBoxNewWithModel, - --- * Methods -#if GTK_CHECK_VERSION(2,6,0) - comboBoxGetWrapWidth, -#endif - comboBoxSetWrapWidth, -#if GTK_CHECK_VERSION(2,6,0) - comboBoxGetRowSpanColumn, -#endif - comboBoxSetRowSpanColumn, -#if GTK_CHECK_VERSION(2,6,0) - comboBoxGetColumnSpanColumn, -#endif - comboBoxSetColumnSpanColumn, - comboBoxGetActive, - comboBoxSetActive, - comboBoxGetActiveIter, - comboBoxSetActiveIter, - comboBoxGetModel, - comboBoxSetModel, - comboBoxPopup, - comboBoxPopdown, -#if GTK_CHECK_VERSION(2,6,0) - comboBoxSetRowSeparatorSource, - comboBoxSetAddTearoffs, - comboBoxGetAddTearoffs, -#if GTK_CHECK_VERSION(2,10,0) - comboBoxSetTitle, - comboBoxGetTitle, -#endif - comboBoxSetFocusOnClick, - comboBoxGetFocusOnClick, -#endif - --- * Attributes - comboBoxModel, - comboBoxWrapWidth, -#if GTK_CHECK_VERSION(2,6,0) - comboBoxRowSpanColumn, - comboBoxColumnSpanColumn, -#endif - comboBoxActive, -#if GTK_CHECK_VERSION(2,6,0) - comboBoxAddTearoffs, - comboBoxHasFrame, - comboBoxFocusOnClick, -#if GTK_CHECK_VERSION(2,10,0) - comboBoxTearoffTitle, - comboBoxPopupShown, - comboBoxTitle, -#endif -#endif - --- * Signals - changed, - popupShownNotify, - [_$_] --- * Deprecated -#ifndef DISABLE_DEPRECATED - onChanged, - afterChanged, -#endif -#endif - ) 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 System.Glib.GObject (makeNewGObject, - mkFunPtrDestroyNotify) -{#import Graphics.UI.Gtk.Types#} hiding (ListStore) -{#import Graphics.UI.Gtk.ModelView.Types#} (TypedTreeModelClass, - TreeIter, - receiveTreeIter) -{#import Graphics.UI.Gtk.Signals#} -{#import Graphics.UI.Gtk.ModelView.CustomStore#} [_$_] -import Graphics.UI.Gtk.ModelView.ListStore ( ListStore, listStoreNew ) -import Graphics.UI.Gtk.ModelView.CellLayout ( cellLayoutSetAttributes, - cellLayoutPackStart ) -import Graphics.UI.Gtk.ModelView.CellRendererText ( cellRendererTextNew, [_$_] - cellText) -{# context lib="gtk" prefix="gtk" #} - -#if GTK_CHECK_VERSION(2,4,0) --------------------- --- Constructors - --- | Creates a new empty 'ComboBox'. --- -comboBoxNew :: IO ComboBox -comboBoxNew = - makeNewObject mkComboBox $ - liftM (castPtr :: Ptr Widget -> Ptr ComboBox) $ - {# call gtk_combo_box_new #} - --- | Convenience function which constructs a new text combo box, which is a --- 'ComboBox' just displaying strings. If you use this function to create a --- text combo box, you can supply the @id@ function as first argument. In this --- case 'comboBoxNewText' will return a @'Graphics.UI.Gtk.ModelView.ListStore' --- String@ containing the initial list of strings. --- -comboBoxNewText :: - (a -> String) -- ^ a function to extract elements from a the store - -> [a] -- ^ the initial contents of the store - -> IO (ComboBox, ListStore a) -- the resulting combo box and the store -comboBoxNewText extract initial = do - store <- listStoreNew initial - combo <- comboBoxNewWithModel store - ren <- cellRendererTextNew - cellLayoutPackStart combo ren True - cellLayoutSetAttributes combo ren store (\a -> [cellText := extract a]) - return (combo, store) - --- %hash c:2570 --- | Creates a new 'ComboBox' with the model initialized to @model@. --- -comboBoxNewWithModel :: TreeModelClass model => - model -- ^ @model@ - A 'TreeModel'. - -> IO ComboBox -comboBoxNewWithModel model = - makeNewObject mkComboBox $ - liftM (castPtr :: Ptr Widget -> Ptr ComboBox) $ - {# call gtk_combo_box_new_with_model #} - (toTreeModel model) - --------------------- --- Methods - -#if GTK_CHECK_VERSION(2,6,0) --- %hash d:566e --- | Returns the wrap width which is used to determine the number of columns --- for the popup menu. If the wrap width is larger than 1, the combo box is in --- table mode. --- --- * Available since Gtk+ version 2.6 --- -comboBoxGetWrapWidth :: ComboBoxClass self => self -> IO Int -comboBoxGetWrapWidth self = - liftM fromIntegral $ - {# call gtk_combo_box_get_wrap_width #} - (toComboBox self) -#endif - --- | Sets the wrap width of the combo box to be @width@. The wrap width is --- basically the preferred number of columns when you want the popup to be --- laid out in a table. --- -comboBoxSetWrapWidth :: ComboBoxClass self => self -> Int -> IO () -comboBoxSetWrapWidth self width = - {# call gtk_combo_box_set_wrap_width #} - (toComboBox self) - (fromIntegral width) - -#if GTK_CHECK_VERSION(2,6,0) --- | Gets the column with row span information for @comboBox@. --- --- * Available since Gtk+ version 2.6 --- -comboBoxGetRowSpanColumn :: ComboBoxClass self => self -> IO (ColumnId row Int) -comboBoxGetRowSpanColumn self = - liftM (makeColumnIdInt . fromIntegral) $ - {# call gtk_combo_box_get_row_span_column #} - (toComboBox self) -#endif - --- %hash d:f80b --- | Sets the column with row span information for @comboBox@ to be @rowSpan@. --- The row span column contains integers which indicate how many rows an item --- should span. --- -comboBoxSetRowSpanColumn :: ComboBoxClass self => self -> ColumnId row Int -> IO () -comboBoxSetRowSpanColumn self rowSpan = - {# call gtk_combo_box_set_row_span_column #} - (toComboBox self) - ((fromIntegral . columnIdToNumber) rowSpan) - -#if GTK_CHECK_VERSION(2,6,0) --- | Gets the source of the column span information for the combo box. --- --- * Available since Gtk+ version 2.6 --- -comboBoxGetColumnSpanColumn :: ComboBoxClass self => self -> IO (ColumnId row Int) -comboBoxGetColumnSpanColumn self = - liftM (makeColumnIdInt . fromIntegral) $ - {# call gtk_combo_box_get_column_span_column #} - (toComboBox self) -#endif - --- %hash d:4303 --- | Sets the source of the column span information for the combo box. The --- column span source contains integers which indicate how many columns an --- item should span. --- -comboBoxSetColumnSpanColumn :: ComboBoxClass self => self -> ColumnId row Int -> IO () -comboBoxSetColumnSpanColumn self columnSpan = - {# call gtk_combo_box_set_column_span_column #} - (toComboBox self) - ((fromIntegral . columnIdToNumber) columnSpan) - --- %hash c:e719 d:e6a --- | Returns the index of the currently active item, or -1 if there's no --- active item. If the model is a non-flat treemodel, and the active item is --- not an immediate child of the root of the tree, this function returns --- @'treePathGetIndices' path !! 0@, where @path@ is the 'TreePath' of the --- active item. --- -comboBoxGetActive :: ComboBoxClass self => self - -> IO Int -- ^ returns An integer which is the index of the currently active - -- item, or -1 if there's no active item. -comboBoxGetActive self = - liftM fromIntegral $ - {# call gtk_combo_box_get_active #} - (toComboBox self) - --- %hash c:3572 d:fbed --- | Sets the active item of @comboBox@ to be the item at @index@. --- -comboBoxSetActive :: ComboBoxClass self => self - -> Int -- ^ @index@ - An index in the model passed during construction, or -1 - -- to have no active item. - -> IO () -comboBoxSetActive self index = - {# call gtk_combo_box_set_active #} - (toComboBox self) - (fromIntegral index) - --- %hash c:744a d:e897 --- | Returns a 'TreeIter' that points to the current active item, if it --- exists, or @Nothing@ if there is no current active item. --- -comboBoxGetActiveIter :: ComboBoxClass self => self -> IO (Maybe TreeIter) -comboBoxGetActiveIter self = - receiveTreeIter $ \iterPtr -> - {# call gtk_combo_box_get_active_iter #} - (toComboBox self) - iterPtr - --- %hash c:9a70 --- | Sets the current active item to be the one referenced by @iter@. @iter@ --- must correspond to a path of depth one. --- -comboBoxSetActiveIter :: ComboBoxClass self => self - -> TreeIter -- ^ @iter@ - The 'TreeIter'. - -> IO () -comboBoxSetActiveIter self iter = - with iter $ \iterPtr -> - {# call gtk_combo_box_set_active_iter #} - (toComboBox self) - iterPtr - --- %hash c:2460 --- | Returns the 'TreeModel' which is acting as data source for @comboBox@. --- -comboBoxGetModel :: ComboBoxClass self - => self - -> IO (Maybe TreeModel) -- ^ returns A 'TreeModel' which was passed during - -- construction. -comboBoxGetModel self = - maybeNull (makeNewGObject mkTreeModel) $ - {# call unsafe gtk_combo_box_get_model #} - (toComboBox self) - --- %hash c:f5d0 --- | Sets the model used by @comboBox@ to be @model@. Will unset a previously --- set model (if applicable). If model is @Nothing@, then it will unset the --- model. --- --- Note that this function does not clear the cell renderers, you have to call --- 'comboBoxCellLayoutClear' yourself if you need to set up different cell --- renderers for the new model. --- -comboBoxSetModel :: (ComboBoxClass self, TreeModelClass model) => self -> - Maybe model -> IO () -comboBoxSetModel self model = - {# call gtk_combo_box_set_model #} - (toComboBox self) - (maybe (TreeModel nullForeignPtr) toTreeModel model) - --- | Pops up the menu or dropdown list of the combo box. --- --- This function is mostly intended for use by accessibility technologies; --- applications should have little use for it. --- -comboBoxPopup :: ComboBoxClass self => self -> IO () -comboBoxPopup self = - {# call gtk_combo_box_popup #} - (toComboBox self) - --- %hash c:32a4 d:463e --- | Hides the menu or dropdown list of @comboBox@. --- --- This function is mostly intended for use by accessibility technologies; --- applications should have little use for it. --- -comboBoxPopdown :: ComboBoxClass self => self -> IO () -comboBoxPopdown self = - {# call gtk_combo_box_popdown #} - (toComboBox self) - -#if GTK_CHECK_VERSION(2,6,0) --- %hash c:6fec d:a050 --- | Installs a mapping from the model to a row separator flag, which is used --- to determine whether a row should be drawn as a separator. If the row --- separator mapping is @Nothing@, no separators are drawn. This is the --- default value. --- --- * Available since Gtk+ version 2.6 --- -comboBoxSetRowSeparatorSource :: (ComboBoxClass self, - TreeModelClass (model row), - TypedTreeModelClass model) - => self -- ^ the 'ComboBox' widget - -> Maybe (model row, row -> Bool) - -- ^ The model and a function to extract a Boolean from it. - -> IO () -comboBoxSetRowSeparatorSource self Nothing = - {# call gtk_combo_box_set_row_separator_func #} - (toComboBox self) nullFunPtr nullPtr nullFunPtr -comboBoxSetRowSeparatorSource self (Just (model, extract)) = do - funPtr <- mkRowSeparatorFunc $ \_ iterPtr -> do - iter <- peek iterPtr - value <- treeModelGetRow model iter - return (extract value) - desPtr <- mkFunPtrDestroyNotify funPtr - {# call gtk_combo_box_set_row_separator_func #} - (toComboBox self) funPtr nullPtr desPtr - -{#pointer TreeViewRowSeparatorFunc#} - -foreign import ccall "wrapper" mkRowSeparatorFunc :: - (Ptr TreeModel -> Ptr TreeIter -> IO Bool) -> IO TreeViewRowSeparatorFunc - --- %hash c:5bf8 --- | Sets whether the popup menu should have a tearoff menu item. --- --- * Available since Gtk+ version 2.6 --- -comboBoxSetAddTearoffs :: ComboBoxClass self => self - -> Bool -- ^ @addTearoffs@ - @True@ to add tearoff menu items - -> IO () -comboBoxSetAddTearoffs self addTearoffs = - {# call gtk_combo_box_set_add_tearoffs #} - (toComboBox self) - (fromBool addTearoffs) - --- | Gets the current value of the :add-tearoffs property. --- -comboBoxGetAddTearoffs :: ComboBoxClass self => self -> IO Bool -comboBoxGetAddTearoffs self = - liftM toBool $ - {# call gtk_combo_box_get_add_tearoffs #} - (toComboBox self) - -#if GTK_CHECK_VERSION(2,10,0) --- %hash c:64db d:ecde --- | Sets the menu's title in tearoff mode. --- --- * Available since Gtk+ version 2.10 --- -comboBoxSetTitle :: ComboBoxClass self => self - -> String -- ^ @title@ - a title for the menu in tearoff mode. - -> IO () -comboBoxSetTitle self title = - withUTFString title $ \titlePtr -> - {# call gtk_combo_box_set_title #} - (toComboBox self) - titlePtr - --- %hash c:9f54 d:e396 --- | Gets the current title of the menu in tearoff mode. See --- 'comboBoxSetAddTearoffs'. --- --- * Available since Gtk+ version 2.10 --- -comboBoxGetTitle :: ComboBoxClass self => self - -> IO String -- ^ returns the menu's title in tearoff mode. -comboBoxGetTitle self = - {# call gtk_combo_box_get_title #} - (toComboBox self) - >>= peekUTFString -#endif - --- %hash c:fe18 --- | Sets whether the combo box will grab focus when it is clicked with the --- mouse. Making mouse clicks not grab focus is useful in places like toolbars --- where you don't want the keyboard focus removed from the main area of the --- application. --- --- * Available since Gtk+ version 2.6 --- -comboBoxSetFocusOnClick :: ComboBoxClass self => self - -> Bool -- ^ @focusOnClick@ - whether the combo box grabs focus when clicked - -- with the mouse - -> IO () -comboBoxSetFocusOnClick self focusOnClick = - {# call gtk_combo_box_set_focus_on_click #} - (toComboBox self) - (fromBool focusOnClick) - --- %hash c:9168 --- | Returns whether the combo box grabs focus when it is clicked with the --- mouse. See 'comboBoxSetFocusOnClick'. --- --- * Available since Gtk+ version 2.6 --- -comboBoxGetFocusOnClick :: ComboBoxClass self => self - -> IO Bool -- ^ returns @True@ if the combo box grabs focus when it is - -- clicked with the mouse. -comboBoxGetFocusOnClick self = - liftM toBool $ - {# call gtk_combo_box_get_focus_on_click #} - (toComboBox self) -#else -foreign import ccall "wrapper" dummyForStub :: (CInt -> IO ()) -> IO (FunPtr (CInt -> IO ())) -#endif - --------------------- --- Attributes - --- %hash c:c23c --- | The model from which the combo box takes the values shown in the list. --- -comboBoxModel :: (ComboBoxClass self, TreeModelClass treeModel) => ReadWriteAttr self TreeModel treeModel -comboBoxModel = newAttrFromObjectProperty "model" - {# call pure unsafe gtk_tree_model_get_type #} - --- %hash c:ea5e --- | If wrap-width is set to a positive value, the list will be displayed in --- multiple columns, the number of columns is determined by wrap-width. --- --- Allowed values: >= 0 --- --- Default value: 0 --- -comboBoxWrapWidth :: ComboBoxClass self => Attr self Int -comboBoxWrapWidth = newAttrFromIntProperty "wrap-width" - -#if GTK_CHECK_VERSION(2,6,0) --- %hash c:a445 --- | The values of that column are used to determine how many rows a value in --- the list will span. Therefore, the values in the model column pointed to by --- this property must be greater than zero and not larger than wrap-width. --- --- Default value: 'invalidColumnId' --- --- * Available since Gtk+ version 2.6 --- -co... [truncated message content] |