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: Duncan C. <dun...@wo...> - 2007-10-24 12:50:05
|
Sat Oct 20 11:49:23 PDT 2007 Peter Gavin <pg...@gm...> * gstreamer: add bytestring dependency in Makefile.am if HAVE_SPLIT_BASE is set hunk ./Makefile.am 1872 +if HAVE_SPLIT_BASE +libHSgstreamer_a_EXTERNALDEPS += bytestring +endif |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:20:13
|
Mon Oct 8 19:30:28 PDT 2007 Peter Gavin <pg...@gm...> * gtk: some source documentation cleanups hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 182 --- %hash c:784f d:88a3 --- | Creates a status icon displaying a stock icon. Sample stock icon names --- are 'stockOpen', 'stockQuit'. You can register your own stock icon names, see --- 'iconFactoryAddDefault' and 'iconFactoryAdd'. +-- %hash c:784f d:88a3 | Creates a status icon displaying a stock +-- icon. Sample stock icon names are 'stockOpen', 'stockQuit'. You can +-- register your own stock icon names, see +-- 'Graphics.UI.Gtk.General.IconFactory.iconFactoryAddDefault' and +-- 'Graphics.UI.Gtk.General.IconFactory.iconFactoryAdd'. hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 267 --- 'ImageEmpty'. +-- 'Graphics.UI.Gtk.Display.Image.ImageEmpty'. hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 276 --- %hash c:cd8a d:9fed --- | Gets the 'Pixbuf' being displayed by the 'StatusIcon'. The storage type --- of the status icon must be 'ImageEmpty' or 'ImagePixbuf' (see --- 'statusIconGetStorageType'). The caller of this function does not own a --- reference to the returned pixbuf. +-- %hash c:cd8a d:9fed | Gets the 'Pixbuf' being displayed by the +-- 'StatusIcon'. The storage type of the status icon must be +-- 'Graphics.UI.Gtk.Display.Image.ImageEmpty' or +-- 'Graphics.UI.Gtk.Display.Image.ImagePixbuf' (see +-- 'statusIconGetStorageType'). The caller of this function does not +-- own a reference to the returned pixbuf. hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 292 --- %hash c:ecce d:448 --- | Gets the id of the stock icon being displayed by the 'StatusIcon'. The --- storage type of the status icon must be 'ImageEmpty' or 'ImageStock' (see +-- %hash c:ecce d:448 | Gets the id of the stock icon being displayed +-- by the 'StatusIcon'. The storage type of the status icon must be +-- 'Graphics.UI.Gtk.Display.Image.ImageEmpty' or +-- 'Graphics.UI.Gtk.Display.Image.ImageStock' (see hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 307 --- %hash c:6e6b d:273e --- | Gets the name of the icon being displayed by the 'StatusIcon'. The --- storage type of the status icon must be 'ImageEmpty' or 'ImageIconName' (see +-- %hash c:6e6b d:273e | Gets the name of the icon being displayed by +-- the 'StatusIcon'. The storage type of the status icon must be +-- 'Graphics.UI.Gtk.Display.Image.ImageEmpty' or +-- 'Graphics.UI.Gtk.Display.Image.ImageIconName' (see hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 494 --- Default value: 'ImageEmpty' +-- Default value: 'Graphics.UI.Gtk.Display.Image.ImageEmpty' hunk ./gtk/Graphics/UI/Gtk/Entry/EntryCompletion.chs.pp 37 --- \"Completion functionality\" means that when the user modifies the text --- in the entry, 'EntryCompletion' checks which rows in the model match the --- current content of the entry, and displays a list of matches. By default, --- the matching is done by comparing the entry text case-insensitively against --- the text in a model (see 'entryCompletionSetTextModel'), but this --- can be overridden with a custom match function (see +-- \"Completion functionality\" means that when the user modifies the +-- text in the entry, 'EntryCompletion' checks which rows in the model +-- match the current content of the entry, and displays a list of +-- matches. By default, the matching is done by comparing the entry +-- text case-insensitively against the text in a model (see +-- 'Graphics.UI.Gtk.Entry.entryCompletionSetTextModel'), but this can +-- be overridden with a custom match function (see hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 171 --- 'dragContextSugestedAction' is set to 'ActionAsk'. +-- 'dragContextSuggestedAction' is set to 'ActionAsk'. hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 559 --- | Add the text targets supported by 'Selection' to the target list of the --- drag source. The targets are added with @info = 0@. If you need another --- value, use 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and 'dragSourceSetTargetList'. +-- | Add the text targets supported by +-- 'Graphics.UI.Gtk.General.Selection.Selection' to the target list of +-- the drag source. The targets are added with @info = 0@. If you need +-- another value, use +-- 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and +-- 'dragSourceSetTargetList'. hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 616 --- | The ::drag-data-get signal is emitted on the drag source when the drop --- site requests the data which is dragged. It is the responsibility of the --- signal handler to set the selection data in the format which is indicated --- by 'InfoId'. See 'selectionDataSet' and 'selectionDataSetText'. +-- | The ::drag-data-get signal is emitted on the drag source when the +-- drop site requests the data which is dragged. It is the +-- responsibility of the signal handler to set the selection data in +-- the format which is indicated by 'InfoId'. See +-- 'Graphics.UI.Gtk.General.Selection.selectionDataSet' and +-- 'Graphics.UI.Gtk.General.Selection.selectionDataSetText'. hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 155 --- * 'DestDefaultHightlight': 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/General.chs 139 --- 'post' your GUI actions to the main GUI thread. You can do this using +-- \'post\' your GUI actions to the main GUI thread. You can do this using hunk ./gtk/Graphics/UI/Gtk/General/StockItems.hsc 27 --- * Defining you own --- 'IconSet's as 'StockItem's will make it possible for [_$_] --- Gtk to choose --- the most appropriate sizes and enables themes to override your built in --- icons. A couple of constants are defined here as well. They are useful [_$_] --- in accessing Gtk's predefined items. +-- * Defining you own 'Graphics.UI.Gtk.General.IconFactory.IconSet's +-- as 'StockItem's will make it possible for Gtk to choose the most +-- appropriate sizes and enables themes to override your built in +-- icons. A couple of constants are defined here as well. They are +-- useful in accessing Gtk's predefined items. hunk ./gtk/Graphics/UI/Gtk/Layout/HButtonBox.chs 35 --- A 'HButtonBox' is created with 'hButtonBoxNew'. Buttons are packed into a --- button box the same way widgets are added to any other container, using --- 'containerAdd'. You can also use 'boxPackStart' or 'boxPackEnd', but for --- button boxes both these functions work just like 'containerAdd', ie., they --- pack the button in a way that depends on the current layout style and on --- whether the button has had 'buttonBoxSetChildSecondary' called on it. +-- A 'HButtonBox' is created with 'hButtonBoxNew'. Buttons are packed +-- into a button box the same way widgets are added to any other +-- container, using +-- 'Graphics.UI.Gtk.Abstract.Container.containerAdd'. You can also use +-- 'Graphics.UI.Gtk.Abstract.Box.boxPackStart' or +-- 'Graphics.UI.Gtk.Abstract.Box.boxPackEnd', but for button boxes +-- both these functions work just like +-- 'Graphics.UI.Gtk.Abstract.Container.containerAdd', ie., they pack +-- the button in a way that depends on the current layout style and on +-- whether the button has had +-- 'Graphics.UI.Gtk.Abstract.ButtonBox.buttonBoxSetChildSecondary' +-- called on it. hunk ./gtk/Graphics/UI/Gtk/Layout/HButtonBox.chs 48 --- The spacing between buttons can be set with 'boxSetSpacing'. The --- arrangement and layout of the buttons can be changed with --- 'buttonBoxSetLayout'. +-- The spacing between buttons can be set with +-- 'Graphics.UI.Gtk.Abstract.Box.boxSetSpacing'. The arrangement and +-- layout of the buttons can be changed with +-- 'Graphics.UI.Gtk.Abstract.ButtonBox.buttonBoxSetLayout'. hunk ./gtk/Graphics/UI/Gtk/Layout/VButtonBox.chs 35 --- A 'VButtonBox' is created with 'vButtonBoxNew'. Buttons are packed into a --- button box the same way widgets are added to any other container, using --- 'containerAdd'. You can also use 'boxPackStart' or 'boxPackEnd', but for --- button boxes both these functions work just like 'containerAdd', ie., they --- pack the button in a way that depends on the current layout style and on --- whether the button has had 'buttonBoxSetChildSecondary' called on it. +-- A 'VButtonBox' is created with 'vButtonBoxNew'. Buttons are packed +-- into a button box the same way widgets are added to any other +-- container, using +-- 'Graphics.UI.Gtk.Abstract.Container.containerAdd'. You can also use +-- 'Graphics.UI.Gtk.Abstract.Box.boxPackStart' or +-- 'Graphics.UI.Gtk.Abstract.Box.boxPackEnd', but for button boxes +-- both these functions work just like +-- 'Graphics.UI.Gtk.Abstract.Container.containerAdd', ie., they pack +-- the button in a way that depends on the current layout style and on +-- whether the button has had +-- 'Graphics.UI.Gtk.Abstract.ButtonBox.buttonBoxSetChildSecondary' +-- called on it. hunk ./gtk/Graphics/UI/Gtk/Layout/VButtonBox.chs 48 --- The spacing between buttons can be set with 'boxSetSpacing'. The --- arrangement and layout of the buttons can be changed with --- 'buttonBoxSetLayout'. +-- The spacing between buttons can be set with +-- 'Graphics.UI.Gtk.Abstract.Box.boxSetSpacing'. The arrangement and +-- layout of the buttons can be changed with +-- 'Graphics.UI.Gtk.Abstract.ButtonBox.buttonBoxSetLayout'. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs.pp 202 --- | 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 'TreePath' of the --- active item. +-- | 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. 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 '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 +-- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxGetActiveText'. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 95 --- construction, you should set a model using 'comboBoxSetModel' and a +-- construction, you should set a model using +-- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxSetModel' and a hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 105 --- | 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. +-- | 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. hunk ./gtk/Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs.pp 124 --- | 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: 'comboBoxAppendText', --- 'comboBoxInsertText', 'comboBoxPrependText' and 'comboBoxRemoveText'. +-- | 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'. hunk ./gtk/Graphics/UI/Gtk/ModelView/TreeModel.chs.pp 356 - -> IO String -- ^ returns A newly-allocated string. Must be freed with - -- 'gFree'. + -> IO String -- ^ the returned string representation hunk ./gtk/Graphics/UI/Gtk/Multiline/TextTag.chs.pp 285 --- | Font weight as an integer, see predefined values in 'Weight'; for --- example, 'WeightBold'. +-- | Font weight as an integer, see predefined values in 'Graphics.UI.Gtk.Pango.Enums.Weight'; for +-- example, 'Graphics.UI.Gtk.Pango.Enums.WeightBold'. hunk ./gtk/Graphics/UI/Gtk/TreeList/TreeModelSort.chs.pp 182 --- 'TreeModelSort' of any cached iterators that haven't been reffed with --- 'treeModelRefNode'. This might be useful if the child model being sorted is --- static (and doesn't change often) and there has been a lot of unreffed --- access to nodes. As a side effect of this function, all unreffed iters will +-- 'TreeModelSort' of any cached iterators that haven't been reffed +-- with 'Graphics.UI.Gtk.TreeModel.treeModelRefNode'. This might be +-- useful if the child model being sorted is static (and doesn't +-- change often) and there has been a lot of unreffed access to +-- nodes. As a side effect of this function, all unreffed iters will |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:20:10
|
Sat Sep 29 10:04:20 PDT 2007 Peter Gavin <pg...@gm...> * gnomevfs: add function S.G.V.Volume.volumeUnmount hunk ./gnomevfs/System/Gnome/VFS/Volume.chs 58 - volumeIsUserVisible + volumeIsUserVisible, + volumeUnmount hunk ./gnomevfs/System/Gnome/VFS/Volume.chs 298 +-- Requests unmount of a 'Volume'. +-- [_$_] +-- Note that 'volumeUnmount' may also unvoke 'volumeEject', if +-- @volume@ signals that it should be ejected when it is unmounted. +-- This may be true for CD-ROMs, USB sticks, and other devices, +-- depending on the backend providing the volume. +volumeUnmount :: VolumeClass volume + => volume -- ^ @volume@ - the volume to eject + -> VolumeOpSuccessCallback -- ^ @successCallback@ - the + -- callback to call once + -- the operation has + -- completed successfully + -> VolumeOpFailureCallback -- ^ @failureCallback@ - the + -- callback to call if the + -- operation fails + -> IO () +volumeUnmount volume successCallback failureCallback = + do cCallback <- volumeOpCallbackMarshal successCallback failureCallback + {# call volume_unmount #} (castToVolume volume) cCallback $ castFunPtrToPtr cCallback + |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:20:10
|
Thu Sep 6 13:57:46 PDT 2007 Peter Gavin <pg...@gm...> * gnomevfs: hide Marshal and Types from haddock hunk ./gnomevfs/System/Gnome/VFS/Marshal.chs 28 --- [_$_] + +-- #hide + hunk ./gnomevfs/System/Gnome/VFS/Types.chs 28 --- [_$_] + +-- #hide + |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:20:09
|
Sun Aug 5 07:47:38 PDT 2007 Peter Gavin <pg...@gm...> * make hierarchyGenGst not use splitobjs hunk ./Makefile.am 114 +tools_hierarchyGenGst_TypeGenerator_NOSPLITOBJS = yes |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:10:16
|
Thu Oct 11 06:07:54 PDT 2007 Duncan Coutts <du...@ha...> * Move all deprecated exports to their own section in the export list hunk ./tools/apiGen/src/CodeGen.hs 530 - [ (text name, (since, deprecated)) + [ (text name, (since, False)) hunk ./tools/apiGen/src/CodeGen.hs 533 - decl_deprecated = deprecated, + decl_deprecated = False, hunk ./tools/apiGen/src/CodeGen.hs 537 - [ (text name, (since, deprecated)) + [ (text name, (since, False)) hunk ./tools/apiGen/src/CodeGen.hs 540 - decl_deprecated = deprecated, + decl_deprecated = False, hunk ./tools/apiGen/src/CodeGen.hs 544 - [ (text name, (since, deprecated)) + [ (text name, (since, False)) hunk ./tools/apiGen/src/CodeGen.hs 546 - decl_deprecated = deprecated, + decl_deprecated = False, hunk ./tools/apiGen/src/CodeGen.hs 551 - [ (text name, (since, deprecated)) + [ (text name, (since, False)) hunk ./tools/apiGen/src/CodeGen.hs 554 - decl_deprecated = deprecated, + decl_deprecated = False, hunk ./tools/apiGen/src/CodeGen.hs 558 - [ (text name, (since, deprecated)) + [ (text name, (since, False)) hunk ./tools/apiGen/src/CodeGen.hs 561 - decl_deprecated = deprecated, + decl_deprecated = False, hunk ./tools/apiGen/src/CodeGen.hs 565 - [ (text name, (since, deprecated)) + [ (text name, (since, True)) hunk ./tools/apiGen/src/CodeGen.hs 568 - decl_deprecated = deprecated, - decl_body = Module.Signal { signal_is_old_style = True } + decl_deprecated = True |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:10:10
|
Thu Oct 11 06:06:12 PDT 2007 Duncan Coutts <du...@ha...> * Use qualified names for new signals hunk ./tools/apiGen/src/Module.hs 300 - decl_name = lowerCaseFirstChar (Api.signal_name signal), + decl_name = + let objName = lowerCaseFirstChar (Api.object_name object) + in objName ++ Api.signal_name signal, |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:10:10
|
Thu Oct 11 05:45:25 PDT 2007 Duncan Coutts <du...@ha...> * Disable generation hashes for the moment They don't quite work reliably yet for some reason. hunk ./tools/apiGen/src/CodeGen.hs 55 - hashes - $$ formattedDocs + --TODO: re-enable hashes and make it work reliably +{- hashes + $$-} formattedDocs |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:10:10
|
Thu Oct 11 05:52:01 PDT 2007 Duncan Coutts <du...@ha...> * Use the proper deprecated doc comment rather than a generic one. hunk ./tools/apiGen/src/Module.hs 687 - let line = "Warning: this function is deprecated " - ++ "and should not be used in newly-written code." + let line = "Warning: " ++ decl_deprecated_comment decl |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:10:09
|
Thu Oct 11 06:05:40 PDT 2007 Duncan Coutts <du...@ha...> * Use the correct name for old signals hunk ./tools/apiGen/src/Module.hs 446 - let oldName = "on" ++ upperCaseFirstChar(decl_name decl) in + let oldName = "on" ++ signal_name signal in hunk ./tools/apiGen/src/Module.hs 458 - let oldName = "after" ++ upperCaseFirstChar(decl_name decl) in + let oldName = "after" ++ signal_name signal in |
From: Duncan C. <dun...@wo...> - 2007-10-24 12:10:09
|
Thu Oct 11 05:49:07 PDT 2007 Duncan Coutts <du...@ha...> * Deprecate getter/setter methods that duplicate attributes Add deprecated notes. Also combine docs for attributes synthesised out of getter/setter methods. hunk ./tools/apiGen/src/Module.hs 516 + concat hunk ./tools/apiGen/src/Module.hs 518 + declName = lowerCaseFirstChar (module_name module_) ++ attrName hunk ./tools/apiGen/src/Module.hs 520 - decl_name = lowerCaseFirstChar (module_name module_) ++ attrName, + decl_name = declName, hunk ./tools/apiGen/src/Module.hs 528 - decl_doc = Just - [ParaText - [SpanText ("'" ++ lowerCaseFirstChar attrName ++ "' property. See ") - ,SpanIdent (Names.cFuncNameToHsName (method_cname getter_body)) - ,SpanText " and " - ,SpanIdent (Names.cFuncNameToHsName (method_cname setter_body))] - ], + decl_doc = Just $ + fromMaybe [] (decl_doc setter) + ++ fromMaybe [] (decl_doc getter) + ++ [ParaText [SpanText $ "TODO: merge attr docs from those of" + ++ " the setter and getter methods"]], hunk ./tools/apiGen/src/Module.hs 536 + : deprecateGetterMethod getter declName + : deprecateSetterMethod setter declName + : [] hunk ./tools/apiGen/src/Module.hs 544 - ++ nonPropsDecls + ++ filter (not . isGetSetMethod) nonPropsDecls + ++ concat + [ deprecateGetterMethod getter (decl_name prop) + : deprecateSetterMethod setter (decl_name prop) : [] + | (prop,(getter, setter)) <- directProps ], + module_todos = module_todos module_ hunk ./tools/apiGen/src/Module.hs 553 + deprecateGetterMethod decl attrName = decl { + decl_deprecated = True, + decl_doc = Nothing, + decl_deprecated_comment = + "instead of '" ++ decl_name decl ++ " obj'" + ++ " use 'get obj " ++ attrName ++ "'" + } + deprecateSetterMethod decl attrName = decl { + decl_deprecated = True, + decl_doc = Nothing, + decl_deprecated_comment = + "instead of '" ++ decl_name decl ++ " obj value'" + ++ " use 'set obj [ " ++ attrName ++ " := value ]'" + } + + -- methods that are getters or setters for properties. We want to deprecate + -- these methods and eventually not export the ones that are not needed to + -- implement the properties. That is, we'd remove the directProps ones completely + -- and keep but not export the extraProps ones. We only want to continue to + -- support the attributes as the public API, we don't want duplication in the API + -- between attributes and getter/setter methods. + getterSetterMethodNames = + [ decl_name decl | (_,(get, set)) <- directProps, decl <- [get,set] ] + ++ [ decl_name decl | (get, set) <- extraProps, decl <- [get,set] ] + + isGetSetMethod Decl { decl_body = Method {}, decl_name = name } + = name `elem` getterSetterMethodNames + isGetSetMethod _ = False + |
From: Axel S. <A....@ke...> - 2007-10-20 17:57:47
|
Sat Oct 20 09:19:37 PDT 2007 hth...@zo... * Tutorial Port Scrolled Window (Chapter 6.1) addfile ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap6-1.hs hunk ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap6-1.hs 1 +import Graphics.UI.Gtk +import Data.IORef [_$_] +import System.Random (randomRIO) + +main:: IO () +main= do + initGUI + window <- windowNew + set window [ windowTitle := "Guess a Number", [_$_] + windowDefaultWidth := 300, windowDefaultHeight := 250] + mb <- vBoxNew False 0 + containerAdd window mb + + info <- labelNew (Just "Press \"New\" for a random number") + boxPackStart mb info PackNatural 7 + sep1 <- hSeparatorNew + boxPackStart mb sep1 PackNatural 7 + [_$_] + scrwin <- scrolledWindowNew Nothing Nothing + boxPackStart mb scrwin PackGrow 0 + + table <- tableNew 10 10 True + scrolledWindowAddWithViewport scrwin table + + buttonlist <- sequence (map numButton [1..100]) + let places = cross [0..9] [0..9] + sequence_ (zipWith (attachButton table) buttonlist places) + + sep2 <- hSeparatorNew + boxPackStart mb sep2 PackNatural 7 + hb <- hBoxNew False 0 + boxPackStart mb hb PackNatural 0 + play <- buttonNewFromStock stockNew + quit <- buttonNewFromStock stockQuit + boxPackStart hb play PackNatural 0 + boxPackEnd hb quit PackNatural 0 + [_$_] + randstore <- newIORef 50 + randomButton info randstore play + + sequence_ (map (actionButton info randstore) buttonlist) [_$_] + + widgetShowAll window + onClicked quit (widgetDestroy window) + onDestroy window mainQuit + mainGUI + +numButton :: Int -> IO Button +numButton n = do + button <- buttonNewWithLabel (show n) + return button + +cross :: [Int] -> [Int] -> [(Int,Int)] +cross row col = do [_$_] + x <- row + y <- col + return (x,y) + +attachButton :: Table -> Button -> (Int,Int) -> IO () +attachButton ta bu (x,y) = [_$_] + tableAttachDefaults ta bu y (y+1) x (x+1) + +actionButton :: ButtonClass b => Label -> IORef Int -> b -> IO (ConnectId b) +actionButton inf rst b = [_$_] + onClicked b $ do label <- get b buttonLabel + let num = (read label):: Int + rand <- readIORef rst + case compare num rand of + GT -> do set inf [labelLabel := "Too High"] + widgetModifyFg inf StateNormal (Color 65535 0 0) + LT -> do set inf [labelLabel := "Too Low"] + widgetModifyFg inf StateNormal (Color 65535 0 0) + EQ -> do set inf [labelLabel := "Correct"] + widgetModifyFg inf StateNormal (Color 0 35000 0) + +randomButton :: ButtonClass b => Label -> IORef Int -> b -> IO (ConnectId b) +randomButton inf rst b = [_$_] + onClicked b $ do rand <- randomRIO (1::Int, 100) + writeIORef rst rand [_$_] + set inf [labelLabel := "Ready"] + widgetModifyFg inf StateNormal (Color 0 0 65535) addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap6-1.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap6-1.png addfile ./docs/tutorial/Tutorial_Port/chap6-1.xhtml hunk ./docs/tutorial/Tutorial_Port/chap6-1.xhtml 1 +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8" /> + <title>Gtk2Hs Tutorial: Scrolled Windows</title> + <link href="default.css" type="text/css" rel="stylesheet" /> + </head> + <body> + <div id="header"> + <h1>Gtk2Hs Tutorial</h1> + <span class="nav-previous"> + <a href="chap5-4.xhtml">Previous</a> + </span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap6-2.xhtml">Next</a> + </span> + </div> + <h2>6.1 Scrolled Windows</h2> + <p>Scrolled windows are used to create a scrollable area with + another widget inside it. You may insert any type of widget + into a scrolled window, and it will be accessible regardless of + the size by using the scrollbars.</p> + <p>The following function is used to create a new scrolled + window.</p> + <pre class="codebox">scrolledWindowNew :: Maybe Adjustment -> Maybe Adjustment -> IO ScrolledWindow +</pre> + <p>The first argument is the adjustment for the horizontal + direction, and the second is for the vertical direction. They + are almost always set to [_$_] + <code>Nothing</code> .</p> + <pre class="codebox">scrolledWindowSetPolicy :: ScrolledWindowClass self => +self -> PolicyType -> PolicyType -> IO () +</pre> + <p>This sets the policy to be used with respect to the + horizontal and vertical scrollbars. The constructor [_$_] + <code>PolicyAlways</code> always shows the scrollbar, [_$_] + <code>PolicyNever</code> never shows it and [_$_] + <code>PolicyAutomatic</code> shows it only if the page size is + larger than the window. The default is [_$_] + <code>PolicyAlways</code> .</p> + <p>You can then place your object into the scrolled window + using [_$_] + <code>containerAdd</code> if that object has a window associated + with it. If not, then you'll need a [_$_] + <code>Viewport</code> , but you can add one automatically + with:</p> + <pre class="codebox">scrolledWindowAddWithViewport :: (ScrolledWindowClass self, WidgetClass child) +=> self -> child -> IO () +</pre> + <p>Should you forget about the viewport, GHCi produces a + helpful error message if you use [_$_] + <code>containerAdd</code> when you should not have done so!</p> + <p>Here is an example that packs a table with 100 toggle + buttons into a scrolled window. It implements a program from + 'Yet Another Haskell Tutorial' by Hal Daumé III. This + tutorial is freely available from the Haskell website. On page + 43 there is a small program that lets a user repeatedly guess a + number between 1 and 100 and tells whether the guess is too + high, too low or correct. The random number is generated with + function [_$_] + <code>randomRIO</code> from module System.Random.</p> + <p>The example implements this with a graphical user + interface.</p> + <p><img src="Images/GtkChap6-1.png" alt="Scrolled Window" id="imgGtkChap6-1" /></p> [_$_] + [_$_] + <p>In the main window we use a vertical box to pack a label + (for user information), a horizontal separator, a scrolled + window, a horizontal separator and a horizontal box for two + buttons from stock. The scrolled window is packed with [_$_] + <code>PackGrow</code> , to let it resize with the window, and + the play and quit buttons are packed at the opposite ends of + the horizontal box.</p> + <p>The 100 buttons are created with:</p> + <pre class="codebox"> buttonlist <- sequence (map numButton [1..100]) +</pre> + <p>where the function [_$_] + <code>numButton</code> is defined as:</p> + <pre class="codebox">numButton :: Int -> IO Button +numButton n = do + button <- buttonNewWithLabel (show n) + return button +</pre> + <p>So, each button automatically gets the appropriate number as + its label.</p> + <p>Inside the scrolled window we create a 10 by 10 table for + the 100 buttons. To position the buttons we use the function [_$_] + <code>cross</code> , which is based on the [_$_] + <code>List monad</code> . This function, a very simple way to + get a Cartesian product from two or more lists, is also + discussed in YAHT (another program).</p> + <pre class="codebox">cross :: [Int] -> [Int] -> [(Int,Int)] +cross row col = do [_$_] + x <- row + y <- col + return (x,y) +</pre> + <p>The function [_$_] + <code>attachButton</code> takes a table, a button and a tuple of + coordinates to place a button in the table. (See Chapter 3.3 + for more on packing tables.)</p> + <pre class="codebox">attachButton :: Table -> Button -> (Int,Int) -> IO () attachButton ta bu (x,y) = [_$_] + tableAttachDefaults ta bu y (y+1) x (x+1) +</pre> + <p>Now the following code segment packs all the buttons in the + table, with [_$_] + <code>buttonlist</code> as described above.</p> + <pre class="codebox"> let places = cross [0..9] [0..9] + sequence_ (zipWith (attachButton table) buttonlist places) +</pre> + <p>Every time the user presses the play button, a random number + must be generated, which can subsequently be compared to the + user choice. But the Gtk2Hs signal handler [_$_] + <code>onClicked</code> takes a button, and a function which + takes no parameters and has a value of type [_$_] + <code>IO ()</code> . We need something like a global variable, + and this is provided with the module Data.IORef. We can now use + the following snippets, in different functions, to initialize, + write and read the random number.</p> + <pre class="codebox">snippet 1 -- randstore <- newIORef 50 [_$_] +snippet 2 -- writeIORef rst rand [_$_] +snippet 3 -- rand <- readIORef rst +</pre> + <p>The first gets a variable of type [_$_] + <code>IORef Int</code> and initializes it with 50. The second is + implemented in the function [_$_] + <code>randomButton</code> :</p> + <pre class="codebox">randomButton :: ButtonClass b => Label -> IORef Int -> b -> IO (ConnectId b) +randomButton inf rst b = [_$_] + onClicked b $ do rand <- randomRIO (1::Int, 100) + writeIORef rst rand [_$_] + set inf [labelLabel := "Ready"] + widgetModifyFg inf StateNormal (Color 0 0 65535) +</pre> + <p>and then used in the following snippet, where [_$_] + <code>info</code> is the label for the user information. + (See Chapter 5.3 for colors and how they can be changed.)</p> + <p>Similar to the writing of the random number, the function [_$_] + <code>actionButton</code> implements the reading of [_$_] + <code>randstore.</code> It then compares the number obtained + from the label of the button which has been clicked, and + displays the relevant information on the [_$_] + <code>info</code> label. </p> + <p>Finally we have to monitor all 100 buttons to find out which + one was pressed, if any.</p> + <pre class="codebox"> sequence_ (map (actionButton info randstore) buttonlist) +</pre> + <p>The above is analogous to all the other [_$_] + <code>sequence</code> _ and [_$_] + <code>map</code> combinations we've used, but in this case + exactly one of the 100 signal handlers will be triggered, any + time the user presses that particular button.</p> + <p>The following is the complete code for the example.</p> + <pre class="codebox"> +import Graphics.UI.Gtk +import Data.IORef [_$_] +import System.Random (randomRIO) + +main:: IO () +main= do + initGUI + window <- windowNew + set window [ windowTitle := "Guess a Number", [_$_] + windowDefaultWidth := 300, windowDefaultHeight := 250] + mb <- vBoxNew False 0 + containerAdd window mb + + info <- labelNew (Just "Press \"New\" for a random number") + boxPackStart mb info PackNatural 7 + sep1 <- hSeparatorNew + boxPackStart mb sep1 PackNatural 7 + [_$_] + scrwin <- scrolledWindowNew Nothing Nothing + boxPackStart mb scrwin PackGrow 0 + + table <- tableNew 10 10 True + scrolledWindowAddWithViewport scrwin table + + buttonlist <- sequence (map numButton [1..100]) + let places = cross [0..9] [0..9] + sequence_ (zipWith (attachButton table) buttonlist places) + + sep2 <- hSeparatorNew + boxPackStart mb sep2 PackNatural 7 + hb <- hBoxNew False 0 + boxPackStart mb hb PackNatural 0 + play <- buttonNewFromStock stockNew + quit <- buttonNewFromStock stockQuit + boxPackStart hb play PackNatural 0 + boxPackEnd hb quit PackNatural 0 + [_$_] + randstore <- newIORef 50 + randomButton info randstore play + + sequence_ (map (actionButton info randstore) buttonlist) [_$_] + + widgetShowAll window + onClicked quit (widgetDestroy window) + onDestroy window mainQuit + mainGUI + +numButton :: Int -> IO Button +numButton n = do + button <- buttonNewWithLabel (show n) + return button + +cross :: [Int] -> [Int] -> [(Int,Int)] +cross row col = do [_$_] + x <- row + y <- col + return (x,y) + +attachButton :: Table -> Button -> (Int,Int) -> IO () +attachButton ta bu (x,y) = [_$_] + tableAttachDefaults ta bu y (y+1) x (x+1) + +actionButton :: ButtonClass b => Label -> IORef Int -> b -> IO (ConnectId b) +actionButton inf rst b = [_$_] + onClicked b $ do label <- get b buttonLabel + let num = (read label):: Int + rand <- readIORef rst + case compare num rand of + GT -> do set inf [labelLabel := "Too High"] + widgetModifyFg inf StateNormal (Color 65535 0 0) + LT -> do set inf [labelLabel := "Too Low"] + widgetModifyFg inf StateNormal (Color 65535 0 0) + EQ -> do set inf [labelLabel := "Correct"] + widgetModifyFg inf StateNormal (Color 0 35000 0) + +randomButton :: ButtonClass b => Label -> IORef Int -> b -> IO (ConnectId b) +randomButton inf rst b = [_$_] + onClicked b $ do rand <- randomRIO (1::Int, 100) + writeIORef rst rand [_$_] + set inf [labelLabel := "Ready"] + widgetModifyFg inf StateNormal (Color 0 0 65535) +</pre> + <div id="footer"> + <span class="nav-previous"> + <a href="chap5-4.xhtml">Previous</a> + <br />5.4 Notebook</span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap6-2.xhtml">Next</a> + <br />6.2</span> + </div> + </body> +</html> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 1 -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 5 -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <title>Gtk2Hs Tutorial</title> - <link href="default.css" type="text/css" rel="stylesheet" /> -</head> - -<body> - -<div id="title"> - <h2>Gtk2Hs Tutorial</h2> -</div> - -<div id="authors"> - <h3>Hans van Thiel</h3> -</div> - -<div id="credits"> - <h4>An Adaptation of the GTK+ 2.0 Tutorial by</h4> - <h3>Tony Gale</h3> - <h3>Ian Main</h3> - <h4>&</h4> - <h3>The GTK Team</h3> -</div> - -<div id="toc"> - <h3>Table of Contents</h3> - <ol> - <li><a href="chap1.xhtml"></a>1. Introduction <em>— Not Available Yet</em></li> - - <li><a href="chap2.xhtml">2. Getting Started</a></li> - - <li>3. Packing + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8" /> + <title>Gtk2Hs Tutorial</title> + <link href="default.css" type="text/css" rel="stylesheet" /> + </head> + <body> + <div id="title"> + <h2>Gtk2Hs Tutorial</h2> + </div> + <div id="authors"> + <h3>Hans van Thiel</h3> + </div> + <div id="credits"> + <h4>An Adaptation of the GTK+ 2.0 Tutorial by</h4> + <h3>Tony Gale</h3> + <h3>Ian Main</h3> + <h4>&</h4> + <h3>The GTK Team</h3> + </div> + <div id="toc"> + <h3>Table of Contents</h3> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 28 - <li><a href="chap3-1.xhtml">3.1 Packing Widgets</a></li> - - <li><a href="chap3-2.xhtml">3.2 Packing Demonstration Program</a></li> - - <li><a href="chap3-3.xhtml">3.3 Packing Using Tables</a></li> + <li> + <a href="chap1.xhtml"></a>1. Introduction [_$_] + <em>— Not Available Yet</em></li> + <li> + <a href="chap2.xhtml">2. Getting Started</a> + </li> + <li>3. Packing [_$_] + <ol> + <li> + <a href="chap3-1.xhtml">3.1 Packing Widgets</a> + </li> + <li> + <a href="chap3-2.xhtml">3.2 Packing Demonstration + Program</a> + </li> + <li> + <a href="chap3-3.xhtml">3.3 Packing Using Tables</a> + </li> + </ol></li> + <li>4. Miscellaneous Widgets [_$_] + <ol> + <li> + <a href="chap4-1.xhtml">4.1 The Button Widget</a> + </li> + <li> + <a href="chap4-2.xhtml">4.2 Adjustments, Scale and + Range</a> + </li> + <li> + <a href="chap4-3.xhtml">4.3 Labels</a> + </li> + <li> + <a href="chap4-4.xhtml">4.4 Arrows and Tooltips</a> + </li> + <li> + <a href="chap4-5.xhtml">4.5 Dialogs, Stock Items and + Progress Bars</a> + </li> + <li> + <a href="chap4-6.xhtml">4.6 Text Entries and Status + Bars</a> + </li> + <li> + <a href="chap4-7.xhtml">4.7 Spin Buttons</a> + </li> + </ol></li> + <li>5. Aggregated Widgets [_$_] + <ol> + <li> + <a href="chap5-1.xhtml">5.1 Calendar</a> + </li> + <li> + <a href="chap5-2.xhtml">5.2 File Selection</a> + </li> + <li> + <a href="chap5-3.xhtml">5.3 Font and Color + Selection</a> + </li> + <li> + <a href="chap5-4.xhtml">5.4 Notebook</a> + </li> + </ol></li> + <li>6. Supporting Widgets [_$_] + <ol> + <li> + <a href="chap6-1.xhtml">6.1 Scrolled Windows</a> + </li> + </ol></li> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 97 - </li> - <li>4. Miscellaneous Widgets - <ol> - <li><a href="chap4-1.xhtml">4.1 The Button Widget</a></li> - - <li><a href="chap4-2.xhtml">4.2 Adjustments, Scale and Range</a></li> - - <li><a href="chap4-3.xhtml">4.3 Labels</a></li> - - <li><a href="chap4-4.xhtml">4.4 Arrows and Tooltips</a></li> - - <li><a href="chap4-5.xhtml">4.5 Dialogs, Stock Items and Progress Bars</a></li> - - <li><a href="chap4-6.xhtml">4.6 Text Entries and Status Bars</a></li> - - <li><a href="chap4-7.xhtml">4.7 Spin Buttons</a></li> - </ol> - </li> - <li>5. Aggregated Widgets - <ol> - <li><a href="chap5-1.xhtml">5.1 Calendar</a></li> - - <li><a href="chap5-2.xhtml">5.2 File Selection</a></li> - [_$_] - <li><a href="chap5-3.xhtml">5.3 Font and Color Selection</a></li> - [_$_] - <li><a href="chap5-4.xhtml">5.4 Notebook</a></li> - </ol> - </li> - </ol> -</div> - -<h3>Tutorial Copyright and Permissions Notice</h3> - -<p>The GTK Tutorial is Copyright © 1997 Ian Main.</p> - -<p>Copyright © 1998-2002 Tony Gale.</p> - -<p>Copyright © 2007 Hans van Thiel and Alex Tarkovsky.</p> - -<p> -Permission is granted to make and distribute verbatim copies of this manual -provided the copyright notice and this permission notice are preserved on all -copies. -</p> - -<p> -Permission is granted to copy and distribute modified versions of this document -under the conditions for verbatim copying, provided that this copyright notice -is included exactly as in the original, and that the entire resulting derived -work is distributed under the terms of a permission notice identical to this -one. -</p> - -<p> -Permission is granted to copy and distribute translations of this document into -another language, under the above conditions for modified versions. -</p> - -<p> -If you are intending to incorporate this document into a published work, please -contact the maintainer, and we will make an effort to ensure that you have the -most up to date information available. -</p> - -<p> -There is no guarantee that this document lives up to its intended purpose. This -is simply provided as a free resource. As such, the authors and maintainers of -the information provided within can not make any guarantee that the information -is even accurate. -</p> - -<div id="footer"> - <span class="nav-previous"> </span> - <span class="nav-home"> </span> - <span class="nav-next"><!-- a href="chap1.xhtml" -->Next<!-- /a --><br />1. Introduction</span> -</div> - -</body> + </div> + <h3>Tutorial Copyright and Permissions Notice</h3> + <p>The GTK Tutorial is Copyright © 1997 Ian Main.</p> + <p>Copyright © 1998-2002 Tony Gale.</p> + <p>Copyright © 2007 Hans van Thiel and Alex Tarkovsky.</p> + <p>Permission is granted to make and distribute verbatim copies + of this manual provided the copyright notice and this + permission notice are preserved on all copies.</p> + <p>Permission is granted to copy and distribute modified + versions of this document under the conditions for verbatim + copying, provided that this copyright notice is included + exactly as in the original, and that the entire resulting + derived work is distributed under the terms of a permission + notice identical to this one.</p> + <p>Permission is granted to copy and distribute translations of + this document into another language, under the above conditions + for modified versions.</p> + <p>If you are intending to incorporate this document into a + published work, please contact the maintainer, and we will make + an effort to ensure that you have the most up to date + information available.</p> + <p>There is no guarantee that this document lives up to its + intended purpose. This is simply provided as a free resource. + As such, the authors and maintainers of the information + provided within can not make any guarantee that the information + is even accurate.</p> + <div id="footer"> + <span class="nav-previous"> </span> + <span class="nav-home"> </span> + <span class="nav-next"> + <!-- a href="chap1.xhtml" -->Next [_$_] + <!-- /a --> + <br />1. Introduction</span> + </div> + </body> |
From: Axel S. <A....@ke...> - 2007-10-20 17:57:46
|
Sun Oct 14 08:35:04 PDT 2007 hth...@zo... * Tutorial Port Notebook (Chapter 5.4) addfile ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap5-4a.hs hunk ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap5-4a.hs 1 +import Graphics.UI.Gtk +import Data.Char (toUpper) + +main :: IO () +main= do + initGUI + window <- windowNew + set window [windowTitle := "Notebook Example 1", windowDefaultWidth := 300, + windowDefaultHeight := 200 ] + [_$_] + ntbk <- notebookNew + containerAdd window ntbk + set ntbk [notebookScrollable := True, notebookTabPos := PosBottom] + + stls <- stockListIds + sequence_ (map (myNewPage ntbk) stls) + + onSwitchPage ntbk (putStrLn . ((++)"Page: ") . show) + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +tabName :: StockId -> String +tabName st = (drop 3) (conv st) where + conv (x:[]) = x:[] + conv (x:y:ys) | x == '-' = (toUpper y):(conv ys) + | otherwise = x: (conv (y:ys)) + +myNewPage :: Notebook -> StockId -> IO Int +myNewPage noteb stk = [_$_] + do img <- imageNewFromStock stk 6 + pagenum <- notebookAppendPage noteb img (tabName stk) + return pagenum [_$_] addfile ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap5-4b.hs hunk ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap5-4b.hs 1 +import Graphics.UI.Gtk +import Data.Char (toUpper) + +main :: IO () +main= do + initGUI + window <- windowNew + set window [windowTitle := "Notebook Example 2", windowDefaultWidth := 300, + windowDefaultHeight := 200 ] + [_$_] + ntbk <- notebookNew + containerAdd window ntbk + set ntbk [notebookScrollable := True, notebookEnablePopup := True, + notebookTabPos := PosRight ] + + stls <- stockListIds + sequence_ (map (myNewPage ntbk) stls) + + onSwitchPage ntbk (putStrLn . ((++)"Page: ") . show) + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +tabName :: StockId -> String +tabName st = (drop 3) (conv st) where + conv (x:[]) = x:[] + conv (x:y:ys) | x == '-' = (toUpper y):(conv ys) + | otherwise = x: (conv (y:ys)) + +myNewPage :: Notebook -> StockId -> IO Int +myNewPage noteb stk = [_$_] + do img <- imageNewFromStock stk 4 + let nmstr = tabName stk + men <- labelNew (Just ((take 1) nmstr)) + cont <- labelNew (Just ("stock" ++ nmstr)) + pagenum <- notebookAppendPageMenu noteb cont img men + return pagenum [_$_] addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap5-4a.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap5-4a.png addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap5-4b.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap5-4b.png addfile ./docs/tutorial/Tutorial_Port/chap5-4.xhtml hunk ./docs/tutorial/Tutorial_Port/chap5-4.xhtml 1 +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8" /> + <title>Gtk2Hs Tutorial: Notebook</title> + <link href="default.css" type="text/css" rel="stylesheet" /> + </head> + <body> + <div id="header"> + <h1>Gtk2Hs Tutorial</h1> + <span class="nav-previous"> + <a href="chap5-3.xhtml">Previous</a> + </span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap6-1.xhtml">Next</a> + </span> + </div> + <h2>Notebook</h2> + <p>The [_$_] + <code>Notebook</code> widget is a collection of "pages" that + overlap each other. Each page is different, and only one will + be visible at a time. Pages 'contain' some other widget, which + you must supply.</p> + <p>To create a new notebook widget:</p> + <pre class="codebox">NotebookNew :: IO Notebook +</pre> + <p>Once the notebook has been created, there are a number of + functions and attributes to use and to customize it.The + following attributes determine the position of the tabs, and + whether they are visible at all.</p> + <pre class="codebox">notebookTabPos :: NotebookClass self => Attr self PositionType +notebookShowTabs :: NotebookClass self => Attr self Bool +</pre> + <p>The PositionType has constructors [_$_] + <code>PosLeft</code> , [_$_] + <code>PosRight</code> , [_$_] + <code>PosTop</code> (the default) and [_$_] + <code>PosBottom.</code> </p> + <p>Next we will look at how to add pages to the notebook. There + are three ways, append, prepend and insert.</p> + <pre class="codebox">noteBookAppendPage :: (NotebookClass self, WidgetClass child) +=> self +-> child -- the widget to use as the contents of the page +-> String -- the label text +-> IO Int -- the index (page number) of the new page (starting at 0) +</pre> + <p>The function [_$_] + <code>notebookPrependPage</code> has exactly the same signature. + It will, of course, return 0 as its index. The function [_$_] + <code>notebookInsertPage</code> takes the index at which to + insert the page as an additional parameter. You can remove + pages with [_$_] + <code>notebookRemovePage.</code> </p> + <p>A [_$_] + <code>Notebook</code> is a container widget and you can use + other containers as a child, including horizontal and vertical + boxes. Therefore you can build quite complex pages, and set + their layouts with the usual packing functions.</p> + <p>The listed functions to add, prepend and insert pages only + work with textual tabs. All three also have versions which + allow for a popup menu to appear, and with those you can use + any widget as a label.</p> + <pre class="codebox">notebookAppendPageMenu :: +(NotebookClass self, WidgetClass child, WidgetClass tabLabel, WidgetClass menuLabel) +=> self +-> child -- the widget to use as the contents of the page +-> tabLabel -- the widget to use as the label of the page +-> menuLabel -- the widget to use as the label of the popup menu +-> IO Int -- the index (page number) of the new page (starting at 0) +</pre> + <p> + <code>notebookPrependPageMenu </code> and [_$_] + <code> notebookInsertPageMenu</code> will place the new page + first or at the designated index, respectively.</p> + <p>Some useful attributes (but see the API Documentation for + more) are:</p> + <pre class="codebox">notebookScrollable :: NotebookClass self => Attr self Bool +notebookCurrentPage :: NotebookClass self => Attr self Int +notebookEnablePopup :: NotebookClass self => Attr self Bool +</pre> + <p>If the number of pages is large you can set [_$_] + <code>notebookScrollable</code> . Use [_$_] + <code>notebookCurrentPage</code> or the function [_$_] + <code>notebookSetCurrentPage</code> to open the notebook at + another page than the (default) first one. The attribute [_$_] + <code>notebookEnablePopup</code> determines whether the user's + clicking the right mouse button on a tab will show a popup menu + of all the available pages. That is, if the menu fuctions have + been defined.</p> + <p>A [_$_] + <code>Notebook</code> widget has its own signal handling + function:</p> + <pre class="codebox">onSwitchPage :: NotebookClass nb => nb -> (Int -> IO ()) -> IO (ConnectId nb) +</pre> + <p>The function you must supply takes a page index returned by [_$_] + <code>onSwitchPage</code> and must do some output.</p> + <p>The examples show a catalogue of [_$_] + <code>StockItem</code> icon sets in different ways.</p> + <p> + <img src="Images/GtkChap5-4a.png" alt="Notebook Example 1" + id="imgGtkChap5-4a" /> + </p> + <p>Stock items were summarily discussed in chapter 4.5. Recall + that a [_$_] + <code>StockItem</code> is known throughout GTK+ (and Gtk2Hs). + The following function produces a list of all stock + identifiers.</p> + <pre class="codebox">stockListIds :: IO [StockId] +</pre> + <p>A [_$_] + <code>StockId</code> is a [_$_] + <code>String</code> and in Gtk2Hs has the form: [_$_] + <code>stockCopy</code> , [_$_] + <code>stockDialogError</code> etc. In GTK+ the corresponding + form is: gtk-copy, gtk-dialog-error and so on. The example + defines a function tabName to convert the GTK+ identifiers in + the StockId list to names for the notebook tabs. The function [_$_] + <code>myNewPage</code> uses [_$_] + <code>imageNewFromStock</code> to get the icon into an [_$_] + <code>Image</code> widget, which is then added to the page. It + returns the page index, but this is not used. To get a list of + all pages use [_$_] + <code>sequence</code> instead of [_$_] + <code>sequence_</code> </p> + <p>Note that the icon size, in pixels, may be restricted. The + default is 4 and the value used here, 6, is also allowed but a + size of 8 produces a run time error with GHCi.</p> + <pre class="codebox"> +import Graphics.UI.Gtk +import Data.Char (toUpper) + +main :: IO () +main= do + initGUI + window <- windowNew + set window [windowTitle := "Notebook Example 1", windowDefaultWidth := 300, + windowDefaultHeight := 200 ] + [_$_] + ntbk <- notebookNew + containerAdd window ntbk + set ntbk [notebookScrollable := True, notebookTabPos := PosBottom] + + stls <- stockListIds + sequence_ (map (myNewPage ntbk) stls) + + onSwitchPage ntbk (putStrLn . ((++)"Page: ") . show) + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +tabName :: StockId -> String +tabName st = (drop 3) (conv st) where + conv (x:[]) = x:[] + conv (x:y:ys) | x == '-' = (toUpper y):(conv ys) + | otherwise = x: (conv (y:ys)) + +myNewPage :: Notebook -> StockId -> IO Int +myNewPage noteb stk = [_$_] + do img <- imageNewFromStock stk 6 + pagenum <- notebookAppendPage noteb img (tabName stk) + return pagenum [_$_] +</pre> + <p>A second way to show the catalogue is to put the icons in + the notebook tabs.</p> + <p> + <img src="Images/GtkChap5-4b.png" alt="Notebook Example 2" + id="imgGtkChap5-4a" /> + </p> + <p>To do this we need the menu style of adding pages, and we've + also defined a menu tab consisting of the first letter of the + name string. The result is a popup menu consisting of 98 + letters, which itself will scroll. It can simply be disabled + through the [_$_] + <code>notebookEnablePopup</code> attribute. The content of each + page is the Gtk2Hs stock item identifier (see + Graphics.UI.Gtk.General.StockItems).</p> + <pre class="codebox"> +import Graphics.UI.Gtk +import Data.Char (toUpper) + +main :: IO () +main= do + initGUI + window <- windowNew + set window [windowTitle := "Notebook Example 2", windowDefaultWidth := 300, + windowDefaultHeight := 200 ] + [_$_] + ntbk <- notebookNew + containerAdd window ntbk + set ntbk [notebookScrollable := True, notebookEnablePopup := True, + notebookTabPos := PosRight ] + + stls <- stockListIds + sequence_ (map (myNewPage ntbk) stls) + + onSwitchPage ntbk (putStrLn . ((++)"Page: ") . show) + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +tabName :: StockId -> String +tabName st = (drop 3) (conv st) where + conv (x:[]) = x:[] + conv (x:y:ys) | x == '-' = (toUpper y):(conv ys) + | otherwise = x: (conv (y:ys)) + +myNewPage :: Notebook -> StockId -> IO Int +myNewPage noteb stk = [_$_] + do img <- imageNewFromStock stk 4 + let nmstr = tabName stk + men <- labelNew (Just ((take 1) nmstr)) + cont <- labelNew (Just ("stock" ++ nmstr)) + pagenum <- notebookAppendPageMenu noteb cont img men + return pagenum [_$_] +</pre> + <div id="footer"> + <span class="nav-previous"> + <a href="chap5-3.xhtml">Previous</a> + <br />5.3 Font and Color Selection</span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <a href="chap6-1.xhtml">Next</a> + <br />To be continued</span> + </div> + </body> +</html> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 68 + [_$_] + <li><a href="chap5-4.xhtml">5.4 Notebook</a></li> |
From: Axel S. <A....@ke...> - 2007-10-20 17:57:46
|
Tue Oct 9 10:21:47 PDT 2007 hth...@zo... * Tutorial_Port Font and File Selection (Chapter 5.3) addfile ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap5-3.hs hunk ./docs/tutorial/Tutorial_Port/Example_Code/GtkChap5-3.hs 1 +import Graphics.UI.Gtk + +main :: IO () +main = do + initGUI + window <- windowNew + set window [windowTitle := "Font and Color Selection", containerBorderWidth := 10 ] + vb <- vBoxNew False 0 + containerAdd window vb + + qtlab <- labelNew (Just "How poor are they that have not patience!\nWhat wound did ever heal but by degrees?\nThou know'st we work by wit, and not by witchcraft;\nAnd wit depends on dilatory time.") + boxPackStart vb qtlab PackGrow 0 + + srclab <- labelNew (Just "From Othello (II, iii, 376-379)") + srcfont <- fontDescriptionFromString "Courier Italic 10" + widgetModifyFont srclab (Just srcfont) + miscSetAlignment srclab 1.0 0.5 + boxPackStart vb srclab PackNatural 10 + + sep <- hSeparatorNew + boxPackStart vb sep PackGrow 10 + [_$_] + fntb <- fontButtonNew + boxPackStart vb fntb PackGrow 0 + + colb <- colorButtonNew + boxPackStart vb colb PackGrow 0 + + onFontSet fntb $ do name <- fontButtonGetFontName fntb + fdesc <- fontDescriptionFromString name + widgetModifyFont qtlab (Just fdesc) + putStrLn name + + onColorSet colb $ do colour <- colorButtonGetColor colb + widgetModifyFg qtlab StateNormal colour + putStrLn (show colour) + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +instance Show Color where + show (Color r g b) = "Red: " ++ (show r) ++ [_$_] + " Green: " ++ (show g) ++ [_$_] + " Blue: " ++ (show b) + + + addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3a.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3a.png addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3b.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3b.png addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3c.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3c.png addfile ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3d.png binary ./docs/tutorial/Tutorial_Port/Images/GtkChap5-3d.png addfile ./docs/tutorial/Tutorial_Port/chap5-3.xhtml hunk ./docs/tutorial/Tutorial_Port/chap5-3.xhtml 1 +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8" /> + <title>Gtk2Hs Tutorial: Font and Color Selection</title> + <link href="default.css" type="text/css" rel="stylesheet" /> + </head> + <body> + <div id="header"> + <h1>Gtk2Hs Tutorial</h1> + <span class="nav-previous"> + <a href="chap5-2.xhtml">Previous</a> + </span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + </span> + <span class="nav-next"> + <!-- a href="chap5-4.xhtml" -->Next [_$_] + <!--</a>--></span> + </div> + <h1>5.3 Font and Color Selection</h1> + <p>Font and color selection are much like file selection. There + are three ways to implement them, as widgets, dialogs and + buttons. The user selected values are obtained through the + appropriate attributes or functions. We'll discuss font + selection first. You can use:</p> + <pre class="codebox"> +fontSelectionNew :: IO FontSelection +fontSelectionDialogNew :: String -> IO FontSelectionDialog +fontButtonNew :: IO FontButton +</pre> + <p>The [_$_] + <code>String</code> parameter is the title of the dialog window. + There are a host of attributes and functions to manage the + display of these widgets, all pretty straightforward. With a + dialog you use the appropriate [_$_] + <code>ResponseId</code> types; with the [_$_] + <code>FontButton</code> you use:</p> + <pre class="codebox"> +onFontSet:: FontButtonClass self => self -> IO () -> IO (ConnectId self) +</pre> + <p>Then you use the following function to get the name of the + user selected font:</p> + <pre class="codebox"> +fontButtonGetFontName :: FontButtonClass self => self -> IO String +</pre> + <p>The font name will be something like "Courier Italic 10" or + "URW Gothic L Semi-Bold Oblique 16", whatever is available on + your system. As you can see from the image below, the user can + select a family, a style and a size.</p> + <p> + <img src="Images/GtkChap5-3a.png" alt="Font Select Window" + id="imgGtkChap5-3a" /> + </p> + <p>Finding and querying information about fonts is documented + in Graphics.UI.Gtk.Pango.Font. Many advanced features are + supported, but the general user will only need to know how to + get a [_$_] + <code>FontDescription</code> from a font name.</p> + <pre class="codebox"> +fontDescriptionFromString :: String -> IO FontDescription +</pre> + <p>Once you have a [_$_] + <code>FontDescription</code> you can use:</p> + <pre class="codebox"> +widgetModifyFont:: WidgetClass self => self -> Maybe FontDescription -> IO () +</pre> + <p>Color selection is analogous to font selection. You have + three choices:</p> + <pre class="codebox"> +colorSelectionNew :: IO Color Selection +colorSelectionDialogNew: :: String -> IO ColorSelectionDialog +colorButtonNew :: IO Color Button +</pre> + <p>Whith a ColorButton use:</p> + <pre class="codebox"> +onColorSet :: ColorButtonClass self => self -> IO () -> IO (ConnectId self) +</pre> + <p>and then:</p> + <pre class="codebox"> +colorButtonGetColor :: ColorButtonClass self => self -> IO Color +</pre> + <p>There is also a function (and an attribute) to get the Alpha + value (opacity) if this feature has been enabled.</p> + <p>The default color selection window looks like this:</p> + <p> + <img src="Images/GtkChap5-3b.png" + alt="Color Selection Window" id="imgGtkChap5-3b" /> + </p> + <p>Color is a data type of three [_$_] + <code>Ints</code> , ranging from 0 to 65535, specifying the red, + green and blue components. There are functions to set the + foreground, background, text and base colors of a widget, and + these functions take a [_$_] + <code>StateType</code> parameter. These are: [_$_] + <code>StateNormal, StateActive, StatePreLight, StateSelected + and StateInsensitive</code> and they depend on whether a widget + is active, the mouse pointer is over a widget, a widget is + selected and such. Display of widgets has many features, but to + change the color of a label text, for example, you just use [_$_] + <code>StateNormal</code> and the [_$_] + <code>Color</code> the user has selected.</p> + <pre class="codebox"> +widgetModifyFg :: WidgetClass self => self -> StateType -> Color -> IO () +</pre> + <p>When in doubt what [_$_] + <code>StateType</code> the widget has, there is the following + function:</p> + <pre class="codebox"> +widgetGetState :: WidgetClass w => w -> IO StateType +</pre> + <p>Here is an example of font and color selection.</p> + <p> + <img src="Images/GtkChap5-3c.png" + alt="FontButton and ColorButton Example" + id="imgGtkChap5-3c" /> + </p> + <p>The window automatically resizes to accommodate the larger + font.</p> + <p> + <img src="Images/GtkChap5-3d.png" alt="Window" + id="imgGtkChap5-3d" /> + </p> + <pre class="codebox"> +import Graphics.UI.Gtk + +main :: IO () +main = do + initGUI + window <- windowNew + set window [windowTitle := "Font and Color Selection", +containerBorderWidth := 10 ] + vb <- vBoxNew False 0 + containerAdd window vb + + qtlab <- labelNew (Just "How poor are they that have not +patience!\nWhat wound did ever heal but by degrees?\nThou know'st +we work by wit, and not by witchcraft;\nAnd wit depends on dilatory +time.") + boxPackStart vb qtlab PackGrow 0 + + srclab <- labelNew (Just "From Othello (II, iii, 376-379)") + srcfont <- fontDescriptionFromString "Courier Italic 10" + widgetModifyFont srclab (Just srcfont) + miscSetAlignment srclab 1.0 0.5 + boxPackStart vb srclab PackNatural 10 + + sep <- hSeparatorNew + boxPackStart vb sep PackGrow 10 + [_$_] + fntb <- fontButtonNew + boxPackStart vb fntb PackGrow 0 + + colb <- colorButtonNew + boxPackStart vb colb PackGrow 0 + + onFontSet fntb $ do name <- fontButtonGetFontName fntb + fdesc <- fontDescriptionFromString name + widgetModifyFont qtlab (Just fdesc) + putStrLn name + + onColorSet colb $ do colour <- colorButtonGetColor colb + widgetModifyFg qtlab StateNormal colour + putStrLn (show colour) + + widgetShowAll window + onDestroy window mainQuit + mainGUI + +instance Show Color where + show (Color r g b) = "Red: " ++ (show r) ++ [_$_] + " Green: " ++ (show g) ++ [_$_] + " Blue: " ++ (show b) +</pre> + <div id="footer"> + <span class="nav-previous"> + <a href="chap1.xhtml">Previous</a> + <br />5.2 File Selection</span> + <span class="nav-home"> + <a href="index.xhtml">Home</a> + <br /> </span> + <span class="nav-next"> + <!--<a href="chap3-1.xhtml">-->Next [_$_] + <!--</a>--> + <br /></span> + </div> + </body> +</html> hunk ./docs/tutorial/Tutorial_Port/index.xhtml 67 - <li><a href="chap5-3.xhtml">5.3 Font Selection</a></li> + <li><a href="chap5-3.xhtml">5.3 Font and Color Selection</a></li> |
From: Axel S. <A....@ke...> - 2007-10-20 17:57:46
|
Mon Oct 15 03:56:56 PDT 2007 A....@ke... * Add a comment on the return values of events. hunk ./gtk/Graphics/UI/Gtk/Abstract/Widget.chs.pp 49 +-- Widgets receive events, that is, signals that indicate some low-level +-- user iteraction. The signal handlers for all these events have to +-- return @True@ if the signal has been dealt with and @False@ if other +-- signal handlers should be run. |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:40
|
Wed Jul 25 07:49:24 PDT 2007 Duncan Coutts <du...@ha...> * Build the statusicon demo hunk ./Makefile.am 1779 +endif +if HAVE_GTK_VERSION_2_10 +DEMOS += demo/statusicon |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:39
|
Mon Oct 15 07:32:26 PDT 2007 Duncan Coutts <du...@ha...> * Make gtk2hs build with ghc 6.8 This is a back-port to the gtk2hs-0.9.12 branch of a patch by Bertram Felgenhauer hunk ./Makefile.am 128 +if HAVE_SPLIT_BASE +tools_c2hs_c2hsLocal_EXTERNALDEPS += pretty containers array +endif hunk ./Makefile.am 364 +if HAVE_SPLIT_BASE +libHSgtk_a_EXTERNALDEPS += containers array +endif hunk ./Makefile.am 1597 +if HAVE_SPLIT_BASE +libHSsoegtk_a_EXTERNALDEPS += old-time +endif hunk ./configure.ac 152 +dnl check for a recent ghc-6.7 or later as a proxy for the base package split +GTKHS_PROG_CHECK_VERSION($GHC_VERSION, -ge, 6.7.20070912, [ +HAVE_SPLIT_BASE=yes +AC_DEFINE([HAVE_SPLIT_BASE], [1], [Using split base package.]) +]) +AM_CONDITIONAL(HAVE_SPLIT_BASE, test "$HAVE_SPLIT_BASE" = "yes") +AC_SUBST(HAVE_SPLIT_BASE) |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:39
|
Thu Jul 26 06:07:48 PDT 2007 A....@ke... * Add authors name to author's file. hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 4 --- Author : [Insert your full name here] +-- Author : Andrea Vezzosi |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:38
|
Tue Jul 24 20:34:33 PDT 2007 Andrea Vezzosi <san...@gm...> * Add GtkStatusIcon bindings hunk ./Makefile.am 416 + gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp \ hunk ./gtk/Graphics/UI/Gtk.hs 75 + module Graphics.UI.Gtk.Display.StatusIcon, hunk ./gtk/Graphics/UI/Gtk.hs 252 +import Graphics.UI.Gtk.Display.StatusIcon hiding (onActivate,afterActivate,onPopupMenu,afterPopupMenu) addfile ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp hunk ./gtk/Graphics/UI/Gtk/Display/StatusIcon.chs.pp 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Widget StatusIcon +-- +-- Author : [Insert your full name here] +-- +-- Created: 19 July 2007 +-- +-- Copyright (C) 2007 [Insert your full name here] +-- +-- 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) +-- +-- Display an icon in the system tray +-- +-- * Module available since Gtk+ version 2.10 +-- +module Graphics.UI.Gtk.Display.StatusIcon ( + +-- * Detail +-- +-- | The \"system tray\" or notification area is normally used for transient +-- icons that indicate some special state. For example, a system tray icon +-- might appear to tell the user that they have new mail, or have an incoming +-- instant message, or something along those lines. The basic idea is that +-- creating an icon in the notification area is less annoying than popping up a +-- dialog. +-- +-- A 'StatusIcon' object can be used to display an icon in a \"system +-- tray\". The icon can have a tooltip, and the user can interact with it by +-- activating it or popping up a context menu. Critical information should not +-- solely be displayed in a 'StatusIcon', since it may not be visible (e.g. +-- when the user doesn't have a notification area on his panel). This can be +-- checked with 'statusIconIsEmbedded'. +-- +-- On X11, the implementation follows the freedesktop.org \"System Tray\" +-- specification. Implementations of the \"tray\" side of this specification +-- can be found e.g. in the GNOME and KDE panel applications. +-- +-- Note that a 'StatusIcon' is /not/ a widget, but just a 'GObject'. Making +-- it a widget would be impractical, since the system tray on Win32 doesn't +-- allow to embed arbitrary widgets. + +-- * Class Hierarchy +-- +-- | +-- @ +-- | 'GObject' +-- | +----StatusIcon +-- @ + +#if GTK_CHECK_VERSION(2,10,0) +-- * Types + StatusIcon, + StatusIconClass, + castToStatusIcon, + toStatusIcon, + +-- * Constructors + statusIconNew, + statusIconNewFromPixbuf, + statusIconNewFromFile, + statusIconNewFromStock, + statusIconNewFromIconName, + +-- * Methods + statusIconSetFromPixbuf, + statusIconSetFromFile, + statusIconSetFromStock, + statusIconSetFromIconName, + statusIconGetStorageType, + statusIconGetPixbuf, + statusIconGetStock, + statusIconGetIconName, + statusIconGetSize, + statusIconSetTooltip, + statusIconSetVisible, + statusIconGetVisible, + statusIconSetBlinking, + statusIconGetBlinking, + statusIconIsEmbedded, + statusIconPositionMenu, + statusIconGetGeometry, + +-- * Attributes + statusIconPixbuf, + statusIconFile, + statusIconStock, + statusIconIconName, + statusIconStorageType, + statusIconSize, + statusIconBlinking, + statusIconVisible, + +-- * Signals + sizeChanged, + activate, + popupMenu, + +-- * Deprecated +#ifndef DISABLE_DEPRECATED + onActivate, + afterActivate, + onPopupMenu, + afterPopupMenu, + onSizeChanged, + afterSizeChanged, +#endif +#endif + ) where + +import Control.Monad (liftM) + +import System.Glib.FFI +import System.Glib.UTFString +import System.Glib.Attributes +import System.Glib.Properties +import System.Glib.GObject (constructNewGObject,makeNewGObject) +{#import Graphics.UI.Gtk.Types#} +{#import Graphics.UI.Gtk.General.Enums#} +import Graphics.UI.Gtk.General.Structs +{#import Graphics.UI.Gtk.Display.Image#} (ImageType) +{#import Graphics.UI.Gtk.Signals#} +import Graphics.UI.Gtk.General.StockItems +import Graphics.UI.Gtk.Gdk.Events + + +{# context lib="gtk" prefix="gtk" #} + +#if GTK_CHECK_VERSION(2,10,0) +-------------------- +-- Constructors + +-- %hash c:2fb1 d:9bd6 +-- | Creates an empty status icon object. +-- +statusIconNew :: IO StatusIcon +statusIconNew = + constructNewGObject mkStatusIcon $ + {# call gtk_status_icon_new #} + +-- %hash c:3318 d:cd70 +-- | Creates a status icon displaying @pixbuf@. +-- +-- The image will be scaled down to fit in the available space in the +-- notification area, if necessary. +-- +statusIconNewFromPixbuf :: + Pixbuf -- ^ @pixbuf@ - a 'Pixbuf' + -> IO StatusIcon +statusIconNewFromPixbuf pixbuf = + constructNewGObject mkStatusIcon $ + {# call gtk_status_icon_new_from_pixbuf #} + pixbuf + +-- %hash c:325a d:6c24 +-- | Creates a status icon displaying the file @filename@. +-- +-- The image will be scaled down to fit in the available space in the +-- notification area, if necessary. +-- +statusIconNewFromFile :: + String -- ^ @filename@ - a filename + -> IO StatusIcon +statusIconNewFromFile filename = + constructNewGObject mkStatusIcon $ + withUTFString filename $ \filenamePtr -> + {# call gtk_status_icon_new_from_file #} + filenamePtr + +-- %hash c:784f d:88a3 +-- | Creates a status icon displaying a stock icon. Sample stock icon names +-- are 'stockOpen', 'stockQuit'. You can register your own stock icon names, see +-- 'iconFactoryAddDefault' and 'iconFactoryAdd'. +-- +statusIconNewFromStock :: + StockId -- ^ @stockId@ - a stock icon id + -> IO StatusIcon +statusIconNewFromStock stockId = + constructNewGObject mkStatusIcon $ + withUTFString stockId $ \stockIdPtr -> + {# call gtk_status_icon_new_from_stock #} + stockIdPtr + +-- %hash c:6e1b d:8731 +-- | Creates a status icon displaying an icon from the current icon theme. If +-- the current icon theme is changed, the icon will be updated appropriately. +-- +statusIconNewFromIconName :: + String -- ^ @iconName@ - an icon name + -> IO StatusIcon +statusIconNewFromIconName iconName = + constructNewGObject mkStatusIcon $ + withUTFString iconName $ \iconNamePtr -> + {# call gtk_status_icon_new_from_icon_name #} + iconNamePtr + +-------------------- +-- Methods + +-- %hash c:2256 d:12b2 +-- | Makes @statusIcon@ display @pixbuf@. See 'statusIconNewFromPixbuf' for +-- details. +-- +statusIconSetFromPixbuf :: StatusIconClass self => self + -> Pixbuf -- ^ @pixbuf@ - a 'Pixbuf' + -> IO () +statusIconSetFromPixbuf self pixbuf = + {# call gtk_status_icon_set_from_pixbuf #} + (toStatusIcon self) + pixbuf + +-- %hash c:c2c0 d:c0f8 +-- | Makes @statusIcon@ display the file @filename@. See +-- 'statusIconNewFromFile' for details. +-- +statusIconSetFromFile :: StatusIconClass self => self + -> String -- ^ @filename@ - a filename + -> IO () +statusIconSetFromFile self filename = + withUTFString filename $ \filenamePtr -> + {# call gtk_status_icon_set_from_file #} + (toStatusIcon self) + filenamePtr + +-- %hash c:d755 d:8fa3 +-- | Makes @statusIcon@ display the stock icon with the id @stockId@. See +-- 'statusIconNewFromStock' for details. +-- +statusIconSetFromStock :: StatusIconClass self => self + -> StockId -- ^ @stockId@ - a stock icon id + -> IO () +statusIconSetFromStock self stockId = + withUTFString stockId $ \stockIdPtr -> + {# call gtk_status_icon_set_from_stock #} + (toStatusIcon self) + stockIdPtr + +-- %hash c:b501 d:3ded +-- | Makes @statusIcon@ display the icon named @iconName@ from the current +-- icon theme. See 'statusIconNewFromIconName' for details. +-- +statusIconSetFromIconName :: StatusIconClass self => self + -> String -- ^ @iconName@ - an icon name + -> IO () +statusIconSetFromIconName self iconName = + withUTFString iconName $ \iconNamePtr -> + {# call gtk_status_icon_set_from_icon_name #} + (toStatusIcon self) + iconNamePtr + +-- %hash c:6317 d:d3c5 +-- | Gets the type of representation being used by the 'StatusIcon' to store +-- image data. If the 'StatusIcon' has no image data, the return value will be +-- 'ImageEmpty'. +-- +statusIconGetStorageType :: StatusIconClass self => self + -> IO ImageType -- ^ returns the image representation being used +statusIconGetStorageType self = + liftM (toEnum . fromIntegral) $ + {# call gtk_status_icon_get_storage_type #} + (toStatusIcon self) + +-- %hash c:cd8a d:9fed +-- | Gets the 'Pixbuf' being displayed by the 'StatusIcon'. The storage type +-- of the status icon must be 'ImageEmpty' or 'ImagePixbuf' (see +-- 'statusIconGetStorageType'). The caller of this function does not own a +-- reference to the returned pixbuf. +-- +statusIconGetPixbuf :: StatusIconClass self => self + -> IO (Maybe Pixbuf) -- ^ returns the displayed pixbuf, or @Nothing@ if the + -- image is empty. +statusIconGetPixbuf self = do + ptr <- {# call gtk_status_icon_get_pixbuf #} + (toStatusIcon self) + maybePeek (makeNewGObject mkPixbuf . return) ptr + [_$_] + +-- %hash c:ecce d:448 +-- | Gets the id of the stock icon being displayed by the 'StatusIcon'. The +-- storage type of the status icon must be 'ImageEmpty' or 'ImageStock' (see +-- 'statusIconGetStorageType'). The returned string is owned by the +-- 'StatusIcon' and should not be freed or modified. +-- +statusIconGetStock :: StatusIconClass self => self + -> IO (Maybe StockId) -- ^ returns stock id of the displayed stock icon, or @Nothing@ + -- if the image is empty. +statusIconGetStock self = + {# call gtk_status_icon_get_stock #} + (toStatusIcon self) + >>= maybePeek peekUTFString + +-- %hash c:6e6b d:273e +-- | Gets the name of the icon being displayed by the 'StatusIcon'. The +-- storage type of the status icon must be 'ImageEmpty' or 'ImageIconName' (see +-- 'statusIconGetStorageType'). The returned string is owned by the +-- 'StatusIcon' and should not be freed or modified. +-- +statusIconGetIconName :: StatusIconClass self => self + -> IO (Maybe String) -- ^ returns name of the displayed icon, or @Nothing@ + -- if the image is empty. +statusIconGetIconName self = + {# call gtk_status_icon_get_icon_name #} + (toStatusIcon self) + >>= maybePeek peekUTFString + +-- %hash c:b1db d:b874 +-- | Gets the size in pixels that is available for the image. Stock icons and +-- named icons adapt their size automatically if the size of the notification +-- area changes. For other storage types, the size-changed signal can be used +-- to react to size changes. +-- +statusIconGetSize :: StatusIconClass self => self + -> IO Int -- ^ returns the size that is available for the image +statusIconGetSize self = + liftM fromIntegral $ + {# call gtk_status_icon_get_size #} + (toStatusIcon self) + +-- %hash c:7644 d:d87b +-- | Sets the tooltip of the status icon. +-- +statusIconSetTooltip :: StatusIconClass self => self + -> String -- ^ @tooltipText@ - the tooltip text + -> IO () +statusIconSetTooltip self tooltipText = + withUTFString tooltipText $ \tooltipTextPtr -> + {# call gtk_status_icon_set_tooltip #} + (toStatusIcon self) + tooltipTextPtr + +-- %hash c:7bd8 d:74fd +-- | Shows or hides a status icon. +-- +statusIconSetVisible :: StatusIconClass self => self + -> Bool -- ^ @visible@ - @True@ to show the status icon, @False@ to hide it + -> IO () +statusIconSetVisible self visible = + {# call gtk_status_icon_set_visible #} + (toStatusIcon self) + (fromBool visible) + +-- %hash c:e90c d:6c0b +-- | Returns whether the status icon is visible or not. Note that being +-- visible does not guarantee that the user can actually see the icon, see also +-- 'statusIconIsEmbedded'. +-- +statusIconGetVisible :: StatusIconClass self => self + -> IO Bool -- ^ returns @True@ if the status icon is visible +statusIconGetVisible self = + liftM toBool $ + {# call gtk_status_icon_get_visible #} + (toStatusIcon self) + +-- %hash c:aa47 d:3980 +-- | Makes the status icon start or stop blinking. Note that blinking user +-- interface elements may be problematic for some users, and thus may be turned +-- off, in which case this setting has no effect. +-- +statusIconSetBlinking :: StatusIconClass self => self + -> Bool -- ^ @blinking@ - @True@ to turn blinking on, @False@ to turn it off + -> IO () +statusIconSetBlinking self blinking = + {# call gtk_status_icon_set_blinking #} + (toStatusIcon self) + (fromBool blinking) + +-- %hash c:2168 d:3189 +-- | Returns whether the icon is blinking, see 'statusIconSetBlinking'. +-- +statusIconGetBlinking :: StatusIconClass self => self + -> IO Bool -- ^ returns @True@ if the icon is blinking +statusIconGetBlinking self = + liftM toBool $ + {# call gtk_status_icon_get_blinking #} + (toStatusIcon self) + +-- %hash c:ffa d:8c83 +-- | Returns whether the status icon is embedded in a notification area. +-- +statusIconIsEmbedded :: StatusIconClass self => self + -> IO Bool -- ^ returns @True@ if the status icon is embedded in a + -- notification area. +statusIconIsEmbedded self = + liftM toBool $ + {# call gtk_status_icon_is_embedded #} + (toStatusIcon self) + +-- %hash c:6a16 d:99ad +-- | Menu positioning function to use with 'menuPopup' to position @menu@ +-- aligned to the status icon @userData@. +-- +statusIconPositionMenu :: (MenuClass menu, StatusIconClass self) => + menu -- ^ @menu@ - the 'Menu' + -> self -- ^ @userData@ - the status icon to position the + -- menu on + -> IO (Int,Int,Bool) -- ^ @(x,y,pushIn)@ - + -- @(x,y)@ - coordinates. + -- @pushIn@ - whether the menu should be + -- pushed in to be completely inside the screen + -- instead of just clamped to the size to the + -- screen. +statusIconPositionMenu menu userData = + alloca $ \xPtr -> + alloca $ \yPtr -> + alloca $ \pushInPtr -> do + {# call gtk_status_icon_position_menu #} + (toMenu menu) + xPtr + yPtr + pushInPtr + (castPtr . unsafeForeignPtrToPtr . unStatusIcon $ toStatusIcon userData) + x <- peek xPtr [_$_] + y <- peek yPtr + pushIn <- peek pushInPtr + return (fromIntegral x, fromIntegral y, toBool pushIn) + +-- FIXME: it's a partial binding, the potentially returned Screen is ignored +-- %hash c:7939 d:5ea +-- | Obtains information about the location of the status icon on screen. This +-- information can be used to e.g. position popups like notification bubbles. +-- +-- Note that some platforms do not allow Gtk+ to provide this information, +-- and even on platforms that do allow it, the information is not reliable +-- unless the status icon is embedded in a notification area, see +-- 'statusIconIsEmbedded'. +-- +statusIconGetGeometry :: StatusIconClass self => self -> IO (Maybe (Rectangle,Orientation)) +statusIconGetGeometry self = + alloca $ \recPtr -> + alloca $ \orPtr -> [_$_] + (liftM toBool $ {# call gtk_status_icon_get_geometry #} + (toStatusIcon self) nullPtr (castPtr recPtr) orPtr) >>= \b -> + if b [_$_] + then do + rec <- peek recPtr + or <- peek orPtr + return $ Just (rec,toEnum $ fromIntegral or) + else return Nothing + + +-------------------- +-- Attributes + +-- %hash c:575d d:54e3 +-- | A 'Pixbuf' to display. +-- +statusIconPixbuf :: StatusIconClass self => Attr self Pixbuf +statusIconPixbuf = newAttrFromObjectProperty "pixbuf" + {# call pure unsafe gdk_pixbuf_get_type #} + +-- %hash c:6783 d:d235 +-- | Filename to load and display. +-- +-- Default value: @Nothing@ +-- +statusIconFile :: StatusIconClass self => WriteAttr self (Maybe String) +statusIconFile = writeAttrFromMaybeStringProperty "file" + +-- %hash c:3fc3 d:7ec1 +-- | Stock ID for a stock image to display. +-- +-- Default value: @Nothing@ +-- +statusIconStock :: StatusIconClass self => Attr self (Maybe String) +statusIconStock = newAttrFromMaybeStringProperty "stock" + +-- %hash c:3502 d:9b7a +-- | The name of the icon from the icon theme. +-- +-- Default value: @Nothing@ +-- +statusIconIconName :: StatusIconClass self => Attr self (Maybe String) +statusIconIconName = newAttrFromMaybeStringProperty "icon-name" + +-- %hash c:570e d:983f +-- | The representation being used for image data. +-- +-- Default value: 'ImageEmpty' +-- +statusIconStorageType :: StatusIconClass self => ReadAttr self ImageType +statusIconStorageType = readAttrFromEnumProperty "storage-type" + {# call pure unsafe gtk_image_type_get_type #} + +-- %hash c:10be d:4621 +-- | The size of the icon. +-- +-- Allowed values: >= 0 +-- +-- Default value: 0 +-- +statusIconSize :: StatusIconClass self => ReadAttr self Int +statusIconSize = readAttrFromIntProperty "size" + +-- %hash c:eb d:655d +-- | Whether or not the status icon is blinking. +-- +-- Default value: @False@ +-- +statusIconBlinking :: StatusIconClass self => Attr self Bool +statusIconBlinking = newAttrFromBoolProperty "blinking" + +-- %hash c:4e2b d:7712 +-- | Whether or not the status icon is visible. +-- +-- Default value: @True@ +-- +statusIconVisible :: StatusIconClass self => Attr self Bool +statusIconVisible = newAttrFromBoolProperty "visible" + +-------------------- +-- Signals + +-- %hash c:969a d:71d0 +-- | Gets emitted when the size available for the image changes, e.g. because +-- the notification area got resized. +-- +sizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool) +sizeChanged = Signal (connect_INT__BOOL "size_changed") + +-- | Gets emitted when the user activates the status icon. [_$_] +-- If and how status icons can activated is platform-dependent. +activate :: StatusIconClass self => Signal self (IO ()) +activate = Signal (connect_NONE__NONE "activate") + [_$_] +-- | Gets emitted when the user brings up the context menu +-- of the status icon. Whether status icons can have context [_$_] +-- menus and how these are activated is platform-dependent. +-- +-- The 'MouseButton' and 'TimeStamp' parameters should be [_$_] +-- passed as the last to arguments to 'Graphics.UI.Gtk.menuPopup'. +popupMenu :: StatusIconClass self => Signal self (Maybe MouseButton -> TimeStamp -> IO ()) +popupMenu = Signal wrap + +wrap flag self f = connect_WORD_WORD__NONE "popup_menu" flag self (\m t -> f (toMB m) (fromIntegral t)) + where toMB 0 = Nothing + toMB n = Just . toEnum . fromIntegral $ n + +-------------------- +-- Deprecated Signals + +#ifndef DISABLE_DEPRECATED +-- %hash c:bd32 +onActivate :: StatusIconClass self => self + -> IO () + -> IO (ConnectId self) +onActivate = connect_NONE__NONE "activate" False +{-# DEPRECATED onActivate "instead of 'onActivate obj' use 'on obj activate'" #-} + +-- %hash c:a571 +afterActivate :: StatusIconClass self => self + -> IO () + -> IO (ConnectId self) +afterActivate = connect_NONE__NONE "activate" True +{-# DEPRECATED afterActivate "instead of 'afterActivate obj' use 'after obj activate'" #-} + +-- %hash c:44a5 +onPopupMenu :: StatusIconClass self => self + -> (Maybe MouseButton -> TimeStamp -> IO ()) + -> IO (ConnectId self) +onPopupMenu = wrap False [_$_] +{-# DEPRECATED onPopupMenu "instead of 'onPopupMenu obj' use 'on obj popupMenu'" #-} + +-- %hash c:1904 +afterPopupMenu :: StatusIconClass self => self + -> (Maybe MouseButton -> TimeStamp -> IO ()) + -> IO (ConnectId self) +afterPopupMenu = wrap True +{-# DEPRECATED afterPopupMenu "instead of 'afterPopupMenu obj' use 'after obj popupMenu'" #-} + +-- %hash c:e226 +onSizeChanged :: StatusIconClass self => self + -> (Int -> IO Bool) + -> IO (ConnectId self) +onSizeChanged = connect_INT__BOOL "size_changed" False +{-# DEPRECATED onSizeChanged "instead of 'onSizeChanged obj' use 'on obj sizeChanged'" #-} + +-- %hash c:ec65 +afterSizeChanged :: StatusIconClass self => self + -> (Int -> IO Bool) + -> IO (ConnectId self) +afterSizeChanged = connect_INT__BOOL "size_changed" True +{-# DEPRECATED afterSizeChanged "instead of 'afterSizeChanged obj' use 'after obj sizeChanged'" #-} +#endif +#endif hunk ./tools/callbackGen/gtkmarshal.list 26 - + [_$_] hunk ./tools/callbackGen/gtkmarshal.list 30 +BOOLEAN:INT hunk ./tools/callbackGen/gtkmarshal.list 97 -#VOID:UINT,UINT +VOID:UINT,UINT hunk ./tools/hierarchyGen/hierarchy.list 176 + GtkStatusIcon if gtk-2.10 |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:38
|
Wed Jul 25 02:49:36 PDT 2007 Andrea Vezzosi <san...@gm...> * StatusIcon demo adddir ./demo/statusicon addfile ./demo/statusicon/Makefile hunk ./demo/statusicon/Makefile 1 + +PROG = statusIcon +SOURCES = StatusIcon.hs + +$(PROG) : $(SOURCES) + $(HC) --make $< -o $@ $(HCFLAGS) + +clean: + rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROG) + +HC=ghc addfile ./demo/statusicon/StatusIcon.hs hunk ./demo/statusicon/StatusIcon.hs 1 +-- Simple StatusIcon example +import Graphics.UI.Gtk +import qualified Graphics.UI.Gtk.Display.StatusIcon as I + + +main = do + initGUI + icon <- statusIconNewFromStock stockQuit + statusIconSetVisible icon True + statusIconSetTooltip icon "This is a test" + menu <- mkmenu icon + I.onPopupMenu icon $ \b a -> do [_$_] + widgetShowAll menu + print (b,a) + menuPopup menu $ maybe Nothing (\b' -> Just (b',a)) b + I.onActivate icon $ do + putStrLn "'activate' signal triggered" + mainGUI + +mkmenu s = do [_$_] + m <- menuNew + mapM_ (mkitem m) [("Let's blink!",statusIconSetBlinking s True) + ,("Let's stop blink!",statusIconSetBlinking s False) + ,("Quit",mainQuit)] [_$_] + return m + where + mkitem menu (label,act) = [_$_] + do i <- menuItemNewWithLabel label + menuShellAppend menu i + i `onActivateLeaf` act |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:37
|
Wed Oct 10 10:28:32 PDT 2007 jn...@ar... * binding textbuffer clipboard functions (v2) Cut, copy and paste functions for the text buffer and a minimal clipboard module that just provides a type and a function to get the standard clipboards. hunk ./Makefile.am 425 + gtk/Graphics/UI/Gtk/General/Clipboard.chs \ hunk ./gtk/Graphics/UI/Gtk.hs 50 + module Graphics.UI.Gtk.General.Clipboard, + hunk ./gtk/Graphics/UI/Gtk.hs 224 +import Graphics.UI.Gtk.General.Clipboard addfile ./gtk/Graphics/UI/Gtk/General/Clipboard.chs hunk ./gtk/Graphics/UI/Gtk/General/Clipboard.chs 1 +-- -*-haskell-*- +-- GIMP Toolkit (GTK) Clipboard support +-- +-- Author : Juergen Nicklisch +-- +-- Created: 26 March 2007 +-- +-- Copyright (C) 2007 Juergen Nicklisch +-- +-- 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. +-- +-- 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 +-- +-- | +-- Maintainer : gtk...@li... +-- Stability : provisional +-- Portability : portable (depends on GHC) +-- +-- Functions for the Clipboard. +-- +module Graphics.UI.Gtk.General.Clipboard ( + +-- * Types +ClipboardType(..), + [_$_] +-- * Methods +clipboardGet + ) where + +import System.Glib.FFI +import System.Glib.Flags (fromFlags) +import System.Glib.Signals +import System.Glib.GObject +{#import Graphics.UI.Gtk.Types#} [_$_] +{#import Graphics.UI.Gtk.General.DNDTypes#} + +{# context lib="gtk" prefix="gtk" #} + +-------------------- +-- Types + +-- | 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) + +data ClipboardType = ClipClipboard + | ClipPrimary + deriving (Eq,Show) + +-------------------- +-- Methods + +-- | 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. +-- +clipboardGet :: ClipboardType + -> IO Clipboard +clipboardGet clipboardType = do + makeNewGObject Clipboard $ + {#call gtk_clipboard_get#} + (clipboardTypeToPointer clipboardType) + +clipboardTypeToPointer :: ClipboardType -> Ptr () +clipboardTypeToPointer ClipClipboard = nullPtr `plusPtr` 1 +clipboardTypeToPointer ClipPrimary = nullPtr `plusPtr` 69 hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 36 --- If Clipboards are bound, then these functions need to be bound as well: --- gtk_text_buffer_paste_clipboard --- gtk_text_buffer_copy_clipboard --- gtk_text_buffer_cut_clipboard +-- If Clipboards are fully bound, then these functions need to be bound as well: hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 140 + textBufferPasteClipboard, + textBufferCopyClipboard, + textBufferCutClipboard, + hunk ./gtk/Graphics/UI/Gtk/Multiline/TextBuffer.chs.pp 962 +-- | Pastes the contents of a clipboard at the insertion point, +-- or at override_location. (Note: pasting is asynchronous, that is, +-- we'll ask for the paste data and return, and at some point later +-- after the main loop runs, the paste data will be inserted.) +textBufferPasteClipboard :: TextBufferClass self => self + -> Clipboard -- ^ @clipboard@ - the GtkClipboard to paste from + -> TextIter -- ^ @overrideLocation@ - location to insert pasted text + -> Bool -- ^ @defaultEditable@ - whether the buffer is editable by default + -> IO () +textBufferPasteClipboard self clipboard overrideLocation defaultEditable = + {# call gtk_text_buffer_paste_clipboard #} + (toTextBuffer self) + clipboard + overrideLocation + (fromBool defaultEditable) + +-- | Copies the currently-selected text to a clipboard. +textBufferCopyClipboard :: TextBufferClass self => self + -> Clipboard -- ^ @clipboard@ - the GtkClipboard object to copy to + -> IO () +textBufferCopyClipboard self clipboard = + {# call gtk_text_buffer_copy_clipboard #} + (toTextBuffer self) + clipboard + +-- | Copies the currently-selected text to a clipboard, +-- then deletes said text if it's editable. +textBufferCutClipboard :: TextBufferClass self => self + -> Clipboard -- ^ @clipboard@ - the GtkClipboard object to cut to + -> Bool -- ^ @defaultEditable@ - whether the buffer is editable by default + -> IO () +textBufferCutClipboard self clipboard defaultEditable = + {# call gtk_text_buffer_cut_clipboard #} + (toTextBuffer self) + clipboard + (fromBool defaultEditable) + |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:34
|
Thu Jul 26 06:02:15 PDT 2007 A....@ke... * Add stock items to reference documentation. addfile ./docs/reference/images/stock-icons/stock_about_24.png binary ./docs/reference/images/stock-icons/stock_about_24.png addfile ./docs/reference/images/stock-icons/stock_add_24.png binary ./docs/reference/images/stock-icons/stock_add_24.png addfile ./docs/reference/images/stock-icons/stock_align_center_24.png binary ./docs/reference/images/stock-icons/stock_align_center_24.png addfile ./docs/reference/images/stock-icons/stock_align_justify_24.png binary ./docs/reference/images/stock-icons/stock_align_justify_24.png addfile ./docs/reference/images/stock-icons/stock_align_left_24.png binary ./docs/reference/images/stock-icons/stock_align_left_24.png addfile ./docs/reference/images/stock-icons/stock_align_right_24.png binary ./docs/reference/images/stock-icons/stock_align_right_24.png addfile ./docs/reference/images/stock-icons/stock_apply_20.png binary ./docs/reference/images/stock-icons/stock_apply_20.png addfile ./docs/reference/images/stock-icons/stock_bottom_24.png binary ./docs/reference/images/stock-icons/stock_bottom_24.png addfile ./docs/reference/images/stock-icons/stock_broken_image_24.png binary ./docs/reference/images/stock-icons/stock_broken_image_24.png addfile ./docs/reference/images/stock-icons/stock_cancel_20.png binary ./docs/reference/images/stock-icons/stock_cancel_20.png addfile ./docs/reference/images/stock-icons/stock_cdrom_24.png binary ./docs/reference/images/stock-icons/stock_cdrom_24.png addfile ./docs/reference/images/stock-icons/stock_clear_24.png binary ./docs/reference/images/stock-icons/stock_clear_24.png addfile ./docs/reference/images/stock-icons/stock_close_24.png binary ./docs/reference/images/stock-icons/stock_close_24.png addfile ./docs/reference/images/stock-icons/stock_color_picker_25.png binary ./docs/reference/images/stock-icons/stock_color_picker_25.png addfile ./docs/reference/images/stock-icons/stock_colorselector_24.png binary ./docs/reference/images/stock-icons/stock_colorselector_24.png addfile ./docs/reference/images/stock-icons/stock_connect_24.png binary ./docs/reference/images/stock-icons/stock_connect_24.png addfile ./docs/reference/images/stock-icons/stock_convert_24.png binary ./docs/reference/images/stock-icons/stock_convert_24.png addfile ./docs/reference/images/stock-icons/stock_copy_24.png binary ./docs/reference/images/stock-icons/stock_copy_24.png addfile ./docs/reference/images/stock-icons/stock_cut_24.png binary ./docs/reference/images/stock-icons/stock_cut_24.png addfile ./docs/reference/images/stock-icons/stock_dialog_authentication_48.png binary ./docs/reference/images/stock-icons/stock_dialog_authentication_48.png addfile ./docs/reference/images/stock-icons/stock_dialog_error_48.png binary ./docs/reference/images/stock-icons/stock_dialog_error_48.png addfile ./docs/reference/images/stock-icons/stock_dialog_info_48.png binary ./docs/reference/images/stock-icons/stock_dialog_info_48.png addfile ./docs/reference/images/stock-icons/stock_dialog_question_48.png binary ./docs/reference/images/stock-icons/stock_dialog_question_48.png addfile ./docs/reference/images/stock-icons/stock_dialog_warning_48.png binary ./docs/reference/images/stock-icons/stock_dialog_warning_48.png addfile ./docs/reference/images/stock-icons/stock_directory_24.png binary ./docs/reference/images/stock-icons/stock_directory_24.png addfile ./docs/reference/images/stock-icons/stock_disconnect_24.png binary ./docs/reference/images/stock-icons/stock_disconnect_24.png addfile ./docs/reference/images/stock-icons/stock_dnd_32.png binary ./docs/reference/images/stock-icons/stock_dnd_32.png addfile ./docs/reference/images/stock-icons/stock_dnd_multiple_32.png binary ./docs/reference/images/stock-icons/stock_dnd_multiple_32.png addfile ./docs/reference/images/stock-icons/stock_down_arrow_24.png binary ./docs/reference/images/stock-icons/stock_down_arrow_24.png addfile ./docs/reference/images/stock-icons/stock_edit_24.png binary ./docs/reference/images/stock-icons/stock_edit_24.png addfile ./docs/reference/images/stock-icons/stock_exec_24.png binary ./docs/reference/images/stock-icons/stock_exec_24.png addfile ./docs/reference/images/stock-icons/stock_exit_24.png binary ./docs/reference/images/stock-icons/stock_exit_24.png addfile ./docs/reference/images/stock-icons/stock_file_24.png binary ./docs/reference/images/stock-icons/stock_file_24.png addfile ./docs/reference/images/stock-icons/stock_first_24.png binary ./docs/reference/images/stock-icons/stock_first_24.png addfile ./docs/reference/images/stock-icons/stock_font_24.png binary ./docs/reference/images/stock-icons/stock_font_24.png addfile ./docs/reference/images/stock-icons/stock_fullscreen_24.png binary ./docs/reference/images/stock-icons/stock_fullscreen_24.png addfile ./docs/reference/images/stock-icons/stock_harddisk_24.png binary ./docs/reference/images/stock-icons/stock_harddisk_24.png addfile ./docs/reference/images/stock-icons/stock_help_24.png binary ./docs/reference/images/stock-icons/stock_help_24.png addfile ./docs/reference/images/stock-icons/stock_home_24.png binary ./docs/reference/images/stock-icons/stock_home_24.png addfile ./docs/reference/images/stock-icons/stock_index_24.png binary ./docs/reference/images/stock-icons/stock_index_24.png addfile ./docs/reference/images/stock-icons/stock_info_24.png binary ./docs/reference/images/stock-icons/stock_info_24.png addfile ./docs/reference/images/stock-icons/stock_jump_to_24.png binary ./docs/reference/images/stock-icons/stock_jump_to_24.png addfile ./docs/reference/images/stock-icons/stock_last_24.png binary ./docs/reference/images/stock-icons/stock_last_24.png addfile ./docs/reference/images/stock-icons/stock_leave_fullscreen_24.png binary ./docs/reference/images/stock-icons/stock_leave_fullscreen_24.png addfile ./docs/reference/images/stock-icons/stock_left_arrow_24.png binary ./docs/reference/images/stock-icons/stock_left_arrow_24.png addfile ./docs/reference/images/stock-icons/stock_media_forward_24.png binary ./docs/reference/images/stock-icons/stock_media_forward_24.png addfile ./docs/reference/images/stock-icons/stock_media_next_24.png binary ./docs/reference/images/stock-icons/stock_media_next_24.png addfile ./docs/reference/images/stock-icons/stock_media_pause_24.png binary ./docs/reference/images/stock-icons/stock_media_pause_24.png addfile ./docs/reference/images/stock-icons/stock_media_play_24.png binary ./docs/reference/images/stock-icons/stock_media_play_24.png addfile ./docs/reference/images/stock-icons/stock_media_previous_24.png binary ./docs/reference/images/stock-icons/stock_media_previous_24.png addfile ./docs/reference/images/stock-icons/stock_media_record_24.png binary ./docs/reference/images/stock-icons/stock_media_record_24.png addfile ./docs/reference/images/stock-icons/stock_media_rewind_24.png binary ./docs/reference/images/stock-icons/stock_media_rewind_24.png addfile ./docs/reference/images/stock-icons/stock_media_stop_24.png binary ./docs/reference/images/stock-icons/stock_media_stop_24.png addfile ./docs/reference/images/stock-icons/stock_network_24.png binary ./docs/reference/images/stock-icons/stock_network_24.png addfile ./docs/reference/images/stock-icons/stock_new_24.png binary ./docs/reference/images/stock-icons/stock_new_24.png addfile ./docs/reference/images/stock-icons/stock_no_20.png binary ./docs/reference/images/stock-icons/stock_no_20.png addfile ./docs/reference/images/stock-icons/stock_ok_20.png binary ./docs/reference/images/stock-icons/stock_ok_20.png addfile ./docs/reference/images/stock-icons/stock_open_24.png binary ./docs/reference/images/stock-icons/stock_open_24.png addfile ./docs/reference/images/stock-icons/stock_paste_24.png binary ./docs/reference/images/stock-icons/stock_paste_24.png addfile ./docs/reference/images/stock-icons/stock_preferences_24.png binary ./docs/reference/images/stock-icons/stock_preferences_24.png addfile ./docs/reference/images/stock-icons/stock_print_24.png binary ./docs/reference/images/stock-icons/stock_print_24.png addfile ./docs/reference/images/stock-icons/stock_print_preview_24.png binary ./docs/reference/images/stock-icons/stock_print_preview_24.png addfile ./docs/reference/images/stock-icons/stock_properties_24.png binary ./docs/reference/images/stock-icons/stock_properties_24.png addfile ./docs/reference/images/stock-icons/stock_redo_24.png binary ./docs/reference/images/stock-icons/stock_redo_24.png addfile ./docs/reference/images/stock-icons/stock_refresh_24.png binary ./docs/reference/images/stock-icons/stock_refresh_24.png addfile ./docs/reference/images/stock-icons/stock_remove_24.png binary ./docs/reference/images/stock-icons/stock_remove_24.png addfile ./docs/reference/images/stock-icons/stock_revert_24.png binary ./docs/reference/images/stock-icons/stock_revert_24.png addfile ./docs/reference/images/stock-icons/stock_right_arrow_24.png binary ./docs/reference/images/stock-icons/stock_right_arrow_24.png addfile ./docs/reference/images/stock-icons/stock_save_24.png binary ./docs/reference/images/stock-icons/stock_save_24.png addfile ./docs/reference/images/stock-icons/stock_save_as_24.png binary ./docs/reference/images/stock-icons/stock_save_as_24.png addfile ./docs/reference/images/stock-icons/stock_search_24.png binary ./docs/reference/images/stock-icons/stock_search_24.png addfile ./docs/reference/images/stock-icons/stock_search_replace_24.png binary ./docs/reference/images/stock-icons/stock_search_replace_24.png addfile ./docs/reference/images/stock-icons/stock_sort_ascending_24.png binary ./docs/reference/images/stock-icons/stock_sort_ascending_24.png addfile ./docs/reference/images/stock-icons/stock_sort_descending_24.png binary ./docs/reference/images/stock-icons/stock_sort_descending_24.png addfile ./docs/reference/images/stock-icons/stock_spellcheck_24.png binary ./docs/reference/images/stock-icons/stock_spellcheck_24.png addfile ./docs/reference/images/stock-icons/stock_stop_24.png binary ./docs/reference/images/stock-icons/stock_stop_24.png addfile ./docs/reference/images/stock-icons/stock_text_bold_24.png binary ./docs/reference/images/stock-icons/stock_text_bold_24.png addfile ./docs/reference/images/stock-icons/stock_text_indent_24.png binary ./docs/reference/images/stock-icons/stock_text_indent_24.png addfile ./docs/reference/images/stock-icons/stock_text_italic_24.png binary ./docs/reference/images/stock-icons/stock_text_italic_24.png addfile ./docs/reference/images/stock-icons/stock_text_strikethrough_24.png binary ./docs/reference/images/stock-icons/stock_text_strikethrough_24.png addfile ./docs/reference/images/stock-icons/stock_text_underline_24.png binary ./docs/reference/images/stock-icons/stock_text_underline_24.png addfile ./docs/reference/images/stock-icons/stock_text_unindent_24.png binary ./docs/reference/images/stock-icons/stock_text_unindent_24.png addfile ./docs/reference/images/stock-icons/stock_top_24.png binary ./docs/reference/images/stock-icons/stock_top_24.png addfile ./docs/reference/images/stock-icons/stock_trash_24.png binary ./docs/reference/images/stock-icons/stock_trash_24.png addfile ./docs/reference/images/stock-icons/stock_undelete_24.png binary ./docs/reference/images/stock-icons/stock_undelete_24.png addfile ./docs/reference/images/stock-icons/stock_undo_24.png binary ./docs/reference/images/stock-icons/stock_undo_24.png addfile ./docs/reference/images/stock-icons/stock_up_arrow_24.png binary ./docs/reference/images/stock-icons/stock_up_arrow_24.png addfile ./docs/reference/images/stock-icons/stock_yes_20.png binary ./docs/reference/images/stock-icons/stock_yes_20.png addfile ./docs/reference/images/stock-icons/stock_zoom_1_24.png binary ./docs/reference/images/stock-icons/stock_zoom_1_24.png addfile ./docs/reference/images/stock-icons/stock_zoom_fit_24.png binary ./docs/reference/images/stock-icons/stock_zoom_fit_24.png addfile ./docs/reference/images/stock-icons/stock_zoom_in_24.png binary ./docs/reference/images/stock-icons/stock_zoom_in_24.png addfile ./docs/reference/images/stock-icons/stock_zoom_out_24.png binary ./docs/reference/images/stock-icons/stock_zoom_out_24.png |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:33
|
Thu Oct 4 07:41:15 PDT 2007 A....@ke... * Add a catch-all constructor to the set of mouse buttons. hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 109 + | OtherButton Int hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 116 + toEnum n = OtherButton (fromIntegral n) hunk ./gtk/Graphics/UI/Gtk/General/Enums.chs.pp 120 + fromEnum (OtherButton n) = fromIntegral n |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:31
|
Sun Jul 15 09:35:52 PDT 2007 A....@ke... * Add missing case in Drag. Fix documentation. hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 246 +dragDestFindTarget widget context Nothing = do + ttPtr <- + {# call gtk_drag_dest_find_target #} + (toWidget widget) + (toDragContext context) + (TargetList nullForeignPtr) + if ttPtr==nullPtr then return Nothing else return (Just (TargetTag ttPtr)) +[_^I_][_$_] hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 285 --- | Add image targets supported by the selection mechanism to the target --- list of the drag source. The targets are added with an 'InfoId' of 0. If --- you need another value, use 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and +-- | Add image targets supported by the selection mechanism to the target list +-- of the drag source. The targets are added with an 'InfoId' of 0. If you +-- need another value, use +-- 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and hunk ./gtk/Graphics/UI/Gtk/General/Drag.chs.pp 297 --- | Add URI targets supported by the selection mechanism to the target --- list of the drag source. The targets are added with an 'InfoId' of 0. If --- you need another value, use 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and +-- | Add URI targets supported by the selection mechanism to the target list +-- of the drag source. The targets are added with an 'InfoId' of 0. If you +-- need another value, use +-- 'Graphics.UI.Gtk.General.Selection.targetListAddTextTargets' and |
From: Duncan C. <dun...@wo...> - 2007-10-15 14:44:27
|
Sun Jul 15 09:35:12 PDT 2007 A....@ke... * Add a new function to Pixbuf. Correct documentation. hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 321 -pixbufNewFromFileAtScale :: String -> Int -> Int -> Bool -> IO Pixbuf +pixbufNewFromFileAtScale :: [_$_] + String -- ^ the name of the file + -> Int -- ^ target width + -> Int -- ^ target height + -> Bool -- ^ whether to preserve the aspect ratio + -> IO Pixbuf hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 526 -pixbufScaleSimple :: Pixbuf -> Int -> Int -> InterpType -> IO Pixbuf +pixbufScaleSimple :: [_$_] + Pixbuf -- ^ @src@ - the source image + -> Int -- ^ @width@ - the target width + -> Int -- ^ @height@ the target height + -> InterpType -- ^ interpolation type + -> IO Pixbuf hunk ./gtk/Graphics/UI/Gtk/Gdk/Pixbuf.chs.pp 582 -pixbufComposite :: Pixbuf -> Pixbuf -> Int -> Int -> Int -> Int -> - Double -> Double -> Double -> Double -> InterpType -> - Word8 -> IO () +pixbufComposite :: + Pixbuf -- ^ @src@ - the source pixbuf + -> Pixbuf -- ^ @dest@ - the pixbuf into which to render the results + -> Int -- ^ @destX@ - the left coordinate for region to render + -> Int -- ^ @destY@ - the top coordinate for region to render [_$_] + -> Int -- ^ @destWidth@ - the width of the region to render + -> Int -- ^ @destHeight@ - the height of the region to render + -> Double -- ^ @offsetX@ - the offset in the X direction (currently + -- rounded to an integer) + -> Double -- ^ @offsetY@ - the offset in the Y direction [_$_] + -- (currently rounded to an integer) + -> Double -- ^ @scaleX@ - the scale factor in the X direction + -> Double -- ^ @scaleY@ - the scale factor in the Y direction + -> InterpType -- ^ the interpolation type for the transformation. + -> Word8 -- ^ @alpha@ - the transparency + -> IO () hunk ./gtk/Graphics/UI/Gtk/Gdk/PixbufData.hs.pp 48 --- * See 'pixbufGetPixels'. +-- * See 'Graphics.UI.Gtk.Gdk.Pixbuf.pixbufGetPixels'. |