You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(68) |
Aug
(4) |
Sep
|
Oct
(23) |
Nov
(95) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(3) |
Feb
|
Mar
|
Apr
(51) |
May
(81) |
Jun
(2) |
Jul
(86) |
Aug
(143) |
Sep
(3) |
Oct
(31) |
Nov
(63) |
Dec
(90) |
2005 |
Jan
(277) |
Feb
(157) |
Mar
(99) |
Apr
(195) |
May
(151) |
Jun
(148) |
Jul
(98) |
Aug
(123) |
Sep
(20) |
Oct
(174) |
Nov
(155) |
Dec
(26) |
2006 |
Jan
(51) |
Feb
(19) |
Mar
(16) |
Apr
(12) |
May
(5) |
Jun
|
Jul
(11) |
Aug
(7) |
Sep
(10) |
Oct
(31) |
Nov
(174) |
Dec
(56) |
2007 |
Jan
(45) |
Feb
(52) |
Mar
(10) |
Apr
(5) |
May
(47) |
Jun
(16) |
Jul
(80) |
Aug
(29) |
Sep
(14) |
Oct
(59) |
Nov
(46) |
Dec
(16) |
2008 |
Jan
(10) |
Feb
(1) |
Mar
|
Apr
|
May
(49) |
Jun
(26) |
Jul
(8) |
Aug
(4) |
Sep
(25) |
Oct
(53) |
Nov
(9) |
Dec
(1) |
2009 |
Jan
(66) |
Feb
(11) |
Mar
(1) |
Apr
(14) |
May
(8) |
Jun
(1) |
Jul
(2) |
Aug
(2) |
Sep
(9) |
Oct
(23) |
Nov
(35) |
Dec
|
2010 |
Jan
(7) |
Feb
(2) |
Mar
(39) |
Apr
(19) |
May
(161) |
Jun
(19) |
Jul
(32) |
Aug
(65) |
Sep
(113) |
Oct
(120) |
Nov
(2) |
Dec
|
2012 |
Jan
|
Feb
(5) |
Mar
(4) |
Apr
(7) |
May
(9) |
Jun
(14) |
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(12) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(17) |
Mar
(4) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(8) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Axel S. <si...@co...> - 2008-09-15 21:27:43
|
Sat Sep 13 16:52:46 EDT 2008 A....@ke... * Fix demo with respect to some recent name changes and export changes. hunk ./demo/treeList/ListDND.hs 53 - compTypeTag <- tagNew "_CompType" + compTypeTag <- atomNew "_CompType" hunk ./demo/treeList/ListDND.hs 117 - t <- selectionDataGetTarget - l <- selectionDataGetLength |
From: Axel S. <si...@co...> - 2008-09-07 12:31:45
|
Sun Sep 7 08:30:21 EDT 2008 A....@ke... * Rename the toggle signal in CellRendererToggle since it clashed with ToggleButton. hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 66 - toggled, + cellToggled, hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 70 - onToggled, - afterToggled + onCellToggled, + afterCellToggled hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 208 --- | The 'toggled' signal is emitted when the cell is toggled. +-- | The 'cellToggled' signal is emitted when the cell is toggled. hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 210 -toggled :: CellRendererToggleClass self => Signal self (String -> IO ()) -toggled = Signal (connect_STRING__NONE "toggled") +cellToggled :: CellRendererToggleClass self => Signal self (String -> IO ()) +cellToggled = Signal (connect_STRING__NONE "toggled") hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 218 -onToggled :: CellRendererToggleClass self => self +onCellToggled :: CellRendererToggleClass self => self hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 221 -onToggled = connect_STRING__NONE "toggled" False -{-# DEPRECATED onToggled "instead of 'onToggled obj' use 'on obj toggled'" #-} +onCellToggled = connect_STRING__NONE "toggled" False +{-# DEPRECATED onCellToggled "instead of 'onCellToggled obj' use 'on obj cellToggled'" #-} hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 225 -afterToggled :: CellRendererToggleClass self => self +afterCellToggled :: CellRendererToggleClass self => self hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererToggle.chs.pp 228 -afterToggled = connect_STRING__NONE "toggled" True -{-# DEPRECATED afterToggled "instead of 'afterToggled obj' use 'after obj toggled'" #-} +afterCellToggled = connect_STRING__NONE "toggled" True +{-# DEPRECATED afterCellToggled "instead of 'afterCellToggled obj' use 'after obj cellToggled'" #-} |
From: Axel S. <si...@co...> - 2008-09-07 12:31:43
|
Sun Sep 7 08:29:38 EDT 2008 A....@ke... * Fix the names of the color attributes. hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 178 -cellTextBackground = writeAttrFromStringProperty "cell-background" +cellTextBackground = writeAttrFromStringProperty "background" hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 183 -cellTextBackgroundColor = newAttrFromBoxedStorableProperty "cell-background-gdk" +cellTextBackgroundColor = newAttrFromBoxedStorableProperty "background-gdk" hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 191 -cellTextBackgroundSet = newAttrFromBoolProperty "cell-background-set" +cellTextBackgroundSet = newAttrFromBoolProperty "background-set" hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 251 -cellTextForeground = writeAttrFromStringProperty "cell-foreground" +cellTextForeground = writeAttrFromStringProperty "foreground" hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 256 -cellTextForegroundColor = newAttrFromBoxedStorableProperty "cell-foreground-gdk" +cellTextForegroundColor = newAttrFromBoxedStorableProperty "foreground-gdk" hunk ./gtk/Graphics/UI/Gtk/ModelView/CellRendererText.chs.pp 264 -cellTextForegroundSet = newAttrFromBoolProperty "cell-foreground-set" +cellTextForegroundSet = newAttrFromBoolProperty "foreground-set" |
From: Axel S. <si...@co...> - 2008-09-07 12:31:43
|
Sun Sep 7 08:23:59 EDT 2008 A....@ke... * Add the matchSelected signal to EntryCompletion. Using this signal and using the CellLayout functions to connect to a model is broken in Gtk+, see http://bugzilla.gnome.org/show_bug.cgi?id=551202 hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 48 --- model, but this can be overridden by connecting to the ::match-selected +-- model, but this can be overridden by connecting to the 'matchSelected' hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 59 --- selected, the ::action-activated signal is emitted. +-- selected, the 'completionActionActivated' signal is emitted. hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 82 + entryCompletionSetTextModel, hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 121 + insertPrefix, +#endif + completionActionActivated, + matchSelected, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED +#if GTK_CHECK_VERSION(2,6,0) hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 135 +#endif hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 148 -{#import Graphics.UI.Gtk.ModelView.Types#} (TreeIter) +{#import Graphics.UI.Gtk.ModelView.Types#} (TreeIter, peekTreeIter, + TypedTreeModelClass) hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 152 - columnIdToNumber) + columnIdToNumber, + treeModelSetColumn) hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 203 +-- | Convenience function for setting up the most used case of this code: a +-- completion list with just strings. This function will set up @completion@ to +-- have a list displaying all (and just) strings in the completion list, and to +-- get those strings from @model@. This functions creates and adds a [_$_] +-- 'CellRendererText' which retrieves its content from the given model. +-- +entryCompletionSetTextModel :: (TreeModelClass (model String), + TypedTreeModelClass model) + => EntryCompletion -- ^ @completion@ + -> model String -- ^ the model containing 'String's + -> IO () +entryCompletionSetTextModel self model = do + let strCol = makeColumnIdString 0 + treeModelSetColumn model strCol id + set self [entryCompletionTextColumn := strCol] + hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 225 --- completion for key. Note that key is normalized and case-folded. +-- completion for key. Note that the key is normalized and case-folded. hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 549 +#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:f4eb d:9ccf +-- | Gets emitted when the inline autocompletion is triggered. The default +-- behaviour is to make the entry display the whole prefix and select the newly +-- inserted part. +-- +-- Applications may connect to this signal in order to insert only a smaller +-- part of the @prefix@ into the entry - e.g. the entry used in the +-- 'FileChooser' inserts only the part of the prefix up to the next \'\/\'. +-- +-- * Available since Gtk+ version 2.6 +-- +insertPrefix :: EntryCompletionClass self => Signal self (String -> IO Bool) +insertPrefix = Signal (connect_STRING__BOOL "insert_prefix") +#endif + +-- %hash c:d50e d:ad7e +-- | Gets emitted when a match from the list is selected. The default +-- behaviour is to replace the contents of the entry with the contents of the +-- text column in the row pointed to by @iter@. +-- +matchSelected :: EntryCompletionClass self => Signal self (TreeModel -> TreeIter -> IO Bool) +matchSelected = Signal (connect_OBJECT_BOXED__BOOL "match_selected" peekTreeIter) hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 573 +-- %hash c:21ac d:2cbc +-- | Gets emitted when an action is activated. +-- +completionActionActivated :: EntryCompletionClass self => Signal self (Int -> IO ()) +completionActionActivated = Signal (connect_INT__NONE "action_activated") + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 604 +#endif hunk ./tools/callbackGen/gtkmarshal.list 35 -#BOOLEAN:OBJECT,BOXED +BOOLEAN:OBJECT,BOXED |
From: Axel S. <si...@co...> - 2008-09-07 12:31:42
|
Sun Sep 7 08:26:16 EDT 2008 A....@ke... * Forgot to link the stub file for Clipboard. hunk ./Makefile.am 635 + gtk/Graphics/UI/Gtk/General/Clipboard_stub.o \ |
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] |
From: Axel S. <si...@co...> - 2008-09-06 18:54:17
|
Sat Sep 6 14:53:42 EDT 2008 A....@ke... * Remove name of previous author since the whole content has changed. hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 4 --- Author : Juergen Nicklisch Axel Simon +-- Author : Axel Simon hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 20 --- I remove all definitions for the clipboard by Juergen Nicklisch since +-- I removed all definitions for the clipboard by Juergen Nicklisch since |
From: Axel S. <si...@co...> - 2008-09-06 18:50:27
|
Sat Sep 6 14:41:26 EDT 2008 A....@ke... * Add Clipboard functionality. This patch replaces the two definitions that have been in the Clipboard module. I didn't bind the functions that wait for the clipboard data to arrive since it should be easy enough to use callback functions in Haskell. hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 2 --- GIMP Toolkit (GTK) Clipboard support +-- GIMP Toolkit (GTK) Clipboard hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 4 --- Author : Juergen Nicklisch +-- Author : Juergen Nicklisch Axel Simon hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 8 --- Copyright (C) 2007 Juergen Nicklisch +-- Copyright (C) 2007 Axel Simon hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 20 --- functions that seem to be internal: gtk_selection_convert --- functions that relate to target tables are not bound since they seem --- superfluous: targets_*, selection_data_copy, selection_data_free +-- I remove all definitions for the clipboard by Juergen Nicklisch since +-- the way the clipboards were selected didn't tie in with the Selection +-- module. hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 29 --- Functions for the Clipboard. +-- Storing data on clipboards hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 33 -#if GTK_CHECK_VERSION(2,2,0) +-- * Detail +-- +-- | The 'Clipboard' object represents a clipboard of data shared between +-- different processes or between different widgets in the same process. Each +-- clipboard is identified by a 'SelectionTag' which itself is an 'Atom'. The +-- default clipboard corresponds to the 'selectionClipboard' tag; another +-- commonly used clipboard is the 'selectionPrimary' tag, which, in X, +-- traditionally contains the currently selected text. +-- +-- To support having a number of different formats on the clipboard at the +-- same time, the clipboard mechanism allows providing callbacks instead of +-- the actual data. When you set the contents of the clipboard, you can either +-- supply the data directly (via functions like 'clipboardSetText'), or you +-- can supply a callback to be called at a later time when the data is needed +-- (via 'clipboardSetWithData'). Providing a callback also avoids having to +-- make copies of the data when it is not needed. +-- +-- Setting clipboard data is done using 'clipboardSetWithData' and +-- 'clipboardSetWithOwner'. Both functions are quite similar; the choice +-- between the two depends mostly on which is more convenient in a particular +-- situation. The former is most useful when you want to have a blob of data +-- with callbacks to convert it into the various data types that you +-- advertise. When the @clearFunc@ you provided is called, you simply free the +-- data blob. The latter is more useful when the contents of clipboard reflect +-- the internal state of a 'GObject' (As an example, for the +-- 'selectionPrimary' clipboard, when an entry widget provides the clipboard's +-- contents the contents are simply the text within the selected region.) If +-- the contents change, the entry widget can call 'clipboardSetWithOwner' to +-- update the timestamp for clipboard ownership, without having to worry about +-- @clearFunc@ being called. +-- +-- Requesting the data from the clipboard is essentially asynchronous. If the +-- contents of the clipboard are provided within the same process, then a +-- direct function call will be made to retrieve the data, but if they are +-- provided by another process, then the data needs to be retrieved from the +-- other process, which may take some time. To avoid blocking the user +-- interface, the call to request the selection, 'clipboardRequestContents' +-- takes a callback that will be called when the contents are received (or +-- when the request fails.) If you don't want to deal with providing a +-- separate callback, you can also use 'clipboardWaitForContents'. What this +-- does is run the GLib main loop recursively waiting for the contents. This +-- can simplify the code flow, but you still have to be aware that other +-- callbacks in your program can be called while this recursive mainloop is +-- running. +-- +-- Along with the functions to get the clipboard contents as an arbitrary data +-- chunk, there are also functions to retrieve it as text, +-- 'clipboardRequestText' and 'clipboardWaitForText'. These functions take +-- care of determining which formats are advertised by the clipboard provider, +-- asking for the clipboard in the best available format and converting the +-- its content. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----Clipboard +-- @ + hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 94 -ClipboardType(..), - [_$_] + Clipboard, + ClipboardClass, + castToClipboard, + toClipboard, + +-- * Constants + selectionPrimary, + selectionSecondary, + selectionClipboard, + hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 105 -clipboardGet + clipboardGet, +#if GTK_CHECK_VERSION(2,2,0) + clipboardGetForDisplay, + clipboardGetDisplay, +#endif + clipboardSetWithData, + clipboardSetWithOwner, + clipboardGetOwner, + clipboardClear, + clipboardSetText, +#if GTK_CHECK_VERSION(2,6,0) + clipboardSetImage, +#endif + clipboardRequestContents, + clipboardRequestText, +#if GTK_CHECK_VERSION(2,6,0) + clipboardRequestImage, +#endif +#if GTK_CHECK_VERSION(2,4,0) + clipboardRequestTargets, +#if GTK_CHECK_VERSION(2,10,0) + clipboardRequestRichText, +#endif +#endif +#if GTK_CHECK_VERSION(2,6,0) + clipboardSetCanStore, + clipboardStore, hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 136 -import System.Glib.Flags (fromFlags) -import System.Glib.Signals -import System.Glib.GObject -{#import Graphics.UI.Gtk.Types#} [_$_] -{#import Graphics.UI.Gtk.General.DNDTypes#} +import System.Glib.UTFString +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.General.DNDTypes#} (SelectionTag, TargetTag, + atomNew, Atom(..)) +{#import Graphics.UI.Gtk.General.Selection#} (InfoId, SelectionDataM) +import Graphics.UI.Gtk.General.Structs ( + selectionPrimary, + selectionSecondary, + selectionClipboard, + withTargetEntries) +import Control.Monad ( liftM ) +import Control.Monad.Trans ( liftIO ) +import Control.Monad.Reader (runReaderT, ask) +import Data.IORef ( newIORef, readIORef, writeIORef ) hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 153 -#if GTK_CHECK_VERSION(2,2,0) + hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 155 --- Types +-- Methods + +-- %hash c:d8d1 d:febf +-- | Returns the clipboard object for the given selection. See +-- 'clipboardGetForDisplay' for complete details. +-- +clipboardGet :: + SelectionTag -- ^ @selection@ - a 'SelectionTag' which + -- identifies the clipboard to use. + -> IO Clipboard -- ^ returns the appropriate clipboard object. If no + -- clipboard already exists, a new one will be created. Once a + -- clipboard object has been created, it is persistent. +clipboardGet (Atom selection) = + makeNewGObject mkClipboard $ + {# call gtk_clipboard_get #} selection hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 171 --- | Use ClipClipboard for the Windows-style cut/copy/paste menu items; --- use ClipPrimary for the currently-selected text, even if it isn't --- explicitly copied, and for middle-mouse-click (Netscape, Mozilla, --- XEmacs, some GTK+ apps) +#if GTK_CHECK_VERSION(2,2,0) +-- %hash c:251 d:39fa +-- | Returns the clipboard object for the given selection. Cut\/copy\/paste +-- menu items and keyboard shortcuts should use the default clipboard, +-- returned by passing 'selectionClipboard' for @selection@. The +-- currently-selected object or text should be provided on the clipboard +-- identified by 'selectionPrimary'. Cut\/copy\/paste menu items conceptually +-- copy the contents of the 'selectionPrimary' clipboard to the default +-- clipboard, i.e. they copy the selection to what the user sees as the +-- clipboard. +-- +-- See +-- <http://www.freedesktop.org/Standards/clipboards-spec> for a detailed +-- discussion of the 'selectionClipboard' vs. 'selectionPrimary' selections +-- under the X window system. On Win32 the 'selectionPrimary' clipboard is +-- essentially ignored. +-- +-- It's possible to have arbitrary named clipboards; if you do invent new +-- clipboards, you should prefix the selection name with an underscore +-- (because the ICCCM requires that nonstandard atoms are +-- underscore-prefixed), and namespace it as well. For example, if your +-- application called \"Foo\" has a special-purpose clipboard, you could +-- create it using 'Graphics.UI.Gtk.General.Selection.atomNew' +-- \"_FOO_SPECIAL_CLIPBOARD\". +-- +-- * Available since Gtk+ version 2.2 +-- +clipboardGetForDisplay :: + Display -- ^ @display@ - the display for which the clipboard is to be + -- retrieved or created + -> SelectionTag -- ^ @selection@ - a 'SelectionTag' which + -- identifies the clipboard to use. + -> IO Clipboard -- ^ returns the appropriate clipboard object. If no + -- clipboard already exists, a new one will be created. Once a + -- clipboard object has been created, it is persistent. +clipboardGetForDisplay display (Atom selection) = + makeNewGObject mkClipboard $ + {# call gtk_clipboard_get_for_display #} + display selection hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 211 -data ClipboardType = ClipClipboard - | ClipPrimary - deriving (Eq,Show) +-- %hash c:3931 d:93f1 +-- | Gets the 'Display' associated with @clipboard@ +-- +-- * Available since Gtk+ version 2.2 +-- +clipboardGetDisplay :: ClipboardClass self => self + -> IO Display -- ^ returns the 'Display' associated with @clipboard@ +clipboardGetDisplay self = + makeNewGObject mkDisplay $ + {# call gtk_clipboard_get_display #} + (toClipboard self) +#endif + +-- %hash c:c65a d:b402 +-- | Virtually sets the contents of the specified clipboard by providing a +-- list of supported formats for the clipboard data and a function to call to +-- get the actual data when it is requested. +-- +clipboardSetWithData :: ClipboardClass self => self + -> [(TargetTag, InfoId)] -- ^ @targets@ - a list containing information + -- about the available forms for the clipboard + -- data + -> (InfoId -> SelectionDataM ()) + -- ^ @getFunc@ - function to call to get the + -- actual clipboard data, should call + -- 'Graphics.UI.Gtk.General.Selection.selectionDataSet'. + -> IO () -- ^ @clearFunc@ - when the clipboard contents + -- are set again, this function will be called, + -- and @getFunc@ will not be subsequently called. + -> IO Bool -- ^ returns @True@ if setting the clipboard + -- data succeeded. If setting the clipboard data + -- failed the provided callback functions will be + -- ignored. +clipboardSetWithData self targets getFunc clearFunc = do + gFunPtr <- mkClipboardGetFunc + (\_ sPtr info -> runReaderT (getFunc info) sPtr >> return ()) + dFunPtr <- mkFunPtrClearFunc clearFunc gFunPtr + withTargetEntries targets $ \nTargets targets -> + liftM toBool $ + {# call gtk_clipboard_set_with_data #} + (toClipboard self) + targets + (fromIntegral nTargets) + gFunPtr + dFunPtr + nullPtr + +{#pointer ClipboardGetFunc#} + +foreign import ccall "wrapper" mkClipboardGetFunc :: + (Ptr Clipboard -> Ptr () -> {#type guint#} -> IO ()) -> IO ClipboardGetFunc + +-- For reasons unknown, the two surrounding clipboard functions use a +-- non-standard finaliser. It might be that it is of interest to the user +-- when data is not needed anymore, thus we provide an IO action. Anyway, +-- this function is copy and paste of the mkFunPtrDestroyNotify function +-- in GObject. +mkFunPtrClearFunc :: IO () -> FunPtr a -> + IO (FunPtr (Ptr Clipboard -> Ptr () -> IO ())) +mkFunPtrClearFunc clearFunc hPtr = do + dRef <- newIORef nullFunPtr + dPtr <- mkClearFuncPtr $ do + clearFunc + freeHaskellFunPtr hPtr + dPtr <- readIORef dRef + freeHaskellFunPtr dPtr + writeIORef dRef dPtr + return dPtr + +foreign import ccall "wrapper" mkClearFuncPtr :: IO () -> [_$_] + IO (FunPtr (Ptr Clipboard -> Ptr () -> IO ())) + +-- %hash c:e778 d:7b3f +-- | Virtually sets the contents of the specified clipboard by providing a +-- list of supported formats for the clipboard data and a function to call to +-- get the actual data when it is requested. +-- +-- The difference between this function and 'clipboardSetWithData' is that +-- a 'GObject' is passed in. If this function is called repeatedly with +-- the same 'GObject' then the @clearFunc@ is not called each time. +-- +clipboardSetWithOwner :: (ClipboardClass self, GObjectClass owner) => self + -> [(TargetTag, InfoId)] -- ^ @targets@ - a list containing information + -- about the available forms for the clipboard + -- data + -> (InfoId -> SelectionDataM ()) + -- ^ @getFunc@ - function to call to get the + -- actual clipboard data, should call + -- 'Graphics.UI.Gtk.General.Selection.selectionDataSet'. + -> IO () -- ^ @clearFunc@ - when the clipboard contents + -- are set again, this function will be called, + -- and @getFunc@ will not be subsequently called. + -> owner -- ^ @owner@ - an object that \"owns\" the data. + -> IO Bool -- ^ returns @True@ if setting the clipboard + -- data succeeded. If setting the clipboard data + -- failed the provided callback functions will be + -- ignored. +clipboardSetWithOwner self targets getFunc clearFunc owner = do + gFunPtr <- mkClipboardGetFunc + (\_ sPtr info -> runReaderT (getFunc info) sPtr >> return ()) + dFunPtr <- mkFunPtrClearFunc clearFunc gFunPtr + withTargetEntries targets $ \nTargets targets -> + liftM toBool $ + {# call gtk_clipboard_set_with_owner #} + (toClipboard self) + targets + (fromIntegral nTargets) + gFunPtr + dFunPtr + (toGObject owner) + +-- %hash c:dba2 d:efc2 +-- | If the clipboard contents callbacks were set with +-- 'clipboardSetWithOwner', and the 'clipboardSetWithData' or 'clipboardClear' +-- has not subsequently called, returns the owner set by +-- 'clipboardSetWithOwner'. +-- +clipboardGetOwner :: ClipboardClass self => self + -> IO (Maybe GObject) -- ^ returns the owner of the clipboard, if any; otherwise + -- @Nothing@. +clipboardGetOwner self = + maybeNull (makeNewGObject mkGObject) $ + {# call gtk_clipboard_get_owner #} + (toClipboard self) hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 336 --------------------- --- Methods hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 337 --- | Returns the clipboard object for the given selection. --- Cut/copy/paste menu items and keyboard shortcuts should use the default clipboard, --- returned by passing GDK_SELECTION_CLIPBOARD for selection. --- The currently-selected object or text should be provided on the clipboard --- identified by --GDK_SELECTION_PRIMARY. Cut/copy/paste menu items conceptually --- copy the contents of the GDK_SELECTION_PRIMARY clipboard to the default clipboard, --- i.e. they copy the selection to what the user sees as the clipboard. +-- %hash c:d6f8 d:486 +-- | Clears the contents of the clipboard. Generally this should only be +-- called between the time you call 'clipboardSetWithOwner' or +-- 'clipboardSetWithData', and when the @clearFunc@ you supplied is called. +-- Otherwise, the clipboard may be owned by someone else. hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 343 -clipboardGet :: ClipboardType - -> IO Clipboard -clipboardGet clipboardType = do - makeNewGObject Clipboard $ - {#call gtk_clipboard_get#} - (clipboardTypeToPointer clipboardType) +clipboardClear :: ClipboardClass self => self -> IO () +clipboardClear self = + {# call gtk_clipboard_clear #} + (toClipboard self) hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs.pp 348 -clipboardTypeToPointer :: ClipboardType -> Ptr () -clipboardTypeToPointer ClipClipboard = nullPtr `plusPtr` 1 -clipboardTypeToPointer ClipPrimary = nullPtr `plusPtr` 69 +-- %hash c:5211 d:14c6 +-- | Sets the contents of the clipboard to the given UTF-8 string. Gtk+ will +-- make a copy of the text and take responsibility for responding for requests +-- for the text, and for converting the text into the requested format. +-- +clipboardSetText :: ClipboardClass self => self + -> String -- ^ @text@ - the text to be set as clipboard content + -> IO () +clipboardSetText self text = + withUTFStringLen text $ \(textPtr,len) -> + {# call gtk_clipboard_set_text #} + (toClipboard self) + textPtr + (fromIntegral len) + +#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:5172 d:e4dd +-- | Sets the contents of the clipboard to the given 'Pixbuf'. Gtk+ will take +-- responsibility for responding for requests for the image, and for converting +-- the image into the requested format. +-- +-- * Available since Gtk+ version 2.6 +-- +clipboardSetImage :: ClipboardClass self => self + -> Pixbuf -- ^ @pixbuf@ - a 'Pixbuf' + -> IO () +clipboardSetImage self pixbuf = + {# call gtk_clipboard_set_image #} + (toClipboard self) + pixbuf +#endif + +-- %hash c:22cd d:f72d +-- | Requests the contents of clipboard as the given target. When the results +-- of the result are later received the supplied callback will be called. +-- +clipboardRequestContents :: ClipboardClass self => self + -> TargetTag -- ^ @target@ - an atom representing the form + -- into which the clipboard owner should + -- convert the selection. + -> SelectionDataM () -- ^ @callback@ - A function to call when the + -- results are received (or the retrieval + -- fails). If the retrieval fails, + -- 'Graphics.UI.Gtk.General.Selection.selectionDataIsValid' returns @False@. + -> IO () +clipboardRequestContents self (Atom target) callback = do + cbRef <- newIORef nullFunPtr + cbPtr <- mkClipboardReceivedFunc + (\_ sPtr -> do + cbPtr <- readIORef cbRef + freeHaskellFunPtr cbPtr + runReaderT callback sPtr + return ()) + writeIORef cbRef cbPtr + {# call gtk_clipboard_request_contents #} + (toClipboard self) + target + cbPtr + nullPtr + +{#pointer ClipboardReceivedFunc#} + +foreign import ccall "wrapper" mkClipboardReceivedFunc :: + (Ptr Clipboard -> Ptr () -> IO ()) -> IO ClipboardReceivedFunc + +-- %hash c:7bb1 d:4ef1 +-- | Requests the contents of the clipboard as text. When the text is later +-- received, it will be converted if it is stored in a different character set +-- if necessary, and @callback@ will be called. +-- +-- The @text@ parameter to @callback@ will contain the resulting text if the +-- request succeeded, or @Nothing@ if it failed. This could happen for various reasons, in +-- particular if the clipboard was empty or if the contents of the clipboard +-- could not be converted into text form. +-- +clipboardRequestText :: ClipboardClass self => self + -> (Maybe String -> IO ()) -- ^ @callback@ - a function to call when + -- the text is received, or the retrieval + -- fails. (It will always be called one + -- way or the other.) + -> IO () +clipboardRequestText self callback = do + cbRef <- newIORef nullFunPtr + cbPtr <- mkClipboardTextReceivedFunc + (\_ sPtr -> do + cbPtr <- readIORef cbRef + freeHaskellFunPtr cbPtr + mStr <- if sPtr==nullPtr then return Nothing else + liftM Just $ peekUTFString sPtr + callback mStr) + writeIORef cbRef cbPtr + {# call gtk_clipboard_request_text #} + (toClipboard self) + cbPtr + nullPtr + +{#pointer ClipboardTextReceivedFunc#} + +foreign import ccall "wrapper" mkClipboardTextReceivedFunc :: + (Ptr Clipboard -> CString -> IO ()) -> IO ClipboardTextReceivedFunc + + +#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:3207 d:e3c1 +-- | Requests the contents of the clipboard as image. When the image is later +-- received, it will be converted to a 'Pixbuf', and @callback@ will be called. +-- +-- The @pixbuf@ parameter to @callback@ will contain the resulting 'Pixbuf' +-- if the request succeeded, or @Nothing@ if it failed. This could happen for various +-- reasons, in particular if the clipboard was empty or if the contents of the +-- clipboard could not be converted into an image. +-- +-- * Available since Gtk+ version 2.6 +-- +clipboardRequestImage :: ClipboardClass self => self + -> (Maybe Pixbuf -> IO ()) -- ^ @callback@ - a function to call + -- when the image is received, or the + -- retrieval fails. (It will always be + -- called one way or the other.) + -> IO () +clipboardRequestImage self callback = do + cbRef <- newIORef nullFunPtr + cbPtr <- mkClipboardImageReceivedFunc + (\_ sPtr -> do + cbPtr <- readIORef cbRef + freeHaskellFunPtr cbPtr + mPixbuf <- maybeNull (makeNewGObject mkPixbuf) (return sPtr) + callback mPixbuf) + writeIORef cbRef cbPtr + {# call gtk_clipboard_request_image #} + (toClipboard self) + cbPtr + nullPtr + +{#pointer ClipboardImageReceivedFunc#} + +foreign import ccall "wrapper" mkClipboardImageReceivedFunc :: + (Ptr Clipboard -> Ptr Pixbuf -> IO ()) -> IO ClipboardImageReceivedFunc + +#endif + +#if GTK_CHECK_VERSION(2,4,0) +-- %hash c:63f6 d:c0e1 +-- | Requests the contents of the clipboard as list of supported targets. When +-- the list is later received, @callback@ will be called. +-- +-- The @targets@ parameter to @callback@ will contain the resulting targets +-- if the request succeeded, or @Nothing@ if it failed. +-- +-- * Available since Gtk+ version 2.4 +-- +clipboardRequestTargets :: ClipboardClass self => self + -> (Maybe [TargetTag] -> IO ()) -- ^ @callback@ - a function to call + -- when the targets are received, or + -- the retrieval fails. (It will always + -- be called one way or the other.) + -> IO () +clipboardRequestTargets self callback = do + cbRef <- newIORef nullFunPtr + cbPtr <- mkClipboardTargetsReceivedFunc + (\_ tPtr len -> do + cbPtr <- readIORef cbRef + freeHaskellFunPtr cbPtr + mTargets <- if tPtr==nullPtr then return Nothing else + liftM (Just . map Atom) $ peekArray (fromIntegral len) tPtr + callback mTargets) + writeIORef cbRef cbPtr + {# call gtk_clipboard_request_targets #} + (toClipboard self) + cbPtr + nullPtr + +{#pointer ClipboardTargetsReceivedFunc#} + +foreign import ccall "wrapper" mkClipboardTargetsReceivedFunc :: + (Ptr Clipboard -> Ptr (Ptr ()) -> {#type gint#} -> IO ()) -> IO ClipboardTargetsReceivedFunc + +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:5601 d:d6a6 +-- | Requests the contents of the clipboard as rich text. When the rich text +-- is later received, @callback@ will be called. +-- +-- The @text@ parameter to @callback@ will contain the resulting rich text if +-- the request succeeded, or @Nothing@ if it failed. This function can fail +-- for various reasons, in particular if the clipboard was empty or if the +-- contents of the clipboard could not be converted into rich text form. +-- +-- * Available since Gtk+ version 2.10 +-- +clipboardRequestRichText :: (ClipboardClass self, TextBufferClass buffer) => self + -> buffer -- ^ @buffer@ - a 'TextBuffer' that determines the supported rich text formats + -> (Maybe (TargetTag,String) -> IO ()) -- ^ @callback@ - a function to call + -- when the text is received, or the + -- retrieval fails. (It will always be + -- called one way or the other.) + -> IO () +clipboardRequestRichText self buffer callback = do + cbRef <- newIORef nullFunPtr + cbPtr <- mkClipboardRichTextReceivedFunc + (\_ tPtr sPtr len -> do + cbPtr <- readIORef cbRef + freeHaskellFunPtr cbPtr + mRes <- if sPtr==nullPtr then return Nothing else liftM Just $ do + str <- peekUTFStringLen (sPtr,fromIntegral len) + return (Atom tPtr, str) + callback mRes) + writeIORef cbRef cbPtr + {# call gtk_clipboard_request_rich_text #} + (toClipboard self) + (toTextBuffer buffer) + cbPtr + nullPtr + +{#pointer ClipboardRichTextReceivedFunc#} + +foreign import ccall "wrapper" mkClipboardRichTextReceivedFunc :: + (Ptr Clipboard -> Ptr () -> CString -> {#type gsize#} -> IO ()) -> + IO ClipboardRichTextReceivedFunc +#endif +#endif + +#if GTK_CHECK_VERSION(2,6,0) +-- %hash c:6e6a d:f98a +-- | Hints that the clipboard data should be stored somewhere when the +-- application exits or when 'clipboardStore' is called. +-- +-- This value is reset when the clipboard owner changes. Where the clipboard +-- data is stored is platform dependent, see 'displayStoreClipboard' for more +-- information. +-- +-- * Available since Gtk+ version 2.6 +-- +clipboardSetCanStore :: ClipboardClass self => self + -> Maybe [(TargetTag, InfoId)] -- ^ @targets@ - list containing information + -- about which forms should be stored or + -- @Nothing@ to indicate that all forms + -- should be stored. + -> IO () +clipboardSetCanStore self Nothing = + {# call gtk_clipboard_set_can_store #} + (toClipboard self) + nullPtr + 0 +clipboardSetCanStore self (Just targets) = + withTargetEntries targets $ \nTargets targets -> + {# call gtk_clipboard_set_can_store #} + (toClipboard self) + targets + (fromIntegral nTargets) + +-- %hash c:f98a d:ded8 +-- | Stores the current clipboard data somewhere so that it will stay around +-- after the application has quit. +-- +-- * Available since Gtk+ version 2.6 +-- +clipboardStore :: ClipboardClass self => self -> IO () +clipboardStore self = + {# call gtk_clipboard_store #} + (toClipboard self) hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 91 - selectionDataGetType + selectionDataGetType, + withTargetEntries hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 107 -import Graphics.UI.Gtk.General.DNDTypes (Atom(Atom) , SelectionTag, +import Graphics.UI.Gtk.General.DNDTypes (InfoId, Atom(Atom) , SelectionTag, hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 877 +-- A type that identifies a target. This is needed to marshal arrays of +-- GtkTargetEntries. +data TargetEntry = TargetEntry (Ptr #{type gchar}) InfoId + +-- brain damaged API: the whole selection API doesn't need GtkTargetEntry +-- structure, but stupid Clipboard has two functions that only provide this +-- interface. Thus, convert the efficient Atoms back into strings, have +-- the clipboard functions convert them back to string before we get a +-- chance to free the freshly allocated strings. + +withTargetEntries :: [(TargetTag, InfoId)] -> (Int -> Ptr () -> IO a) -> IO a +withTargetEntries tags fun = do + ptrsInfo <- mapM (\(Atom tag, info) -> gdk_atom_name tag >>= \strPtr -> + return (TargetEntry strPtr info)) tags + let len = length tags + res <- withArrayLen ptrsInfo (\len ptr -> fun len (castPtr ptr)) + mapM_ (\(TargetEntry ptr _) -> g_free ptr) ptrsInfo + return res + +foreign import ccall unsafe "gdk_atom_name" + gdk_atom_name :: Ptr () -> IO (Ptr #{type gchar}) + +foreign import ccall unsafe "g_free" + g_free :: Ptr #{type gchar} -> IO () + +instance Storable TargetEntry where + sizeOf _ = #{const sizeof(GtkTargetEntry)} + alignment _ = alignment (undefined::#type guint32) + peek ptr = undefined + poke ptr (TargetEntry cPtr info) = do + #{poke GtkTargetEntry, target} ptr cPtr + #{poke GtkTargetEntry, flags} ptr (0::#{type guint}) + #{poke GtkTargetEntry, info} ptr info |
From: Axel S. <si...@co...> - 2008-09-06 18:50:26
|
Sat Sep 6 14:44:51 EDT 2008 A....@ke... * Fix a memory management error. hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 523 + dPtr <- mkFunPtrDestroyNotify fPtr hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeView.chs.pp 527 - nullPtr nullFunPtr - freeHaskellFunPtr fPtr + nullPtr dPtr |
From: Axel S. <si...@co...> - 2008-09-06 18:50:25
|
Sat Sep 6 14:40:45 EDT 2008 A....@ke... * Add function to Selection. hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 68 --- selectionOwnerSetForDisplay, + selectionOwnerSetForDisplay, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 73 - selectionDataGetLength, + selectionDataIsValid, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 196 - TargetTag -> InfoId -> IO () + TargetTag -> InfoId -> IO () hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 218 - TimeStamp -> IO Bool + TimeStamp -> IO Bool hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 227 --- [_$_] +-- | Set the ownership of a given selection and display. hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 229 ---selectionOwnerSetForDisplay :: WidgetClass widget => Display -> widget -> {-GdkAtom-} -> Word32 -> IO Bool ---selectionOwnerSetForDisplay display widget selection time = --- liftM toBool $ --- {#call unsafe gtk_selection_owner_set_for_display #} --- display --- (toWidget widget) --- {-selection-} --- (fromIntegral time) +selectionOwnerSetForDisplay :: WidgetClass widget => Display -> Maybe widget -> + SelectionTag -> TimeStamp -> IO Bool +selectionOwnerSetForDisplay display widget (Atom selection) time = + liftM toBool $ + {#call unsafe gtk_selection_owner_set_for_display #} + display + (maybe (mkWidget nullForeignPtr) toWidget widget) + selection + (fromIntegral time) hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 284 +-- | Check if the currently stored data is valid. +-- +-- * If this function returns @False@, no data is set in this selection +-- and 'selectionDataGet' will return @Nothing@ no matter what type +-- is requested. +-- +selectionDataIsValid :: SelectionDataM Bool +selectionDataIsValid = do + len <- selectionDataGetLength + return (len>=0) + [_$_] |
From: Axel S. <si...@co...> - 2008-09-06 18:50:25
|
Sat Sep 6 14:38:54 EDT 2008 A....@ke... * Rename tagNew to atomNew. hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 40 - tagNew, + atomNew, hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 113 -tagNew :: String -> IO Atom -tagNew name = withUTFString name $ \strPtr -> +atomNew :: String -> IO Atom +atomNew name = withUTFString name $ \strPtr -> hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 50 - tagNew, + atomNew, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 64 - TargetTag, tagNew) + TargetTag, atomNew) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 85 -targetTreeModelRow = unsafePerformIO $ tagNew "GTK_TREE_MODEL_ROW" +targetTreeModelRow = unsafePerformIO $ atomNew "GTK_TREE_MODEL_ROW" |
From: Axel S. <si...@co...> - 2008-09-04 21:04:33
|
Thu Sep 4 17:01:58 EDT 2008 A....@ke... * Add ability to toggle ticks in list. hunk ./demo/treeList/ListDemo.hs 5 +import System.Glib.Signals (on) hunk ./demo/treeList/ListDemo.hs 49 + -- update the model when the toggle buttons are activated + on renderer3 New.toggled $ \pathStr -> do + let (i:_) = New.stringToTreePath pathStr + val <- New.listStoreGetValue model i + New.listStoreSetValue model i val { marked = not (marked val) } + |
From: Axel S. <si...@co...> - 2008-09-02 20:08:13
|
Tue Sep 2 16:07:10 EDT 2008 A....@ke... * Export and fix functions for querying display size. hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 77 + screenGetWidthMM, + screenGetHeightMM, hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 301 -screenGetWidthMm :: Screen +screenGetWidthMM :: Screen hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 303 -screenGetWidthMm self = +screenGetWidthMM self = hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 308 +screenGetWidthMm = screenGetWidthMM + hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 313 -screenGetHeightMm :: Screen +screenGetHeightMM :: Screen hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 315 -screenGetHeightMm self = +screenGetHeightMM self = hunk ./gtk/Graphics/UI/Gtk/Gdk/Screen.chs.pp 320 +screenGetHeightMm = screenGetHeightMM |
From: Axel S. <si...@co...> - 2008-09-02 20:08:13
|
Tue Sep 2 16:01:27 EDT 2008 A....@ke... * Repair general DND functionality on lists. This patch not only represents some bug fixes, it also adds a few tags that make the actual use of DND easier. Some functions such as selectionDataGet have changed in order to make them safer. It should be easy now to add Clipboards. What needs to be tested is if all functions are there to implement DND on normal widgets. An example for this would be quite elaborate, hence I have no example yet. hunk ./gtk/Graphics/UI/Gtk/Gdk/Enums.chs.pp 68 --- | Specify the kind of action performed on a drag event. + +-- | Used in 'Graphics.UI.Gtk.Genearl.Drag.DragContext' to indicate what the +-- destination should do with the dropped data. +-- +-- * 'ActionDefault': Initialisation value, should not be used. +-- +-- * 'ActionCopy': Copy the data. +-- +-- * 'ActionMove': Move the data, i.e. first copy it, then delete it from the source. +-- +-- * 'ActionLink': Add a link to the data. Note that this is only useful if source and +-- destination agree on what it means. +-- +-- * 'ActionPrivate': Special action which tells the source that the destination will do +-- something that the source doesn't understand. +-- +-- * 'ActionAsk': Ask the user what to do with the data. +-- hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 24 --- Type declarations for DND and Selections +-- Type declarations for Selections that are used for DND and Clipboards. hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 30 - TargetTag(TargetTag), - SelectionTag(SelectionTag), - PropertyTag(PropertyTag), + TargetTag, + SelectionTag, + SelectionTypeTag, + PropertyTag, + Atom(Atom), hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 40 - targetTagNew, - selectionTagNew, + tagNew, hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 47 -import System.Glib.UTFString ( peekUTFString, withUTFString ) +import System.Glib.UTFString ( readUTFString, withUTFString ) hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 57 --- | A tag that uniquely identifies a target. -newtype TargetTag = TargetTag (Ptr ()) deriving Eq +-- | A tag that uniquely identifies a selection. A selection denotes the +-- exchange mechanism that is being used, for instance, the clipboard is the +-- most common exchange mechanism. For drag and drop applications, a new +-- selection tag is usually created for each different kind of data that is +-- being exchanged. +type SelectionTag = Atom hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 64 -instance Show TargetTag where - show (TargetTag ptr) = atomToString ptr +-- | A tag that uniquely identifies a target. A target describes the format of +-- the underlying data source, for instance, it might be a string. A single +-- selection may support multiple targets: suppose a new target is created for +-- the Haskell data type 'Double'. In this case, the value of the floating +-- point number could also be offered as a string. +type TargetTag = Atom hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 71 --- | A tag that uniquely identifies a selection. -newtype SelectionTag = SelectionTag (Ptr ()) deriving Eq +-- | A tag that defines the encoding of the binary data. For instance, a +-- string might be encoded as UTF-8 or in a different locale. Each encoding +-- would use the same 'TargetTag' but a different 'SelectionTypeTag'. +type SelectionTypeTag = Atom hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 76 -instance Show SelectionTag where - show (SelectionTag ptr) = atomToString ptr - --- | A tag that uniquely identifies a property of a +-- | A tag +-- that uniquely identifies a property of a hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 80 -newtype PropertyTag = PropertyTag (Ptr ()) deriving Eq +type PropertyTag = Atom + +-- | An atom is an index into a global string table. It is possible to +-- associate binary data with each entry. This facility is used for +-- inter-application data exchange such as properties of +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawWindow' (using 'PropertyTag'), +-- 'Graphics.UI.Gtk.Clipboard.Clipboard' or 'Graphics.UI.Gtk.General.Drag' +-- ('SelectionId' and 'TargetId'). +newtype Atom = Atom (Ptr ()) deriving Eq hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 90 -instance Show PropertyTag where - show (PropertyTag ptr) = atomToString ptr +instance Show Atom where + show (Atom ptr) = atomToString ptr hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 95 - str <- peekUTFString strPtr - {#call unsafe g_free#} (castPtr strPtr) - return str + readUTFString strPtr hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 107 --- | Create a new 'TargetTag'. Note that creating two target tags with the --- same name will yield two different tags. The name is merely meant to --- ease application development. --- -targetTagNew :: String -> IO TargetTag -targetTagNew name = withUTFString name $ \strPtr -> - liftM TargetTag $ {#call unsafe gdk_atom_intern#} strPtr 0 - --- | Create a new 'SelectionTag'. Note that creating two selection tags with the --- same name will yield two different tags. The name is merely meant to --- ease application development. +-- | Create a new 'TargetTag', 'SelectionTag', 'SelectionTypeTag' or +-- 'PropertyTag'. Note that creating two target tags with the same name will +-- create the same tag, in particular, the tag will be the same across +-- different applications. Note that the name of an 'Atom' can be printed +-- by 'show' though comparing the atom is merely an integer comparison. hunk ./gtk/Graphics/UI/Gtk/General/DNDTypes.chs 113 -selectionTagNew :: String -> IO SelectionTag -selectionTagNew name = withUTFString name $ \strPtr -> - liftM SelectionTag $ {#call unsafe gdk_atom_intern#} strPtr 0 +tagNew :: String -> IO Atom +tagNew name = withUTFString name $ \strPtr -> + liftM Atom $ {#call unsafe gdk_atom_intern#} strPtr 0 hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 139 +import Graphics.UI.Gtk.Gdk.Enums ( DragAction(..) ) hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 151 --------------------- --- Types - --- | Used in 'DragContext' to indicate what the destination should do with the --- dropped data. --- --- * 'ActionDefault': Initialisation value, should not be used. --- * 'ActionCopy': Copy the data. --- * 'ActionMove': Move the data, i.e. first copy it, then delete it from the source using --- the DELETE target of the X selection protocol. --- * 'ActionLink': Add a link to the data. Note that this is only useful if source and --- destination agree on what it means. --- * 'ActionPrivate': Special action which tells the source that the destination will do --- something that the source doesn't understand. --- * 'ActionAsk': Ask the user what to do with the data. - -{#enum GdkDragAction as DragAction {underscoreToCase} deriving (Bounded, Eq, Show) #} [_$_] - -instance Flags DragAction hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 230 - if ttPtr==nullPtr then return Nothing else return (Just (TargetTag ttPtr)) + if ttPtr==nullPtr then return Nothing else return (Just (Atom ttPtr)) hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 237 - if ttPtr==nullPtr then return Nothing else return (Just (TargetTag ttPtr)) + if ttPtr==nullPtr then return Nothing else return (Just (Atom ttPtr)) hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 327 -dragGetData widget context (TargetTag target) time = +dragGetData widget context (Atom target) time = hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 151 --- * 'DestDefaultMotion': If set for a widget, GTK+, during a drag over this +-- * 'DestDefaultMotion': If set for a widget, GTK+, during a drag over this hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 155 --- * 'DestDefaultHighlight': If set for a widget, GTK+ will draw a +-- +-- * 'DestDefaultHighlight': If set for a widget, GTK+ will draw a hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 159 --- * 'DestDefaultDrop': If set for a widget, when a drop occurs, GTK+ will +-- +-- * 'DestDefaultDrop': If set for a widget, when a drop occurs, GTK+ will hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 167 +-- hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 35 + Atom, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 38 + SelectionTypeTag, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 42 - [_$_] + +-- * Constants + targetString, + selectionTypeAtom, + selectionTypeInteger, + selectionTypeString, + hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 50 - targetTagNew, - selectionTagNew, + tagNew, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 73 + selectionDataGetLength, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 83 + selectionDataGetTarget, + selectionDataSetTarget, + selectionDataGetTargets, hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 106 +import Graphics.UI.Gtk.General.Structs ( + targetString, + selectionTypeAtom, + selectionTypeInteger, + selectionTypeString, + selectionDataGetType) + hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 119 +import Data.Word ( Word32 ) hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 133 -targetListAdd tl (TargetTag tagPtr) flags info = do +targetListAdd tl (Atom tagPtr) flags info = do hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 188 -targetListRemove tl (TargetTag t)= {#call unsafe target_list_remove#} tl t +targetListRemove tl (Atom t)= {#call unsafe target_list_remove#} tl t hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 197 -selectionAddTarget widget (SelectionTag selection) (TargetTag target) info = +selectionAddTarget widget (Atom selection) (Atom target) info = hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 208 -selectionClearTargets widget (SelectionTag selection) = +selectionClearTargets widget (Atom selection) = hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 219 -selectionOwnerSet widget (SelectionTag selection) time = +selectionOwnerSet widget (Atom selection) time = hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 227 --- | +-- [_$_] hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 252 -selectionDataSet :: (Integral a, Storable a) => SelectionTag -> [a] -> +selectionDataSet :: (Integral a, Storable a) => SelectionTypeTag -> [a] -> hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 254 -selectionDataSet (SelectionTag tagPtr) values@(~(v:_)) = ask >>= \selPtr -> +selectionDataSet (Atom tagPtr) values@(~(v:_)) = ask >>= \selPtr -> hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 257 - (castPtr arrayPtr) (fromIntegral arrayLen) + (castPtr arrayPtr) (fromIntegral (arrayLen*sizeOf v)) hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 261 --- the size does not match, @Nothing@ is returned. +-- the size or the type tag does not match, @Nothing@ is returned. hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 263 -selectionDataGet :: (Integral a, Storable a) => SelectionDataM (Maybe [a]) -selectionDataGet = do +selectionDataGet :: (Integral a, Storable a) => [_$_] + SelectionTypeTag -> SelectionDataM (Maybe [a]) +selectionDataGet tagPtr = do hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 268 + typeTag <- selectionDataGetType selPtr + if typeTag/=tagPtr then return Nothing else do hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 271 - lenUnits <- {#get SelectionData -> length#} selPtr + lenBytes <- liftM fromIntegral $ {#get SelectionData -> length#} selPtr hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 273 - if lenUnits<0 || bitSize/=sizeOf (unsafePerformIO (peek dataPtr))*8 + if lenBytes<=0 || bitSize/=sizeOf (unsafePerformIO (peek dataPtr))*8 hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 276 - peekArray (fromIntegral lenUnits) dataPtr - [_$_] + peekArray (fromIntegral (lenBytes `quot` (bitSize `quot` 8))) dataPtr + +selectionDataGetLength :: SelectionDataM Int +selectionDataGetLength = do + selPtr <- ask + liftIO $ liftM fromIntegral $ {#get SelectionData -> length#} selPtr [_$_] + hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 362 +-- | Retrieve the currently set 'TargetTag' in the selection. +selectionDataGetTarget :: SelectionDataM TargetTag +selectionDataGetTarget = do + selPtr <- ask + liftM Atom $ liftIO $ {#get SelectionData -> target#} selPtr + +-- | Set the selection to the given 'TargetTag'. +selectionDataSetTarget :: TargetTag -> SelectionDataM () +selectionDataSetTarget (Atom targetTag) = do + selPtr <- ask + liftIO $ {#set SelectionData -> target#} selPtr targetTag + hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 375 --- | Queries the content type of the selection by extracting the targets that --- the contained data can be converted into. +-- | Queries the content type of the selection data as a list of targets. +-- Whenever the application is asked whether certain targets are acceptable, +-- it is handed a selection that contains a list of 'TargetTag's as payload. +-- A similar result could be achieved using 'selectionDataGet +-- selectionTypeAtom'. hunk ./gtk/Graphics/UI/Gtk/General/Selection.chs.pp 392 - return (map TargetTag targetPtrs) + return (map Atom targetPtrs) hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 82 - treeSortableDefaultSortColumnId + treeSortableDefaultSortColumnId, + tagInvalid, + selectionPrimary, + selectionSecondary, + selectionClipboard, + targetString, + selectionTypeAtom, + selectionTypeInteger, + selectionTypeString, + selectionDataGetType hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 106 - +import Graphics.UI.Gtk.General.DNDTypes (Atom(Atom) , SelectionTag, + TargetTag, SelectionTypeTag) hunk ./gtk/Graphics/UI/Gtk/General/Structs.hsc 830 + +intToAtom :: Int -> Atom +intToAtom = Atom . plusPtr nullPtr + +-- | An invalid 'TargetTag', 'SelectionTag', 'SelectionTypeTag' or 'PropertyTag'. +-- +tagInvalid :: Atom +tagInvalid = intToAtom #{const GDK_NONE} + +-- | The primary selection (the currently highlighted text in X11 that can +-- in many applications be pasted using the middle button). +selectionPrimary :: SelectionTag +selectionPrimary = intToAtom #{const GDK_SELECTION_PRIMARY} + +-- | The secondary selection. Rarely used. +selectionSecondary :: SelectionTag +selectionSecondary = intToAtom #{const GDK_SELECTION_SECONDARY} + +-- | The modern clipboard that is filled by copy or cut commands. +selectionClipboard :: SelectionTag +selectionClipboard = intToAtom #{const GDK_SELECTION_CLIPBOARD} + +-- | If this target is provided by a selection, then the data is a string. +targetString :: TargetTag +targetString = intToAtom #{const GDK_TARGET_STRING} + +-- | The type indicating that the associated data is itself a (list of) +-- 'Graphics.UI.Gtk.General.Selection.Atom's. +selectionTypeAtom :: SelectionTypeTag +selectionTypeAtom = intToAtom #{const GDK_SELECTION_TYPE_ATOM} + +-- | The type indicating that the associated data consists of integers. +selectionTypeInteger :: SelectionTypeTag +selectionTypeInteger = intToAtom #{const GDK_SELECTION_TYPE_INTEGER} + +-- | The type indicating that the associated data is a string without further +-- information on its encoding. +selectionTypeString :: SelectionTypeTag +selectionTypeString = intToAtom #{const GDK_SELECTION_TYPE_STRING} + +-- | Extract the type field of SelectionData*. This should be in the +-- Selection modules but c2hs chokes on the 'type' field. +selectionDataGetType :: Ptr () -> IO SelectionTypeTag +selectionDataGetType selPtr = + liftM intToAtom $ #{peek GtkSelectionData, type} selPtr + hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 47 + module Graphics.UI.Gtk.ModelView.TreeDrag, hunk ./gtk/Graphics/UI/Gtk/ModelView.hs 72 +import Graphics.UI.Gtk.ModelView.TreeDrag hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 34 - + listStoreNewDND, + [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 44 + listStoreGetSize, hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 190 +-- | Query the number of elements in the store. +listStoreGetSize :: ListStore a -> IO Int +listStoreGetSize (ListStore model) = + liftM Seq.length $ readIORef (customTreeModelGetPrivate model) + [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 42 --- * Utility functions +-- * DND information for exchanging a model and a path. hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 44 + targetTreeModelRow, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 46 - treeSetRowDragData - + treeSetRowDragData, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 63 -import Graphics.UI.Gtk.General.DNDTypes (SelectionDataM, SelectionData) +import Graphics.UI.Gtk.General.DNDTypes (SelectionDataM, SelectionData, + TargetTag, tagNew) hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 75 +-- | The 'SelectionTag', 'TargetTag' and 'SelectionTypeTag' of the DND +-- mechanism of 'Graphics.UI.Gtk.ModelView.ListStore' and +-- 'Graphics.UI.Gtk.ModelView.TreeStore'. This tag is used by +-- 'treeGetRowDragData' and 'treeSetRowDragData' to store a store and a +-- 'TreePath' in a 'SelectionDataM'. This target should be added to a +-- 'Graphics.UI.Gtk.General.Selection.TargetList' using +-- 'Graphics.UI.Gtk.General.Seleciton.TargetSameWidget' flag and an +-- 'Graphics.UI.Gtk.General.Selection.InfoId' of @0@. +-- +targetTreeModelRow :: TargetTag +targetTreeModelRow = unsafePerformIO $ tagNew "GTK_TREE_MODEL_ROW" + hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 88 --- | Obtains a 'TreeModel' and a path from 'SelectionDataM' whenever the target name is --- "GTK_TREE_MODEL_ROW". Normally called from a 'treeDragDestDragDataReceived' handler. +-- | Obtains a 'TreeModel' and a path from 'SelectionDataM' whenever the target is +-- 'targetTreeModelRow'. Normally called from a 'treeDragDestDragDataReceived' handler. hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeDrag.chs 104 --- | Sets selection data with the target name "GTK_TREE_MODEL_ROW", consisting +-- | Sets selection data with the target 'targetTreeModelRow', consisting hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 34 + treeStoreNewDND, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 43 + treeStoreLookup, hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 554 - (Store { depth = d, + (Store { depth = d, -- this might be a space leak hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeStore.hs 677 + +-- | Extract a subtree from the current model. Like 'treeStoreGetTree' +-- but returns @Nothing@ if the path refers to a non-existant node. +-- +treeStoreLookup :: TreeStore a -> TreePath -> IO (Maybe (Tree a)) +treeStoreLookup (TreeStore model) path = do + store@Store { depth = d, content = cache } <- [_$_] + readIORef (customTreeModelGetPrivate model) + case fromPath d path of + (Just iter) -> do + let (res, cache') = checkSuccess d iter cache + writeIORef (customTreeModelGetPrivate model) store { content = cache' } + case cache' of + ((_,node:_):_) | res -> return (Just node) + _ -> return Nothing + _ -> return Nothing |
From: Axel S. <si...@co...> - 2008-09-02 20:08:12
|
Tue Sep 2 16:00:31 EDT 2008 A....@ke... * Add a demonstration of DND on lists. hunk ./Makefile.am 2323 - demo/treeList/DirList.hs demo/treeList/Makefile \ + demo/treeList/DirList.hs demo/treeList/Completion.hs \ + demo/treeList/ListDND.hs \ + demo/treeList/resListDND/desktop.png \ + demo/treeList/resListDND/laptop.png \ + demo/treeList/resListDND/laptopSmall.png \ + demo/treeList/resListDND/printer.png \ + demo/treeList/resListDND/server.png \ + demo/treeList/resListDND/tower.png \ + demo/treeList/Makefile \ addfile ./demo/treeList/ListDND.hs hunk ./demo/treeList/ListDND.hs 1 +module Main where + +import Graphics.UI.Gtk +import Graphics.UI.Gtk.ModelView as New +import System.Glib.GObject ( toGObject ) +import System.Glib.Signals ( on ) +import System.FilePath +import Control.Concurrent.MVar +import Control.Monad ( liftM ) +import Control.Monad.Trans ( liftIO ) +import Data.Maybe ( fromMaybe ) +import Data.List ( findIndex ) + +roomStrCol :: ColumnId String String +roomStrCol = makeColumnIdString 1 + +-- Define a string column and an image column on the store holding the +-- computer types. +compPicCol :: ColumnId CompType Pixbuf +compPicCol = makeColumnIdPixbuf 1 + +compStrCol :: ColumnId CompType String +compStrCol = makeColumnIdString 2 + +data Computer = Computer { + name :: String, + addr :: (Int, Int, Int, Int), + roomStore :: New.ListStore String, + roomSel :: Int, + cType :: CompType } + +data CompType + = MacBookPro + | MacBook + | Printer + | MacPro + | Xserve + | IMac + deriving (Enum, Bounded, Show) + +showCT :: CompType -> String +showCT ct = case show ct of + 'I':xs -> 'i':xs + xs -> xs + +main = do + initGUI + + win <- windowNew + onDestroy win mainQuit + + -- create a tag that we use as selection, target and selection type + compTypeTag <- tagNew "_CompType" + + let pNames = map ("resListDND" </>) + ["laptop.png","laptopSmall.png","printer.png", + "tower.png","server.png","desktop.png"] + pics <- mapM pixbufNewFromFile pNames + + smallPics <- mapM (\n -> pixbufNewFromFileAtScale n 48 48 True) pNames +[_^I_][_$_] + [noRoom, publicRoom, restrictedRoom] <- mapM New.listStoreNew + [["Paul (Home)","John (Home)","Fred (Home)"], + ["N12","S112", "S113", "S114"], + ["Server Room Upstairs", "Server Room Downstairs"]] + + -- define extractor function for the string column + New.treeModelSetColumn noRoom roomStrCol id + New.treeModelSetColumn publicRoom roomStrCol id + New.treeModelSetColumn restrictedRoom roomStrCol id + [_$_] + let genRoomStore MacBookPro = noRoom + genRoomStore MacBook = noRoom + genRoomStore Printer = publicRoom + genRoomStore MacPro = publicRoom + genRoomStore Xserve = restrictedRoom + genRoomStore IMac = publicRoom + + -- the initial computer list - it's a coincidence that there's + -- one computer of each type + content <- New.listStoreNewDND [_$_] + (map (\t -> Computer { name = showCT t, addr = (192,168,0,fromEnum t+1), + roomStore = genRoomStore t, roomSel = 0, cType = t}) + [minBound :: CompType .. maxBound]) + (Just listStoreDefaultDragSourceIface) + (Just DragDestIface { + treeDragDestRowDropPossible = \store path@(i:_) -> do + mCT <- selectionDataGet compTypeTag + case mCT :: Maybe [Int] of + Just [ct] -> return True + Nothing -> + (treeDragDestRowDropPossible listStoreDefaultDragDestIface) + store path + _ -> return False, + treeDragDestDragDataReceived = \store path@(i:_) -> do + mCT <- selectionDataGet compTypeTag + case mCT of + Just [ct] -> do + let t = toEnum ct + liftIO $ New.listStoreInsert store i + Computer { name = showCT t, addr = (192,168,0,254), + roomStore = genRoomStore t, roomSel = 0, + cType = t } + return True + Nothing -> + (treeDragDestDragDataReceived listStoreDefaultDragDestIface) + store path + }) + -- the area with the possible computer types + compTypes <- New.listStoreNewDND [minBound :: CompType .. maxBound] + (Just DragSourceIface { + treeDragSourceRowDraggable = \store (i:_) -> return True, + treeDragSourceDragDataGet = \store (i:_) -> do + ty <- selectionDataGetTarget + ct <- liftIO $ listStoreGetValue store i + selectionDataSet compTypeTag [fromEnum ct] + t <- selectionDataGetTarget + l <- selectionDataGetLength + return True, + treeDragSourceDragDataDelete = \store path -> return True + }) + Nothing + + -- define extractor functions for the two column + New.treeModelSetColumn compTypes compPicCol $ + \t -> pics !! fromEnum t + New.treeModelSetColumn compTypes compStrCol showCT + [_$_] + -- create an icon view of all the computer types + typesView <- New.iconViewNew + set typesView [New.iconViewModel := Just compTypes, + New.iconViewPixbufColumn := compPicCol, + New.iconViewTextColumn := compStrCol, + New.iconViewColumns := 6] [_$_] + + -- create an editable list of computers + inventory <- New.treeViewNewWithModel content + + tyCol <- New.treeViewColumnNew + New.treeViewColumnSetTitle tyCol "Type" + picRen <- New.cellRendererPixbufNew + New.treeViewColumnPackStart tyCol picRen False + New.cellLayoutSetAttributes tyCol picRen content + (\Computer { cType = t} -> [New.cellPixbuf := smallPics !! fromEnum t]) + tyRen <- New.cellRendererTextNew + New.treeViewColumnPackStart tyCol tyRen False + New.cellLayoutSetAttributes tyCol tyRen content + (\Computer { cType = t} -> [New.cellText := showCT t]) + New.treeViewAppendColumn inventory tyCol + + nameCol <- New.treeViewColumnNew + New.treeViewColumnSetTitle nameCol "Name" + New.treeViewColumnSetResizable nameCol True + New.treeViewColumnSetMinWidth nameCol 100 + nameRen <- New.cellRendererTextNew + set nameRen [ New.cellTextEditable := True, + New.cellTextEditableSet := True, + New.cellTextEllipsize := EllipsizeEnd, + New.cellTextEllipsizeSet := True] + New.treeViewColumnPackStart nameCol nameRen True + New.cellLayoutSetAttributes nameCol nameRen content + (\Computer { name = n } -> [New.cellText := n]) + New.treeViewAppendColumn inventory nameCol + on nameRen edited $ \[i] str -> do + val <- New.listStoreGetValue content i + New.listStoreSetValue content i val { name = str } + + addrCol <- New.treeViewColumnNew + New.treeViewColumnSetTitle addrCol "Address" + oct1 <- New.cellRendererTextNew + dot1 <- New.cellRendererTextNew + oct2 <- New.cellRendererTextNew + dot2 <- New.cellRendererTextNew + oct3 <- New.cellRendererTextNew + dot3 <- New.cellRendererTextNew + oct4 <- New.cellRendererTextNew + mapM_ (uncurry (New.cellLayoutPackStart addrCol)) + [(oct1, True), (dot1, False), (oct2, True), + (dot2, False), (oct3, True), (dot3, False), (oct4, True)] + mapM_ (\d -> set d [New.cellText := ".", + New.cellTextWidthChars := 0]) [dot1, dot2, dot3] + mapM_ (\o -> set o [New.cellXAlign := 1.0, + New.cellTextWidthChars := 3]) [oct1, oct2, oct3, oct4] + New.cellLayoutSetAttributes addrCol oct1 content + (\Computer { addr = (o1,_,_,_)} -> [New.cellText := show o1]) + New.cellLayoutSetAttributes addrCol oct2 content + (\Computer { addr = (_,o2,_,_)} -> [New.cellText := show o2]) + New.cellLayoutSetAttributes addrCol oct3 content + (\Computer { addr = (_,_,o3,_)} -> [New.cellText := show o3]) + New.cellLayoutSetAttributes addrCol oct4 content + (\Computer { addr = (_,_,_,o4)} -> [New.cellText := show o4]) [_$_] + New.treeViewAppendColumn inventory addrCol + + roomCol <- New.treeViewColumnNew + New.treeViewColumnSetTitle roomCol "Room" + New.treeViewColumnSetResizable roomCol True + New.treeViewColumnSetSizing roomCol New.TreeViewColumnAutosize + roomRen <- New.cellRendererComboNew + set roomRen [ New.cellTextEditable := True, + New.cellTextEditableSet := True, + New.cellComboHasEntry := True ] + New.treeViewColumnPackStart roomCol roomRen True + New.cellLayoutSetAttributes roomCol roomRen content + (\Computer { roomStore = t, roomSel = idx } -> + [New.cellText :=> New.listStoreGetValue t idx, + New.cellComboTextModel := (t, roomStrCol)]) + on roomRen edited $ \[i] str -> do + row@Computer { roomStore = t } <- New.listStoreGetValue content i + elems <- New.listStoreToList t + idx <- case (findIndex ((==) str) elems) of + Just idx -> return idx + Nothing -> New.listStoreAppend t str + New.listStoreSetValue content i row { roomSel = idx } + New.treeViewAppendColumn inventory roomCol + + -- make typesView a drag source for compTypeTag values + tl <- targetListNew + targetListAdd tl compTypeTag [TargetSameApp] 0 + iconViewEnableModelDragSource typesView [Button1] tl [ActionCopy] + [_$_] + -- Due to a bug in Gtk+, the treeDragSourceDragDataGet handler in + -- the DND source handler is not called unless the IconView is also + -- set to be a DND destination. Bugzilla 550528 + tl <- targetListNew + iconViewEnableModelDragDest typesView tl [] + [_$_] + -- make the inventory widget a drag destination for compTypeTag values + tl <- targetListNew + targetListAdd tl compTypeTag [TargetSameApp] 0 + targetListAdd tl targetTreeModelRow [TargetSameWidget] 0 + New.treeViewEnableModelDragDest inventory tl [ActionMove] + tl <- targetListNew + targetListAdd tl targetTreeModelRow [TargetSameWidget] 0 + New.treeViewEnableModelDragSource inventory [Button1] tl [ActionMove] + [_$_] + -- Install drag and drop for permuting rows. This is now done above using + -- the explicit target 'targetTreeModelRow'. Calling the function below + -- will set a completely new 'TargetList' thereby removing our own + -- 'compTypeTag' from the inventory widget's target list. + [_$_] + --New.treeViewSetReorderable inventory True + + -- arrange the widgets + v <- vPanedNew + panedAdd1 v typesView + panedAdd2 v inventory + containerAdd win v + + widgetShowAll win + mainGUI [_$_] hunk ./demo/treeList/Makefile 2 -PROGS = listdemo treedemo listtest treetest dirlist treesort completion +PROGS = listdemo treedemo listtest treetest dirlist treesort completion \ + listdnd + hunk ./demo/treeList/Makefile 6 - TreeSort.hs Completion.hs + TreeSort.hs Completion.hs ListDND.hs hunk ./demo/treeList/Makefile 31 +listdnd : ListDND.hs + $(HC_RULE) + |
From: Axel S. <si...@co...> - 2008-08-27 17:27:08
|
Wed Aug 27 13:24:36 EDT 2008 A....@ke... * Int64 GObject property getters and setters used incorrect type. Reported by Oleg Belozeorov. hunk ./glib/System/Glib/GTypeConstants.hsc 28 + uint64, int64, hunk ./glib/System/Glib/GTypeConstants.hsc 41 -invalid, uint, int, uchar, char, bool, enum, flags, +invalid, uint, int, uint64, int64, uchar, char, bool, enum, flags, hunk ./glib/System/Glib/GTypeConstants.hsc 47 +uint64 = #const G_TYPE_UINT64 +int64 = #const G_TYPE_INT64 hunk ./glib/System/Glib/Properties.chs 140 -objectSetPropertyInt64 = objectSetPropertyInternal GType.int valueSetInt64 +objectSetPropertyInt64 = objectSetPropertyInternal GType.int64 valueSetInt64 hunk ./glib/System/Glib/Properties.chs 143 -objectGetPropertyInt64 = objectGetPropertyInternal GType.int valueGetInt64 +objectGetPropertyInt64 = objectGetPropertyInternal GType.int64 valueGetInt64 hunk ./glib/System/Glib/Properties.chs 146 -objectSetPropertyUInt64 = objectSetPropertyInternal GType.uint (\gv v -> valueSetUInt64 gv (fromIntegral v)) +objectSetPropertyUInt64 = objectSetPropertyInternal GType.uint64 (\gv v -> valueSetUInt64 gv (fromIntegral v)) hunk ./glib/System/Glib/Properties.chs 149 -objectGetPropertyUInt64 = objectGetPropertyInternal GType.uint (\gv -> liftM fromIntegral $ valueGetUInt64 gv) +objectGetPropertyUInt64 = objectGetPropertyInternal GType.uint64 (\gv -> liftM fromIntegral $ valueGetUInt64 gv) |
From: Axel S. <si...@co...> - 2008-08-21 21:25:02
|
Thu Aug 21 17:22:36 EDT 2008 A....@ke... * Fix bug #1138. I forgot to set the stamp in those TreeIters correctly that were created directly in ListStore. It was all correct in TreeStore. hunk ./gtk/Graphics/UI/Gtk/ModelView/CustomStore.chs 149 - -> IO () -- ^ returns the newly assigned column + -> IO () hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 602 - [_$_] - if (iter->stamp != store->stamp) - g_critical ("iter->stamp == %d\t\tstore->stamp == %d\n", iter->stamp, store->stamp); - [_$_] hunk ./gtk/Graphics/UI/Gtk/ModelView/Gtk2HsStore.c 614 - - if (iter->stamp != store->stamp) - g_critical ("iter->stamp == %d\t\tstore->stamp == %d\n", iter->stamp, store->stamp); - hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 197 - treeModelRowInserted model [index'] (TreeIter 0 (fromIntegral index') 0 0) + stamp <- customTreeModelGetStamp model + treeModelRowInserted model [index'] (TreeIter stamp (fromIntegral index') 0 0) hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 209 - treeModelRowInserted model [0] (TreeIter 0 0 0 0) + stamp <- customTreeModelGetStamp model + treeModelRowInserted model [0] (TreeIter stamp 0 0 0) hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 214 -listStorePrependList = undefined +listStorePrependList store list = + mapM_ (listStoreInsert store 0) (reverse list) hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 223 - treeModelRowInserted model [index] (TreeIter 0 (fromIntegral index) 0 0) + stamp <- customTreeModelGetStamp model + treeModelRowInserted model [index] (TreeIter stamp (fromIntegral index) 0 0) hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 235 + stamp <- customTreeModelGetStamp model hunk ./gtk/Graphics/UI/Gtk/ModelView/ListStore.hs.pp 237 - treeModelRowInserted model [index] (TreeIter 0 (fromIntegral index) 0 0) + treeModelRowInserted model [index] (TreeIter stamp (fromIntegral index) 0 0) |
Thu Aug 21 17:18:47 EDT 2008 A....@ke... * Revamp widget by adding most methods and separating signals from events. Keep only the old style signals with the mixture of events and signals that we had before in order not to break anything. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 8 --- Copyright (C) 2001-2005 Axel Simon +-- Copyright (C) 2001-2008 Axel Simon hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 20 --- TODO --- --- unimplemented methods that seem to be useful in user programs: --- widgetSizeRequest, widgetAddAccelerator, widgetRemoveAccelerator, --- widgetAcceleratorSignal, widgetGrabDefault, --- widgetPango*, widgetSetAdjustments --- --- implement the following methods in GtkWindow object: --- widget_set_uposition, widget_set_usize hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 26 --- The base class for all widgets. While a widget cannot be created directly, +-- The base class for all widgets. +-- +module Graphics.UI.Gtk.Abstract.Widget ( + +-- * Detail +-- +-- | The base class for all widgets. While a widget cannot be created directly, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 37 -module Graphics.UI.Gtk.Abstract.Widget ( --- * Detail --- [_$_] --- | 'Widget' introduces style properties - these are basically object +-- 'Widget' introduces style properties - these are basically object hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 43 +-- hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 50 +-- hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 64 - Allocation, + EventMask(..), + ExtensionMode(..), + GType, + KeyVal, + Region, + Bitmap, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 72 + Color, + IconSize(..), + StateType(..), + TextDirection(..), hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 78 - [_$_] + StockId, + WidgetHelpType(..), + hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 82 - widgetGetState, - widgetGetSavedState, - widgetShow, -- Showing and hiding a widget. + widgetShow, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 88 - widgetQueueDraw, -- Functions to be used with DrawingArea. - widgetGetDrawWindow, - widgetGetSize, - widgetHasIntersection, + widgetQueueDraw, + widgetAddAccelerator, + widgetRemoveAccelerator, + widgetSetAccelPath, +#if GTK_CHECK_VERSION(2,4,0) + widgetCanActivateAccel, +#endif + widgetActivate, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 97 - widgetRegionIntersect, - widgetActivate, -- Manipulate widget state. - widgetSetSensitivity, - widgetSetSizeRequest, - widgetGetSizeRequest, + widgetHasIntersection, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 99 - widgetSetAppPaintable, - widgetSetName, -- Naming, Themes + widgetGrabDefault, + widgetSetName, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 102 - EventMask(..), + widgetSetSensitive, + widgetSetSensitivity, + widgetGetParentWindow, + widgetGetDrawWindow, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 109 - ExtensionMode(..), + widgetSetEvents, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 112 - widgetGetToplevel, -- Widget browsing. - widgetIsAncestor, - widgetReparent, - TextDirection(..), - widgetSetDirection, -- General Setup. - widgetGetDirection, - widgetQueueDrawArea, - widgetSetDoubleBuffered, - widgetSetRedrawOnAllocate, - widgetGetParentWindow, + widgetGetToplevel, + widgetGetAncestor, + widgetGetColormap, + widgetSetColormap, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 117 + widgetIsAncestor, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 119 + widgetSetStyle, + widgetGetStyle, + widgetPushColormap, + widgetPopColormap, + widgetSetDefaultColormap, + widgetGetDefaultStyle, + widgetGetDefaultColormap, + widgetSetDirection, + widgetGetDirection, + widgetSetDefaultDirection, + widgetGetDefaultDirection, + widgetShapeCombineMask, +#if GTK_CHECK_VERSION(2,10,0) + widgetInputShapeCombineMask, +#endif hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 137 - widgetSetCompositeName, - widgetGetParent, - widgetSetDefaultDirection, - widgetGetDefaultDirection, - widgetGetStyle, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 144 - widgetCreateLayout, -- Drawing text. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 146 + widgetCreateLayout, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 148 + widgetQueueDrawArea, + widgetResetShapes, + widgetSetAppPaintable, + widgetSetDoubleBuffered, + widgetSetRedrawOnAllocate, + widgetSetCompositeName, + widgetSetScrollAdjustments, + widgetRegionIntersect, + widgetGetAccessible, + widgetChildFocus, + widgetGetChildVisible, + widgetGetParent, + widgetGetSettings, +#if GTK_CHECK_VERSION(2,2,0) + --widgetGetClipboard, + widgetGetDisplay, + widgetGetRootWindow, + widgetGetScreen, + widgetHasScreen, +#endif + widgetGetSizeRequest, + widgetSetChildVisible, + widgetSetSizeRequest, +#if GTK_CHECK_VERSION(2,4,0) + widgetSetNoShowAll, + widgetGetNoShowAll, + widgetListMnemonicLabels, + widgetAddMnemonicLabel, + widgetRemoveMnemonicLabel, +#if GTK_CHECK_VERSION(2,10,0) + widgetGetAction, + widgetIsComposited, +#endif +#endif + widgetReparent, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 185 - widgetGetColormap, - widgetSetColormap, - widgetGetScreen, + widgetGetState, + widgetGetSavedState, + widgetGetSize, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 208 + widgetChildVisible, + widgetColormap, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 212 - widgetSensitivity, hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 214 + realize, + unrealize, + mapSignal, + unmapSignal, + sizeRequest, + sizeAllocate, + showSignal, + hideSignal, + focus, + stateChanged, + parentSet, + hierarchyChanged, + styleSet, + directionChanged, + grabNotify, + popupMenuSignal, + showHelp, + accelClosuresChanged, + screenChanged, + +-- * Events + buttonPressEvent, + buttonReleaseEvent, + configureEvent, + deleteEvent, + destroyEvent, + enterNotifyEvent, + exposeEvent, + focusInEvent, + focusOutEvent, +#if GTK_CHECK_VERSION(2,8,0) + grabBrokenEvent, +#endif + keyPressEvent, + keyReleaseEvent, + leaveNotifyEvent, + mapEvent, + motionNotifyEvent, + noExposeEvent, + proximityInEvent, + proximityOutEvent, + scrollEvent, + unmapEvent, + visibilityNotifyEvent, + windowStateEvent, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 324 - StateType(..), hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 334 +#endif hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 340 +import Data.Bits ((.&.), complement) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 347 +import System.Glib.GType (GType) +import System.Glib.GList (GList, fromGList) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 353 +import Graphics.UI.Gtk.Gdk.Keys (KeyVal) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 355 +{#import Graphics.UI.Gtk.Gdk.Pixmap#} (Bitmap) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 357 - ,Requisition(..), Color, IconSize + ,Requisition(..), Color, IconSize(..) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 361 - marshExposeRect) + marshExposeRect, + EventButton, + EventScroll, + EventMotion, + EventExpose, + EventKey, + EventConfigure, + EventCrossing, + EventFocus, + EventProperty, + EventProximity, + EventVisibility, + EventWindowState, + EventGrabBroken) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 376 - AccelFlags(..), DirectionType(..)) + AccelFlags(..), DirectionType(..), Modifier) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 385 + hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 457 --- Functions to be used with DrawingArea. - --- | Prepare text for display. --- --- The 'PangoLayout' represents the rendered text. It can be shown on screen --- by calling 'Graphics.UI.Gtk.Gdk.Drawable.drawLayout'. --- --- The returned 'PangoLayout' shares the same font information ('PangoContext') as this --- widget. If this information changes, the 'PangoLayout' should change. The --- following code ensures that the displayed text always reflects the widget's --- settings: --- --- > l <- widgetCreateLayout w "My Text." --- > let update = do --- > layoutContextChanged l --- > -- update the Drawables which show this layout --- > w `onDirectionChanged` update --- > w `onStyleChanged` update --- -widgetCreateLayout :: WidgetClass self => self - -> String -- ^ @text@ - text to set on the layout - -> IO PangoLayout -widgetCreateLayout self text = do - pl <- constructNewGObject mkPangoLayoutRaw $ - withUTFString text $ \textPtr -> - {# call unsafe widget_create_pango_layout #} - (toWidget self) - textPtr - ps <- makeNewPangoString text - psRef <- newIORef ps - return (PangoLayout psRef pl) +-- * Functions to be used with 'Graphics.UI.Gtk.Misc.DrawingArea'. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 467 --- | Check if the widget intersects with a given area. +-- %hash c:1e14 d:53c5 +-- | Installs an accelerator for this @widget@ in @accelGroup@ that causes +-- @accelSignal@ to be emitted if the accelerator is activated. The +-- @accelGroup@ needs to be added to the widget's toplevel via +-- 'windowAddAccelGroup', and the signal must be of type @G_RUN_ACTION@. +-- Accelerators added through this function are not user changeable during +-- runtime. If you want to support accelerators that can be changed by the +-- user, use 'accelMapAddEntry' and 'widgetSetAccelPath' or +-- 'menuItemSetAccelPath' instead. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 477 -widgetHasIntersection :: WidgetClass self => self - -> Rectangle -- ^ @area@ - a rectangle - -> IO Bool -- ^ returns @True@ if there was an intersection -widgetHasIntersection self area = [_$_] - liftM toBool $ - with area $ \areaPtr -> - {# call unsafe widget_intersect #} +widgetAddAccelerator :: WidgetClass self => self + -> String -- ^ @accelSignal@ - widget signal to emit on accelerator + -- activation + -> AccelGroup -- ^ @accelGroup@ - accel group for this widget, added to + -- its toplevel + -> KeyVal -- ^ @accelKey@ - the key of the accelerator + -> [Modifier] -- ^ @accelMods@ - modifier key combination of the + -- accelerator + -> [AccelFlags] -- ^ @accelFlags@ - flag accelerators, e.g. 'AccelVisible' + -> IO () +widgetAddAccelerator self accelSignal accelGroup accelKey accelMods accelFlags = + withUTFString accelSignal $ \accelSignalPtr -> + {# call gtk_widget_add_accelerator #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 491 - (castPtr areaPtr) - (castPtr nullPtr) + accelSignalPtr + accelGroup + (fromIntegral accelKey) + ((fromIntegral . fromFlags) accelMods) + ((fromIntegral . fromFlags) accelFlags) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 497 --- | Computes the intersection of a widget's area and @area@, returning the --- intersection, and returns @Nothing@ if there was no intersection. +-- %hash c:3442 d:dfe8 +-- | Removes an accelerator from @widget@, previously installed with +-- 'widgetAddAccelerator'. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 501 -widgetIntersect :: WidgetClass self => self - -> Rectangle -- ^ @area@ - a rectangle - -> IO (Maybe Rectangle) -- ^ returns the intersection or @Nothing@ -widgetIntersect self area = - with area $ \areaPtr -> - alloca $ \intersectionPtr -> do - hasIntersection <- {# call unsafe widget_intersect #} +widgetRemoveAccelerator :: WidgetClass self => self + -> AccelGroup -- ^ @accelGroup@ - accel group for this widget + -> KeyVal -- ^ @accelKey@ - the key of the accelerator + -> [Modifier] -- ^ @accelMods@ - modifier key combination of the + -- accelerator + -> IO Bool -- ^ returns whether an accelerator was installed and could + -- be removed +widgetRemoveAccelerator self accelGroup accelKey accelMods = + liftM toBool $ + {# call gtk_widget_remove_accelerator #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 512 - (castPtr areaPtr) - (castPtr intersectionPtr) - if (toBool hasIntersection) - then liftM Just $ peek intersectionPtr - else return Nothing + accelGroup + (fromIntegral accelKey) + ((fromIntegral . fromFlags) accelMods) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 516 --- | Computes the intersection of a widget's area and @region@, returning --- the intersection. The result may be empty, use --- 'Graphics.UI.Gtk.Gdk.Region.regionEmpty' to check. +-- %hash c:f8d4 d:bd7f +-- | Given an accelerator group, @accelGroup@, and an accelerator path, +-- @accelPath@, sets up an accelerator in @accelGroup@ so whenever the key +-- binding that is defined for @accelPath@ is pressed, @widget@ will be +-- activated. This removes any accelerators (for any accelerator group) +-- installed by previous calls to 'widgetSetAccelPath'. Associating +-- accelerators with paths allows them to be modified by the user and the +-- modifications to be saved for future use. (See 'accelMapSave'.) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 525 -widgetRegionIntersect :: WidgetClass self => self - -> Region -- ^ @region@ - a 'Region' in the same coordinate system as the - -- widget's allocation. That is, relative to the widget's - -- 'DrawWindow' for 'NoWindow' widgets; relative to the parent - -- 'DrawWindow' of the widget's 'DrawWindow' for widgets with - -- their own 'DrawWindow'. - -> IO Region -- ^ returns A region holding the intersection of the widget and - -- @region@. The coordinates of the return value are relative to - -- the widget's 'DrawWindow', if it has one, otherwise - -- it is relative to the parent's 'DrawWindow'. -widgetRegionIntersect self region = do - intersectionPtr <- {# call gtk_widget_region_intersect #} +-- This function is a low level function that would most likely be used by a +-- menu creation system like 'ItemFactory'. If you use 'ItemFactory', setting +-- up accelerator paths will be done automatically. +-- +-- Even when you you aren't using 'ItemFactory', if you only want to set up +-- accelerators on menu items 'menuItemSetAccelPath' provides a somewhat more +-- convenient interface. +-- +widgetSetAccelPath :: WidgetClass self => self + -> String -- ^ @accelPath@ - path used to look up the accelerator + -> AccelGroup -- ^ @accelGroup@ - a 'AccelGroup'. + -> IO () +widgetSetAccelPath self accelPath accelGroup = + withUTFString accelPath $ \accelPathPtr -> + {# call gtk_widget_set_accel_path #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 541 - region - makeNewRegion intersectionPtr + accelPathPtr + accelGroup hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 544 --- Manipulate widget state. +#if GTK_CHECK_VERSION(2,4,0) +-- %hash c:157e d:82ae +-- | Determines whether an accelerator that activates the signal identified by +-- @signalId@ can currently be activated. This is done by emitting the +-- 'canActivateAccel' signal on the widget the signal is attached to; if the +-- signal isn't overridden by a handler or in a derived widget, then the +-- default check is that the widget must be sensitive, and the widget and all +-- its ancestors mapped. +-- +-- * Available since Gtk+ version 2.4 +-- +widgetCanActivateAccel :: WidgetClass self => + (ConnectId self) -- ^ @signalId@ - the ID of a signal installed on @widget@ + -> IO Bool -- ^ returns @True@ if the accelerator can be activated. +widgetCanActivateAccel (ConnectId signalId self) = + liftM toBool $ + {# call gtk_widget_can_activate_accel #} + (toWidget self) + (fromIntegral signalId) +#endif hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 577 --- | Sets the sensitivity of a widget. A widget is sensitive if the user can --- interact with it. Insensitive widgets are \"grayed out\" and the user can't --- interact with them. Insensitive widgets are known as \"inactive\", --- \"disabled\", or \"ghosted\" in some other toolkits. +-- | Computes the intersection of a widget's area and @area@, returning the +-- intersection, and returns @Nothing@ if there was no intersection. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 580 -widgetSetSensitivity :: WidgetClass self => self - -> Bool -- ^ @sensitive@ - @True@ to make the widget sensitive - -> IO () -widgetSetSensitivity self sensitive = - {# call widget_set_sensitive #} +widgetIntersect :: WidgetClass self => self + -> Rectangle -- ^ @area@ - a rectangle + -> IO (Maybe Rectangle) -- ^ returns the intersection or @Nothing@ +widgetIntersect self area = + with area $ \areaPtr -> + alloca $ \intersectionPtr -> do + hasIntersection <- {# call unsafe widget_intersect #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 588 - (fromBool sensitive) + (castPtr areaPtr) + (castPtr intersectionPtr) + if (toBool hasIntersection) + then liftM Just $ peek intersectionPtr + else return Nothing hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 594 --- | Sets the minimum size of a widget; that is, the widget's size request --- will be @width@ by @height@. You can use this function to force a widget to --- be either larger or smaller than it normally would be. --- --- In most cases, 'Graphics.UI.Gtk.Windows.Window.windowSetDefaultSize' --- is a better choice for toplevel --- windows than this function; setting the default size will still allow users --- to shrink the window. Setting the size request will force them to leave the --- window at least as large as the size request. When dealing with window --- sizes, 'Graphics.UI.Gtk.Windows.Window.windowSetGeometryHints' can be a --- useful function as well. --- --- Note the inherent danger of setting any fixed size - themes, translations --- into other languages, different fonts, and user action can all change the --- appropriate size for a given widget. So, it's basically impossible to --- hardcode a size that will always be correct. --- --- The size request of a widget is the smallest size a widget can accept --- while still functioning well and drawing itself correctly. However in some --- strange cases a widget may be allocated less than its requested size, and in --- many cases a widget may be allocated more space than it requested. --- --- If the size request in a given direction is -1 (unset), then the --- \"natural\" size request of the widget will be used instead. --- --- Widgets can't actually be allocated a size less than 1 by 1, but you can --- pass 0,0 to this function to mean \"as small as possible.\" +-- | Check if the widget intersects with a given area. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 596 -widgetSetSizeRequest :: WidgetClass self => self - -> Int -- ^ @width@ - width @widget@ should request, or -1 to unset - -> Int -- ^ @height@ - height @widget@ should request, or -1 to unset - -> IO () -widgetSetSizeRequest self width height = - {# call widget_set_size_request #} +widgetHasIntersection :: WidgetClass self => self + -> Rectangle -- ^ @area@ - a rectangle + -> IO Bool -- ^ returns @True@ if there was an intersection +widgetHasIntersection self area = [_$_] + liftM toBool $ + with area $ \areaPtr -> + {# call unsafe widget_intersect #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 604 - (fromIntegral width) - (fromIntegral height) + (castPtr areaPtr) + (castPtr nullPtr) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 607 --- | Gets the size request that was explicitly set for the widget using --- 'widgetSetSizeRequest'. A value of -1 for @width@ or @height@ --- indicates that that dimension has not been set explicitly and the natural --- requisition of the widget will be used intead. See 'widgetSetSizeRequest'. --- To get the size a widget will actually use, call connect to the --- signal 'onSizeRequest' instead of calling this function. +-- %hash d:1cab +-- | Determines if the widget is the focus widget within its toplevel. (This +-- does not mean that the 'widgetHasFocus' attribute is necessarily set; +-- 'widgetHasFocus' will only be set if the toplevel widget additionally has +-- the global input focus.) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 613 -widgetGetSizeRequest :: WidgetClass self => self - -> IO (Int, Int) -- ^ @(width, height)@ -widgetGetSizeRequest self = - alloca $ \widthPtr -> - alloca $ \heightPtr -> do - {# call gtk_widget_get_size_request #} +widgetGetIsFocus :: WidgetClass self => self + -> IO Bool -- ^ returns @True@ if the widget is the focus widget. +widgetGetIsFocus self = + liftM toBool $ + {# call unsafe widget_is_focus #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 619 - widthPtr - heightPtr - width <- peek widthPtr - height <- peek heightPtr - return (fromIntegral width, fromIntegral height) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 620 --- | Causes the widget to have the keyboard focus for the 'Window' it's inside. --- The widget must be a focusable widget, such as a 'Entry'; something like --- 'Frame' won't work. (More precisely, it must have the "CanFocus" flag set.) +-- %hash d:e1e +-- | Causes @widget@ to have the keyboard focus for the 'Window' it's inside. +-- @widget@ must be a focusable widget, such as a +-- 'Graphics.UI.Gtk.Entry.Entry'; something like +-- 'Graphics.UI.Gtk.Ornaments.Frame' won't work. (More precisely, it must have +-- the 'widgetCanFocus' flag set.) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 632 --- | Sets whether the application intends to draw on the widget in response --- to an 'onExpose' signal. +-- %hash c:e5e9 d:412a +-- | Causes @widget@ to become the default widget. @widget@ must have the +-- 'canDefault' flag set. The default widget is +-- activated when the user presses Enter in a window. Default widgets must be +-- activatable, that is, 'widgetActivate' should affect them. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 638 --- * This is a hint to the widget and does not affect the behavior of the --- GTK+ core; many widgets ignore this flag entirely. For widgets that do --- pay attention to the flag, such as 'EventBox' and 'Window', the effect --- is to suppress default themed drawing of the widget's background. --- (Children of the widget will still be drawn.) The application is then --- entirely responsible for drawing the widget background. --- -widgetSetAppPaintable :: WidgetClass self => self - -> Bool -- ^ @appPaintable@ - @True@ if the application will paint on the - -- widget - -> IO () -widgetSetAppPaintable self appPaintable = - {# call widget_set_app_paintable #} +widgetGrabDefault :: WidgetClass self => self -> IO () +widgetGrabDefault self = + {# call gtk_widget_grab_default #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 642 - (fromBool appPaintable) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 643 +-- %hash c:4f62 d:d05a hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 669 +-- %hash c:25b1 d:f898 +-- | Sets the sensitivity of a widget. A widget is sensitive if the user can +-- interact with it. Insensitive widgets are \"grayed out\" and the user can't +-- interact with them. Insensitive widgets are known as \"inactive\", +-- \"disabled\", or \"ghosted\" in some other toolkits. +-- +widgetSetSensitive :: WidgetClass self => self + -> Bool -- ^ @sensitive@ - @True@ to make the widget sensitive + -> IO () +widgetSetSensitive self sensitive = + {# call gtk_widget_set_sensitive #} + (toWidget self) + (fromBool sensitive) + [_$_] +-- bad spelling backwards compatability definition +widgetSetSensitivity :: WidgetClass self => self -> Bool -> IO () +widgetSetSensitivity = widgetSetSensitive + +-- | Gets the widget's parent window. +-- +widgetGetParentWindow :: WidgetClass self => self -> IO DrawWindow +widgetGetParentWindow self = + makeNewGObject mkDrawWindow $ + {# call gtk_widget_get_parent_window #} + (toWidget self) + hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 702 --- should be called whenever a signal receiving an 'Event' is disconected. [_$_] +-- should be called whenever all signals receiving an 'Event' +-- have been disconected. [_$_] hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 720 - {# call widget_add_events #} + {# call unsafe widget_add_events #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 734 --- | Sets the extension events. +-- %hash c:468a d:49a0 +-- | Sets the event mask (see 'EventMask') for a widget. The event mask +-- determines which events a widget will receive. Keep in mind that different +-- widgets have different default event masks, and by changing the event mask +-- you may disrupt a widget's functionality, so be careful. This function must +-- be called while a widget is unrealized. Consider 'widgetAddEvents' for +-- widgets that are already realized, or if you want to preserve the existing +-- event mask. This function can't be used with 'NoWindow' widgets; to get +-- events on those widgets, place them inside a +-- 'Graphics.UI.Gtk.Misc.EventBox' and receive events on the event box. +-- +widgetSetEvents :: WidgetClass self => self + -> [EventMask] -- ^ @events@ - event mask + -> IO () +widgetSetEvents self events = + {# call unsafe widget_set_events #} + (toWidget self) + (fromIntegral $ fromFlags events) + +-- %hash c:4f2c d:781 +-- | Sets the extension events mask to @mode@. See 'ExtensionMode' and +-- 'inputSetExtensionEvents'. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 765 +-- %hash c:c824 d:e611 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 776 --- Widget browsing. - +-- %hash c:270b d:8877 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 790 --- | Determines whether @widget@ is somewhere inside @ancestor@, possibly with --- intermediate containers. +-- %hash c:17bc d:f8f9 +-- | Gets the first ancestor of @widget@ with type @widgetType@. For example, +-- @widgetGetAncestor widget gTypeBox@ gets the first 'Box' that's +-- an ancestor of @widget@. See note about checking for a toplevel +-- 'Window' in the docs for 'widgetGetToplevel'. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 796 -widgetIsAncestor :: (WidgetClass self, WidgetClass ancestor) => - self -- ^ @widget@ - the widget in question - -> ancestor -- ^ @ancestor@ - another 'Widget' - -> IO Bool -- ^ returns @True@ if @ancestor@ contains @widget@ as a child, - -- grandchild, great grandchild, etc. -widgetIsAncestor self ancestor = - liftM toBool $ - {# call unsafe widget_is_ancestor #} - (toWidget self) - (toWidget ancestor) - --- | Moves a widget from one 'Container' to another. +-- Note that unlike 'widgetIsAncestor', 'widgetGetAncestor' considers +-- @widget@ to be an ancestor of itself. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 799 -widgetReparent :: (WidgetClass self, WidgetClass newParent) => self - -> newParent -- ^ @newParent@ - a 'Container' to move the widget into - -> IO () -widgetReparent self newParent = - {# call widget_reparent #} +widgetGetAncestor :: WidgetClass self => self + -> GType -- ^ @widgetType@ - ancestor type + -> IO (Maybe Widget) -- ^ returns the ancestor widget, or @Nothing@ if not found +widgetGetAncestor self widgetType = do + ptr <- {# call gtk_widget_get_ancestor #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 805 - (toWidget newParent) + widgetType + if ptr==nullPtr then return Nothing else + liftM Just $ makeNewObject mkWidget (return ptr) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 809 --- | Sets the reading direction on a particular widget. This direction --- controls the primary direction for widgets containing text, and also the --- direction in which the children of a container are packed. The ability to --- set the direction is present in order so that correct localization into --- languages with right-to-left reading directions can be done. Generally, --- applications will let the default reading direction present, except for --- containers where the containers are arranged in an order that is explicitely --- visual rather than logical (such as buttons for text justification). --- --- If the direction is set to 'TextDirNone', then the value set by --- 'widgetSetDefaultDirection' will be used. --- -widgetSetDirection :: WidgetClass self => self -> TextDirection -> IO () -widgetSetDirection self dir = - {# call widget_set_direction #} - (toWidget self) - ((fromIntegral . fromEnum) dir) - --- | Gets the reading direction for a particular widget. See --- 'widgetSetDirection'. --- -widgetGetDirection :: WidgetClass self => self -> IO TextDirection -widgetGetDirection self = - liftM (toEnum . fromIntegral) $ - {# call widget_get_direction #} - (toWidget self) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 810 --- | Invalidates the rectangular area of @widget@ defined by @x@, @y@, @width@ --- and @height@ by calling --- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' on the widget's --- 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawWindow' and --- all its child windows. Once the main loop becomes idle (after the current --- batch of events has been processed, roughly), the window will receive expose --- events for the union of all regions that have been invalidated. +-- %hash c:bd95 d:eb94 +-- | Gets the colormap that will be used to render @widget@. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 813 --- Normally you would only use this function in widget implementations. You --- might also use it, or 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' --- directly, to schedule a redraw --- of a 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawingArea' or some portion thereof. --- --- Frequently you can just call --- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRect' or --- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRegion' instead of this --- function. Those functions will --- invalidate only a single window, instead of the widget and all its children. --- --- The advantage of adding to the invalidated region compared to simply --- drawing immediately is efficiency; using an invalid region ensures that you --- only have to redraw one time. --- -widgetQueueDrawArea :: WidgetClass self => self - -> Int -- ^ @x@ - x coordinate of upper-left corner of rectangle to redraw - -> Int -- ^ @y@ - y coordinate of upper-left corner of rectangle to redraw - -> Int -- ^ @width@ - width of region to draw - -> Int -- ^ @height@ - height of region to draw - -> IO () -widgetQueueDrawArea self x y width height = - {# call gtk_widget_queue_draw_area #} - (toWidget self) - (fromIntegral x) - (fromIntegral y) - (fromIntegral width) - (fromIntegral height) - --- | Widgets are double buffered by default; you can use this function to turn --- off the buffering. \"Double buffered\" simply means that --- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' and --- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint' are called automatically --- around expose events sent to the widget. --- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' diverts all --- drawing to a widget's window to an offscreen buffer, and --- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint' --- draws the buffer to the screen. The result is that users see the window --- update in one smooth step, and don't see individual graphics primitives --- being rendered. --- --- In very simple terms, double buffered widgets don't flicker, so you would --- only use this function to turn off double buffering if you had special needs --- and really knew what you were doing. --- --- Note: if you turn off double-buffering, you have to handle expose events, --- since even the clearing to the background color or pixmap will not happen --- automatically (as it is done in --- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaint'). --- -widgetSetDoubleBuffered :: WidgetClass self => self - -> Bool -- ^ @doubleBuffered@ - @True@ to double-buffer a widget - -> IO () -widgetSetDoubleBuffered self doubleBuffered = - {# call gtk_widget_set_double_buffered #} +widgetGetColormap :: WidgetClass self => self + -> IO Colormap -- ^ returns the colormap used by @widget@ +widgetGetColormap self = + makeNewGObject mkColormap $ + {# call gtk_widget_get_colormap #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 819 - (fromBool doubleBuffered) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 820 --- | Sets whether the entire widget is queued for drawing when its size --- allocation changes. By default, this setting is @True@ and the entire widget --- is redrawn on every size change. If your widget leaves the upper left --- unchanged when made bigger, turning this setting on will improve --- performance. --- --- Note that for \"no window\" widgets setting this flag to @False@ turns off --- all allocation on resizing: the widget will not even redraw if its position --- changes; this is to allow containers that don't draw anything to avoid --- excess invalidations. If you set this flag on a \"no window\" widget that --- /does/ draw its window, you are responsible for invalidating both --- the old and new allocation of the widget when the widget is moved and --- responsible for invalidating regions newly when the widget increases size. +-- %hash c:cba1 d:ffeb +-- | Sets the colormap for the widget to the given value. Widget must not have +-- been previously realized. This probably should only be used from an 'init' +-- function (i.e. from the constructor for the widget). hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 825 -widgetSetRedrawOnAllocate :: WidgetClass self => self - -> Bool -- ^ @redrawOnAllocate@ - if @True@, the entire widget will be - -- redrawn when it is allocated to a new size. Otherwise, only the - -- new portion of the widget will be redrawn. +widgetSetColormap :: WidgetClass self => self + -> Colormap -- ^ @colormap@ - a colormap hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 828 -widgetSetRedrawOnAllocate self redrawOnAllocate = - {# call gtk_widget_set_redraw_on_allocate #} - (toWidget self) - (fromBool redrawOnAllocate) - --- | Gets the widget's parent window. --- -widgetGetParentWindow :: WidgetClass self => self -> IO DrawWindow -widgetGetParentWindow self = - makeNewGObject mkDrawWindow $ - {# call gtk_widget_get_parent_window #} +widgetSetColormap self colormap = + {# call gtk_widget_set_colormap #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 831 + colormap hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 833 +-- %hash c:3522 d:5637 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 854 +-- %hash c:499d +-- | Determines whether @widget@ is somewhere inside @ancestor@, possibly with +-- intermediate containers. +-- +widgetIsAncestor :: (WidgetClass self, WidgetClass ancestor) => + self -- ^ @widget@ - the widget in question + -> ancestor -- ^ @ancestor@ - another 'Widget' + -> IO Bool -- ^ returns @True@ if @ancestor@ contains @widget@ as a child, + -- grandchild, great grandchild, etc. +widgetIsAncestor self ancestor = + liftM toBool $ + {# call unsafe widget_is_ancestor #} + (toWidget self) + (toWidget ancestor) + +-- %hash c:8661 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 899 --- | Obtains the full path to the widget. The path is simply the name of a +-- %hash c:596c d:b7e5 +-- | Sets the 'Style' for a widget. You probably don't want +-- to use this function; it interacts badly with themes, because themes work by +-- replacing the 'Style'. Instead, use 'widgetModifyStyle'. +-- +widgetSetStyle :: WidgetClass self => self + -> Maybe Style -- ^ @style@ - a 'Style', or @Nothing@ to remove the effect of a previous + -- 'widgetSetStyle' and go back to the default style + -> IO () +widgetSetStyle self style = + {# call gtk_widget_set_style #} + (toWidget self) + (fromMaybe (mkStyle nullForeignPtr) style) + +-- | Retrieve the 'Style' associated with the widget. +-- +widgetGetStyle :: WidgetClass widget => widget -> IO Style +widgetGetStyle widget = do + {# call gtk_widget_ensure_style #} (toWidget widget) + makeNewGObject mkStyle $ {# call gtk_widget_get_style #} (toWidget widget) + +-- %hash c:d5ed d:dc10 +-- | Pushes @cmap@ onto a global stack of colormaps; the topmost colormap on +-- the stack will be used to create all widgets. Remove @cmap@ with +-- 'widgetPopColormap'. There's little reason to use this function. +-- +widgetPushColormap :: + Colormap -- ^ @cmap@ - a 'Colormap' + -> IO () +widgetPushColormap cmap = + {# call gtk_widget_push_colormap #} + cmap + +-- %hash c:7300 d:2920 +-- | Removes a colormap pushed with 'widgetPushColormap'. +-- +widgetPopColormap :: IO () +widgetPopColormap = + {# call gtk_widget_pop_colormap #} + +-- %hash c:1f73 d:590e +-- | Sets the default colormap to use when creating widgets. +-- 'widgetPushColormap' is a better function to use if you only want to affect +-- a few widgets, rather than all widgets. +-- +widgetSetDefaultColormap :: + Colormap -- ^ @colormap@ - a 'Colormap' + -> IO () +widgetSetDefaultColormap colormap = + {# call gtk_widget_set_default_colormap #} + colormap + +-- %hash c:e71b d:72c2 +-- | Returns the default style used by all widgets initially. +-- +widgetGetDefaultStyle :: + IO Style -- ^ returns the default style. This 'Style' object is owned by + -- Gtk and should not be modified. +widgetGetDefaultStyle = + makeNewGObject mkStyle $ + {# call gtk_widget_get_default_style #} + +-- %hash c:d731 d:52bf +-- | Obtains the default colormap used to create widgets. +-- +widgetGetDefaultColormap :: + IO Colormap -- ^ returns default widget colormap +widgetGetDefaultColormap = + makeNewGObject mkColormap $ + {# call gtk_widget_get_default_colormap #} + +-- | Sets the reading direction on a particular widget. This direction +-- controls the primary direction for widgets containing text, and also the +-- direction in which the children of a container are packed. The ability to +-- set the direction is present in order so that correct localization into +-- languages with right-to-left reading directions can be done. Generally, +-- applications will let the default reading direction present, except for +-- containers where the containers are arranged in an order that is explicitely +-- visual rather than logical (such as buttons for text justification). +-- +-- If the direction is set to 'TextDirNone', then the value set by +-- 'widgetSetDefaultDirection' will be used. +-- +widgetSetDirection :: WidgetClass self => self -> TextDirection -> IO () +widgetSetDirection self dir = + {# call widget_set_direction #} + (toWidget self) + ((fromIntegral . fromEnum) dir) + +-- | Gets the reading direction for a particular widget. See +-- 'widgetSetDirection'. +-- +widgetGetDirection :: WidgetClass self => self -> IO TextDirection +widgetGetDirection self = + liftM (toEnum . fromIntegral) $ + {# call widget_get_direction #} + (toWidget self) + +-- %hash c:ff9a +-- | Sets the default reading direction for widgets where the direction has +-- not been explicitly set by 'widgetSetDirection'. +-- +widgetSetDefaultDirection :: [_$_] + TextDirection -- ^ @dir@ - the new default direction. This cannot be + -- 'TextDirNone'. + -> IO () +widgetSetDefaultDirection dir = + {# call gtk_widget_set_default_direction #} + ((fromIntegral . fromEnum) dir) + +-- | Obtains the current default reading direction. See +-- 'widgetSetDefaultDirection'. +-- +widgetGetDefaultDirection :: IO TextDirection +widgetGetDefaultDirection = + liftM (toEnum . fromIntegral) $ + {# call gtk_widget_get_default_direction #} + +-- %hash c:c7ba d:3a9c +-- | Sets a shape for this widget's 'DrawWindow'. This allows for transparent +-- windows etc., see 'windowShapeCombineMask' for more information. +-- +widgetShapeCombineMask :: WidgetClass self => self + -> Maybe Bitmap -- ^ @shapeMask@ - shape to be added, or @Nothint@ to remove an + -- existing shape. + -> Int -- ^ @offsetX@ - X position of shape mask with respect to @window@. + -> Int -- ^ @offsetY@ - Y position of shape mask with respect to @window@. + -> IO () +widgetShapeCombineMask self shapeMask offsetX offsetY = + case (fromMaybe (mkPixmap nullForeignPtr) shapeMask) of + Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr -> + {# call gtk_widget_shape_combine_mask #} + (toWidget self) + (castPtr bitmapPtr) + (fromIntegral offsetX) + (fromIntegral offsetY) + +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:3c29 d:68e2 +-- | Sets an input shape for this widget's GDK window. This allows for windows +-- which react to mouse click in a nonrectangular region, see +-- 'windowInputShapeCombineMask' for more information. +-- +-- * Available since Gtk+ version 2.10 +-- +widgetInputShapeCombineMask :: WidgetClass self => self + -> Maybe Bitmap -- ^ @shapeMask@ - shape to be added, or @Nothint@ to remove an + -- existing shape. + -> Int -- ^ @offsetX@ - X position of shape mask with respect to @window@. + -> Int -- ^ @offsetY@ - Y position of shape mask with respect to @window@. + -> IO () +widgetInputShapeCombineMask self shapeMask offsetX offsetY = + case (fromMaybe (mkPixmap nullForeignPtr) shapeMask) of + Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr -> + {# call gtk_widget_input_shape_combine_mask #} + (toWidget self) + (castPtr bitmapPtr) + (fromIntegral offsetX) + (fromIntegral offsetY) +#endif + +-- %hash c:7e36 d:616f +-- | Obtains the full path to @widget@. The path is simply the name of a hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1091 +-- %hash c:d4a6 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1114 +-- %hash c:769e hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1125 --- | Sets a widgets composite name. A child widget of a container is --- composite if it serves as an internal widget and, thus, is not --- added by the user. --- -widgetSetCompositeName :: WidgetClass self => self - -> String -- ^ @name@ - the name to set. - -> IO () -widgetSetCompositeName self name = - withUTFString name $ \namePtr -> - {# call gtk_widget_set_composite_name #} - (toWidget self) - namePtr - --- | Returns the parent container of @widget@. --- --- * Returns the parent container of @widget@ if it has one. --- -widgetGetParent :: WidgetClass self => self - -> IO (Maybe Widget) [_$_] -widgetGetParent self = do - parentPtr <- {# call gtk_widget_get_parent #} (toWidget self) - if parentPtr==nullPtr then return Nothing else - liftM Just $ makeNewObject mkWidget (return parentPtr) - --- | Sets the default reading direction for widgets where the direction has --- not been explicitly set by 'widgetSetDirection'. --- -widgetSetDefaultDirection :: [_$_] - TextDirection -- ^ @dir@ - the new default direction. This cannot be - -- 'TextDirNone'. - -> IO () -widgetSetDefaultDirection dir = - {# call gtk_widget_set_default_direction #} - ((fromIntegral . fromEnum) dir) - --- | Obtains the current default reading direction. See --- 'widgetSetDefaultDirection'. --- -widgetGetDefaultDirection :: IO TextDirection -widgetGetDefaultDirection = - liftM (toEnum . fromIntegral) $ - {# call gtk_widget_get_default_direction #} - --- | Retrieve the 'Style' associated with the widget. --- -widgetGetStyle :: WidgetClass widget => widget -> IO Style -widgetGetStyle widget = do - {# call gtk_widget_ensure_style #} (toWidget widget) - makeNewGObject mkStyle $ {# call gtk_widget_get_style #} (toWidget widget) - hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1168 +-- %hash c:5550 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1185 +-- %hash c:2c5 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1209 +-- %hash c:d2ba hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1228 +-- %hash c:ac08 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1254 +-- %hash c:38d7 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1299 +-- | Prepare text for display. +-- +-- The 'PangoLayout' represents the rendered text. It can be shown on screen +-- by calling 'Graphics.UI.Gtk.Gdk.Drawable.drawLayout'. +-- +-- The returned 'PangoLayout' shares the same font information ('PangoContext') as this +-- widget. If this information changes, the 'PangoLayout' should change. The +-- following code ensures that the displayed text always reflects the widget's +-- settings: +-- +-- > l <- widgetCreateLayout w "My Text." +-- > let update = do +-- > layoutContextChanged l +-- > -- update the Drawables which show this layout +-- > w `onDirectionChanged` update +-- > w `onStyleChanged` update +-- +widgetCreateLayout :: WidgetClass self => self + -> String -- ^ @text@ - text to set on the layout + -> IO PangoLayout +widgetCreateLayout self text = do + pl <- constructNewGObject mkPangoLayoutRaw $ + withUTFString text $ \textPtr -> + {# call unsafe widget_create_pango_layout #} + (toWidget self) + textPtr + ps <- makeNewPangoString text + psRef <- newIORef ps + return (PangoLayout psRef pl) + +-- %hash c:cee d:1d29 hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1345 - -> StockId -- ^ the stock ID of the icon - -> IconSize -- ^ @size@ - a stock size. The size - -- 'Graphics.UI.Gtk.General.IconFactory.IconSizeInvalid' means - -- render at the size of the source and don't scale (if there are - -- multiple source sizes, Gtk+ picks one of the available sizes). - -> String -- ^ @detail@ - render detail to pass to theme engine - -> IO (Maybe Pixbuf) -- ^ the new 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' - -- if the stock icon was found -widgetRenderIcon self stockId size detail = do - pixbufPtr <- - withUTFString detail $ \detailPtr -> - withUTFString stockId $ \stockIdPtr -> - {# call gtk_widget_render_icon #} - (toWidget self) stockIdPtr ((fromIntegral . fromEnum) size) detailPtr - if pixbufPtr==nullPtr then return Nothing else [_$_] - liftM Just $ constructNewGObject mkPixbuf (return pixbufPtr) + -> String -- ^ @stockId@ - a stock ID + -> IconSize -- ^ @size@ - a stock size + -> String -- ^ @detail@ - render detail to pass to theme engine + -> IO (Maybe Pixbuf) -- ^ returns a new pixbuf, or @Nothing@ if the stock ID + -- wasn't known +widgetRenderIcon self stockId size detail = + maybeNull (makeNewGObject mkPixbuf) $ + withUTFString detail $ \detailPtr -> + withUTFString stockId $ \stockIdPtr -> + {# call gtk_widget_render_icon #} + (toWidget self) + stockIdPtr + ((fromIntegral . fromEnum) size) + detailPtr hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1360 --- | Set if this widget can receive keyboard input. +-- %hash c:62f d:1863 +-- | Invalidates the rectangular area of @widget@ defined by @x@, @y@, @width@ +-- and @height@ by calling +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' on the widget's +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawWindow' and all its child windows. Once +-- the main loop becomes idle (after the current batch of events has been +-- processed, roughly), the window will receive expose events for the union of +-- all regions that have been invalidated. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1369 --- * To use the 'onKeyPress' event, the widget must be allowed --- to get the input focus. Once it has the input focus all keyboard --- input is directed to this widget. +-- Normally you would only use this function in widget implementations. In +-- particular, you might use it, or +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' directly, to +-- schedule a redraw of a 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawingArea' or some +-- portion thereof. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1375 -widgetSetCanFocus :: WidgetClass self => self -> Bool -> IO () -widgetSetCanFocus = objectSetPropertyBool "can_focus" +-- Frequently you can just call +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRect' or +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRegion' instead of this +-- function. Those functions will invalidate only a single window, instead of +-- the widget and all its children. +-- +-- The advantage of adding to the invalidated region compared to simply +-- drawing immediately is efficiency; using an invalid region ensures that you +-- only have to redraw one time. +-- +widgetQueueDrawArea :: WidgetClass self => self + -> Int -- ^ @x@ - x coordinate of upper-left corner of rectangle to redraw + -> Int -- ^ @y@ - y coordinate of upper-left corner of rectangle to redraw + -> Int -- ^ @width@ - width of region to draw + -> Int -- ^ @height@ - height of region to draw + -> IO () +widgetQueueDrawArea self x y width height = + {# call gtk_widget_queue_draw_area #} + (toWidget self) + (fromIntegral x) + (fromIntegral y) + (fromIntegral width) + (fromIntegral height) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1399 --- | Check if this widget can receive keyboard input. +-- %hash c:5ffb d:3e1a +-- | Recursively resets the shape on this widget and its descendants. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1402 -widgetGetCanFocus :: WidgetClass self => self -> IO Bool -widgetGetCanFocus = objectGetPropertyBool "can_focus" +widgetResetShapes :: WidgetClass self => self -> IO () +widgetResetShapes self = + {# call gtk_widget_reset_shapes #} + (toWidget self) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1407 -widgetGetColormap :: WidgetClass self => self - -> IO Colormap -- ^ returns the colormap used by @widget@ -widgetGetColormap self = - makeNewGObject mkColormap $ - {# call gtk_widget_get_colormap #} +-- | Sets whether the application intends to draw on the widget in response +-- to an 'onExpose' signal. +-- +-- * This is a hint to the widget and does not affect the behavior of the +-- GTK+ core; many widgets ignore this flag entirely. For widgets that do +-- pay attention to the flag, such as 'EventBox' and 'Window', the effect +-- is to suppress default themed drawing of the widget's background. +-- (Children of the widget will still be drawn.) The application is then +-- entirely responsible for drawing the widget background. +-- +widgetSetAppPaintable :: WidgetClass self => self + -> Bool -- ^ @appPaintable@ - @True@ if the application will paint on the + -- widget + -> IO () +widgetSetAppPaintable self appPaintable = + {# call widget_set_app_paintable #} hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1424 + (fromBool appPaintable) hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1426 -widgetSetColormap :: WidgetClass self => self - -> Colormap -- ^ @colormap@ - a colormap +-- %hash c:89b2 d:e14d +-- | Widgets are double buffered by default; you can use this function to turn +-- off the buffering. \"Double buffered\" simply means that +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' and +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint' are called automatically +-- around expose events sent to the widget. +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' diverts all +-- drawing to a widget's window to an offscreen buffer, and +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint' +-- draws the buffer to the screen. The result is that users see the window +-- update in one smooth step, and don't see individual graphics primitives +-- being rendered. +-- +-- In very simple terms, double buffered widgets don't flicker, so you would +-- only use this function to turn off double buffering if you had special needs +-- and really knew what you were doing. +-- +-- Note: if you turn off double-buffering, you have to handle expose events, +-- since even the clearing to the background color or pixmap will not happen +-- automatically (as it is done in +-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaint'). +-- +widgetSetDoubleBuffered :: WidgetClass self => self + -> Bool -- ^ @doubleBuffered@ - @True@ to double-buffer a widget hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 1451 -widgetSetColormap self colormap = - {# call gtk_widget_set_colormap #} +widgetSetDoubleBuffered self doubleBuffered = + {# call gtk_widget_set_double_buffered #} + (toWidget self) + (fromBool doubleBuffered) + +-- %hash c:d61 d:ac24 +-- | Sets whether the entire widget is queued for drawing when its size +-- allocation changes. By default, this setting is @True@ and the entire widget +-- is redrawn on every size change. If your widget leaves the upper left +-- unchanged when made bigger, turning this setting on will improve +-- performance. +-- +-- Note that for \"no window\" widgets setting this flag to @False@ turns off +-- all allocation on resizing: the widget will not even redraw if its position +-- changes; this is to allow containers that don't draw anything to avoid +-- excess invalidations. If you set this flag on a \"no window\" widget that +-- /does/ draw its window, you are responsible for invalidating both +-- the old and new allocation of the widget when the widget is moved and +-- responsible for invalidating regions newly when the widget increases size. +-- +widgetSetRedrawOnAllocate :: WidgetClass self => self + -> Bool -- ^ @redrawOnAllocate@ - if @True@, the entire widget will be + -- redrawn when it is allocated to a new size. Otherwise, only the + -- new portion of the widget will be redrawn. + -> IO () +widgetSetRedrawOnAllocate self redrawOnAllocate = + {# call gtk_widget_set_redraw_on_allocate #} + (toWidget self) + (fromBool redrawOnAllocate) + +-- | Sets a widgets composite name. A child widget of a container is +-- composite if it serves as an internal widget and, thus, is not +-- added by the user. +-- +widgetSetCompositeName :: WidgetClass self => self + -> String -- ^ @name@ - the name to set. + -> IO () +widgetSetCompositeName self name = + withUTFString name $ \namePtr -> + {# call gtk_widget_set_composite_name #} + (toWidget self) + namePtr + +-- %hash c:5c58 d:6895 +-- | For widgets that support scrolling, sets the scroll adjustments and +-- returns @True@. For widgets that don't support scrolling, does nothing and +-- returns @False@. Widgets that don't support scrolling can be scrolled by +-- placing them in a 'Viewport', which does support scrolling. +-- +widgetSetScrollAdjustments :: WidgetClass self => self + -> Maybe Adjustment -- ^ @hadjustment@ - an adjustment for horizontal scrolling, or + -- @Nothing@ + -> Maybe Adjustment -- ^ @vadjustment@ - an adjustment for vertical scrolling, or + -- @Nothing@ + -> IO Bool -- ^ returns @True@ if the widget supports scrolling +widgetSetScrollAdjustments self hadjustment vadjustment = + liftM toBool $ + {# call gtk_widget_set_scroll_adjustments #} + (toWidget self) + (fromMaybe (mkAdjustment nullForeignPtr) hadjustment) + (fromMaybe (mkAdjustment nullForeignPtr) vadjustment) + +-- | Computes the intersection of a widget's area and @region@, returning +-- the intersection. The result may be empty, use +-- 'Graphics.UI.Gtk.Gdk.Region.regionEmpty' to check. +-- +widgetRegionIntersect :: WidgetClass self => self + -> Region -- ^ @region@ - a 'Region' in the same coordin... [truncated message content] |
From: Axel S. <si...@co...> - 2008-08-21 21:25:02
|
Thu Aug 21 17:16:58 EDT 2008 A....@ke... * Add getter and setter for Maybe Objects. hunk ./glib/System/Glib/GValueTypes.chs 63 + valueGetMaybeGObject, hunk ./glib/System/Glib/GValueTypes.chs 226 -valueSetMaybeGObject :: GObjectClass gobj => GValue -> (Maybe gobj) -> IO () -valueSetMaybeGObject gvalue (Just obj) = valueSetGObject gvalue obj -valueSetMaybeGObject gvalue Nothing = - {# call unsafe g_value_set_object #} gvalue nullPtr - hunk ./glib/System/Glib/GValueTypes.chs 235 + +valueSetMaybeGObject :: GObjectClass gobj => GValue -> (Maybe gobj) -> IO () +valueSetMaybeGObject gvalue (Just obj) = valueSetGObject gvalue obj +valueSetMaybeGObject gvalue Nothing = + {# call unsafe g_value_set_object #} gvalue nullPtr + +valueGetMaybeGObject :: GObjectClass gobj => GValue -> IO (Maybe gobj) +valueGetMaybeGObject gvalue = + liftM (liftM unsafeCastGObject) $ + maybeNull (makeNewGObject mkGObject) $ + liftM castPtr $ + {# call unsafe value_get_object #} gvalue hunk ./glib/System/Glib/Properties.chs 84 - + newAttrFromMaybeObjectProperty, + [_$_] hunk ./glib/System/Glib/Properties.chs 217 +objectSetPropertyMaybeGObject :: (GObjectClass gobj, GObjectClass gobj') => GType -> String -> gobj -> (Maybe gobj') -> IO () +objectSetPropertyMaybeGObject gtype = objectSetPropertyInternal gtype valueSetMaybeGObject + +objectGetPropertyMaybeGObject :: (GObjectClass gobj, GObjectClass gobj') => GType -> String -> gobj -> IO (Maybe gobj') +objectGetPropertyMaybeGObject gtype = objectGetPropertyInternal gtype valueGetMaybeGObject + hunk ./glib/System/Glib/Properties.chs 316 +newAttrFromMaybeObjectProperty :: (GObjectClass gobj, GObjectClass gobj', GObjectClass gobj'') => String -> GType -> ReadWriteAttr gobj (Maybe gobj') (Maybe gobj'') +newAttrFromMaybeObjectProperty propName gtype = + newAttr (objectGetPropertyMaybeGObject gtype propName) (objectSetPropertyMaybeGObject gtype propName) + [_$_] |
From: Axel S. <si...@co...> - 2008-07-22 20:38:57
|
Sun Jul 13 05:28:51 EDT 2008 ha...@fi... * Missing window focus functions hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 83 + windowGetFocus, + windowSetFocus, + windowSetDefault, hunk ./gtk/Graphics/UI/Gtk/Windows/Window.chs.pp 501 +-- | Retrieves the current focused widget within the window. +-- | Note that this is the widget that would have the focus if the toplevel +-- | window focused; if the toplevel window is not focused then +-- | 'widgetHasFocus' will not be True for the widget. +-- +windowGetFocus :: WindowClass self => self -> IO (Maybe Widget) +windowGetFocus self = + maybeNull (makeNewObject mkWidget) $ + {# call unsafe gtk_window_get_focus #} + (toWindow self) + +-- | If focus is not the current focus widget, and is focusable, sets it as +-- | the focus widget for the window. If focus is Nothing, unsets the focus +-- | widget for this window. To set the focus to a particular widget in the +-- | toplevel, it is usually more convenient to use 'widgetGrabFocus' instead +-- | of this function. +-- +windowSetFocus :: (WindowClass self, WidgetClass widget) => self + -> Maybe widget + -> IO () +windowSetFocus self focus = + {# call unsafe gtk_window_set_focus #} + (toWindow self) + (maybe (Widget nullForeignPtr) toWidget focus) + +-- | The default widget is the widget that's activated when the user presses +-- | Enter in a dialog (for example). This function sets or unsets the default +-- | widget for a Window about. When setting (rather than unsetting) the +-- | default widget it's generally easier to call widgetGrabDefault on the +-- | widget. Before making a widget the default widget, you must set the +-- | 'widgetCanDefault' flag on the widget. +-- +windowSetDefault :: (WindowClass self, WidgetClass widget) => self + -> Maybe widget + -> IO () +windowSetDefault self defaultWidget = + {# call unsafe gtk_window_set_focus #} + (toWindow self) + (maybe (Widget nullForeignPtr) toWidget defaultWidget) + |
From: Axel S. <si...@co...> - 2008-07-22 20:38:54
|
Sun Jul 13 05:35:09 EDT 2008 ha...@fi... * Add `isA` function to GObjectClass and gType* functions for each type You can use this function to test the type of an object. For instance.. when (obj `isA` gTypeNotebook) doSomething $ castToNotebook obj hunk ./glib/System/Glib/GObject.chs.pp 44 + -- ** GType queries + isA, + hunk ./glib/System/Glib/GObject.chs.pp 71 -import System.Glib.GType (GType) +import System.Glib.GType (GType, typeInstanceIsA) hunk ./glib/System/Glib/GObject.chs.pp 237 +-- | Determine if this is an instance of a particular GTK type +-- +isA :: GObjectClass o => o -> GType -> Bool +isA obj gType = [_$_] + typeInstanceIsA ((unsafeForeignPtrToPtr.castForeignPtr.unGObject.toGObject) obj) gType + + hunk ./tools/hierarchyGen/TypeGen.hs 190 - indent 1.ss "castTo".ss n + indent 1.ss "castTo".ss n.ss ", gType".ss n hunk ./tools/hierarchyGen/TypeGen.hs 198 - . makeUpcast typeTable obj + . makeUpcast obj + . makeGType typeTable obj hunk ./tools/hierarchyGen/TypeGen.hs 202 -makeUpcast :: TypeTable -> [String] -> ShowS -makeUpcast table [obj] = id -- no casting for GObject -makeUpcast table (obj:_:_) = [_$_] +makeUpcast :: [String] -> ShowS +makeUpcast [obj] = id -- no casting for GObject +makeUpcast (obj:_:_) = [_$_] hunk ./tools/hierarchyGen/TypeGen.hs 206 - indent 0.ss "castTo".ss obj.ss " = castTo". + indent 0.ss "castTo".ss obj.ss " = castTo gType".ss obj.ss " \"".ss obj.ss "\"". + indent 0 + +makeGType :: TypeTable -> [String] -> ShowS +makeGType table [obj] = id -- no GType for GObject +makeGType table (obj:_:_) = [_$_] + indent 0.ss "gType".ss obj.ss " :: GType". + indent 0.ss "gType".ss obj.ss " =". hunk ./tools/hierarchyGen/TypeGen.hs 218 - ss " #} \"".ss obj.ss "\"". + ss " #}". |
From: Axel S. <si...@co...> - 2008-07-21 20:42:59
|
Mon Jul 21 16:40:57 EDT 2008 A....@ke... * Add Show instance to Event structure. hunk ./gtk/Graphics/UI/Gtk/Gdk/Events.hsc 324 - } + } deriving Show hunk ./gtk/Graphics/UI/Gtk/Gdk/Region.chs.pp 67 +instance Show Region where + show r = show (unsafePerformIO (regionGetRectangles r)) + [_$_] hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 138 - deriving Eq + deriving (Eq,Show,Enum) |
From: <du...@co...> - 2008-07-14 15:42:15
|
Mon Jul 14 11:02:59 EDT 2008 Duncan Coutts <du...@ha...> * We do not need -fvia-C just because we are using -fffi It used to be recommended practise but no longer. In addition -fvia-C causes problems on ppc32. hunk ./Makefile.am 220 -tools_c2hs_toplevel_C2HSConfig_hs_HCFLAGS = -fffi -fvia-C \ - '-\#include<c2hs_config.h>' +tools_c2hs_toplevel_C2HSConfig_hs_HCFLAGS = -fffi '-\#include<c2hs_config.h>' |
From: Axel S. <si...@co...> - 2008-07-09 00:11:33
|
Tue Jul 8 15:29:54 EDT 2008 A....@ke... * Renamed the Container.chs file to Container.chs.pp hunk ./Makefile.am 426 - gtk/Graphics/UI/Gtk/Abstract/Container.chs \ + gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp \ hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs 1 --- -*-haskell-*- --- GIMP Toolkit (GTK) Widget Container --- --- Author : Axel Simon --- --- Created: 15 May 2001 --- --- Copyright (C) 1999-2005 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) --- --- Base class for widgets which contain other widgets --- -module Graphics.UI.Gtk.Abstract.Container ( --- * Detail --- [_$_] --- | A Gtk+ user interface is constructed by nesting widgets inside widgets. --- Container widgets are the inner nodes in the resulting tree of widgets: they --- contain other widgets. So, for example, you might have a 'Window' containing --- a 'Frame' containing a 'Label'. If you wanted an image instead of a textual --- label inside the frame, you might replace the 'Label' widget with a 'Image' --- widget. --- --- There are two major kinds of container widgets in Gtk+. Both are --- subclasses of the abstract 'Container' base class. --- --- The first type of container widget has a single child widget and derives --- from 'Bin'. These containers are decorators, which add some kind of --- functionality to the child. For example, a 'Button' makes its child into a --- clickable button; a 'Frame' draws a frame around its child and a 'Window' --- places its child widget inside a top-level window. --- --- The second type of container can have more than one child; its purpose is --- to manage layout. This means that these containers assign sizes and --- positions to their children. For example, a 'HBox' arranges its children in --- a horizontal row, and a 'Table' arranges the widgets it contains in a --- two-dimensional grid. --- --- To fulfill its task, a layout container must negotiate the size --- requirements with its parent and its children. This negotiation is carried --- out in two phases, size requisition and size allocation. - --- ** Size Requisition --- [_$_] --- | The size requisition of a widget is it's desired width and height. This --- is represented by a 'Requisition'. --- --- How a widget determines its desired size depends on the widget. A --- 'Label', for example, requests enough space to display all its text. --- Container widgets generally base their size request on the requisitions of --- their children. --- --- The size requisition phase of the widget layout process operates --- top-down. It starts at a top-level widget, typically a 'Window'. The --- top-level widget asks its child for its size requisition by calling --- 'widgetSizeRequest'. To determine its requisition, the child asks its own --- children for their requisitions and so on. Finally, the top-level widget --- will get a requisition back from its child. - --- ** Size Allocation --- [_$_] --- | When the top-level widget has determined how much space its child would --- like to have, the second phase of the size negotiation, size allocation, --- begins. Depending on its configuration (see 'windowSetResizable'), the --- top-level widget may be able to expand in order to satisfy the size request --- or it may have to ignore the size request and keep its fixed size. It then --- tells its child widget how much space it gets by calling --- 'widgetSizeAllocate'. The child widget divides the space among its children --- and tells each child how much space it got, and so on. Under normal --- circumstances, a 'Window' will always give its child the amount of space the --- child requested. --- --- A child's size allocation is represented by an 'Allocation'. --- This contains not only a width and height, but also a --- position (i.e. X and Y coordinates), so that containers can tell their --- children not only how much space they have gotten, but also where they are --- positioned inside the space available to the container. --- --- Widgets are required to honor the size allocation they receive; a size --- request is only a request, and widgets must be able to cope with any size. - --- ** Child attributes --- [_$_] --- | 'Container' introduces child attributes - these are object attributes --- that are not specific to either the container or the contained widget, but --- rather to their relation. Typical examples of child attributes are the --- position or pack-type of a widget which is contained in a 'Box'. --- --- The 'Container' class does not itself define any child attributes, they are --- defined (and documented) by the various 'Container' subclasses. --- --- Child attributes can be set or obtained in a similar way to ordinary --- attributes. So ordinary attributes are set like so: --- --- > set object [ attr := value ] --- --- Whereas child attributes take the child object as a parameter: --- --- > set container [ attr child := value ] --- [_$_] --- And similarily for getting a child attribute's value: --- --- > value <- get container (attr child) --- - --- * Class Hierarchy --- | --- @ --- | 'GObject' --- | +----'Object' --- | +----'Widget' --- | +----Container --- | +----'Bin' --- | +----'Box' --- | +----'CList' --- | +----'Fixed' --- | +----'Paned' --- | +----'IconView' --- | +----'Layout' --- | +----'List' --- | +----'MenuShell' --- | +----'Notebook' --- | +----'Socket' --- | +----'Table' --- | +----'TextView' --- | +----'Toolbar' --- | +----'TreeView' --- @ - --- * Types - Container, - ContainerClass, - castToContainer, - toContainer, - ContainerForeachCB, - ResizeMode(..), - --- * Methods - containerAdd, - containerRemove, - containerForeach, - containerForall, - containerGetChildren, - containerSetFocusChild, - containerSetFocusChain, - containerGetFocusChain, - containerUnsetFocusChain, - containerSetFocusVAdjustment, - containerGetFocusVAdjustment, - containerSetFocusHAdjustment, - containerGetFocusHAdjustment, - containerResizeChildren, - containerSetBorderWidth, - containerGetBorderWidth, - containerGetResizeMode, - containerSetResizeMode, - --- * Attributes - containerResizeMode, - containerBorderWidth, - containerChild, - containerFocusHAdjustment, - containerFocusVAdjustment, - --- * Signals - onAdd, - afterAdd, - onCheckResize, - afterCheckResize, - onRemove, - afterRemove, - onSetFocusChild, - afterSetFocusChild, - ) where - -import Control.Monad (liftM) - -import System.Glib.FFI -import System.Glib.Attributes -import System.Glib.Properties -import Graphics.UI.Gtk.Abstract.Object (makeNewObject) -{#import Graphics.UI.Gtk.Types#} -{#import Graphics.UI.Gtk.Signals#} -import System.Glib.GList (fromGList, toGList) -import Graphics.UI.Gtk.General.Enums (ResizeMode(..)) - -{# context lib="gtk" prefix="gtk" #} - --------------------- --- Methods - --- | Adds @widget@ to the container. Typically used for simple containers such --- as 'Window', 'Frame', or 'Button'; for more complicated layout containers --- such as 'Box' or 'Table', this function will pick default packing parameters --- that may not be correct. So consider functions such as 'boxPackStart' and --- 'tableAttach' as an alternative to 'containerAdd' in those cases. A widget --- may be added to only one container at a time; you can't place the same --- widget inside two different containers. --- -containerAdd :: (ContainerClass self, WidgetClass widget) => self - -> widget -- ^ @widget@ - a widget to be placed inside @container@ - -> IO () -containerAdd self widget = - {# call container_add #} - (toContainer self) - (toWidget widget) - --- | Removes @widget@ from @container@. @widget@ must be inside @container@. --- -containerRemove :: (ContainerClass self, WidgetClass widget) => self - -> widget -- ^ @widget@ - a current child of @container@ - -> IO () -containerRemove self widget = - {# call container_remove #} - (toContainer self) - (toWidget widget) - --- | Maps @callback@ over each non-internal child of @container@. See --- 'containerForall' for details on what constitutes an \"internal\" child. --- Most applications should use 'containerForeach', rather than --- 'containerForall'. --- -containerForeach :: ContainerClass self => self - -> ContainerForeachCB - -> IO () -containerForeach self fun = do - fPtr <- mkContainerForeachFunc (\wPtr _ -> do - w <- makeNewObject mkWidget (return wPtr) - fun w) - {# call container_foreach #} - (toContainer self) - fPtr - nullPtr - freeHaskellFunPtr fPtr - --- | A function that is invoked for all widgets in a container. -type ContainerForeachCB = Widget -> IO () -{#pointer Callback#} - -foreign import ccall "wrapper" mkContainerForeachFunc :: - (Ptr Widget -> Ptr () -> IO ()) -> IO Callback - --- | Maps @callback@ over each child of @container@, including children that --- are considered \"internal\" (implementation details of the container). --- \"Internal\" children generally weren't added by the user of the container, --- but were added by the container implementation itself. Most applications --- should use 'containerForeach', rather than 'containerForall'. --- -containerForall :: ContainerClass self => self - -> ContainerForeachCB -- ^ @callback@ - a callback - -> IO () -containerForall self fun = do - fPtr <- mkContainerForeachFunc (\wPtr _ -> do - w <- makeNewObject mkWidget (return wPtr) - fun w) - {# call container_forall #} - (toContainer self) - fPtr - nullPtr - freeHaskellFunPtr fPtr - --- | Returns the container's non-internal children. See 'containerForall' for --- details on what constitutes an \"internal\" child. --- -containerGetChildren :: ContainerClass self => self - -> IO [Widget] -containerGetChildren self = do - glist <- {# call container_get_children #} (toContainer self) - widgetPtrs <- fromGList glist - mapM (makeNewObject mkWidget . return) widgetPtrs - --- | Give the focus to a specific child of the container. --- -containerSetFocusChild :: (ContainerClass self, WidgetClass child) => self - -> child -- ^ @child@ - -> IO () -containerSetFocusChild self child = - {# call container_set_focus_child #} - (toContainer self) - (toWidget child) - --- | Sets a focus chain, overriding the one computed automatically by Gtk+. --- --- In principle each widget in the chain should be a descendant of the --- container, but this is not enforced by this method, since it's allowed to --- set the focus chain before you pack the widgets, or have a widget in the --- chain that isn't always packed. The necessary checks are done when the focus --- chain is actually traversed. --- -containerSetFocusChain :: ContainerClass self => self - -> [Widget] -- ^ @focusableWidgets@ - the new focus chain. - -> IO () -containerSetFocusChain self chain = - withForeignPtrs (map unWidget chain) $ \wPtrs -> do - glist <- toGList wPtrs - {# call container_set_focus_chain #} - (toContainer self) - glist - --- | Retrieves the focus chain of the container, if one has been set --- explicitly. If no focus chain has been explicitly set, Gtk+ computes the --- focus chain based on the positions of the children. In that case the --- function returns @Nothing@. --- -containerGetFocusChain :: ContainerClass self => self - -> IO (Maybe [Widget]) -containerGetFocusChain self = - alloca $ \glistPtr -> do - {# call container_get_focus_chain #} - (toContainer self) - glistPtr - if glistPtr == nullPtr then return Nothing else liftM Just $ do - glist <- peek glistPtr - widgetPtrs <- fromGList glist - mapM (makeNewObject mkWidget . return) widgetPtrs - --- | Removes a focus chain explicitly set with 'containerSetFocusChain'. --- -containerUnsetFocusChain :: ContainerClass self => self -> IO () -containerUnsetFocusChain self = - {# call container_unset_focus_chain #} - (toContainer self) - --- | Hooks up an adjustment to focus handling in a container, so when a child --- of the container is focused, the adjustment is scrolled to show that widget. --- This function sets the vertical alignment. See --- 'scrolledWindowGetVAdjustment' for a typical way of obtaining the adjustment --- and 'containerSetFocusHAdjustment' for setting the horizontal adjustment. --- --- The adjustments have to be in pixel units and in the same coordinate --- system as the allocation for immediate children of the container. --- -containerSetFocusVAdjustment :: ContainerClass self => self - -> Adjustment -- ^ @adjustment@ - an adjustment which should be adjusted when - -- the focus is moved among the descendents of @container@ - -> IO () -containerSetFocusVAdjustment self adjustment = - {# call container_set_focus_vadjustment #} - (toContainer self) - adjustment - --- | Retrieves the vertical focus adjustment for the container. See --- 'containerSetFocusVAdjustment'. --- -containerGetFocusVAdjustment :: ContainerClass self => self - -> IO (Maybe Adjustment) -- ^ returns the vertical focus adjustment, or - -- @Nothing@ if none has been set. -containerGetFocusVAdjustment self = - maybeNull (makeNewObject mkAdjustment) $ - {# call unsafe container_get_focus_vadjustment #} - (toContainer self) - --- | Hooks up an adjustment to focus handling in a container, so when a child --- of the container is focused, the adjustment is scrolled to show that widget. --- This function sets the horizontal alignment. See --- 'scrolledWindowGetHAdjustment' for a typical way of obtaining the adjustment --- and 'containerSetFocusVAdjustment' for setting the vertical adjustment. --- --- The adjustments have to be in pixel units and in the same coordinate --- system as the allocation for immediate children of the container. --- -containerSetFocusHAdjustment :: ContainerClass self => self - -> Adjustment -- ^ @adjustment@ - an adjustment which should be adjusted when - -- the focus is moved among the descendents of @container@ - -> IO () -containerSetFocusHAdjustment self adjustment = - {# call container_set_focus_hadjustment #} - (toContainer self) - adjustment - --- | Retrieves the horizontal focus adjustment for the container. See --- 'containerSetFocusHAdjustment'. --- -containerGetFocusHAdjustment :: ContainerClass self => self - -> IO (Maybe Adjustment) -- ^ returns the horizontal focus adjustment, or - -- @Nothing@ if none has been set. -containerGetFocusHAdjustment self = - maybeNull (makeNewObject mkAdjustment) $ - {# call unsafe container_get_focus_hadjustment #} - (toContainer self) - --- | Make the container resize its children. --- -containerResizeChildren :: ContainerClass self => self -> IO () -containerResizeChildren self = - {# call container_resize_children #} - (toContainer self) - --- | Sets the border width of the container. --- --- The border width of a container is the amount of space to leave around --- the outside of the container. The only exception to this is 'Window'; --- because toplevel windows can't leave space outside, they leave the space --- inside. The border is added on all sides of the container. To add space to --- only one side, one approach is to create a 'Alignment' widget, call --- 'widgetSetUsize' to give it a size, and place it on the side of the --- container as a spacer. --- -containerSetBorderWidth :: ContainerClass self => self - -> Int -- ^ @borderWidth@ - amount of blank space to leave /outside/ the - -- container. Valid values are in the range 0-65535 pixels. - -> IO () -containerSetBorderWidth self borderWidth = - {# call container_set_border_width #} - (toContainer self) - (fromIntegral borderWidth) - --- | Retrieves the border width of the container. See --- 'containerSetBorderWidth'. --- -containerGetBorderWidth :: ContainerClass self => self - -> IO Int -- ^ returns the current border width -containerGetBorderWidth self = - liftM fromIntegral $ - {# call unsafe container_get_border_width #} - (toContainer self) - --- | Returns the resize mode for the container. See 'containerSetResizeMode'. --- -containerGetResizeMode :: ContainerClass self => self - -> IO ResizeMode -- ^ returns the current resize mode -containerGetResizeMode self = - liftM (toEnum . fromIntegral) $ - {# call gtk_container_get_resize_mode #} - (toContainer self) - --- | Sets the resize mode for the container. --- --- The resize mode of a container determines whether a resize request will --- be passed to the container's parent, queued for later execution or executed --- immediately. --- -containerSetResizeMode :: ContainerClass self => self - -> ResizeMode -- ^ @resizeMode@ - the new resize mode. - -> IO () -containerSetResizeMode self resizeMode = - {# call gtk_container_set_resize_mode #} - (toContainer self) - ((fromIntegral . fromEnum) resizeMode) - --------------------- --- Attributes - --- | Specify how resize events are handled. --- --- Default value: 'ResizeParent' --- -containerResizeMode :: ContainerClass self => Attr self ResizeMode -containerResizeMode = newAttr - containerGetResizeMode - containerSetResizeMode - --- | The width of the empty border outside the containers children. --- --- Allowed values: \<= @('maxBound' :: Int)@ --- --- Default value: 0 --- -containerBorderWidth :: ContainerClass self => Attr self Int -containerBorderWidth = newAttr - containerGetBorderWidth - containerSetBorderWidth - --- | Can be used to add a new child to the container. --- -containerChild :: (ContainerClass self, WidgetClass widget) => WriteAttr self widget -containerChild = writeAttrFromObjectProperty "child" - {# call pure unsafe gtk_widget_get_type #} - --- | \'focusHadjustment\' property. See 'containerGetFocusHAdjustment' and --- 'containerSetFocusHAdjustment' --- -containerFocusHAdjustment :: ContainerClass self => ReadWriteAttr self (Maybe Adjustment) Adjustment -containerFocusHAdjustment = newAttr - containerGetFocusHAdjustment - containerSetFocusHAdjustment - --- | \'focusVadjustment\' property. See 'containerGetFocusVAdjustment' and --- 'containerSetFocusVAdjustment' --- -containerFocusVAdjustment :: ContainerClass self => ReadWriteAttr self (Maybe Adjustment) Adjustment -containerFocusVAdjustment = newAttr - containerGetFocusVAdjustment - containerSetFocusVAdjustment - --------------------- --- Signals - --- | This signal is called each time a new widget is added to this container. --- -onAdd, afterAdd :: ContainerClass self => self - -> (Widget -> IO ()) - -> IO (ConnectId self) -onAdd = connect_OBJECT__NONE "add" False -afterAdd = connect_OBJECT__NONE "add" True - --- | This signal is called when the widget is resized. --- -onCheckResize, afterCheckResize :: ContainerClass self => self - -> IO () - -> IO (ConnectId self) -onCheckResize = connect_NONE__NONE "check-resize" False -afterCheckResize = connect_NONE__NONE "check-resize" True - --- | This signal is called for each widget that is removed from the container. --- -onRemove, afterRemove :: ContainerClass self => self - -> (Widget -> IO ()) - -> IO (ConnectId self) -onRemove = connect_OBJECT__NONE "remove" False -afterRemove = connect_OBJECT__NONE "remove" True - --- | This signal is called if a child in the container receives the input --- focus. --- -onSetFocusChild, afterSetFocusChild :: ContainerClass self => self - -> (Widget -> IO ()) - -> IO (ConnectId self) -onSetFocusChild = connect_OBJECT__NONE "set-focus-child" False -afterSetFocusChild = connect_OBJECT__NONE "set-focus-child" True rmfile ./gtk/Graphics/UI/Gtk/Abstract/Container.chs addfile ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp hunk ./gtk/Graphics/UI/Gtk/Abstract/Container.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget Container +-- +-- Author : Axel Simon +-- +-- Created: 15 May 2001 +-- +-- Copyright (C) 1999-2005 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) +-- +-- Base class for widgets which contain other widgets +-- +module Graphics.UI.Gtk.Abstract.Container ( +-- * Detail +-- [_$_] +-- | A Gtk+ user interface is constructed by nesting widgets inside widgets. +-- Container widgets are the inner nodes in the resulting tree of widgets: they +-- contain other widgets. So, for example, you might have a 'Window' containing +-- a 'Frame' containing a 'Label'. If you wanted an image instead of a textual +-- label inside the frame, you might replace the 'Label' widget with a 'Image' +-- widget. +-- +-- There are two major kinds of container widgets in Gtk+. Both are +-- subclasses of the abstract 'Container' base class. +-- +-- The first type of container widget has a single child widget and derives +-- from 'Bin'. These containers are decorators, which add some kind of +-- functionality to the child. For example, a 'Button' makes its child into a +-- clickable button; a 'Frame' draws a frame around its child and a 'Window' +-- places its child widget inside a top-level window. +-- +-- The second type of container can have more than one child; its purpose is +-- to manage layout. This means that these containers assign sizes and +-- positions to their children. For example, a 'HBox' arranges its children in +-- a horizontal row, and a 'Table' arranges the widgets it contains in a +-- two-dimensional grid. +-- +-- To fulfill its task, a layout container must negotiate the size +-- requirements with its parent and its children. This negotiation is carried +-- out in two phases, size requisition and size allocation. + +-- ** Size Requisition +-- [_$_] +-- | The size requisition of a widget is it's desired width and height. This +-- is represented by a 'Requisition'. +-- +-- How a widget determines its desired size depends on the widget. A +-- 'Label', for example, requests enough space to display all its text. +-- Container widgets generally base their size request on the requisitions of +-- their children. +-- +-- The size requisition phase of the widget layout process operates +-- top-down. It starts at a top-level widget, typically a 'Window'. The +-- top-level widget asks its child for its size requisition by calling +-- 'widgetSizeRequest'. To determine its requisition, the child asks its own +-- children for their requisitions and so on. Finally, the top-level widget +-- will get a requisition back from its child. + +-- ** Size Allocation +-- [_$_] +-- | When the top-level widget has determined how much space its child would +-- like to have, the second phase of the size negotiation, size allocation, +-- begins. Depending on its configuration (see 'windowSetResizable'), the +-- top-level widget may be able to expand in order to satisfy the size request +-- or it may have to ignore the size request and keep its fixed size. It then +-- tells its child widget how much space it gets by calling +-- 'widgetSizeAllocate'. The child widget divides the space among its children +-- and tells each child how much space it got, and so on. Under normal +-- circumstances, a 'Window' will always give its child the amount of space the +-- child requested. +-- +-- A child's size allocation is represented by an 'Allocation'. +-- This contains not only a width and height, but also a +-- position (i.e. X and Y coordinates), so that containers can tell their +-- children not only how much space they have gotten, but also where they are +-- positioned inside the space available to the container. +-- +-- Widgets are required to honor the size allocation they receive; a size +-- request is only a request, and widgets must be able to cope with any size. + +-- ** Child attributes +-- [_$_] +-- | 'Container' introduces child attributes - these are object attributes +-- that are not specific to either the container or the contained widget, but +-- rather to their relation. Typical examples of child attributes are the +-- position or pack-type of a widget which is contained in a 'Box'. +-- +-- The 'Container' class does not itself define any child attributes, they are +-- defined (and documented) by the various 'Container' subclasses. +-- +-- Child attributes can be set or obtained in a similar way to ordinary +-- attributes. So ordinary attributes are set like so: +-- +-- > set object [ attr := value ] +-- +-- Whereas child attributes take the child object as a parameter: +-- +-- > set container [ attr child := value ] +-- [_$_] +-- And similarily for getting a child attribute's value: +-- +-- > value <- get container (attr child) +-- + +-- * Class Hierarchy +-- | +-- @ +-- | 'GObject' +-- | +----'Object' +-- | +----'Widget' +-- | +----Container +-- | +----'Bin' +-- | +----'Box' +-- | +----'CList' +-- | +----'Fixed' +-- | +----'Paned' +-- | +----'IconView' +-- | +----'Layout' +-- | +----'List' +-- | +----'MenuShell' +-- | +----'Notebook' +-- | +----'Socket' +-- | +----'Table' +-- | +----'TextView' +-- | +----'Toolbar' +-- | +----'TreeView' +-- @ + +-- * Types + Container, + ContainerClass, + castToContainer, + toContainer, + ContainerForeachCB, + ResizeMode(..), + +-- * Methods + containerAdd, + containerRemove, + containerForeach, + containerForall, + containerGetChildren, + containerSetFocusChild, + containerSetFocusChain, + containerGetFocusChain, + containerUnsetFocusChain, + containerSetFocusVAdjustment, + containerGetFocusVAdjustment, + containerSetFocusHAdjustment, + containerGetFocusHAdjustment, + containerResizeChildren, + containerSetBorderWidth, + containerGetBorderWidth, + containerGetResizeMode, + containerSetResizeMode, + +-- * Attributes + containerResizeMode, + containerBorderWidth, + containerChild, + containerFocusHAdjustment, + containerFocusVAdjustment, + +-- * Signals + add, + checkResize, + remove, + setFocusChild, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED + onAdd, + afterAdd, + onCheckResize, + afterCheckResize, + onRemove, + afterRemove, + onSetFocusChild, + afterSetFocusChild, +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.Attributes +import System.Glib.Properties +import Graphics.UI.Gtk.Abstract.Object (makeNewObject) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.Signals#} +import System.Glib.GList (fromGList, toGList) +import Graphics.UI.Gtk.General.Enums (ResizeMode(..)) + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Methods + +-- | Adds @widget@ to the container. Typically used for simple containers such +-- as 'Window', 'Frame', or 'Button'; for more complicated layout containers +-- such as 'Box' or 'Table', this function will pick default packing parameters +-- that may not be correct. So consider functions such as 'boxPackStart' and +-- 'tableAttach' as an alternative to 'containerAdd' in those cases. A widget +-- may be added to only one container at a time; you can't place the same +-- widget inside two different containers. +-- +containerAdd :: (ContainerClass self, WidgetClass widget) => self + -> widget -- ^ @widget@ - a widget to be placed inside @container@ + -> IO () +containerAdd self widget = + {# call container_add #} + (toContainer self) + (toWidget widget) + +-- | Removes @widget@ from @container@. @widget@ must be inside @container@. +-- +containerRemove :: (ContainerClass self, WidgetClass widget) => self + -> widget -- ^ @widget@ - a current child of @container@ + -> IO () +containerRemove self widget = + {# call container_remove #} + (toContainer self) + (toWidget widget) + +-- | Maps @callback@ over each non-internal child of @container@. See +-- 'containerForall' for details on what constitutes an \"internal\" child. +-- Most applications should use 'containerForeach', rather than +-- 'containerForall'. +-- +containerForeach :: ContainerClass self => self + -> ContainerForeachCB + -> IO () +containerForeach self fun = do + fPtr <- mkContainerForeachFunc (\wPtr _ -> do + w <- makeNewObject mkWidget (return wPtr) + fun w) + {# call container_foreach #} + (toContainer self) + fPtr + nullPtr + freeHaskellFunPtr fPtr + +-- | A function that is invoked for all widgets in a container. +type ContainerForeachCB = Widget -> IO () +{#pointer Callback#} + +foreign import ccall "wrapper" mkContainerForeachFunc :: + (Ptr Widget -> Ptr () -> IO ()) -> IO Callback + +-- | Maps @callback@ over each child of @container@, including children that +-- are considered \"internal\" (implementation details of the container). +-- \"Internal\" children generally weren't added by the user of the container, +-- but were added by the container implementation itself. Most applications +-- should use 'containerForeach', rather than 'containerForall'. +-- +containerForall :: ContainerClass self => self + -> ContainerForeachCB -- ^ @callback@ - a callback + -> IO () +containerForall self fun = do + fPtr <- mkContainerForeachFunc (\wPtr _ -> do + w <- makeNewObject mkWidget (return wPtr) + fun w) + {# call container_forall #} + (toContainer self) + fPtr + nullPtr + freeHaskellFunPtr fPtr + +-- | Returns the container's non-internal children. See 'containerForall' for +-- details on what constitutes an \"internal\" child. +-- +containerGetChildren :: ContainerClass self => self + -> IO [Widget] +containerGetChildren self = do + glist <- {# call container_get_children #} (toContainer self) + widgetPtrs <- fromGList glist + mapM (makeNewObject mkWidget . return) widgetPtrs + +-- | Give the focus to a specific child of the container. +-- +containerSetFocusChild :: (ContainerClass self, WidgetClass child) => self + -> child -- ^ @child@ + -> IO () +containerSetFocusChild self child = + {# call container_set_focus_child #} + (toContainer self) + (toWidget child) + +-- | Sets a focus chain, overriding the one computed automatically by Gtk+. +-- +-- In principle each widget in the chain should be a descendant of the +-- container, but this is not enforced by this method, since it's allowed to +-- set the focus chain before you pack the widgets, or have a widget in the +-- chain that isn't always packed. The necessary checks are done when the focus +-- chain is actually traversed. +-- +containerSetFocusChain :: ContainerClass self => self + -> [Widget] -- ^ @focusableWidgets@ - the new focus chain. + -> IO () +containerSetFocusChain self chain = + withForeignPtrs (map unWidget chain) $ \wPtrs -> do + glist <- toGList wPtrs + {# call container_set_focus_chain #} + (toContainer self) + glist + +-- | Retrieves the focus chain of the container, if one has been set +-- explicitly. If no focus chain has been explicitly set, Gtk+ computes the +-- focus chain based on the positions of the children. In that case the +-- function returns @Nothing@. +-- +containerGetFocusChain :: ContainerClass self => self + -> IO (Maybe [Widget]) +containerGetFocusChain self = + alloca $ \glistPtr -> do + {# call container_get_focus_chain #} + (toContainer self) + glistPtr + if glistPtr == nullPtr then return Nothing else liftM Just $ do + glist <- peek glistPtr + widgetPtrs <- fromGList glist + mapM (makeNewObject mkWidget . return) widgetPtrs + +-- | Removes a focus chain explicitly set with 'containerSetFocusChain'. +-- +containerUnsetFocusChain :: ContainerClass self => self -> IO () +containerUnsetFocusChain self = + {# call container_unset_focus_chain #} + (toContainer self) + +-- | Hooks up an adjustment to focus handling in a container, so when a child +-- of the container is focused, the adjustment is scrolled to show that widget. +-- This function sets the vertical alignment. See +-- 'scrolledWindowGetVAdjustment' for a typical way of obtaining the adjustment +-- and 'containerSetFocusHAdjustment' for setting the horizontal adjustment. +-- +-- The adjustments have to be in pixel units and in the same coordinate +-- system as the allocation for immediate children of the container. +-- +containerSetFocusVAdjustment :: ContainerClass self => self + -> Adjustment -- ^ @adjustment@ - an adjustment which should be adjusted when + -- the focus is moved among the descendents of @container@ + -> IO () +containerSetFocusVAdjustment self adjustment = + {# call container_set_focus_vadjustment #} + (toContainer self) + adjustment + +-- | Retrieves the vertical focus adjustment for the container. See +-- 'containerSetFocusVAdjustment'. +-- +containerGetFocusVAdjustment :: ContainerClass self => self + -> IO (Maybe Adjustment) -- ^ returns the vertical focus adjustment, or + -- @Nothing@ if none has been set. +containerGetFocusVAdjustment self = + maybeNull (makeNewObject mkAdjustment) $ + {# call unsafe container_get_focus_vadjustment #} + (toContainer self) + +-- | Hooks up an adjustment to focus handling in a container, so when a child +-- of the container is focused, the adjustment is scrolled to show that widget. +-- This function sets the horizontal alignment. See +-- 'scrolledWindowGetHAdjustment' for a typical way of obtaining the adjustment +-- and 'containerSetFocusVAdjustment' for setting the vertical adjustment. +-- +-- The adjustments have to be in pixel units and in the same coordinate +-- system as the allocation for immediate children of the container. +-- +containerSetFocusHAdjustment :: ContainerClass self => self + -> Adjustment -- ^ @adjustment@ - an adjustment which should be adjusted when + -- the focus is moved among the descendents of @container@ + -> IO () +containerSetFocusHAdjustment self adjustment = + {# call container_set_focus_hadjustment #} + (toContainer self) + adjustment + +-- | Retrieves the horizontal focus adjustment for the container. See +-- 'containerSetFocusHAdjustment'. +-- +containerGetFocusHAdjustment :: ContainerClass self => self + -> IO (Maybe Adjustment) -- ^ returns the horizontal focus adjustment, or + -- @Nothing@ if none has been set. +containerGetFocusHAdjustment self = + maybeNull (makeNewObject mkAdjustment) $ + {# call unsafe container_get_focus_hadjustment #} + (toContainer self) + +-- | Make the container resize its children. +-- +containerResizeChildren :: ContainerClass self => self -> IO () +containerResizeChildren self = + {# call container_resize_children #} + (toContainer self) + +-- | Sets the border width of the container. +-- +-- The border width of a container is the amount of space to leave around +-- the outside of the container. The only exception to this is 'Window'; +-- because toplevel windows can't leave space outside, they leave the space +-- inside. The border is added on all sides of the container. To add space to +-- only one side, one approach is to create a 'Alignment' widget, call +-- 'widgetSetUsize' to give it a size, and place it on the side of the +-- container as a spacer. +-- +containerSetBorderWidth :: ContainerClass self => self + -> Int -- ^ @borderWidth@ - amount of blank space to leave /outside/ the + -- container. Valid values are in the range 0-65535 pixels. + -> IO () +containerSetBorderWidth self borderWidth = + {# call container_set_border_width #} + (toContainer self) + (fromIntegral borderWidth) + +-- | Retrieves the border width of the container. See +-- 'containerSetBorderWidth'. +-- +containerGetBorderWidth :: ContainerClass self => self + -> IO Int -- ^ returns the current border width +containerGetBorderWidth self = + liftM fromIntegral $ + {# call unsafe container_get_border_width #} + (toContainer self) + +-- | Returns the resize mode for the container. See 'containerSetResizeMode'. +-- +containerGetResizeMode :: ContainerClass self => self + -> IO ResizeMode -- ^ returns the current resize mode +containerGetResizeMode self = + liftM (toEnum . fromIntegral) $ + {# call gtk_container_get_resize_mode #} + (toContainer self) + +-- | Sets the resize mode for the container. +-- +-- The resize mode of a container determines whether a resize request will +-- be passed to the container's parent, queued for later execution or executed +-- immediately. +-- +containerSetResizeMode :: ContainerClass self => self + -> ResizeMode -- ^ @resizeMode@ - the new resize mode. + -> IO () +containerSetResizeMode self resizeMode = + {# call gtk_container_set_resize_mode #} + (toContainer self) + ((fromIntegral . fromEnum) resizeMode) + +-------------------- +-- Attributes + +-- | Specify how resize events are handled. +-- +-- Default value: 'ResizeParent' +-- +containerResizeMode :: ContainerClass self => Attr self ResizeMode +containerResizeMode = newAttr + containerGetResizeMode + containerSetResizeMode + +-- | The width of the empty border outside the containers children. +-- +-- Allowed values: \<= @('maxBound' :: Int)@ +-- +-- Default value: 0 +-- +containerBorderWidth :: ContainerClass self => Attr self Int +containerBorderWidth = newAttr + containerGetBorderWidth + containerSetBorderWidth + +-- | Can be used to add a new child to the container. +-- +containerChild :: (ContainerClass self, WidgetClass widget) => WriteAttr self widget +containerChild = writeAttrFromObjectProperty "child" + {# call pure unsafe gtk_widget_get_type #} + +-- | \'focusHadjustment\' property. See 'containerGetFocusHAdjustment' and +-- 'containerSetFocusHAdjustment' +-- +containerFocusHAdjustment :: ContainerClass self => ReadWriteAttr self (Maybe Adjustment) Adjustment +containerFocusHAdjustment = newAttr + containerGetFocusHAdjustment + containerSetFocusHAdjustment + +-- | \'focusVadjustment\' property. See 'containerGetFocusVAdjustment' and +-- 'containerSetFocusVAdjustment' +-- +containerFocusVAdjustment :: ContainerClass self => ReadWriteAttr self (Maybe Adjustment) Adjustment +containerFocusVAdjustment = newAttr + containerGetFocusVAdjustment + containerSetFocusVAdjustment + +-------------------- +-- Signals + +-- %hash c:26b d:af3f +-- | +-- +add :: ContainerClass self => Signal self (Widget -> IO ()) +add = Signal (connect_OBJECT__NONE "add") + +-- %hash c:f43a d:af3f +-- | +-- +remove :: ContainerClass self => Signal self (Widget -> IO ()) +remove = Signal (connect_OBJECT__NONE "remove") + +-- %hash c:21a9 d:af3f +-- | +-- +checkResize :: ContainerClass self => Signal self (IO ()) +checkResize = Signal (connect_NONE__NONE "check_resize") + +-- %hash c:b3a d:af3f +-- | +-- +setFocusChild :: ContainerClass self => Signal self (Widget -> IO ()) +setFocusChild = Signal (connect_OBJECT__NONE "set-focus-child") + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED +-- %hash c:fb37 +onAdd :: ContainerClass self => self + -> (Widget -> IO ()) + -> IO (ConnectId self) +onAdd = connect_OBJECT__NONE "add" False +{-# DEPRECATED onAdd "instead of 'onAdd obj' use 'on obj add'" #-} + +-- %hash c:c9d6 +afterAdd :: ContainerClass self => self + -> (Widget -> IO ()) + -> IO (ConnectId self) +afterAdd = connect_OBJECT__NONE "add" True +{-# DEPRECATED afterAdd "instead of 'afterAdd obj' use 'after obj add'" #-} + +-- %hash c:9b66 +onRemove :: ContainerClass self => self + -> (Widget -> IO ()) + -> IO (ConnectId self) +onRemove = connect_OBJECT__NONE "remove" False +{-# DEPRECATED onRemove "instead of 'onRemove obj' use 'on obj remove'" #-} + +-- %hash c:f165 +afterRemove :: ContainerClass self => self + -> (Widget -> IO ()) + -> IO (ConnectId self) +afterRemove = connect_OBJECT__NONE "remove" True +{-# DEPRECATED afterRemove "instead of 'afterRemove obj' use 'after obj remove'" #-} + +-- %hash c:8424 +onCheckResize :: ContainerClass self => self + -> IO () + -> IO (ConnectId self) +onCheckResize = connect_NONE__NONE "check_resize" False +{-# DEPRECATED onCheckResize "instead of 'onCheckResize obj' use 'on obj checkResize'" #-} + +-- %hash c:6803 +afterCheckResize :: ContainerClass self => self + -> IO () + -> IO (ConnectId self) +afterCheckResize = connect_NONE__NONE "check_resize" True +{-# DEPRECATED afterCheckResize "instead of 'afterCheckResize obj' use 'after obj checkResize'" #-} + +-- %hash c:1ac6 +onSetFocusChild :: ContainerClass self => self + -> (Widget -> IO ()) + -> IO (ConnectId self) +onSetFocusChild = connect_OBJECT__NONE "set-focus-child" False +{-# DEPRECATED onSetFocusChild "instead of 'onSetFocusChild obj' use 'on obj setFocusChild'" #-} + +-- %hash c:23e5 +afterSetFocusChild :: ContainerClass self => self + -> (Widget -> IO ()) + -> IO (ConnectId self) +afterSetFocusChild = connect_OBJECT__NONE "set-focus-child" True +{-# DEPRECATED afterSetFocusChild "instead of 'afterSetFocusChild obj' use 'after obj setFocusChild'" #-} +#endif |
From: Axel S. <si...@co...> - 2008-07-09 00:11:27
|
Tue Jul 8 15:31:02 EDT 2008 A....@ke... * Add a few attributes and signals. hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 132 + actionActivated, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 139 +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 507 +-- %hash c:4608 d:49a3 +-- | The \"activate\" signal is emitted when the action is activated. +-- +actionActivated :: ActionClass self => Signal self (IO ()) +actionActivated = Signal (connect_NONE__NONE "activate") + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/Action.chs.pp 525 +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 66 + radioActionValueAttr, hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 68 +#if GTK_CHECK_VERSION(2,10,0) + radioActionCurrentValue, +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 72 --- * Signals +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 77 +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 162 +-- %hash d:1bcf hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 164 --- to determine which action in the group is currently active in an activate --- or changed signal handler. +-- to determine which action in the group is currently active in an ::activate +-- or ::changed signal handler. See 'radioActionGetCurrentValue' and +-- 'RadioActionEntry' for convenient ways to get and set +-- this property. hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 171 -radioActionValue :: RadioActionClass self => Attr self Int -radioActionValue = newAttrFromIntProperty "value" +radioActionValueAttr :: RadioActionClass self => Attr self Int +radioActionValueAttr = newAttrFromIntProperty "value" hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 174 +-- %hash c:a380 hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 182 +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:4cec d:1710 +-- | The value property of the currently active member of the group to which +-- this action belongs. +-- +-- Default value: 0 +-- +-- * Available since Gtk+ version 2.10 +-- +radioActionCurrentValue :: RadioActionClass self => Attr self Int +radioActionCurrentValue = newAttrFromIntProperty "current-value" +#endif + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 196 --- Signals +-- Deprecated Signals hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 198 +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs.pp 209 +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 63 +#if GTK_CHECK_VERSION(2,10,0) hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 65 +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 68 - onToggleActionToggled, - afterToggleActionToggled, + actionToggled, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED + onActionToggled, + afterActionToggled, +#endif + hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 84 +import System.Glib.Properties hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 176 --- | \'active\' property. See 'toggleActionGetActive' and --- 'toggleActionSetActive' +#if GTK_CHECK_VERSION(2,10,0) +-- %hash c:cd0e d:4024 +-- | If the toggle action should be active in or not. +-- +-- Default value: @False@ +-- +-- * Available since Gtk+ version 2.10 hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 185 -toggleActionActive = newAttr - toggleActionGetActive - toggleActionSetActive +toggleActionActive = newAttrFromBoolProperty "active" +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 191 --- | [_$_] +-- %hash c:3829 d:af3f +-- | hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 194 -onToggleActionToggled, afterToggleActionToggled :: ToggleActionClass self => self +actionToggled :: ToggleActionClass self => Signal self (IO ()) +actionToggled = Signal (connect_NONE__NONE "toggled") + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED +-- %hash c:9cc4 +onActionToggled :: ToggleActionClass self => self hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs.pp 205 -onToggleActionToggled = connect_NONE__NONE "toggled" False -afterToggleActionToggled = connect_NONE__NONE "toggled" True +onActionToggled = connect_NONE__NONE "toggled" False +{-# DEPRECATED onActionToggled "instead of 'onActionToggled obj' use 'on obj actionToggled'" #-} + +-- %hash c:61e3 +afterActionToggled :: ToggleActionClass self => self + -> IO () + -> IO (ConnectId self) +afterActionToggled = connect_NONE__NONE "toggled" True +{-# DEPRECATED afterActionToggled "instead of 'afterActionToggled obj' use 'after obj actionToggled'" #-} +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 234 + addWidget, + actionsChanged, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 252 +#endif hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 562 +-- %hash c:58ec d:2a79 +-- | The add_widget signal is emitted for each generated menubar and toolbar. +-- It is not emitted for generated popup menus, which can be obtained by +-- 'uiManagerGetWidget'. +-- +addWidget :: UIManagerClass self => Signal self (Widget -> IO ()) +addWidget = Signal (connect_OBJECT__NONE "add_widget") + +-- %hash c:2480 d:366c +-- | The \"actions-changed\" signal is emitted whenever the set of actions +-- changes. +-- +actionsChanged :: UIManagerClass self => Signal self (IO ()) +actionsChanged = Signal (connect_NONE__NONE "actions_changed") + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED hunk ./gtk/Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs.pp 644 +#endif |