gtk 0.11.2 → 0.15.10
raw patch · 284 files changed
Files
- Graphics/UI/Gtk.chs +181/−11
- Graphics/UI/Gtk/Abstract/Bin.chs +2/−1
- Graphics/UI/Gtk/Abstract/Box.chs +102/−14
- Graphics/UI/Gtk/Abstract/ButtonBox.chs +42/−1
- Graphics/UI/Gtk/Abstract/Container.chs +13/−13
- Graphics/UI/Gtk/Abstract/ContainerChildProperties.chs +5/−4
- Graphics/UI/Gtk/Abstract/IMContext.chs +16/−16
- Graphics/UI/Gtk/Abstract/Misc.chs +2/−1
- Graphics/UI/Gtk/Abstract/Object.chs +48/−18
- Graphics/UI/Gtk/Abstract/Paned.chs +28/−11
- Graphics/UI/Gtk/Abstract/Range.chs +127/−10
- Graphics/UI/Gtk/Abstract/Scale.chs +4/−3
- Graphics/UI/Gtk/Abstract/Scrollbar.hs +2/−2
- Graphics/UI/Gtk/Abstract/Separator.hs +1/−1
- Graphics/UI/Gtk/Abstract/Widget.chs +4470/−3055
- Graphics/UI/Gtk/ActionMenuToolbar/Action.chs +43/−21
- Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs +42/−44
- Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs +9/−10
- Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs +139/−0
- Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs +7/−8
- Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs +34/−35
- Graphics/UI/Gtk/Builder.chs +20/−21
- Graphics/UI/Gtk/Buttons/Button.chs +31/−44
- Graphics/UI/Gtk/Buttons/CheckButton.chs +8/−7
- Graphics/UI/Gtk/Buttons/LinkButton.chs +177/−0
- Graphics/UI/Gtk/Buttons/RadioButton.chs +28/−28
- Graphics/UI/Gtk/Buttons/ScaleButton.chs +235/−0
- Graphics/UI/Gtk/Buttons/ToggleButton.chs +7/−7
- Graphics/UI/Gtk/Buttons/VolumeButton.chs +85/−0
- Graphics/UI/Gtk/Cairo.chs +59/−5
- Graphics/UI/Gtk/Display/AccelLabel.chs +7/−6
- Graphics/UI/Gtk/Display/Image.chs +30/−27
- Graphics/UI/Gtk/Display/InfoBar.chs +272/−0
- Graphics/UI/Gtk/Display/Label.chs +89/−42
- Graphics/UI/Gtk/Display/ProgressBar.chs +21/−11
- Graphics/UI/Gtk/Display/Spinner.chs +99/−0
- Graphics/UI/Gtk/Display/StatusIcon.chs +281/−35
- Graphics/UI/Gtk/Display/Statusbar.chs +63/−20
- Graphics/UI/Gtk/Embedding/Embedding.hsc +5/−4
- Graphics/UI/Gtk/Embedding/Plug.chs +18/−11
- Graphics/UI/Gtk/Embedding/Socket.chs +21/−12
- Graphics/UI/Gtk/Embedding/Types.chs +129/−0
- Graphics/UI/Gtk/Entry/Editable.chs +62/−32
- Graphics/UI/Gtk/Entry/Entry.chs +344/−35
- Graphics/UI/Gtk/Entry/EntryBuffer.chs +248/−0
- Graphics/UI/Gtk/Entry/EntryCompletion.chs +27/−28
- Graphics/UI/Gtk/Entry/HScale.chs +6/−5
- Graphics/UI/Gtk/Entry/SpinButton.chs +8/−7
- Graphics/UI/Gtk/Entry/VScale.chs +6/−5
- Graphics/UI/Gtk/Gdk/AppLaunchContext.chs +140/−0
- Graphics/UI/Gtk/Gdk/Cursor.chs +48/−41
- Graphics/UI/Gtk/Gdk/Display.chs +13/−14
- Graphics/UI/Gtk/Gdk/DisplayManager.chs +112/−0
- Graphics/UI/Gtk/Gdk/DrawWindow.chs +105/−35
- Graphics/UI/Gtk/Gdk/Drawable.chs +49/−28
- Graphics/UI/Gtk/Gdk/Enums.chs +40/−15
- Graphics/UI/Gtk/Gdk/EventM.hsc +129/−67
- Graphics/UI/Gtk/Gdk/Events.hsc +160/−155
- Graphics/UI/Gtk/Gdk/GC.chs +27/−23
- Graphics/UI/Gtk/Gdk/Gdk.chs +11/−4
- Graphics/UI/Gtk/Gdk/Keymap.chs +365/−0
- Graphics/UI/Gtk/Gdk/Keys.chs +72/−6
- Graphics/UI/Gtk/Gdk/Pixbuf.chs +127/−60
- Graphics/UI/Gtk/Gdk/PixbufAnimation.chs +10/−11
- Graphics/UI/Gtk/Gdk/PixbufData.hs +7/−25
- Graphics/UI/Gtk/Gdk/Pixmap.chs +14/−9
- Graphics/UI/Gtk/Gdk/Region.chs +20/−13
- Graphics/UI/Gtk/Gdk/Screen.chs +25/−14
- Graphics/UI/Gtk/General/Clipboard.chs +33/−33
- Graphics/UI/Gtk/General/DNDTypes.chs +7/−7
- Graphics/UI/Gtk/General/Drag.chs +43/−35
- Graphics/UI/Gtk/General/Enums.chs +118/−23
- Graphics/UI/Gtk/General/General.chs +84/−33
- Graphics/UI/Gtk/General/IconFactory.chs +27/−34
- Graphics/UI/Gtk/General/IconTheme.chs +88/−92
- Graphics/UI/Gtk/General/RcStyle.chs +18/−19
- Graphics/UI/Gtk/General/Selection.chs +56/−26
- Graphics/UI/Gtk/General/Settings.chs +122/−0
- Graphics/UI/Gtk/General/StockItems.hsc +250/−249
- Graphics/UI/Gtk/General/Structs.hsc +252/−116
- Graphics/UI/Gtk/General/Style.chs +79/−10
- Graphics/UI/Gtk/General/hsgthread.c +54/−8
- Graphics/UI/Gtk/General/hsgthread.h +3/−0
- Graphics/UI/Gtk/Layout/Alignment.chs +4/−4
- Graphics/UI/Gtk/Layout/AspectFrame.chs +6/−5
- Graphics/UI/Gtk/Layout/Expander.chs +20/−7
- Graphics/UI/Gtk/Layout/Fixed.chs +11/−5
- Graphics/UI/Gtk/Layout/HBox.chs +5/−4
- Graphics/UI/Gtk/Layout/HButtonBox.chs +2/−1
- Graphics/UI/Gtk/Layout/HPaned.chs +4/−3
- Graphics/UI/Gtk/Layout/Layout.chs +13/−6
- Graphics/UI/Gtk/Layout/Notebook.chs +101/−45
- Graphics/UI/Gtk/Layout/Table.chs +31/−7
- Graphics/UI/Gtk/Layout/VBox.chs +5/−4
- Graphics/UI/Gtk/Layout/VButtonBox.chs +2/−1
- Graphics/UI/Gtk/Layout/VPaned.chs +4/−3
- Graphics/UI/Gtk/MenuComboToolbar/CheckMenuItem.chs +19/−11
- Graphics/UI/Gtk/MenuComboToolbar/Combo.chs +13/−8
- Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs +116/−38
- Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs +25/−21
- Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs +9/−8
- Graphics/UI/Gtk/MenuComboToolbar/Menu.chs +15/−16
- Graphics/UI/Gtk/MenuComboToolbar/MenuBar.chs +3/−3
- Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs +137/−36
- Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs +4/−4
- Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs +18/−15
- Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs +8/−4
- Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs +16/−13
- Graphics/UI/Gtk/MenuComboToolbar/RadioToolButton.chs +7/−7
- Graphics/UI/Gtk/MenuComboToolbar/SeparatorMenuItem.chs +3/−3
- Graphics/UI/Gtk/MenuComboToolbar/SeparatorToolItem.chs +3/−3
- Graphics/UI/Gtk/MenuComboToolbar/TearoffMenuItem.chs +4/−3
- Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs +4/−4
- Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs +18/−17
- Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs +69/−14
- Graphics/UI/Gtk/MenuComboToolbar/ToolItemGroup.chs +293/−0
- Graphics/UI/Gtk/MenuComboToolbar/ToolPalette.chs +265/−0
- Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs +110/−72
- Graphics/UI/Gtk/Misc/Accessible.chs +89/−0
- Graphics/UI/Gtk/Misc/Adjustment.chs +5/−5
- Graphics/UI/Gtk/Misc/Arrow.chs +7/−6
- Graphics/UI/Gtk/Misc/Calendar.chs +23/−13
- Graphics/UI/Gtk/Misc/DrawingArea.chs +13/−6
- Graphics/UI/Gtk/Misc/EventBox.chs +3/−3
- Graphics/UI/Gtk/Misc/HandleBox.chs +8/−7
- Graphics/UI/Gtk/Misc/IMContextSimple.chs +99/−0
- Graphics/UI/Gtk/Misc/IMMulticontext.chs +1/−3
- Graphics/UI/Gtk/Misc/SizeGroup.chs +4/−5
- Graphics/UI/Gtk/Misc/Tooltip.chs +51/−29
- Graphics/UI/Gtk/Misc/Tooltips.chs +12/−10
- Graphics/UI/Gtk/Misc/Viewport.chs +41/−9
- Graphics/UI/Gtk/ModelView.chs +85/−0
- Graphics/UI/Gtk/ModelView.hs +0/−80
- Graphics/UI/Gtk/ModelView/CellEditable.chs +144/−0
- Graphics/UI/Gtk/ModelView/CellLayout.chs +15/−17
- Graphics/UI/Gtk/ModelView/CellRenderer.chs +16/−8
- Graphics/UI/Gtk/ModelView/CellRendererAccel.chs +171/−0
- Graphics/UI/Gtk/ModelView/CellRendererCombo.chs +7/−6
- Graphics/UI/Gtk/ModelView/CellRendererPixbuf.chs +7/−6
- Graphics/UI/Gtk/ModelView/CellRendererProgress.chs +5/−4
- Graphics/UI/Gtk/ModelView/CellRendererSpin.chs +131/−0
- Graphics/UI/Gtk/ModelView/CellRendererSpinner.chs +123/−0
- Graphics/UI/Gtk/ModelView/CellRendererText.chs +33/−32
- Graphics/UI/Gtk/ModelView/CellRendererToggle.chs +14/−13
- Graphics/UI/Gtk/ModelView/CellView.chs +18/−11
- Graphics/UI/Gtk/ModelView/CustomStore.chs +26/−34
- Graphics/UI/Gtk/ModelView/Gtk2HsStore.c +11/−8
- Graphics/UI/Gtk/ModelView/Gtk2HsStore.h +2/−3
- Graphics/UI/Gtk/ModelView/IconView.chs +72/−25
- Graphics/UI/Gtk/ModelView/ListStore.hs +53/−39
- Graphics/UI/Gtk/ModelView/Sequence.hs +434/−434
- Graphics/UI/Gtk/ModelView/TreeDrag.chs +5/−3
- Graphics/UI/Gtk/ModelView/TreeModel.chs +22/−24
- Graphics/UI/Gtk/ModelView/TreeModelFilter.chs +11/−15
- Graphics/UI/Gtk/ModelView/TreeModelSort.chs +4/−6
- Graphics/UI/Gtk/ModelView/TreeRowReference.chs +2/−2
- Graphics/UI/Gtk/ModelView/TreeSelection.chs +24/−12
- Graphics/UI/Gtk/ModelView/TreeSortable.chs +17/−11
- Graphics/UI/Gtk/ModelView/TreeStore.hs +85/−73
- Graphics/UI/Gtk/ModelView/TreeView.chs +195/−78
- Graphics/UI/Gtk/ModelView/TreeViewColumn.chs +21/−14
- Graphics/UI/Gtk/ModelView/Types.chs +37/−27
- Graphics/UI/Gtk/Multiline/TextBuffer.chs +141/−61
- Graphics/UI/Gtk/Multiline/TextIter.chs +116/−121
- Graphics/UI/Gtk/Multiline/TextMark.chs +8/−7
- Graphics/UI/Gtk/Multiline/TextTag.chs +66/−52
- Graphics/UI/Gtk/Multiline/TextTagTable.chs +10/−9
- Graphics/UI/Gtk/Multiline/TextView.chs +101/−32
- Graphics/UI/Gtk/Multiline/Types.chs +2/−2
- Graphics/UI/Gtk/Ornaments/Frame.chs +11/−10
- Graphics/UI/Gtk/Ornaments/HSeparator.chs +4/−3
- Graphics/UI/Gtk/Ornaments/VSeparator.chs +4/−3
- Graphics/UI/Gtk/Printing/PageSetup.chs +397/−0
- Graphics/UI/Gtk/Printing/PaperSize.chs +361/−0
- Graphics/UI/Gtk/Printing/PrintContext.chs +226/−0
- Graphics/UI/Gtk/Printing/PrintOperation.chs +944/−0
- Graphics/UI/Gtk/Printing/PrintSettings.chs +1075/−0
- Graphics/UI/Gtk/Recent/RecentChooser.chs +442/−0
- Graphics/UI/Gtk/Recent/RecentChooserMenu.chs +149/−0
- Graphics/UI/Gtk/Recent/RecentChooserWidget.chs +105/−0
- Graphics/UI/Gtk/Recent/RecentFilter.chs +223/−0
- Graphics/UI/Gtk/Recent/RecentInfo.chs +351/−0
- Graphics/UI/Gtk/Recent/RecentManager.chs +320/−0
- Graphics/UI/Gtk/Scrolling/HScrollbar.chs +5/−4
- Graphics/UI/Gtk/Scrolling/ScrolledWindow.chs +137/−6
- Graphics/UI/Gtk/Scrolling/VScrollbar.chs +5/−4
- Graphics/UI/Gtk/Selectors/ColorButton.chs +11/−11
- Graphics/UI/Gtk/Selectors/ColorSelection.chs +5/−4
- Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs +14/−9
- Graphics/UI/Gtk/Selectors/FileChooser.chs +106/−64
- Graphics/UI/Gtk/Selectors/FileChooserButton.chs +34/−15
- Graphics/UI/Gtk/Selectors/FileChooserDialog.chs +16/−14
- Graphics/UI/Gtk/Selectors/FileChooserWidget.chs +8/−3
- Graphics/UI/Gtk/Selectors/FileFilter.chs +23/−20
- Graphics/UI/Gtk/Selectors/FileSelection.chs +18/−35
- Graphics/UI/Gtk/Selectors/FontButton.chs +16/−16
- Graphics/UI/Gtk/Selectors/FontSelection.chs +12/−11
- Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs +59/−12
- Graphics/UI/Gtk/Selectors/HSV.chs +274/−0
- Graphics/UI/Gtk/Signals.chs +0/−850
- Graphics/UI/Gtk/Special/HRuler.chs +80/−0
- Graphics/UI/Gtk/Special/Ruler.chs +177/−0
- Graphics/UI/Gtk/Special/VRuler.chs +81/−0
- Graphics/UI/Gtk/Types.chs +0/−4901
- Graphics/UI/Gtk/Windows/AboutDialog.chs +66/−55
- Graphics/UI/Gtk/Windows/Assistant.chs +603/−0
- Graphics/UI/Gtk/Windows/Dialog.chs +90/−34
- Graphics/UI/Gtk/Windows/Invisible.chs +11/−19
- Graphics/UI/Gtk/Windows/MessageDialog.chs +48/−42
- Graphics/UI/Gtk/Windows/OffscreenWindow.chs +125/−0
- Graphics/UI/Gtk/Windows/Window.chs +195/−106
- Graphics/UI/Gtk/Windows/WindowGroup.chs +2/−3
- Graphics/UI/GtkInternals.chs +1/−1
- Gtk2HsSetup.hs +0/−486
- Setup.hs +4/−3
- demo/actionMenu/ActionMenu.hs +53/−45
- demo/buttonbox/ButtonBox.hs +6/−9
- demo/carsim/CarSim.hs +34/−31
- demo/concurrent/Progress.hs +4/−2
- demo/concurrent/ProgressThreadedRTS.hs +5/−3
- demo/demos.txt +6/−2
- demo/embedded/Embedded.hs +17/−16
- demo/embedded/MPlayer.hs +78/−0
- demo/embedded/Uzbl.hs +6/−6
- demo/fastdraw/FastDraw.hs +46/−59
- demo/filechooser/FileChooserDemo.glade +375/−408
- demo/filechooser/FileChooserDemo.hs +54/−56
- demo/fonts/Fonts.hs +2/−3
- demo/graphic/Drawing.hs +1/−2
- demo/gtkbuilder/GtkBuilderTest.hs +17/−17
- demo/hello/World.hs +3/−3
- demo/inputmethod/Layout.hs +31/−34
- demo/menu/ComboDemo.hs +13/−12
- demo/menu/Makefile +1/−1
- demo/menu/MenuDemo.hs +3/−3
- demo/notebook/Makefile +15/−0
- demo/notebook/Notebook.hs +145/−0
- demo/statusicon/StatusIcon.hs +7/−11
- demo/treeList/Completion.hs +0/−82
- demo/treeList/DirList.hs +0/−82
- demo/treeList/FilterDemo.hs +0/−71
- demo/treeList/ListDND.hs +0/−248
- demo/treeList/ListDemo.hs +0/−66
- demo/treeList/ListTest.glade +0/−1404
- demo/treeList/ListTest.hs +0/−102
- demo/treeList/ListText.hs +0/−78
- demo/treeList/Makefile +0/−45
- demo/treeList/TreeDemo.hs +0/−68
- demo/treeList/TreeSort.hs +0/−85
- demo/treeList/TreeTest.glade +0/−1108
- demo/treeList/TreeTest.hs +0/−115
- demo/treeList/resListDND/desktop.png binary
- demo/treeList/resListDND/laptop.png binary
- demo/treeList/resListDND/laptopSmall.png binary
- demo/treeList/resListDND/printer.png binary
- demo/treeList/resListDND/server.png binary
- demo/treeList/resListDND/tower.png binary
- demo/treeList/rgb.txt +0/−753
- demo/treelist/Completion.hs +81/−0
- demo/treelist/DirList.hs +81/−0
- demo/treelist/FilterDemo.hs +71/−0
- demo/treelist/ListDND.hs +248/−0
- demo/treelist/ListDemo.hs +67/−0
- demo/treelist/ListTest.glade +1389/−0
- demo/treelist/ListTest.hs +105/−0
- demo/treelist/ListText.hs +77/−0
- demo/treelist/Makefile +45/−0
- demo/treelist/TreeDemo.hs +69/−0
- demo/treelist/TreeSort.hs +86/−0
- demo/treelist/TreeTest.glade +1040/−0
- demo/treelist/TreeTest.hs +116/−0
- demo/treelist/resListDND/desktop.png binary
- demo/treelist/resListDND/laptop.png binary
- demo/treelist/resListDND/laptopSmall.png binary
- demo/treelist/resListDND/printer.png binary
- demo/treelist/resListDND/server.png binary
- demo/treelist/resListDND/tower.png binary
- demo/treelist/rgb.txt +753/−0
- demo/unicode/Arabic.hs +12/−9
- gtk.cabal +146/−70
- hierarchy.list +34/−4
- hsgtk.h +84/−0
- marshal.list +27/−17
- wingtk.h +0/−5
Graphics/UI/Gtk.chs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) --@@ -23,10 +24,10 @@ -- -- The following modules are not bound: -- DialogMessage : has only one variadic function which cannot be bound.--- The same functionality can be simulated with Dialog.--- Item : The only child of this abstract class is MenuItem. The--- three signals Item defines are therefore bound in --- MenuItem.+-- The same functionality can be simulated with Dialog.+-- Item : The only child of this abstract class is MenuItem. The+-- three signals Item defines are therefore bound in+-- MenuItem. -- -- TODO --@@ -46,6 +47,7 @@ module Graphics.UI.Gtk.General.IconTheme, module Graphics.UI.Gtk.General.StockItems, module Graphics.UI.Gtk.General.Selection,+ module Graphics.UI.Gtk.General.Settings, module Graphics.UI.Gtk.General.Drag, module Graphics.UI.Gtk.Gdk.Keys, module Graphics.UI.Gtk.General.Style,@@ -53,41 +55,66 @@ module Graphics.UI.Gtk.General.Clipboard, -- * Drawing and other Low-Level Operations+ module Graphics.UI.Gtk.Gdk.AppLaunchContext, module Graphics.UI.Gtk.Gdk.Cursor,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.Gdk.Drawable,+#endif module Graphics.UI.Gtk.Gdk.DrawWindow,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.Gdk.Region,+#endif -- module Graphics.UI.Gtk.Gdk.GC, module Graphics.UI.Gtk.Gdk.EventM,+#if GTK_CHECK_VERSION(3,16,0)+ module Graphics.UI.Gtk.Gdk.GLContext,+#endif module Graphics.UI.Gtk.Gdk.Pixbuf,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.Gdk.Pixmap,+#endif module Graphics.UI.Gtk.Gdk.Screen,+ module Graphics.UI.Gtk.Gdk.Keymap, module Graphics.UI.Gtk.Gdk.Display,+ module Graphics.UI.Gtk.Gdk.DisplayManager, module Graphics.UI.Gtk.Gdk.Gdk, -- ** cairo integration module Graphics.UI.Gtk.Cairo, -- * Windows module Graphics.UI.Gtk.Windows.Window,+ module Graphics.UI.Gtk.Windows.OffscreenWindow, module Graphics.UI.Gtk.Windows.Invisible, module Graphics.UI.Gtk.Windows.Dialog, module Graphics.UI.Gtk.Windows.AboutDialog,+ module Graphics.UI.Gtk.Windows.Assistant, module Graphics.UI.Gtk.Windows.MessageDialog, module Graphics.UI.Gtk.Windows.WindowGroup, -- * Display widgets, module Graphics.UI.Gtk.Display.AccelLabel, module Graphics.UI.Gtk.Display.Image, module Graphics.UI.Gtk.Display.Label,+#if GTK_CHECK_VERSION(3,6,0)+ module Graphics.UI.Gtk.Display.LevelBar,+#endif module Graphics.UI.Gtk.Display.ProgressBar,+ module Graphics.UI.Gtk.Display.Spinner, module Graphics.UI.Gtk.Display.Statusbar, module Graphics.UI.Gtk.Display.StatusIcon,+#if GTK_CHECK_VERSION(2,18,0)+ module Graphics.UI.Gtk.Display.InfoBar,+#endif -- * Buttons and toggles module Graphics.UI.Gtk.Buttons.Button, module Graphics.UI.Gtk.Buttons.CheckButton, module Graphics.UI.Gtk.Buttons.RadioButton, module Graphics.UI.Gtk.Buttons.ToggleButton,+ module Graphics.UI.Gtk.Buttons.LinkButton,+ module Graphics.UI.Gtk.Buttons.ScaleButton,+ module Graphics.UI.Gtk.Buttons.VolumeButton, -- * Numeric\/text data entry module Graphics.UI.Gtk.Entry.Editable, module Graphics.UI.Gtk.Entry.Entry,+ module Graphics.UI.Gtk.Entry.EntryBuffer, module Graphics.UI.Gtk.Entry.EntryCompletion, module Graphics.UI.Gtk.Entry.HScale, module Graphics.UI.Gtk.Entry.VScale,@@ -100,12 +127,16 @@ module Graphics.UI.Gtk.Multiline.TextTagTable, module Graphics.UI.Gtk.Multiline.TextView, -- * Tree and list widget+ module Graphics.UI.Gtk.ModelView.CellEditable, module Graphics.UI.Gtk.ModelView.CellLayout, module Graphics.UI.Gtk.ModelView.CellRenderer,+ module Graphics.UI.Gtk.ModelView.CellRendererSpinner, module Graphics.UI.Gtk.ModelView.CellRendererCombo, module Graphics.UI.Gtk.ModelView.CellRendererPixbuf, module Graphics.UI.Gtk.ModelView.CellRendererProgress, module Graphics.UI.Gtk.ModelView.CellRendererText,+ module Graphics.UI.Gtk.ModelView.CellRendererAccel,+ module Graphics.UI.Gtk.ModelView.CellRendererSpin, module Graphics.UI.Gtk.ModelView.CellRendererToggle, module Graphics.UI.Gtk.ModelView.CellView, module Graphics.UI.Gtk.ModelView.CustomStore,@@ -123,19 +154,27 @@ module Graphics.UI.Gtk.ModelView.TreeViewColumn, -- * Menus, combo box, toolbar module Graphics.UI.Gtk.MenuComboToolbar.CheckMenuItem,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.MenuComboToolbar.Combo,+#endif module Graphics.UI.Gtk.MenuComboToolbar.ComboBox,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry,+#endif module Graphics.UI.Gtk.MenuComboToolbar.Menu, module Graphics.UI.Gtk.MenuComboToolbar.MenuBar, module Graphics.UI.Gtk.MenuComboToolbar.MenuItem, module Graphics.UI.Gtk.MenuComboToolbar.MenuShell,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.MenuComboToolbar.OptionMenu,+#endif module Graphics.UI.Gtk.MenuComboToolbar.ImageMenuItem, module Graphics.UI.Gtk.MenuComboToolbar.RadioMenuItem, module Graphics.UI.Gtk.MenuComboToolbar.TearoffMenuItem, module Graphics.UI.Gtk.MenuComboToolbar.Toolbar, module Graphics.UI.Gtk.MenuComboToolbar.ToolItem,+ module Graphics.UI.Gtk.MenuComboToolbar.ToolItemGroup,+ module Graphics.UI.Gtk.MenuComboToolbar.ToolPalette, module Graphics.UI.Gtk.MenuComboToolbar.ToolButton, module Graphics.UI.Gtk.MenuComboToolbar.MenuToolButton, module Graphics.UI.Gtk.MenuComboToolbar.ToggleToolButton,@@ -147,15 +186,27 @@ module Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup, module Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction, module Graphics.UI.Gtk.ActionMenuToolbar.RadioAction,+ module Graphics.UI.Gtk.ActionMenuToolbar.RecentAction, module Graphics.UI.Gtk.ActionMenuToolbar.UIManager, -- * Selectors (file\/font\/color) module Graphics.UI.Gtk.Selectors.ColorSelection, module Graphics.UI.Gtk.Selectors.ColorSelectionDialog, module Graphics.UI.Gtk.Selectors.ColorButton,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.Selectors.FileSelection,+#endif module Graphics.UI.Gtk.Selectors.FontSelection, module Graphics.UI.Gtk.Selectors.FontSelectionDialog, module Graphics.UI.Gtk.Selectors.FontButton,+#if GTK_CHECK_VERSION(2,14,0)+ module Graphics.UI.Gtk.Selectors.HSV,+#endif+#if GTK_MAJOR_VERSION < 3+ -- * Special-purpose features+ module Graphics.UI.Gtk.Special.Ruler,+ module Graphics.UI.Gtk.Special.HRuler,+ module Graphics.UI.Gtk.Special.VRuler,+#endif -- module InputDialog, -- ** File chooser module Graphics.UI.Gtk.Selectors.FileChooser,@@ -172,31 +223,62 @@ module Graphics.UI.Gtk.Layout.HPaned, module Graphics.UI.Gtk.Layout.Layout, module Graphics.UI.Gtk.Layout.Notebook,+#if GTK_MAJOR_VERSION >= 3+ module Graphics.UI.Gtk.Layout.Grid,+ module Graphics.UI.Gtk.Layout.Overlay,+#endif module Graphics.UI.Gtk.Layout.Expander, module Graphics.UI.Gtk.Layout.Table, module Graphics.UI.Gtk.Layout.VBox, module Graphics.UI.Gtk.Layout.VButtonBox, module Graphics.UI.Gtk.Layout.VPaned,+#if GTK_CHECK_VERSION(3,10,0)+ module Graphics.UI.Gtk.Layout.Stack,+ module Graphics.UI.Gtk.Layout.StackSwitcher,+#endif -- * Ornaments module Graphics.UI.Gtk.Ornaments.Frame, module Graphics.UI.Gtk.Ornaments.HSeparator, module Graphics.UI.Gtk.Ornaments.VSeparator,+ -- * Printing+ module Graphics.UI.Gtk.Printing.PaperSize,+ module Graphics.UI.Gtk.Printing.PageSetup,+ module Graphics.UI.Gtk.Printing.PrintContext,+ module Graphics.UI.Gtk.Printing.PrintOperation,+ module Graphics.UI.Gtk.Printing.PrintSettings,+ -- * Recent+ module Graphics.UI.Gtk.Recent.RecentChooserMenu,+ module Graphics.UI.Gtk.Recent.RecentChooserWidget,+ module Graphics.UI.Gtk.Recent.RecentFilter,+ module Graphics.UI.Gtk.Recent.RecentManager,+ module Graphics.UI.Gtk.Recent.RecentInfo,+ module Graphics.UI.Gtk.Recent.RecentChooser, -- * Scrolling module Graphics.UI.Gtk.Scrolling.HScrollbar, module Graphics.UI.Gtk.Scrolling.ScrolledWindow, module Graphics.UI.Gtk.Scrolling.VScrollbar, -- * Miscellaneous+ module Graphics.UI.Gtk.Misc.Accessible, module Graphics.UI.Gtk.Misc.Adjustment, module Graphics.UI.Gtk.Misc.Arrow, module Graphics.UI.Gtk.Misc.Calendar, module Graphics.UI.Gtk.Misc.DrawingArea,+#if GTK_CHECK_VERSION(3,16,0)+ module Graphics.UI.Gtk.Misc.GLArea,+#endif module Graphics.UI.Gtk.Misc.EventBox, module Graphics.UI.Gtk.Misc.HandleBox, module Graphics.UI.Gtk.Misc.IMMulticontext,+ module Graphics.UI.Gtk.Misc.IMContextSimple, module Graphics.UI.Gtk.Misc.SizeGroup, module Graphics.UI.Gtk.Misc.Tooltip,+#if GTK_MAJOR_VERSION < 3 module Graphics.UI.Gtk.Misc.Tooltips,+#endif module Graphics.UI.Gtk.Misc.Viewport,+#if GTK_MAJOR_VERSION >= 3+ module Graphics.UI.Gtk.Misc.Switch,+#endif -- * Abstract base classes module Graphics.UI.Gtk.Abstract.Box, module Graphics.UI.Gtk.Abstract.ButtonBox,@@ -211,9 +293,11 @@ module Graphics.UI.Gtk.Abstract.Scrollbar, module Graphics.UI.Gtk.Abstract.Separator, module Graphics.UI.Gtk.Abstract.Widget,+#if (defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0))) || defined(GDK_WINDOWING_X11) -- * Cross-process embedding module Graphics.UI.Gtk.Embedding.Plug, module Graphics.UI.Gtk.Embedding.Socket,+#endif -- * Non-widgets module System.Glib.Signals, module System.Glib.Attributes,@@ -235,51 +319,77 @@ import Graphics.UI.Gtk.General.IconTheme import Graphics.UI.Gtk.General.StockItems import Graphics.UI.Gtk.General.Selection+import Graphics.UI.Gtk.General.Settings import Graphics.UI.Gtk.General.Drag import Graphics.UI.Gtk.General.Clipboard -- drawing import Graphics.UI.Gtk.Gdk.Keys import Graphics.UI.Gtk.General.Style import Graphics.UI.Gtk.General.RcStyle+import Graphics.UI.Gtk.Gdk.AppLaunchContext import Graphics.UI.Gtk.Gdk.Cursor+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Gdk.Drawable+#endif import Graphics.UI.Gtk.Gdk.DrawWindow-import Graphics.UI.Gtk.Gdk.Region hiding (makeNewRegion)+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.Gdk.Region hiding (makeNewRegion)+#endif --import Graphics.UI.Gtk.Gdk.GC import Graphics.UI.Gtk.Gdk.EventM+#if GTK_CHECK_VERSION(3,16,0)+import Graphics.UI.Gtk.Gdk.GLContext+#endif import Graphics.UI.Gtk.Gdk.Pixbuf+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Gdk.Pixmap+#endif import Graphics.UI.Gtk.Gdk.Screen+import Graphics.UI.Gtk.Gdk.Keymap import Graphics.UI.Gtk.Gdk.Display+import Graphics.UI.Gtk.Gdk.DisplayManager import Graphics.UI.Gtk.Gdk.Gdk -- cairo integration import Graphics.UI.Gtk.Cairo -- windows import Graphics.UI.Gtk.Windows.Dialog import Graphics.UI.Gtk.Windows.Window+import Graphics.UI.Gtk.Windows.OffscreenWindow import Graphics.UI.Gtk.Windows.Invisible import Graphics.UI.Gtk.Windows.AboutDialog+import Graphics.UI.Gtk.Windows.Assistant import Graphics.UI.Gtk.Windows.MessageDialog import Graphics.UI.Gtk.Windows.WindowGroup -- display widgets import Graphics.UI.Gtk.Display.AccelLabel import Graphics.UI.Gtk.Display.Image import Graphics.UI.Gtk.Display.Label+#if GTK_CHECK_VERSION(3,6,0)+import Graphics.UI.Gtk.Display.LevelBar+#endif import Graphics.UI.Gtk.Display.ProgressBar+import Graphics.UI.Gtk.Display.Spinner import Graphics.UI.Gtk.Display.Statusbar #if GTK_CHECK_VERSION(2,10,0) && !DISABLE_DEPRECATED import Graphics.UI.Gtk.Display.StatusIcon hiding (onActivate,afterActivate,onPopupMenu,afterPopupMenu) #else import Graphics.UI.Gtk.Display.StatusIcon #endif+#if GTK_CHECK_VERSION(2,18,0)+import Graphics.UI.Gtk.Display.InfoBar+#endif -- buttons and toggles import Graphics.UI.Gtk.Buttons.Button import Graphics.UI.Gtk.Buttons.CheckButton import Graphics.UI.Gtk.Buttons.RadioButton import Graphics.UI.Gtk.Buttons.ToggleButton+import Graphics.UI.Gtk.Buttons.LinkButton+import Graphics.UI.Gtk.Buttons.ScaleButton+import Graphics.UI.Gtk.Buttons.VolumeButton -- numeric\/text data entry import Graphics.UI.Gtk.Entry.Editable import Graphics.UI.Gtk.Entry.Entry+import Graphics.UI.Gtk.Entry.EntryBuffer import Graphics.UI.Gtk.Entry.EntryCompletion import Graphics.UI.Gtk.Entry.HScale import Graphics.UI.Gtk.Entry.VScale@@ -293,12 +403,16 @@ import qualified Graphics.UI.Gtk.Multiline.TextView import Graphics.UI.Gtk.Multiline.TextView -- tree and list widget+import Graphics.UI.Gtk.ModelView.CellEditable import Graphics.UI.Gtk.ModelView.CellLayout import Graphics.UI.Gtk.ModelView.CellRenderer+import Graphics.UI.Gtk.ModelView.CellRendererSpinner import Graphics.UI.Gtk.ModelView.CellRendererCombo import Graphics.UI.Gtk.ModelView.CellRendererPixbuf import Graphics.UI.Gtk.ModelView.CellRendererProgress import Graphics.UI.Gtk.ModelView.CellRendererText+import Graphics.UI.Gtk.ModelView.CellRendererAccel+import Graphics.UI.Gtk.ModelView.CellRendererSpin import Graphics.UI.Gtk.ModelView.CellRendererToggle import Graphics.UI.Gtk.ModelView.CellView import Graphics.UI.Gtk.ModelView.CustomStore@@ -315,21 +429,29 @@ import Graphics.UI.Gtk.ModelView.TreeView import Graphics.UI.Gtk.ModelView.TreeViewColumn -- menus, combo box, toolbar+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.MenuComboToolbar.Combo+#endif import Graphics.UI.Gtk.MenuComboToolbar.ComboBox+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry+#endif -- import ItemFactory import Graphics.UI.Gtk.MenuComboToolbar.Menu import Graphics.UI.Gtk.MenuComboToolbar.MenuBar import Graphics.UI.Gtk.MenuComboToolbar.MenuItem import Graphics.UI.Gtk.MenuComboToolbar.MenuShell+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.MenuComboToolbar.OptionMenu+#endif import Graphics.UI.Gtk.MenuComboToolbar.ImageMenuItem import Graphics.UI.Gtk.MenuComboToolbar.RadioMenuItem import Graphics.UI.Gtk.MenuComboToolbar.CheckMenuItem import Graphics.UI.Gtk.MenuComboToolbar.TearoffMenuItem import Graphics.UI.Gtk.MenuComboToolbar.Toolbar import Graphics.UI.Gtk.MenuComboToolbar.ToolItem+import Graphics.UI.Gtk.MenuComboToolbar.ToolItemGroup+import Graphics.UI.Gtk.MenuComboToolbar.ToolPalette import Graphics.UI.Gtk.MenuComboToolbar.ToolButton import Graphics.UI.Gtk.MenuComboToolbar.MenuToolButton import Graphics.UI.Gtk.MenuComboToolbar.ToggleToolButton@@ -341,12 +463,15 @@ import Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup import Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction import Graphics.UI.Gtk.ActionMenuToolbar.RadioAction+import Graphics.UI.Gtk.ActionMenuToolbar.RecentAction import Graphics.UI.Gtk.ActionMenuToolbar.UIManager -- selectors (file\/font\/color\/input device) import Graphics.UI.Gtk.Selectors.ColorSelection import Graphics.UI.Gtk.Selectors.ColorSelectionDialog import Graphics.UI.Gtk.Selectors.ColorButton+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Selectors.FileSelection+#endif import Graphics.UI.Gtk.Selectors.FileChooser import Graphics.UI.Gtk.Selectors.FileChooserDialog import Graphics.UI.Gtk.Selectors.FileChooserWidget@@ -355,6 +480,15 @@ import Graphics.UI.Gtk.Selectors.FontSelection import Graphics.UI.Gtk.Selectors.FontSelectionDialog import Graphics.UI.Gtk.Selectors.FontButton+#if GTK_CHECK_VERSION(2,14,0)+import Graphics.UI.Gtk.Selectors.HSV+#endif+#if GTK_MAJOR_VERSION < 3+-- Special-purpose features+import Graphics.UI.Gtk.Special.Ruler+import Graphics.UI.Gtk.Special.HRuler+import Graphics.UI.Gtk.Special.VRuler+#endif --import InputDialog -- layout containers import Graphics.UI.Gtk.Layout.Alignment@@ -368,28 +502,59 @@ import Graphics.UI.Gtk.Layout.VPaned import Graphics.UI.Gtk.Layout.Layout import Graphics.UI.Gtk.Layout.Notebook+#if GTK_MAJOR_VERSION >= 3+import Graphics.UI.Gtk.Layout.Grid+import Graphics.UI.Gtk.Layout.Overlay+#endif+#if GTK_CHECK_VERSION(3,10,0)+import Graphics.UI.Gtk.Layout.Stack+import Graphics.UI.Gtk.Layout.StackSwitcher+#endif import Graphics.UI.Gtk.Layout.Expander import Graphics.UI.Gtk.Layout.Table -- ornaments import Graphics.UI.Gtk.Ornaments.Frame import Graphics.UI.Gtk.Ornaments.HSeparator import Graphics.UI.Gtk.Ornaments.VSeparator+-- printing+import Graphics.UI.Gtk.Printing.PaperSize+import Graphics.UI.Gtk.Printing.PageSetup+import Graphics.UI.Gtk.Printing.PrintContext+import Graphics.UI.Gtk.Printing.PrintOperation+import Graphics.UI.Gtk.Printing.PrintSettings+-- recent+import Graphics.UI.Gtk.Recent.RecentChooserMenu+import Graphics.UI.Gtk.Recent.RecentChooserWidget+import Graphics.UI.Gtk.Recent.RecentFilter+import Graphics.UI.Gtk.Recent.RecentManager+import Graphics.UI.Gtk.Recent.RecentInfo+import Graphics.UI.Gtk.Recent.RecentChooser -- scrolling import Graphics.UI.Gtk.Scrolling.HScrollbar import Graphics.UI.Gtk.Scrolling.VScrollbar import Graphics.UI.Gtk.Scrolling.ScrolledWindow -- miscellaneous+import Graphics.UI.Gtk.Misc.Accessible import Graphics.UI.Gtk.Misc.Adjustment import Graphics.UI.Gtk.Misc.Arrow import Graphics.UI.Gtk.Misc.Calendar import Graphics.UI.Gtk.Misc.DrawingArea+#if GTK_CHECK_VERSION(3,16,0)+import Graphics.UI.Gtk.Misc.GLArea+#endif import Graphics.UI.Gtk.Misc.EventBox import Graphics.UI.Gtk.Misc.HandleBox import Graphics.UI.Gtk.Misc.IMMulticontext+import Graphics.UI.Gtk.Misc.IMContextSimple import Graphics.UI.Gtk.Misc.SizeGroup import Graphics.UI.Gtk.Misc.Tooltip+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Misc.Tooltips+#endif import Graphics.UI.Gtk.Misc.Viewport+#if GTK_MAJOR_VERSION >= 3+import Graphics.UI.Gtk.Misc.Switch+#endif --import Accessible -- abstract base classes import Graphics.UI.Gtk.Abstract.Box@@ -399,15 +564,18 @@ import Graphics.UI.Gtk.Abstract.Misc import Graphics.UI.Gtk.Abstract.IMContext import Graphics.UI.Gtk.Abstract.Object (+#if GTK_MAJOR_VERSION < 3 Object, ObjectClass, castToObject, gTypeObject, toObject,+#endif GWeakNotify, objectWeakref, objectWeakunref,- objectDestroy )+ objectDestroy,+ notifyProperty ) import Graphics.UI.Gtk.Abstract.Paned import Graphics.UI.Gtk.Abstract.Range import Graphics.UI.Gtk.Abstract.Scale@@ -415,16 +583,18 @@ import Graphics.UI.Gtk.Abstract.Separator import Graphics.UI.Gtk.Abstract.Widget -- cross-process embedding+#if defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0)) || defined(GDK_WINDOWING_X11) import Graphics.UI.Gtk.Embedding.Plug import Graphics.UI.Gtk.Embedding.Socket+#endif -- non widgets import System.Glib.Signals {- do eport 'on' and 'after'- (ConnectId, disconnect,- signalDisconnect,- signalBlock,- signalUnblock)+ (ConnectId, disconnect,+ signalDisconnect,+ signalBlock,+ signalUnblock) -} import System.Glib.Attributes import System.Glib.GObject (@@ -439,7 +609,7 @@ isA ) import Graphics.UI.Gtk.Builder- + -- pango modules import Graphics.Rendering.Pango.Context import Graphics.Rendering.Pango.Markup
Graphics/UI/Gtk/Abstract/Bin.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Bin --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Abstract.Bin ( -- * Detail--- +-- -- | The 'Bin' widget is a container with just one child. It is not very -- useful itself, but it is useful for deriving subclasses, since it provides -- common code needed for handling a single child widget.
Graphics/UI/Gtk/Abstract/Box.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Box --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Abstract.Box ( -- * Detail--- +-- -- | 'Box' is an abstract widget which encapsulates functionality for a -- particular kind of container, one that organizes a variable number of -- widgets into a rectangular area. 'Box' currently has two derived classes,@@ -51,12 +52,9 @@ -- Besides adding widgets at the start or the end of a box, you can also -- specify the padding around each widget (in pixels) and a 'Packing' -- parameter that denotes how to fill up unused space.--- The functions 'boxPackStartDefaults' or 'boxPackEndDefaults' --- are a convenient way to pack widgets into a 'Box' without specifying--- these extra paramters. -- -- While the right amount of padding around each widget is a matter of--- appearance, the 'Packing' paramter specifies the way the widgets in+-- appearance, the 'Packing' parameter specifies the way the widgets in -- the container behave when the window is resized and thereby affect -- the usability. Hence, once you have created a window, you should resize -- it and see if the widgets behave as expected. The 'Packing' parameter of@@ -65,9 +63,9 @@ -- -- Because 'Box' is a 'Container', you may also use -- 'Graphics.UI.Gtk.Abstract.Container.containerAdd' to insert widgets into--- the box, and they will be packed as if with 'boxPackStartDefaults'. Use--- 'Graphics.UI.Gtk.Abstract.Container.containerRemove' to remove widgets--- from the 'Box'.+-- the box, and they will be packed as if with 'boxPackStart' with 'PackRepel'+-- and 0 padding. Use 'Graphics.UI.Gtk.Abstract.Container.containerRemove' to+-- remove widgets from the 'Box'. -- -- Use 'boxSetHomogeneous' to specify whether or not all children of the -- 'Box' are forced to get the same amount of space. Note that the@@ -107,8 +105,10 @@ -- * Methods boxPackStart, boxPackEnd,+#if GTK_MAJOR_VERSION < 3 boxPackStartDefaults, boxPackEndDefaults,+#endif boxGetHomogeneous, boxSetHomogeneous, boxGetSpacing,@@ -116,10 +116,24 @@ boxReorderChild, boxQueryChildPacking, boxSetChildPacking,+#if GTK_CHECK_VERSION(3,10,0)+ boxGetBaselinePosition,+ boxSetBaselinePosition,+#endif+#if GTK_CHECK_VERSION(3,12,0)+ boxGetCenterWidget,+ boxSetCenterWidget,+#endif -- * Attributes boxSpacing, boxHomogeneous,+#if GTK_CHECK_VERSION(3,10,0)+ boxBaselinePosition,+#endif+#if GTK_CHECK_VERSION(3,12,0)+ boxCenterWidget,+#endif -- * Child Attributes boxChildPacking,@@ -128,15 +142,22 @@ boxChildPosition, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (PackType(..), Packing(..),+import Graphics.UI.Gtk.General.Enums (PackType(..), Packing(..), toPacking, fromPacking) import Graphics.UI.Gtk.Abstract.ContainerChildProperties +#if GTK_CHECK_VERSION(3,10,0)+import Graphics.UI.Gtk.General.Enums (BaselinePosition)+#endif+#if GTK_CHECK_VERSION(3,12,0)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+#endif+ {# context lib="gtk" prefix="gtk" #} --------------------@@ -167,14 +188,14 @@ (fromIntegral padding) where (expand, fill) = fromPacking packing --- | Adds the @child@ widget to the box, packed with reference to the end of +-- | Adds the @child@ widget to the box, packed with reference to the end of -- the box. The -- @child@ is packed after (away from end of) any other child packed with -- reference to the end of the box. ----- Note that +-- Note that -- for 'boxPackEnd' the 'PackNatural' option will move a child to the right in--- an 'HBox' or to the bottom in an 'VBox' if there is more space availble.+-- an 'HBox' or to the bottom in an 'VBox' if there is more space available. -- boxPackEnd :: (BoxClass self, WidgetClass child) => self -> child -- ^ @child@ - the 'Widget' to be added to the box.@@ -195,9 +216,11 @@ (fromIntegral padding) where (expand, fill) = fromPacking packing +#if GTK_MAJOR_VERSION < 3 -- | Like 'boxPackStart' but uses the default parameters 'PackRepel' and 0 for -- padding. --+-- Removed in Gtk3 boxPackStartDefaults :: (BoxClass self, WidgetClass widget) => self -> widget -- ^ @widget@ - the 'Widget' to be added to the box. -> IO ()@@ -209,6 +232,7 @@ -- | Like 'boxPackEnd' but uses the default parameters 'PackRepel' and 0 for -- padding. --+-- Removed in Gtk3 boxPackEndDefaults :: (BoxClass self, WidgetClass widget) => self -> widget -- ^ @widget@ - the 'Widget' to be added to the box. -> IO ()@@ -216,6 +240,7 @@ {# call box_pack_end_defaults #} (toBox self) (toWidget widget)+#endif -- | Sets the homogeneous property, -- controlling whether or not all children of the box are given equal space@@ -274,7 +299,7 @@ -- | Returns information about how @child@ is packed into the box. ----- Returns information on the behaviour if free space is available +-- Returns information on the behaviour if free space is available -- (in 'Packing'), the additional padding for this widget and if the widget -- was inserted at the start or end of the container ('PackType'). --@@ -317,6 +342,51 @@ ((fromIntegral . fromEnum) packType) where (expand, fill) = fromPacking packing +#if GTK_CHECK_VERSION(3,10,0)+-- | Gets the value set by `boxSetBaselinePosition`+boxGetBaselinePosition :: BoxClass self => self+ -> IO BaselinePosition+boxGetBaselinePosition self =+ liftM (toEnum . fromIntegral) $+ {# call unsafe box_get_baseline_position #}+ (toBox self)++-- | Sets the baseline position of a box. This affects only+-- horizontal boxes with at least one baseline aligned child.+-- If there is more vertical space available than requested,+-- and the baseline is not allocated by the parent then+-- `position` is used to allocate the baseline wrt the extra+-- space available.+boxSetBaselinePosition :: BoxClass self => self+ -> BaselinePosition+ -> IO ()+boxSetBaselinePosition self position =+ {# call unsafe box_set_baseline_position #}+ (toBox self)+ (fromIntegral $ fromEnum position)+#endif++#if GTK_CHECK_VERSION(3,12,0)+-- | Retrieves the center widget of the box.+boxGetCenterWidget :: BoxClass self => self+ -> IO Widget+boxGetCenterWidget self =+ makeNewObject mkWidget $+ {# call unsafe box_get_center_widget #}+ (toBox self)++-- | Sets a center widget; that is a child widget that will be+-- centered with respect to the full width of the box, even if+-- the children at either side take up different amounts of space.+boxSetCenterWidget :: (BoxClass self, WidgetClass widget) => self+ -> widget+ -> IO ()+boxSetCenterWidget self position =+ {# call unsafe box_set_center_widget #}+ (toBox self)+ (toWidget position)+#endif+ -- | Retrieves the standard spacing between widgets. -- boxGetSpacing :: BoxClass self => self@@ -348,6 +418,24 @@ boxHomogeneous = newAttr boxGetHomogeneous boxSetHomogeneous++#if GTK_CHECK_VERSION(3,10,0)+-- | The position of the baseline aligned widgets if extra space is available.+boxBaselinePosition :: BoxClass self => Attr self BaselinePosition+boxBaselinePosition = newAttr+ boxGetBaselinePosition+ boxSetBaselinePosition+#endif++#if GTK_CHECK_VERSION(3,12,0)+-- | A child widget that will be centered with respect to the+-- full width of the box, even if the children at either side+-- take up different amounts of space.+boxCenterWidget :: (BoxClass self, WidgetClass widget) => ReadWriteAttr self Widget widget+boxCenterWidget = newAttr+ boxGetCenterWidget+ boxSetCenterWidget+#endif -------------------- -- Child Attributes
Graphics/UI/Gtk/Abstract/ButtonBox.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Abstract.ButtonBox ( -- * Detail--- +-- -- | The primary purpose of this class is to keep track of the various -- properties of 'HButtonBox' and 'VButtonBox' widgets. --@@ -77,12 +77,19 @@ #if GTK_CHECK_VERSION(2,4,0) buttonBoxGetChildSecondary, #endif+#if GTK_CHECK_VERSION(3,2,0)+ buttonBoxSetChildNonHomogeneous,+ buttonBoxGetChildNonHomogeneous,+#endif -- * Attributes buttonBoxLayoutStyle, -- * Child Attributes buttonBoxChildSecondary,+#if GTK_CHECK_VERSION(3,2,0)+ buttonBoxChildNonHomogeneous,+#endif ) where import Control.Monad (liftM)@@ -122,6 +129,31 @@ (toWidget child) #endif +#if GTK_CHECK_VERSION(3,2,0)+-- | Sets whether the child is exempted from homogeous sizing.+--+buttonBoxSetChildNonHomogeneous :: (ButtonBoxClass self, WidgetClass child) => self+ -> child -- ^ @child@ - a child of the button box widget+ -> Bool -- ^ @nonHomogeneous@+ -> IO ()+buttonBoxSetChildNonHomogeneous self child nonHomogeneous =+ {# call gtk_button_box_set_child_non_homogeneous #}+ (toButtonBox self)+ (toWidget child)+ (fromBool nonHomogeneous)++-- | Returns whether the child is exempted from homogeneous sizing.+--+buttonBoxGetChildNonHomogeneous :: (ButtonBoxClass self, WidgetClass child) => self+ -> child -- ^ @child@ - a child of the button box widget+ -> IO Bool+buttonBoxGetChildNonHomogeneous self child =+ liftM toBool $+ {# call gtk_button_box_get_child_non_homogeneous #}+ (toButtonBox self)+ (toWidget child)+#endif+ -- | Changes the way buttons are arranged in their container. -- buttonBoxSetLayout :: ButtonBoxClass self => self@@ -178,3 +210,12 @@ -- buttonBoxChildSecondary :: (ButtonBoxClass self, WidgetClass child) => child -> Attr self Bool buttonBoxChildSecondary = newAttrFromContainerChildBoolProperty "secondary"++#if GTK_CHECK_VERSION(3,2,0)+-- | If @True@, the child will not be subject to homogeneous sizing.+--+-- Default value: @False@+--+buttonBoxChildNonHomogeneous :: (ButtonBoxClass self, WidgetClass child) => child -> Attr self Bool+buttonBoxChildNonHomogeneous = newAttrFromContainerChildBoolProperty "non-homogeneous"+#endif
Graphics/UI/Gtk/Abstract/Container.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Abstract.Container ( -- * Detail--- +-- -- | A Gtk+ user interface is constructed by nesting widgets inside widgets. -- Container widgets are the inner nodes in the resulting tree of widgets: they -- contain other widgets. So, for example, you might have a 'Window' containing@@ -55,7 +55,7 @@ -- out in two phases, size requisition and size allocation. -- ** Size Requisition--- +-- -- | The size requisition of a widget is it's desired width and height. This -- is represented by a 'Requisition'. --@@ -72,7 +72,7 @@ -- will get a requisition back from its child. -- ** Size Allocation--- +-- -- | When the top-level widget has determined how much space its child would -- like to have, the second phase of the size negotiation, size allocation, -- begins. Depending on its configuration (see 'windowSetResizable'), the@@ -94,7 +94,7 @@ -- request is only a request, and widgets must be able to cope with any size. -- ** Child attributes--- +-- -- | 'Container' introduces child attributes - these are object attributes -- that are not specific to either the container or the contained widget, but -- rather to their relation. Typical examples of child attributes are the@@ -111,9 +111,9 @@ -- Whereas child attributes take the child object as a parameter: -- -- > set container [ attr child := value ]--- --- And similarily for getting a child attribute's value: --+-- And similarly for getting a child attribute's value:+-- -- > value <- get container (attr child) -- @@ -195,16 +195,16 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import System.Glib.GList (fromGList, withGList)-import Graphics.UI.Gtk.General.Enums (ResizeMode(..))+import System.Glib.GList (fromGList, withGList)+import Graphics.UI.Gtk.General.Enums (ResizeMode(..)) {# context lib="gtk" prefix="gtk" #} @@ -415,7 +415,7 @@ -- because toplevel windows can't leave space outside, they leave the space -- inside. The border is added on all sides of the container. To add space to -- only one side, one approach is to create a 'Alignment' widget, call--- 'widgetSetUsize' to give it a size, and place it on the side of the+-- 'widgetSetSizeRequest' to give it a size, and place it on the side of the -- container as a spacer. -- containerSetBorderWidth :: ContainerClass self => self@@ -524,10 +524,10 @@ -- | Emitted when widgets need to be queried again for their preferred size. -- checkResize :: ContainerClass self => Signal self (IO ())-checkResize = Signal (connect_NONE__NONE "check_resize")+checkResize = Signal (connect_NONE__NONE "check-resize") -- %hash c:b3a d:af3f--- | A widget in the container received the input focus.+-- | A widget in the container received or lost the input focus. -- setFocusChild :: ContainerClass self => Signal self (Maybe Widget -> IO ()) setFocusChild = Signal (connect_MOBJECT__NONE "set-focus-child")
Graphics/UI/Gtk/Abstract/ContainerChildProperties.chs view
@@ -42,13 +42,14 @@ import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Flags {#import Graphics.UI.Gtk.Types#} import System.Glib.GType import qualified System.Glib.GTypeConstants as GType import System.Glib.GValueTypes-{#import System.Glib.GValue#} (GValue(GValue), allocaGValue, valueInit)-import System.Glib.Attributes (Attr, newAttr)+{#import System.Glib.GValue#} (GValue(GValue), allocaGValue, valueInit)+import System.Glib.Attributes (Attr, newAttr) {# context lib="gtk" prefix="gtk" #} @@ -147,8 +148,8 @@ (containerChildSetPropertyInternal gtype valueSetFlags propName child) newAttrFromContainerChildStringProperty ::- (ContainerClass container, WidgetClass child)- => String -> child -> Attr container String+ (ContainerClass container, WidgetClass child, GlibString string)+ => String -> child -> Attr container string newAttrFromContainerChildStringProperty propName child = newAttr (containerChildGetPropertyInternal GType.string valueGetString propName child) (containerChildSetPropertyInternal GType.string valueSetString propName child)
Graphics/UI/Gtk/Abstract/IMContext.chs view
@@ -65,14 +65,14 @@ imContextDeleteSurrounding', ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import Control.Monad.Reader.Class (ask) import Control.Monad.Trans (liftIO) import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.UTFString (readUTFString, withUTFString, genUTFOfs,- ofsToUTF, ofsFromUTF)+ ofsToUTF, ofsFromUTF, GlibString) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey)@@ -103,8 +103,8 @@ -- attributes to apply to the string. This string should be displayed inserted -- at the insertion point. ---imContextGetPreeditString :: IMContextClass self => self- -> IO (String, [[PangoAttribute]], Int)+imContextGetPreeditString :: (IMContextClass self, GlibString string) => self+ -> IO (string, [[PangoAttribute]], Int) -- ^ @(str, attrs, cursorPos)@ Retrieved string, -- attributes to apply to the string, position of cursor. imContextGetPreeditString self =@@ -192,11 +192,11 @@ -- | Sets surrounding context around the insertion point and preedit string. -- This function is expected to be called in response to the--- 'IMContext'::retrieve_surrounding signal, and will likely have no effect if+-- 'imContextRetrieveSurrounding' signal, and will likely have no effect if -- called at other times. ---imContextSetSurrounding :: IMContextClass self => self- -> String -- ^ @text@ - text surrounding the insertion point, as UTF-8. the+imContextSetSurrounding :: (IMContextClass self, GlibString string) => self+ -> string -- ^ @text@ - text surrounding the insertion point, as UTF-8. the -- preedit string should not be included within @text@. -> Int -- ^ @cursorIndex@ - the index of the insertion cursor within -- @text@.@@ -221,8 +221,8 @@ -- is no obligation for a widget to respond to the 'imContextRetrieveSurrounding' -- signal, so input methods must be prepared to function without context. ---imContextGetSurrounding :: IMContextClass self => self- -> IO (Maybe (String, Int)) -- ^ @Maybe (text,cursorIndex)@ Text holding+imContextGetSurrounding :: (IMContextClass self, GlibString string) => self+ -> IO (Maybe (string, Int)) -- ^ @Maybe (text,cursorIndex)@ Text holding -- context around the insertion point and the -- index of the insertion cursor within @text@. -- 'Nothing' if no surrounding text was@@ -275,28 +275,28 @@ -- | This signal is emitted when a new preediting sequence starts. -- imContextPreeditStart :: IMContextClass self => Signal self (IO ())-imContextPreeditStart = Signal (connect_NONE__NONE "preedit_start")+imContextPreeditStart = Signal (connect_NONE__NONE "preedit-start") -- | This signal is emitted when a preediting sequence has been completed or -- canceled. -- imContextPreeditEnd :: IMContextClass self => Signal self (IO ())-imContextPreeditEnd = Signal (connect_NONE__NONE "preedit_end")+imContextPreeditEnd = Signal (connect_NONE__NONE "preedit-end") -- | This signal is emitted whenever the preedit sequence currently being -- entered has changed. It is also emitted at the end of a preedit sequence, -- in which case 'imContextGetPreeditString' returns the empty string. -- imContextPreeditChanged :: IMContextClass self => Signal self (IO ())-imContextPreeditChanged = Signal (connect_NONE__NONE "preedit_changed")+imContextPreeditChanged = Signal (connect_NONE__NONE "preedit-changed") -- | This signal is emitted when a complete input sequence has been -- entered by the user. This can be a single character immediately after a -- key press or the final result of preediting. Parameters: -- -- @str@ - the completed character(s) entered by the user-imContextCommit :: IMContextClass self => Signal self (String -> IO ())-imContextCommit = Signal (connect_STRING__NONE "commit")+imContextCommit :: (IMContextClass self, GlibString string) => Signal self (string -> IO ())+imContextCommit = Signal (connect_GLIBSTRING__NONE "commit") -- | This signal is emitted when the input method requires the context -- surrounding the cursor. The callback should set the input method@@ -304,7 +304,7 @@ -- -- Returns True if the signal was handled. imContextRetrieveSurrounding :: IMContextClass self => Signal self (IO Bool)-imContextRetrieveSurrounding = Signal (connect_NONE__BOOL "retrieve_surrounding")+imContextRetrieveSurrounding = Signal (connect_NONE__BOOL "retrieve-surrounding") -- | This signal is emitted when the input method needs to delete all or part -- of the context surrounding the cursor. Parameters:@@ -316,4 +316,4 @@ -- -- Returns True if the signal was handled. imContextDeleteSurrounding' :: IMContextClass self => Signal self (Int -> Int -> IO Bool)-imContextDeleteSurrounding' = Signal (connect_INT_INT__BOOL "delete_surrounding")+imContextDeleteSurrounding' = Signal (connect_INT_INT__BOOL "delete-surrounding")
Graphics/UI/Gtk/Abstract/Misc.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Misc --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Abstract.Misc ( -- * Detail--- +-- -- | The 'Misc' widget is an abstract widget which is not useful itself, but -- is used to derive subclasses which have alignment and padding attributes. --
Graphics/UI/Gtk/Abstract/Object.chs view
@@ -25,18 +25,20 @@ -- -- The base class of the Gtk+ type hierarchy. ----- * Each widget is a represented as a purely abstract data type. It can only +-- * Each widget is a represented as a purely abstract data type. It can only -- be accessed through and the special access functions that are defined -- in each widget file. -- module Graphics.UI.Gtk.Abstract.Object ( -- * Detail--- +-- -- | 'Object' is the base class for all widgets, and for a few non-widget -- objects such as 'Adjustment'. 'Object' predates 'GObject'; non-widgets that -- derive from 'Object' rather than 'GObject' do so for backward compatibility -- reasons. --+-- Object has been removed in Gt3k, but this module still provides useful+-- functions. -- * Class Hierarchy -- |@@ -51,12 +53,13 @@ -- | +----'Tooltips' -- | +----'TreeViewColumn' -- @-+#if GTK_MAJOR_VERSION < 3 -- * Types Object, ObjectClass, castToObject, gTypeObject, toObject,+#endif -- * Methods makeNewObject,@@ -67,18 +70,13 @@ objectWeakunref, -- * Signals- objectDestroy+ objectDestroy,+ notifyProperty ) where- import Control.Monad (when) import System.Glib.FFI-import System.Glib.GObject (objectUnref)-#if GLIB_CHECK_VERSION(2,10,0)-import System.Glib.GObject (objectRefSink)-#else-import System.Glib.GObject (objectRef)-#endif+import System.Glib.Attributes (ReadWriteAttr) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Data.IORef@@ -91,7 +89,7 @@ -- turn the initial floating state to sunk -- -- * The floating\/sunk concept of a GTK object is not very useful to us.--- The following procedure circumvents the whole subject and ensures +-- The following procedure circumvents the whole subject and ensures -- proper cleanup: -- on creation: objectRef, objectSink -- on finalization: objectUnref@@ -102,13 +100,16 @@ foreign import ccall unsafe "gtk_object_sink" objectSink :: Ptr obj -> IO () #endif- -- This is a convenience function to generate a new widget. It adds the -- finalizer with the method described under objectSink. ----- * The constr argument is the contructor of the specific object.+-- * The constr argument is the constructor of the specific object. ---makeNewObject :: ObjectClass obj => +#if GTK_MAJOR_VERSION < 3+makeNewObject :: ObjectClass obj =>+#else+makeNewObject :: GObjectClass obj =>+#endif (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj makeNewObject (constr, objectUnref) generator = do objPtr <- generator@@ -124,15 +125,20 @@ {#pointer GWeakNotify#} -foreign import ccall "wrapper" mkDestructor :: IO () -> IO GWeakNotify+foreign import ccall "wrapper" mkDestructor+ :: (Ptr () -> Ptr GObject -> IO ()) -> IO GWeakNotify -- | Attach a callback that will be called after the -- destroy hooks have been called --+#if GTK_MAJOR_VERSION < 3 objectWeakref :: ObjectClass o => o -> IO () -> IO GWeakNotify+#else+objectWeakref :: GObjectClass o => o -> IO () -> IO GWeakNotify+#endif objectWeakref obj uFun = do funPtrContainer <- newIORef nullFunPtr- uFunPtr <- mkDestructor $ do+ uFunPtr <- mkDestructor $ \_ _ -> do uFun funPtr <- readIORef funPtrContainer freeHaskellFunPtr funPtr@@ -142,8 +148,12 @@ -- | Detach a weak destroy callback function --+#if GTK_MAJOR_VERSION < 3 objectWeakunref :: ObjectClass o => o -> GWeakNotify -> IO ()-objectWeakunref obj fun = +#else+objectWeakunref :: GObjectClass o => o -> GWeakNotify -> IO ()+#endif+objectWeakunref obj fun = {#call unsafe g_object_weak_unref#} (toGObject obj) fun nullPtr @@ -154,5 +164,25 @@ -- the reference that they hold. May result in finalization of the object if -- all references are released. --+#if GTK_MAJOR_VERSION < 3 objectDestroy :: ObjectClass self => Signal self (IO ())+#else+objectDestroy :: WidgetClass self => Signal self (IO ())+#endif objectDestroy = Signal (connect_NONE__NONE "destroy")++-- | Register a notify callback that is triggered when the given property+-- has been modified.+--+-- * Note that this callback is triggered even if the actual value of+-- the property has not changed.+-- * Not all attributes are properties. A warning will be generated at+-- runtime if the passed-in attribute is not a property of the class+-- with which it was registered.+--+#if GTK_MAJOR_VERSION < 3+notifyProperty :: ObjectClass self => ReadWriteAttr self a b -> Signal self (IO ())+#else+notifyProperty :: GObjectClass self => ReadWriteAttr self a b -> Signal self (IO ())+#endif+notifyProperty attr = Signal (\on obj cb -> connect_PTR__NONE ("notify::"++show attr) on obj (const cb))
Graphics/UI/Gtk/Abstract/Paned.chs view
@@ -27,11 +27,11 @@ -- module Graphics.UI.Gtk.Abstract.Paned ( -- * Detail--- +-- -- | 'Paned' is the base class for widgets with two panes, arranged either -- horizontally ('HPaned') or vertically ('VPaned'). Child widgets are added to -- the panes of the widget with 'panedPack1' and 'panedPack2'. The division--- beween the two children is set by default from the size requests of the+-- between the two children is set by default from the size requests of the -- children, but it can be adjusted by the user. -- -- A paned widget draws a separator between the two child widgets and a@@ -82,6 +82,9 @@ panedGetChild1, panedGetChild2, #endif+#if GTK_CHECK_VERSION(2,20,0)+ panedGetHandleWindow,+#endif -- * Attributes panedPosition,@@ -115,15 +118,17 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}+#ifndef DISABLE_DEPRECATED {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Enums (ScrollType)+import Graphics.UI.Gtk.General.Enums (ScrollType)+#endif import Graphics.UI.Gtk.Abstract.ContainerChildProperties {# context lib="gtk" prefix="gtk" #}@@ -228,6 +233,18 @@ (toPaned self) #endif +#if GTK_CHECK_VERSION(2,20,0)+-- | Returns the 'Window' of the handle. This function is useful when handling button or motion events+-- because it enables the callback to distinguish between the window of the paned, a child and the+-- handle.+panedGetHandleWindow :: PanedClass self => self+ -> IO DrawWindow+panedGetHandleWindow self =+ makeNewGObject mkDrawWindow $+ {#call gtk_paned_get_handle_window #}+ (toPaned self)+#endif+ -------------------- -- Attributes @@ -297,7 +314,7 @@ -- Deprecated Signals #ifndef DISABLE_DEPRECATED--- | +-- | -- onCycleChildFocus, afterCycleChildFocus :: PanedClass self => self -> (Bool -> IO Bool)@@ -305,7 +322,7 @@ onCycleChildFocus = connect_BOOL__BOOL "cycle_child_focus" False afterCycleChildFocus = connect_BOOL__BOOL "cycle_child_focus" True --- | +-- | -- onToggleHandleFocus, afterToggleHandleFocus :: PanedClass self => self -> IO Bool@@ -313,7 +330,7 @@ onToggleHandleFocus = connect_NONE__BOOL "toggle_handle_focus" False afterToggleHandleFocus = connect_NONE__BOOL "toggle_handle_focus" True --- | +-- | -- onMoveHandle, afterMoveHandle :: PanedClass self => self -> (ScrollType -> IO Bool)@@ -321,7 +338,7 @@ onMoveHandle = connect_ENUM__BOOL "move_handle" False afterMoveHandle = connect_ENUM__BOOL "move_handle" True --- | +-- | -- onCycleHandleFocus, afterCycleHandleFocus :: PanedClass self => self -> (Bool -> IO Bool)@@ -329,7 +346,7 @@ onCycleHandleFocus = connect_BOOL__BOOL "cycle_handle_focus" False afterCycleHandleFocus = connect_BOOL__BOOL "cycle_handle_focus" True --- | +-- | -- onAcceptPosition, afterAcceptPosition :: PanedClass self => self -> IO Bool@@ -337,7 +354,7 @@ onAcceptPosition = connect_NONE__BOOL "accept_position" False afterAcceptPosition = connect_NONE__BOOL "accept_position" True --- | +-- | -- onCancelPosition, afterCancelPosition :: PanedClass self => self -> IO Bool
Graphics/UI/Gtk/Abstract/Range.chs view
@@ -51,9 +51,10 @@ -- * Methods rangeGetAdjustment, rangeSetAdjustment,- UpdateType(..),+#if GTK_MAJOR_VERSION < 3 rangeGetUpdatePolicy, rangeSetUpdatePolicy,+#endif rangeGetInverted, rangeSetInverted, rangeGetValue,@@ -68,9 +69,19 @@ rangeSetUpperStepperSensitivity, rangeGetUpperStepperSensitivity, #endif+#if GTK_CHECK_VERSION(2,20,0)+ rangeGetMinSliderSize,+ rangeGetRangeRect,+ rangeGetSliderRange,+ rangeGetSliderSizeFixed,+ rangeSetMinSliderSize,+ rangeSetSliderSizeFixed,+#endif -- * Attributes+#if GTK_MAJOR_VERSION < 3 rangeUpdatePolicy,+#endif rangeAdjustment, rangeInverted, #if GTK_CHECK_VERSION(2,10,0)@@ -78,6 +89,10 @@ rangeUpperStepperSensitivity, #endif rangeValue,+#if GTK_CHECK_VERSION(2,20,0)+ rangeSliderSizeFixed,+ rangeMinSliderSize,+#endif -- * Signals adjustBounds,@@ -101,15 +116,19 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Enums (UpdateType(..), ScrollType(..))+import Graphics.UI.Gtk.General.Enums (ScrollType(..))+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.General.Enums (UpdateType(..))+#endif+import Graphics.UI.Gtk.General.Structs (Rectangle(..)) {# context lib="gtk" prefix="gtk" #} @@ -142,8 +161,10 @@ (toRange self) adjustment +#if GTK_MAJOR_VERSION < 3 -- | Gets the update policy of @range@. See 'rangeSetUpdatePolicy'. --+-- Removed in Gtk3. rangeGetUpdatePolicy :: RangeClass self => self -> IO UpdateType -- ^ returns the current update policy rangeGetUpdatePolicy self =@@ -151,6 +172,7 @@ {# call unsafe range_get_update_policy #} (toRange self) + -- | Sets the update policy for the range. 'UpdateContinuous' means that -- anytime the range slider is moved, the range value will change and the -- value_changed signal will be emitted. 'UpdateDelayed' means that the value@@ -159,6 +181,7 @@ -- 'UpdateDiscontinuous' means that the value will only be updated when the -- user releases the button and ends the slider drag operation. --+-- Removed in Gtk3. rangeSetUpdatePolicy :: RangeClass self => self -> UpdateType -- ^ @policy@ - update policy -> IO ()@@ -166,6 +189,7 @@ {# call range_set_update_policy #} (toRange self) ((fromIntegral . fromEnum) policy)+#endif -- | Gets the value set by 'rangeSetInverted'. --@@ -243,7 +267,7 @@ -- -- * 'SensitivityAuto': the arrow is made insensitive if the thumb is at the end ----- * 'SensitivityOn': the arrow is alwasy sensitive+-- * 'SensitivityOn': the arrow is always sensitive -- -- * 'SensitivityOff': the arrow is always insensitive --@@ -305,18 +329,97 @@ {# call gtk_range_get_upper_stepper_sensitivity #} (toRange self) #endif+#if GTK_CHECK_VERSION(2,20,0)+-- | This function is useful mainly for 'Range' subclasses.+--+-- See 'rangeSetMinSliderSize'.+rangeGetMinSliderSize :: RangeClass self => self+ -> IO Int -- ^ returns The minimum size of the range's slider.+rangeGetMinSliderSize range =+ liftM fromIntegral $+ {#call gtk_range_get_min_slider_size #}+ (toRange range) +-- | This function returns the area that contains the range's through and its steppers, in 'DrawWindow'+-- coordinates.+--+-- This function is useful mainly for 'Range' subclasses.+rangeGetRangeRect :: RangeClass self => self+ -> IO Rectangle+rangeGetRangeRect self =+ alloca $ \rPtr -> do+ {# call gtk_range_get_range_rect #}+ (toRange self)+ (castPtr rPtr)+ peek rPtr++-- | This function returns sliders range along the long dimension, in 'DrawWindow' coordinates.+--+-- This function is useful mainly for 'Range' subclasses.+rangeGetSliderRange :: RangeClass self => self+ -> IO (Maybe (Int, Int))+rangeGetSliderRange range =+ alloca $ \ startPtr ->+ alloca $ \ endPtr -> do+ {#call gtk_range_get_slider_range #}+ (toRange range)+ startPtr+ endPtr+ if (startPtr /= nullPtr && endPtr /= nullPtr)+ then do+ start <- peek startPtr+ end <- peek endPtr+ return (Just (fromIntegral start, fromIntegral end))+ else return Nothing++-- | This function is useful mainly for 'Range' subclasses.+--+-- See 'rangeSetSliderSizeFixed'.+rangeGetSliderSizeFixed :: RangeClass self => self+ -> IO Bool -- ^ returns whether the range's slider has a fixed size.+rangeGetSliderSizeFixed self =+ liftM toBool $+ {#call gtk_range_get_slider_size_fixed #}+ (toRange self)++-- | Sets the minimum size of the range's slider.+--+-- This function is useful mainly for 'Range' subclasses.+rangeSetMinSliderSize :: RangeClass self => self+ -> Bool+ -> IO ()+rangeSetMinSliderSize self minSize =+ {#call gtk_range_set_min_slider_size #}+ (toRange self)+ (fromBool minSize)++-- | Sets whether the range's slider has a fixed size, or a size that depends on it's adjustment's page+-- size.+--+-- This function is useful mainly for 'Range' subclasses.+rangeSetSliderSizeFixed :: RangeClass self => self+ -> Bool -- ^ @sizeFixed@ 'True' to make the slider size constant+ -> IO ()+rangeSetSliderSizeFixed self sizeFixed =+ {#call gtk_range_set_slider_size_fixed #}+ (toRange self)+ (fromBool sizeFixed)+#endif+ -------------------- -- Attributes +#if GTK_MAJOR_VERSION < 3 -- | How the range should be updated on the screen. -- -- Default value: 'UpdateContinuous' --+-- Removed in Gtk3. rangeUpdatePolicy :: RangeClass self => Attr self UpdateType rangeUpdatePolicy = newAttr rangeGetUpdatePolicy rangeSetUpdatePolicy+#endif -- | The 'Adjustment' that contains the current value of this range object. --@@ -364,6 +467,20 @@ rangeGetValue rangeSetValue +#if GTK_CHECK_VERSION(2,20,0)+-- | Whether range's slikder has a fixed size, or a size that depends on it's adjustment's page size.+rangeSliderSizeFixed :: RangeClass self => Attr self Bool+rangeSliderSizeFixed = newAttr+ rangeGetSliderSizeFixed+ rangeSetSliderSizeFixed++-- | Get\/Set sliders range along the long dimension, in 'DrawWindow' coordinates.+rangeMinSliderSize :: RangeClass self => ReadWriteAttr self Int Bool+rangeMinSliderSize = newAttr+ rangeGetMinSliderSize+ rangeSetMinSliderSize+#endif+ -------------------- -- Signals @@ -371,13 +488,13 @@ -- | Emitted when the range value changes. -- valueChanged :: RangeClass self => Signal self (IO ())-valueChanged = Signal (connect_NONE__NONE "value_changed")+valueChanged = Signal (connect_NONE__NONE "value-changed") -- %hash c:9576 d:af3f -- | -- adjustBounds :: RangeClass self => Signal self (Double -> IO ())-adjustBounds = Signal (connect_DOUBLE__NONE "adjust_bounds")+adjustBounds = Signal (connect_DOUBLE__NONE "adjust-bounds") #if GTK_CHECK_VERSION(2,6,0) -- %hash c:a84 d:a60c@@ -398,7 +515,7 @@ -- * Available since Gtk+ version 2.6 -- changeValue :: RangeClass self => Signal self (ScrollType -> Double -> IO Bool)-changeValue = Signal (connect_ENUM_DOUBLE__BOOL "change_value")+changeValue = Signal (connect_ENUM_DOUBLE__BOOL "change-value") #endif --------------------@@ -413,9 +530,9 @@ -- the event itself and return 'True' to prevent further -- processing. Or, by returning 'False', it can pass the event to -- other handlers until the default GTK+ handler is reached.--- +-- -- * Since Gtk 2.6--- +-- onRangeChangeValue, afterRangeChangeValue :: RangeClass self => self -> (ScrollType -> Double -> IO Bool) -> IO (ConnectId self)
Graphics/UI/Gtk/Abstract/Scale.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Scale --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Abstract.Scale ( -- * Detail--- +-- -- | A 'Scale' is a slider control used to select a numeric value. To use it, -- you'll probably want to investigate the methods on its base class, 'Range', -- in addition to the methods for 'Scale' itself. To set the value of a scale,@@ -73,12 +74,12 @@ scaleValuePos, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (PositionType(..))+import Graphics.UI.Gtk.General.Enums (PositionType(..)) {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/Abstract/Scrollbar.hs view
@@ -27,8 +27,8 @@ -- module Graphics.UI.Gtk.Abstract.Scrollbar ( -- * Detail--- --- | The 'Scrollbar' widget is an abstract base class for +--+-- | The 'Scrollbar' widget is an abstract base class for -- 'Graphics.UI.Gtk.Scrolling.HScrollbar' and -- 'Graphics.UI.Gtk.Scrolling.VScrollbar'. It is not very useful in itself. --
Graphics/UI/Gtk/Abstract/Separator.hs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Abstract.Separator ( -- * Detail--- +-- -- | The 'Separator' widget is an abstract class, used only for deriving the -- subclasses 'Graphics.UI.Gtk.Ornaments.HSeparator' and -- 'Graphics.UI.Gtk.Ornaments.VSeparator'.
Graphics/UI/Gtk/Abstract/Widget.chs view
@@ -43,3061 +43,4476 @@ -- the look of applications without the need to write a theme engine in C. -- -- 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.---- * Class Hierarchy------ |--- @--- | 'GObject'--- | +----'Object'--- | +----Widget--- | +----/too many to list/--- @---- * Types- Widget,- WidgetClass,- castToWidget, gTypeWidget,- toWidget,- EventMask(..),- ExtensionMode(..),- GType,- KeyVal,- Region,- Bitmap,- Requisition(..),- Rectangle(..),- Color,- IconSize(..),- StateType(..),- TextDirection(..),- AccelFlags(..),- DirectionType(..),- StockId,- WidgetHelpType(..),---- * Methods- widgetShow,- widgetShowNow,- widgetHide,- widgetShowAll,- widgetHideAll,- widgetDestroy,- widgetQueueDraw,- widgetQueueResize,-#if GTK_CHECK_VERSION(2,4,0)- widgetQueueResizeNoRedraw,-#endif- widgetSizeRequest,- widgetGetChildRequisition,- widgetSizeAllocate,- widgetAddAccelerator,- widgetRemoveAccelerator,- widgetSetAccelPath,-#if GTK_CHECK_VERSION(2,4,0)- widgetCanActivateAccel,-#endif- widgetActivate,- widgetIntersect,- widgetHasIntersection,- widgetGetIsFocus,- widgetGrabFocus,- widgetGrabDefault,- widgetSetName,- widgetGetName,- widgetSetSensitive,- widgetSetSensitivity,- widgetGetParentWindow,- widgetGetDrawWindow,- widgetDelEvents,- widgetAddEvents,- widgetGetEvents,- widgetSetEvents,- widgetSetExtensionEvents,- widgetGetExtensionEvents,- widgetGetToplevel,- widgetGetAncestor,- widgetGetColormap,- widgetSetColormap,- widgetGetPointer,- widgetIsAncestor,- widgetTranslateCoordinates,- widgetSetStyle,- widgetGetStyle,- widgetPushColormap,- widgetPopColormap,- widgetSetDefaultColormap,- widgetGetDefaultStyle,- widgetGetDefaultColormap,- widgetSetDirection,- widgetGetDirection,- widgetSetDefaultDirection,- widgetGetDefaultDirection,- widgetShapeCombineMask,-#if GTK_CHECK_VERSION(2,10,0)- widgetInputShapeCombineMask,-#endif-#if GTK_CHECK_VERSION(2,12,0)- widgetGetTooltipWindow,- widgetSetTooltipWindow,- widgetTriggerTooltipQuery,-#endif- widgetPath,- widgetClassPath,- widgetGetCompositeName,- widgetModifyStyle,- widgetGetModifierStyle,- widgetModifyFg,- widgetModifyBg,- widgetModifyText,- widgetModifyBase,- widgetModifyFont,- widgetCreatePangoContext,- widgetGetPangoContext,- widgetCreateLayout,- widgetRenderIcon,- widgetQueueDrawArea,- widgetResetShapes,- widgetSetAppPaintable,- widgetSetDoubleBuffered,- widgetSetRedrawOnAllocate,- widgetSetCompositeName,- widgetSetScrollAdjustments,- widgetRegionIntersect,- widgetGetAccessible,- widgetChildFocus,- widgetGetChildVisible,- widgetGetParent,- widgetGetSettings,-#if GTK_CHECK_VERSION(2,2,0)- --widgetGetClipboard,- widgetGetDisplay,- widgetGetRootWindow,- widgetGetScreen,- widgetHasScreen,-#endif- widgetGetSizeRequest,- widgetSetChildVisible,- widgetSetSizeRequest,-#if GTK_CHECK_VERSION(2,4,0)- widgetSetNoShowAll,- widgetGetNoShowAll,- widgetListMnemonicLabels,- widgetAddMnemonicLabel,- widgetRemoveMnemonicLabel,-#if GTK_CHECK_VERSION(2,10,0)- widgetGetAction,- widgetIsComposited,-#endif-#endif- widgetReparent,-#if GTK_CHECK_VERSION(2,18,0)- widgetGetCanFocus,- widgetSetCanFocus,- widgetGetAllocation,-#endif- widgetGetState,- widgetGetSavedState,- widgetGetSize,- widgetEvent,---- * Attributes- widgetName,- widgetParent,- widgetWidthRequest,- widgetHeightRequest,- widgetVisible,- widgetSensitive,- widgetAppPaintable,- widgetCanFocus,- widgetHasFocus,- widgetIsFocus,- widgetCanDefault,- widgetHasDefault,- widgetReceivesDefault,- widgetCompositeChild,- widgetStyle,- widgetEvents,- widgetExtensionEvents,- widgetNoShowAll,- widgetChildVisible,- widgetColormap,- widgetCompositeName,- widgetDirection,- widgetTooltipMarkup,- widgetTooltipText,- widgetHasTooltip,---- * Signals- realize,- unrealize,- mapSignal,- unmapSignal,- sizeRequest,- sizeAllocate,- showSignal,- hideSignal,- focus,- stateChanged,- parentSet,- hierarchyChanged,- styleSet,- directionChanged,- grabNotify,- popupMenuSignal,- showHelp,- accelClosuresChanged,- screenChanged,- queryTooltip,---- * Events- buttonPressEvent,- buttonReleaseEvent,- configureEvent,- deleteEvent,- destroyEvent,- enterNotifyEvent,- exposeEvent,- focusInEvent,- focusOutEvent,-#if GTK_CHECK_VERSION(2,8,0)- grabBrokenEvent,-#endif- keyPressEvent,- keyReleaseEvent,- leaveNotifyEvent,- mapEvent,- motionNotifyEvent,- noExposeEvent,- proximityInEvent,- proximityOutEvent,- scrollEvent,- unmapEvent,- visibilityNotifyEvent,- windowStateEvent,---- * Deprecated-#ifndef DISABLE_DEPRECATED- onButtonPress,- afterButtonPress,- onButtonRelease,- afterButtonRelease,- onClient,- afterClient,- onConfigure,- afterConfigure,- onDelete,- afterDelete,- onDestroyEvent, -- you probably want onDestroy- afterDestroyEvent,- onDirectionChanged,- afterDirectionChanged,- onEnterNotify,- afterEnterNotify,- onLeaveNotify,- afterLeaveNotify,- onExpose,- afterExpose,- onExposeRect,- afterExposeRect,- onFocus,- afterFocus,- onFocusIn,- afterFocusIn,- onFocusOut,- afterFocusOut,- onGrabFocus,- afterGrabFocus,- onDestroy,- afterDestroy,- onHide,- afterHide,- onHierarchyChanged,- afterHierarchyChanged,- onKeyPress,- afterKeyPress,- onKeyRelease,- afterKeyRelease,- onMnemonicActivate,- afterMnemonicActivate,- onMotionNotify,- afterMotionNotify,- onParentSet,- afterParentSet,- onPopupMenu,- afterPopupMenu,- onProximityIn,- afterProximityIn,- onProximityOut,- afterProximityOut,- onRealize,- afterRealize,- onScroll,- afterScroll,- onShow,- afterShow,- onSizeAllocate,- afterSizeAllocate,- onSizeRequest,- afterSizeRequest,- onStateChanged,- afterStateChanged,- onUnmap,- afterUnmap,- onUnrealize,- afterUnrealize,- onVisibilityNotify,- afterVisibilityNotify,- onWindowState,- afterWindowState-#endif- ) where--import Control.Monad (liftM, unless)-import Data.Maybe (fromMaybe)-import Control.Monad.Reader (ask)-import Control.Monad.Trans (liftIO)-import Data.Bits ((.&.), complement)-import System.Glib.FFI-import System.Glib.Flags (fromFlags, toFlags)-import System.Glib.UTFString-import System.Glib.Attributes-import System.Glib.Properties-import System.Glib.GObject (constructNewGObject, makeNewGObject)-import System.Glib.GType (GType)-import System.Glib.GList (GList, fromGList)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import Graphics.Rendering.Pango.Markup-{#import Graphics.UI.Gtk.Types#}-{#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.Gdk.Enums (EventMask(..), ExtensionMode(..))-import Graphics.UI.Gtk.Gdk.Keys (KeyVal)-{#import Graphics.UI.Gtk.Gdk.Region#} (Region(..), makeNewRegion)-{#import Graphics.UI.Gtk.Gdk.Pixmap#} (Bitmap)-import Graphics.UI.Gtk.General.Structs (Allocation, Rectangle(..)- ,Requisition(..), Color, IconSize(..)- ,Point- ,widgetGetState, widgetGetSavedState- ,widgetGetDrawWindow, widgetGetSize)-import Graphics.UI.Gtk.Gdk.Events (Event(..), marshalEvent,- marshExposeRect,- EventButton,- EventScroll,- EventMotion,- EventExpose,- EventKey,- EventConfigure,- EventCrossing,- EventFocus,- EventProperty,- EventProximity,- EventVisibility,- EventWindowState,- EventGrabBroken)-import Graphics.UI.Gtk.Gdk.EventM (EventM,- EventM,- EAny,- EKey,- EButton,- EScroll,- EMotion,- EExpose,- EVisibility,- ECrossing,- EFocus,- EConfigure,- EProperty,- EProximity,- EWindowState,-#if GTK_CHECK_VERSION(2,6,0)- EOwnerChange,-#endif-#if GTK_CHECK_VERSION(2,8,0)- EGrabBroken,-#endif- )-import Graphics.UI.Gtk.General.Enums (StateType(..), TextDirection(..),- AccelFlags(..), DirectionType(..), Modifier)-{#import Graphics.Rendering.Pango.Types#} -{#import Graphics.Rendering.Pango.BasicTypes#} (FontDescription(FontDescription),- PangoLayout(PangoLayout), makeNewPangoString )-import Graphics.UI.Gtk.General.StockItems (StockId)-import Data.IORef ( newIORef )-import Control.Monad.Reader ( runReaderT )--{# context lib="gtk" prefix="gtk" #}-------------------------- Methods---- | Flags a widget to be displayed. Any widget that isn't shown will not--- appear on the screen. If you want to show all the widgets in a container,--- it's easier to call 'widgetShowAll' on the container, instead of--- individually showing the widgets.------ Remember that you have to show the containers containing a widget, in--- addition to the widget itself, before it will appear onscreen.------ When a toplevel container is shown, it is immediately realized and--- mapped; other shown widgets are realized and mapped when their toplevel--- container is realized and mapped.----widgetShow :: WidgetClass self => self -> IO ()-widgetShow self =- {# call widget_show #}- (toWidget self)---- | Shows a widget. If the widget is an unmapped toplevel widget (i.e. a--- 'Window' that has not yet been shown), enter the main loop and wait for the--- window to actually be mapped. Be careful; because the main loop is running,--- anything can happen during this function.----widgetShowNow :: WidgetClass self => self -> IO ()-widgetShowNow self =- {# call widget_show_now #}- (toWidget self)---- | Reverses the effects of 'widgetShow', causing the widget to be hidden--- (invisible to the user).----widgetHide :: WidgetClass self => self -> IO ()-widgetHide self =- {# call widget_hide #}- (toWidget self)---- | Recursively shows a widget, and any child widgets (if the widget is a--- container).----widgetShowAll :: WidgetClass self => self -> IO ()-widgetShowAll self =- {# call widget_show_all #}- (toWidget self)---- | Recursively hides a widget and any child widgets.----widgetHideAll :: WidgetClass self => self -> IO ()-widgetHideAll self =- {# call widget_hide_all #}- (toWidget self)---- | Destroys a widget. Equivalent to--- 'Graphics.UI.Gtk.Abstract.Object.objectDestroy'.------ When a widget is destroyed it will be removed from the screen and--- unrealized. When a widget is destroyed, it will break any references it--- holds to other objects.If the widget is inside a container, the widget will--- be removed from the container. The widget will be garbage collected--- (finalized) time after your last reference to the widget dissapears.------ In most cases, only toplevel widgets (windows) require explicit--- destruction, because when you destroy a toplevel its children will be--- destroyed as well.----widgetDestroy :: WidgetClass self => self -> IO ()-widgetDestroy self =- {# call widget_destroy #}- (toWidget self)---- * Functions to be used with 'Graphics.UI.Gtk.Misc.DrawingArea' or--- container implementations.---- | Send a redraw request to a widget. Equivalent to calling--- 'widgetQueueDrawArea' for the entire area of a widget.----widgetQueueDraw :: WidgetClass self => self -> IO ()-widgetQueueDraw self =- {# call widget_queue_draw #}- (toWidget self)---- | This function is only for use in widget implementations. Flags a widget--- to have its size renegotiated; should be called when a widget for some--- reason has a new size request. For example, when you change the text in a--- 'Graphics.UI.Gtk.Display.Label.Label',--- 'Graphics.UI.Gtk.Display.Label.Label' queues a resize to ensure there's--- enough space for the new text.----widgetQueueResize :: WidgetClass self => self -> IO ()-widgetQueueResize self =- {# call widget_queue_resize #}- (toWidget self)--#if GTK_CHECK_VERSION(2,4,0)--- | This function works like 'widgetQueueResize', except that the widget is--- not invalidated.------ * Available since Gtk+ version 2.4----widgetQueueResizeNoRedraw :: WidgetClass self => self -> IO ()-widgetQueueResizeNoRedraw self =- {# call widget_queue_resize_no_redraw #}- (toWidget self)-#endif---- | This function is typically used when implementing a--- 'Graphics.UI.Gtk.Abstract.Container.Container' subclass. Obtains the preferred size--- of a widget. The container uses this information to arrange its child--- widgets and decide what size allocations to give them with--- 'widgetSizeAllocate'.------ You can also call this function from an application, with some caveats.--- Most notably, getting a size request requires the widget to be associated--- with a screen, because font information may be needed. Multihead-aware--- applications should keep this in mind.------ Also remember that the size request is not necessarily the size a widget--- will actually be allocated.----widgetSizeRequest :: WidgetClass self => self -> IO Requisition-widgetSizeRequest self = alloca $ \reqPtr -> do- {#call widget_size_request #} (toWidget self) (castPtr reqPtr)- peek reqPtr---- | This function is only for use in widget implementations. Obtains the--- chached requisition information in the widget, unless someone has forced a--- particular geometry on the widget (e.g. with 'widgetSetUsize'), in which--- case it returns that geometry instead of the widget's requisition.------ This function differs from 'widgetSizeRequest' in that it retrieves the--- last size request value stored in the widget, while 'widgetSizeRequest'--- actually emits the 'sizeRequest' signal on the widget to compute the size--- request (which updates the widget's requisition information).------ Since this function does not emit the 'sizeRequest' signal, it can only be--- used when you know that the widget's requisition is up-to-date, that is,--- 'widgetSizeRequest' has been called since the last time a resize was--- queued. In general, only container implementations have this information;--- applications should use 'widgetSizeRequest'.----widgetGetChildRequisition :: WidgetClass self => self -> IO Requisition-widgetGetChildRequisition self = alloca $ \reqPtr -> do- {#call widget_get_child_requisition #} (toWidget self) (castPtr reqPtr)- peek reqPtr---- | This function is only used by--- 'Graphics.UI.Gtk.Abstract.Container.Container' subclasses, to assign a--- size and position to their child widgets.----widgetSizeAllocate :: WidgetClass self => self- -> Allocation -- ^ The @x@ and @y@ values of the rectangle determine the- -- the position of the widget's area relative to its parent- -- allocation.- -> IO ()-widgetSizeAllocate self rect = with rect $ \rectPtr ->- {#call widget_size_allocate#} (toWidget self) (castPtr rectPtr)---- %hash c:1e14 d:53c5--- | Installs an accelerator for this @widget@ in @accelGroup@ that causes--- @accelSignal@ to be emitted if the accelerator is activated. The--- @accelGroup@ needs to be added to the widget's toplevel via--- 'windowAddAccelGroup', and the signal must be of type @G_RUN_ACTION@.--- Accelerators added through this function are not user changeable during--- runtime. If you want to support accelerators that can be changed by the--- user, use 'accelMapAddEntry' and 'widgetSetAccelPath' or--- 'menuItemSetAccelPath' instead.----widgetAddAccelerator :: WidgetClass self => self- -> String -- ^ @accelSignal@ - widget signal to emit on accelerator- -- activation- -> AccelGroup -- ^ @accelGroup@ - accel group for this widget, added to- -- its toplevel- -> KeyVal -- ^ @accelKey@ - the key of the accelerator- -> [Modifier] -- ^ @accelMods@ - modifier key combination of the- -- accelerator- -> [AccelFlags] -- ^ @accelFlags@ - flag accelerators, e.g. 'AccelVisible'- -> IO ()-widgetAddAccelerator self accelSignal accelGroup accelKey accelMods accelFlags =- withUTFString accelSignal $ \accelSignalPtr ->- {# call gtk_widget_add_accelerator #}- (toWidget self)- accelSignalPtr- accelGroup- (fromIntegral accelKey)- ((fromIntegral . fromFlags) accelMods)- ((fromIntegral . fromFlags) accelFlags)---- %hash c:3442 d:dfe8--- | Removes an accelerator from @widget@, previously installed with--- 'widgetAddAccelerator'.----widgetRemoveAccelerator :: WidgetClass self => self- -> AccelGroup -- ^ @accelGroup@ - accel group for this widget- -> KeyVal -- ^ @accelKey@ - the key of the accelerator- -> [Modifier] -- ^ @accelMods@ - modifier key combination of the- -- accelerator- -> IO Bool -- ^ returns whether an accelerator was installed and could- -- be removed-widgetRemoveAccelerator self accelGroup accelKey accelMods =- liftM toBool $- {# call gtk_widget_remove_accelerator #}- (toWidget self)- accelGroup- (fromIntegral accelKey)- ((fromIntegral . fromFlags) accelMods)---- %hash c:f8d4 d:bd7f--- | Given an accelerator group, @accelGroup@, and an accelerator path,--- @accelPath@, sets up an accelerator in @accelGroup@ so whenever the key--- binding that is defined for @accelPath@ is pressed, @widget@ will be--- activated. This removes any accelerators (for any accelerator group)--- installed by previous calls to 'widgetSetAccelPath'. Associating--- accelerators with paths allows them to be modified by the user and the--- modifications to be saved for future use. (See 'accelMapSave'.)------ This function is a low level function that would most likely be used by a--- menu creation system like 'ItemFactory'. If you use 'ItemFactory', setting--- up accelerator paths will be done automatically.------ Even when you you aren't using 'ItemFactory', if you only want to set up--- accelerators on menu items 'menuItemSetAccelPath' provides a somewhat more--- convenient interface.----widgetSetAccelPath :: WidgetClass self => self- -> String -- ^ @accelPath@ - path used to look up the accelerator- -> AccelGroup -- ^ @accelGroup@ - a 'AccelGroup'.- -> IO ()-widgetSetAccelPath self accelPath accelGroup =- withUTFString accelPath $ \accelPathPtr ->- {# call gtk_widget_set_accel_path #}- (toWidget self)- accelPathPtr- accelGroup--#if GTK_CHECK_VERSION(2,4,0)--- %hash c:157e d:82ae--- | Determines whether an accelerator that activates the signal identified by--- @signalId@ can currently be activated. This is done by emitting the--- 'canActivateAccel' signal on the widget the signal is attached to; if the--- signal isn't overridden by a handler or in a derived widget, then the--- default check is that the widget must be sensitive, and the widget and all--- its ancestors mapped.------ * Available since Gtk+ version 2.4----widgetCanActivateAccel :: WidgetClass self =>- (ConnectId self) -- ^ @signalId@ - the ID of a signal installed on @widget@- -> IO Bool -- ^ returns @True@ if the accelerator can be activated.-widgetCanActivateAccel (ConnectId signalId self) =- liftM toBool $- {# call gtk_widget_can_activate_accel #}- (toWidget self)- (fromIntegral signalId)-#endif---- | For widgets that can be \"activated\" (buttons, menu items, etc.) this--- function activates them. Activation is what happens when you press Enter on--- a widget during key navigation. If @widget@ isn't activatable, the function--- returns @False@.----widgetActivate :: WidgetClass self => self- -> IO Bool -- ^ returns @True@ if the widget was activatable-widgetActivate self =- liftM toBool $- {# call widget_activate #}- (toWidget self)---- | Computes the intersection of a widget's area and @area@, returning the--- intersection, and returns @Nothing@ if there was no intersection.----widgetIntersect :: WidgetClass self => self- -> Rectangle -- ^ @area@ - a rectangle- -> IO (Maybe Rectangle) -- ^ returns the intersection or @Nothing@-widgetIntersect self area =- with area $ \areaPtr ->- alloca $ \intersectionPtr -> do- hasIntersection <- {# call unsafe widget_intersect #}- (toWidget self)- (castPtr areaPtr)- (castPtr intersectionPtr)- if (toBool hasIntersection)- then liftM Just $ peek intersectionPtr- else return Nothing---- | Check if the widget intersects with a given area.----widgetHasIntersection :: WidgetClass self => self- -> Rectangle -- ^ @area@ - a rectangle- -> IO Bool -- ^ returns @True@ if there was an intersection-widgetHasIntersection self area = - liftM toBool $- with area $ \areaPtr ->- {# call unsafe widget_intersect #}- (toWidget self)- (castPtr areaPtr)- (castPtr nullPtr)---- %hash d:1cab--- | Determines if the widget is the focus widget within its toplevel. (This--- does not mean that the 'widgetHasFocus' attribute is necessarily set;--- 'widgetHasFocus' will only be set if the toplevel widget additionally has--- the global input focus.)----widgetGetIsFocus :: WidgetClass self => self- -> IO Bool -- ^ returns @True@ if the widget is the focus widget.-widgetGetIsFocus self =- liftM toBool $- {# call unsafe widget_is_focus #}- (toWidget self)---- %hash d:e1e--- | Causes @widget@ to have the keyboard focus for the 'Window' it's inside.--- @widget@ must be a focusable widget, such as a--- 'Graphics.UI.Gtk.Entry.Entry'; something like--- 'Graphics.UI.Gtk.Ornaments.Frame' won't work. (More precisely, it must have--- the 'widgetCanFocus' flag set.)----widgetGrabFocus :: WidgetClass self => self -> IO ()-widgetGrabFocus self =- {# call widget_grab_focus #}- (toWidget self)---- %hash c:e5e9 d:412a--- | Causes @widget@ to become the default widget. @widget@ must have the--- 'canDefault' flag set. The default widget is--- activated when the user presses Enter in a window. Default widgets must be--- activatable, that is, 'widgetActivate' should affect them.----widgetGrabDefault :: WidgetClass self => self -> IO ()-widgetGrabDefault self =- {# call gtk_widget_grab_default #}- (toWidget self)---- %hash c:4f62 d:d05a--- | Widgets can be named, which allows you to refer to them from a gtkrc--- file. You can apply a style to widgets with a particular name in the gtkrc--- file. See the documentation for gtkrc files.------ Note that widget names are separated by periods in paths (see--- 'widgetPath'), so names with embedded periods may cause confusion.----widgetSetName :: WidgetClass self => self- -> String -- ^ @name@ - name for the widget- -> IO ()-widgetSetName self name =- withUTFString name $ \namePtr ->- {# call widget_set_name #}- (toWidget self)- namePtr---- | Retrieves the name of a widget. See 'widgetSetName' for the significance--- of widget names.----widgetGetName :: WidgetClass self => self -> IO String-widgetGetName self =- {# call unsafe widget_get_name #}- (toWidget self)- >>= peekUTFString---- %hash c:25b1 d:f898--- | Sets the sensitivity of a widget. A widget is sensitive if the user can--- interact with it. Insensitive widgets are \"grayed out\" and the user can't--- interact with them. Insensitive widgets are known as \"inactive\",--- \"disabled\", or \"ghosted\" in some other toolkits.----widgetSetSensitive :: WidgetClass self => self- -> Bool -- ^ @sensitive@ - @True@ to make the widget sensitive- -> IO ()-widgetSetSensitive self sensitive =- {# call gtk_widget_set_sensitive #}- (toWidget self)- (fromBool sensitive)- --- bad spelling backwards compatability definition-widgetSetSensitivity :: WidgetClass self => self -> Bool -> IO ()-widgetSetSensitivity = widgetSetSensitive---- | Gets the widget's parent window.----widgetGetParentWindow :: WidgetClass self => self -> IO DrawWindow-widgetGetParentWindow self =- makeNewGObject mkDrawWindow $- {# call gtk_widget_get_parent_window #}- (toWidget self)---- | Disable event signals.------ * Remove events from the 'EventMask' of this widget. The event mask--- determines which events a widget will receive. Events are signals--- that return an 'Event' data type. On connecting to a such a signal,--- the event mask is automatically adjusted so that he signal is emitted.--- This function is useful to disable the reception of the signal. It--- should be called whenever all signals receiving an 'Event'--- have been disconected. ----widgetDelEvents :: WidgetClass self => self -> [EventMask] -> IO ()-widgetDelEvents self events = do- mask <- {#call unsafe widget_get_events#} (toWidget self)- let mask' = mask .&. (complement (fromIntegral $ fromFlags events))- {#call unsafe widget_set_events#} (toWidget self) mask'---- | Enable event signals.------ * See 'widgetDelEvents'.----widgetAddEvents :: WidgetClass self => self -> [EventMask] -> IO ()-widgetAddEvents self [] = return ()- -- special [] case to work around a GTK+ bug, see:- -- http://bugzilla.gnome.org/show_bug.cgi?id=316702-widgetAddEvents self events =- {# call unsafe widget_add_events #}- (toWidget self)- (fromIntegral $ fromFlags events)---- | Get enabled event signals.------ * See 'widgetDelEvents'.----widgetGetEvents :: WidgetClass self => self -> IO [EventMask]-widgetGetEvents self =- liftM (toFlags . fromIntegral) $- {# call unsafe widget_get_events #}- (toWidget self)---- %hash c:468a d:49a0--- | Sets the event mask (see 'EventMask') for a widget. The event mask--- determines which events a widget will receive. Keep in mind that different--- widgets have different default event masks, and by changing the event mask--- you may disrupt a widget's functionality, so be careful. This function must--- be called while a widget is unrealized. Consider 'widgetAddEvents' for--- widgets that are already realized, or if you want to preserve the existing--- event mask. This function can't be used with 'NoWindow' widgets; to get--- events on those widgets, place them inside a--- 'Graphics.UI.Gtk.Misc.EventBox' and receive events on the event box.----widgetSetEvents :: WidgetClass self => self- -> [EventMask] -- ^ @events@ - event mask- -> IO ()-widgetSetEvents self events =- {# call unsafe widget_set_events #}- (toWidget self)- (fromIntegral $ fromFlags events)---- %hash c:4f2c d:781--- | Sets the extension events mask to @mode@. See 'ExtensionMode' and--- 'inputSetExtensionEvents'.----widgetSetExtensionEvents :: WidgetClass self => self- -> [ExtensionMode]- -> IO ()-widgetSetExtensionEvents self mode =- {# call widget_set_extension_events #}- (toWidget self)- ((fromIntegral . fromFlags) mode)---- %hash c:c824 d:e611--- | Retrieves the extension events the widget will receive; see--- 'widgetSetExtensionEvents'.----widgetGetExtensionEvents :: WidgetClass self => self- -> IO [ExtensionMode]-widgetGetExtensionEvents self =- liftM (toFlags . fromIntegral) $- {# call widget_get_extension_events #}- (toWidget self)---- %hash c:270b d:8877--- | This function returns the topmost widget in the container hierarchy--- @widget@ is a part of. If @widget@ has no parent widgets, it will be--- returned as the topmost widget.----widgetGetToplevel :: WidgetClass self => - self -- ^ @widget@ - the widget in question- -> IO Widget -- ^ returns the topmost ancestor of @widget@, or @widget@- -- itself if there's no ancestor.-widgetGetToplevel self =- makeNewObject mkWidget $- {# call unsafe widget_get_toplevel #}- (toWidget self)---- %hash c:17bc d:f8f9--- | Gets the first ancestor of @widget@ with type @widgetType@. For example,--- @widgetGetAncestor widget gTypeBox@ gets the first 'Box' that's--- an ancestor of @widget@. See note about checking for a toplevel--- 'Window' in the docs for 'widgetGetToplevel'.------ Note that unlike 'widgetIsAncestor', 'widgetGetAncestor' considers--- @widget@ to be an ancestor of itself.----widgetGetAncestor :: WidgetClass self => self- -> GType -- ^ @widgetType@ - ancestor type- -> IO (Maybe Widget) -- ^ returns the ancestor widget, or @Nothing@ if not found-widgetGetAncestor self widgetType = do- ptr <- {# call gtk_widget_get_ancestor #}- (toWidget self)- widgetType- if ptr==nullPtr then return Nothing else- liftM Just $ makeNewObject mkWidget (return ptr)----- %hash c:bd95 d:eb94--- | Gets the colormap that will be used to render @widget@.----widgetGetColormap :: WidgetClass self => self- -> IO Colormap -- ^ returns the colormap used by @widget@-widgetGetColormap self =- makeNewGObject mkColormap $- {# call gtk_widget_get_colormap #}- (toWidget self)---- %hash c:cba1 d:ffeb--- | Sets the colormap for the widget to the given value. Widget must not have--- been previously realized. This probably should only be used from an 'init'--- function (i.e. from the constructor for the widget).----widgetSetColormap :: WidgetClass self => self- -> Colormap -- ^ @colormap@ - a colormap- -> IO ()-widgetSetColormap self colormap =- {# call gtk_widget_set_colormap #}- (toWidget self)- colormap---- %hash c:3522 d:5637--- | Obtains the location of the mouse pointer in widget coordinates. Widget--- coordinates are a bit odd; for historical reasons, they are defined as--- 'widgetGetParentWindow' coordinates for widgets that are not 'NoWindow' widgets,--- and are relative to the widget's allocation's (x,y) for--- widgets that are 'NoWindow' widgets.----widgetGetPointer :: WidgetClass self => self- -> IO (Int, Int) -- ^ @(x, y)@ - X Y coordinate-widgetGetPointer self =- alloca $ \xPtr ->- alloca $ \yPtr ->- {# call gtk_widget_get_pointer #}- (toWidget self)- xPtr- yPtr- >>- peek xPtr >>= \x ->- peek yPtr >>= \y ->- return (fromIntegral x, fromIntegral y)---- %hash c:499d--- | Determines whether @widget@ is somewhere inside @ancestor@, possibly with--- intermediate containers.----widgetIsAncestor :: (WidgetClass self, WidgetClass ancestor) =>- self -- ^ @widget@ - the widget in question- -> ancestor -- ^ @ancestor@ - another 'Widget'- -> IO Bool -- ^ returns @True@ if @ancestor@ contains @widget@ as a child,- -- grandchild, great grandchild, etc.-widgetIsAncestor self ancestor =- liftM toBool $- {# call unsafe widget_is_ancestor #}- (toWidget self)- (toWidget ancestor)---- %hash c:8661--- | Translate coordinates relative to @srcWidget@'s allocation to coordinates--- relative to @destWidget@'s allocations. In order to perform this operation,--- both widgets must be realized, and must share a common toplevel.----widgetTranslateCoordinates :: (WidgetClass self, WidgetClass destWidget) =>- self -- ^ @srcWidget@ - a 'Widget'- -> destWidget -- ^ @destWidget@ - a 'Widget'- -> Int -- ^ @srcX@ - X position relative to @srcWidget@- -> Int -- ^ @srcY@ - Y position relative to @srcWidget@- -> IO (Maybe (Int, Int)) -- ^ @Just (destX, destY)@ - X and Y position- -- relative to @destWidget@. Returns @Nothing@ if- -- either widget was not realized, or there was no- -- common ancestor.-widgetTranslateCoordinates self destWidget srcX srcY =- alloca $ \destXPtr ->- alloca $ \destYPtr -> do- worked <- {# call gtk_widget_translate_coordinates #}- (toWidget self)- (toWidget destWidget)- (fromIntegral srcX)- (fromIntegral srcY)- destXPtr- destYPtr- if (toBool worked)- then do destX <- peek destXPtr- destY <- peek destYPtr- return (Just (fromIntegral destX, fromIntegral destY))- else return Nothing---- %hash c:596c d:b7e5--- | Sets the 'Style' for a widget. You probably don't want--- to use this function; it interacts badly with themes, because themes work by--- replacing the 'Style'. Instead, use 'widgetModifyStyle'.----widgetSetStyle :: WidgetClass self => self- -> Maybe Style -- ^ @style@ - a 'Style', or @Nothing@ to remove the effect of a previous- -- 'widgetSetStyle' and go back to the default style- -> IO ()-widgetSetStyle self style =- {# call gtk_widget_set_style #}- (toWidget self)- (fromMaybe (Style nullForeignPtr) style)---- | Retrieve the 'Style' associated with the widget.----widgetGetStyle :: WidgetClass widget => widget -> IO Style-widgetGetStyle widget = do- {# call gtk_widget_ensure_style #} (toWidget widget)- makeNewGObject mkStyle $ {# call gtk_widget_get_style #} (toWidget widget)---- %hash c:d5ed d:dc10--- | Pushes @cmap@ onto a global stack of colormaps; the topmost colormap on--- the stack will be used to create all widgets. Remove @cmap@ with--- 'widgetPopColormap'. There's little reason to use this function.----widgetPushColormap ::- Colormap -- ^ @cmap@ - a 'Colormap'- -> IO ()-widgetPushColormap cmap =- {# call gtk_widget_push_colormap #}- cmap---- %hash c:7300 d:2920--- | Removes a colormap pushed with 'widgetPushColormap'.----widgetPopColormap :: IO ()-widgetPopColormap =- {# call gtk_widget_pop_colormap #}---- %hash c:1f73 d:590e--- | Sets the default colormap to use when creating widgets.--- 'widgetPushColormap' is a better function to use if you only want to affect--- a few widgets, rather than all widgets.----widgetSetDefaultColormap ::- Colormap -- ^ @colormap@ - a 'Colormap'- -> IO ()-widgetSetDefaultColormap colormap =- {# call gtk_widget_set_default_colormap #}- colormap---- %hash c:e71b d:72c2--- | Returns the default style used by all widgets initially.----widgetGetDefaultStyle ::- IO Style -- ^ returns the default style. This 'Style' object is owned by- -- Gtk and should not be modified.-widgetGetDefaultStyle =- makeNewGObject mkStyle $- {# call gtk_widget_get_default_style #}---- %hash c:d731 d:52bf--- | Obtains the default colormap used to create widgets.----widgetGetDefaultColormap ::- IO Colormap -- ^ returns default widget colormap-widgetGetDefaultColormap =- makeNewGObject mkColormap $- {# call gtk_widget_get_default_colormap #}---- | Sets the reading direction on a particular widget. This direction--- controls the primary direction for widgets containing text, and also the--- direction in which the children of a container are packed. The ability to--- set the direction is present in order so that correct localization into--- languages with right-to-left reading directions can be done. Generally,--- applications will let the default reading direction present, except for--- containers where the containers are arranged in an order that is explicitely--- visual rather than logical (such as buttons for text justification).------ If the direction is set to 'TextDirNone', then the value set by--- 'widgetSetDefaultDirection' will be used.----widgetSetDirection :: WidgetClass self => self -> TextDirection -> IO ()-widgetSetDirection self dir =- {# call widget_set_direction #}- (toWidget self)- ((fromIntegral . fromEnum) dir)---- | Gets the reading direction for a particular widget. See--- 'widgetSetDirection'.----widgetGetDirection :: WidgetClass self => self -> IO TextDirection-widgetGetDirection self =- liftM (toEnum . fromIntegral) $- {# call widget_get_direction #}- (toWidget self)---- %hash c:ff9a--- | Sets the default reading direction for widgets where the direction has--- not been explicitly set by 'widgetSetDirection'.----widgetSetDefaultDirection :: - TextDirection -- ^ @dir@ - the new default direction. This cannot be- -- 'TextDirNone'.- -> IO ()-widgetSetDefaultDirection dir =- {# call gtk_widget_set_default_direction #}- ((fromIntegral . fromEnum) dir)---- | Obtains the current default reading direction. See--- 'widgetSetDefaultDirection'.----widgetGetDefaultDirection :: IO TextDirection-widgetGetDefaultDirection =- liftM (toEnum . fromIntegral) $- {# call gtk_widget_get_default_direction #}---- %hash c:c7ba d:3a9c--- | Sets a shape for this widget's 'DrawWindow'. This allows for transparent--- windows etc., see 'windowShapeCombineMask' for more information.----widgetShapeCombineMask :: WidgetClass self => self- -> Maybe Bitmap -- ^ @shapeMask@ - shape to be added, or @Nothint@ to remove an- -- existing shape.- -> Int -- ^ @offsetX@ - X position of shape mask with respect to @window@.- -> Int -- ^ @offsetY@ - Y position of shape mask with respect to @window@.- -> IO ()-widgetShapeCombineMask self shapeMask offsetX offsetY =- case (fromMaybe (Pixmap nullForeignPtr) shapeMask) of- Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr ->- {# call gtk_widget_shape_combine_mask #}- (toWidget self)- (castPtr bitmapPtr)- (fromIntegral offsetX)- (fromIntegral offsetY)--#if GTK_CHECK_VERSION(2,10,0)--- %hash c:3c29 d:68e2--- | Sets an input shape for this widget's GDK window. This allows for windows--- which react to mouse click in a nonrectangular region, see--- 'windowInputShapeCombineMask' for more information.------ * Available since Gtk+ version 2.10----widgetInputShapeCombineMask :: WidgetClass self => self- -> Maybe Bitmap -- ^ @shapeMask@ - shape to be added, or @Nothint@ to remove an- -- existing shape.- -> Int -- ^ @offsetX@ - X position of shape mask with respect to @window@.- -> Int -- ^ @offsetY@ - Y position of shape mask with respect to @window@.- -> IO ()-widgetInputShapeCombineMask self shapeMask offsetX offsetY =- case (fromMaybe (Pixmap nullForeignPtr) shapeMask) of- Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr ->- {# call gtk_widget_input_shape_combine_mask #}- (toWidget self)- (castPtr bitmapPtr)- (fromIntegral offsetX)- (fromIntegral offsetY)-#endif--#if GTK_CHECK_VERSION(2,12,0)--- | Returns the 'Window' of the current tooltip. This can be the 'Window' created by default, or the--- custom tooltip window set using 'widgetSetTooltipWindow'.--- --- * Available since Gtk+ version 2.12----widgetGetTooltipWindow :: WidgetClass self => self- -> IO Window -- ^ returns The 'Window' of the current tooltip-widgetGetTooltipWindow self =- makeNewObject mkWindow $- {# call gtk_widget_get_tooltip_window #}- (toWidget self)---- | Replaces the default, usually yellow, window used for displaying tooltips with @customWindow@. GTK+--- will take care of showing and hiding @customWindow@ at the right moment, to behave likewise as the--- default tooltip window. If @customWindow@ is 'Nothing', the default tooltip window will be used.--- --- If the custom window should have the default theming it needs to have the name 'gtk-tooltip', see--- 'widgetSetName'.------ * Available since Gtk+ version 2.12--- -widgetSetTooltipWindow :: (WidgetClass self, WindowClass customWindow) => self- -> Maybe customWindow -- ^ @customWindow@ a 'Window', or 'Nothing'. allow-none. - -> IO ()-widgetSetTooltipWindow self customWindow =- {# call gtk_widget_set_tooltip_window #}- (toWidget self)- (maybe (Window nullForeignPtr) toWindow customWindow)---- | Triggers a tooltip query on the display where the toplevel of @widget@ is--- located. See 'tooltipTriggerTooltipQuery' for more information.------ * Available since Gtk+ version 2.12----widgetTriggerTooltipQuery :: WidgetClass self => self -> IO ()-widgetTriggerTooltipQuery self =- {# call gtk_widget_trigger_tooltip_query #}- (toWidget self)-#endif---- %hash c:7e36 d:616f--- | Obtains the full path to @widget@. The path is simply the name of a--- widget and all its parents in the container hierarchy, separated by periods.--- The name of a widget comes from 'widgetGetName'. Paths are used to apply--- styles to a widget in gtkrc configuration files. Widget names are the type--- of the widget by default (e.g. \"GtkButton\") or can be set to an--- application-specific value with 'widgetSetName'. By setting the name of a--- widget, you allow users or theme authors to apply styles to that specific--- widget in their gtkrc file. Also returns the path in reverse--- order, i.e. starting with the widget's name instead of starting with the--- name of the widget's outermost ancestor.----widgetPath :: WidgetClass self => self- -> IO (Int, String, String) -- ^ @(pathLength, path, pathReversed)@ - length- -- of the path, path string and reverse path- -- string-widgetPath self =- alloca $ \pathLengthPtr ->- alloca $ \pathPtr ->- alloca $ \pathReversedPtr ->- {# call gtk_widget_path #}- (toWidget self)- pathLengthPtr- pathPtr- pathReversedPtr- >>- peek pathLengthPtr >>= \pathLength ->- peek pathPtr >>= readUTFString >>= \path ->- peek pathReversedPtr >>= readUTFString >>= \pathReversed ->- return (fromIntegral pathLength, path, pathReversed)---- %hash c:d4a6--- | Same as 'widgetPath', but always uses the name of a widget's type, never--- uses a custom name set with 'widgetSetName'.----widgetClassPath :: WidgetClass self => self- -> IO (Int, String, String) -- ^ @(pathLength, path, pathReversed)@ - length- -- of the path, path string and reverse path- -- string-widgetClassPath self =- alloca $ \pathLengthPtr ->- alloca $ \pathPtr ->- alloca $ \pathReversedPtr ->- {# call gtk_widget_class_path #}- (toWidget self)- pathLengthPtr- pathPtr- pathReversedPtr- >>- peek pathLengthPtr >>= \pathLength ->- peek pathPtr >>= readUTFString >>= \path ->- peek pathReversedPtr >>= readUTFString >>= \pathReversed ->- return (fromIntegral pathLength, path, pathReversed)---- %hash c:769e--- | Obtains the composite name of a widget.----widgetGetCompositeName :: WidgetClass self => self- -> IO (Maybe String) -- ^ returns the composite name of @widget@, or- -- @Nothing@ if @widget@ is not a composite child.-widgetGetCompositeName self =- {# call gtk_widget_get_composite_name #}- (toWidget self)- >>= maybePeek peekUTFString---- | Modifies style values on the widget. Modifications made using this--- technique take precedence over style values set via an RC file, however,--- they will be overriden if a style is explicitely set on the widget using--- 'widgetSetStyle'. The 'RcStyle' structure is designed so each field can--- either be set or unset, so it is possible, using this function, to modify--- some style values and leave the others unchanged.------ Note that modifications made with this function are not cumulative with--- previous calls to 'widgetModifyStyle' or with such functions as--- 'widgetModifyFg'. If you wish to retain previous values, you must first call--- 'widgetGetModifierStyle', make your modifications to the returned style,--- then call 'widgetModifyStyle' with that style. On the other hand, if you--- first call 'widgetModifyStyle', subsequent calls to such functions--- 'widgetModifyFg' will have a cumulative effect with the initial--- modifications.----widgetModifyStyle :: (WidgetClass self, RcStyleClass style) => self- -> style -- ^ @style@ - the 'RcStyle' holding the style modifications- -> IO ()-widgetModifyStyle self style =- {# call gtk_widget_modify_style #}- (toWidget self)- (toRcStyle style)---- | Returns the current modifier style for the widget. (As set by--- 'widgetModifyStyle'.) If no style has previously set, a new 'RcStyle' will--- be created with all values unset, and set as the modifier style for the--- widget. If you make changes to this rc style, you must call--- 'widgetModifyStyle', passing in the returned rc style, to make sure that--- your changes take effect.------ Caution: passing the style back to 'widgetModifyStyle' will normally end--- up destroying it, because 'widgetModifyStyle' copies the passed-in style and--- sets the copy as the new modifier style, thus dropping any reference to the--- old modifier style. Add a reference to the modifier style if you want to--- keep it alive.----widgetGetModifierStyle :: WidgetClass self => self -> IO RcStyle-widgetGetModifierStyle self =- makeNewGObject mkRcStyle $- {# call gtk_widget_get_modifier_style #}- (toWidget self)---- %hash c:5550--- | Sets the foreground color for a widget in a particular state. All other--- style values are left untouched. See also 'widgetModifyStyle'.----widgetModifyFg :: WidgetClass self => self- -> StateType -- ^ @state@ - the state for which to set the foreground color.- -> Color -- ^ @color@ - the color to assign (does not need to be- -- allocated), or @Nothing@ to undo the effect of previous calls- -- to of 'widgetModifyFg'.- -> IO ()-widgetModifyFg self state color =- with color $ \colorPtr ->- {# call gtk_widget_modify_fg #}- (toWidget self)- ((fromIntegral . fromEnum) state)- (castPtr colorPtr)---- %hash c:2c5--- | Sets the background color for a widget in a particular state. All other--- style values are left untouched. See also 'widgetModifyStyle'.------ Note that \"no window\" widgets (which have the 'NoWindow' flag set) draw--- on their parent container's window and thus may not draw any background--- themselves. This is the case for e.g. 'Label'. To modify the background of--- such widgets, you have to set the background color on their parent; if you--- want to set the background of a rectangular area around a label, try placing--- the label in a 'EventBox' widget and setting the background color on that.----widgetModifyBg :: WidgetClass self => self- -> StateType -- ^ @state@ - the state for which to set the background color.- -> Color -- ^ @color@ - the color to assign (does not need to be- -- allocated), or @Nothing@ to undo the effect of previous calls- -- to of 'widgetModifyBg'.- -> IO ()-widgetModifyBg self state color =- with color $ \colorPtr ->- {# call gtk_widget_modify_bg #}- (toWidget self)- ((fromIntegral . fromEnum) state)- (castPtr colorPtr)---- %hash c:d2ba--- | Sets the text color for a widget in a particular state. All other style--- values are left untouched. The text color is the foreground color used along--- with the base color (see 'widgetModifyBase') for widgets such as 'Entry' and--- 'TextView'. See also 'widgetModifyStyle'.----widgetModifyText :: WidgetClass self => self- -> StateType -- ^ @state@ - the state for which to set the text color.- -> Color -- ^ @color@ - the color to assign (does not need to be- -- allocated), or @Nothing@ to undo the effect of previous calls- -- to of 'widgetModifyText'.- -> IO ()-widgetModifyText self state color =- with color $ \colorPtr ->- {# call gtk_widget_modify_text #}- (toWidget self)- ((fromIntegral . fromEnum) state)- (castPtr colorPtr)---- %hash c:ac08--- | Sets the base color for a widget in a particular state. All other style--- values are left untouched. The base color is the background color used along--- with the text color (see 'widgetModifyText') for widgets such as 'Entry' and--- 'TextView'. See also 'widgetModifyStyle'.------ Note that \"no window\" widgets (which have the 'NoWindow' flag set) draw--- on their parent container's window and thus may not draw any background--- themselves. This is the case for e.g. 'Label'. To modify the background of--- such widgets, you have to set the base color on their parent; if you want to--- set the background of a rectangular area around a label, try placing the--- label in a 'EventBox' widget and setting the base color on that.----widgetModifyBase :: WidgetClass self => self- -> StateType -- ^ @state@ - the state for which to set the base color.- -> Color -- ^ @color@ - the color to assign (does not need to be- -- allocated), or @Nothing@ to undo the effect of previous calls- -- to of 'widgetModifyBase'.- -> IO ()-widgetModifyBase self state color =- with color $ \colorPtr ->- {# call gtk_widget_modify_base #}- (toWidget self)- ((fromIntegral . fromEnum) state)- (castPtr colorPtr)---- %hash c:38d7--- | Sets the font to use for a widget. All other style values are left--- untouched. See also 'widgetModifyStyle'.----widgetModifyFont :: WidgetClass self => self- -> Maybe FontDescription -- ^ @fontDesc@ - the font description to use, or- -- @Nothing@ to undo the effect of previous calls to- -- 'widgetModifyFont'.- -> IO ()-widgetModifyFont self fontDesc =- {# call gtk_widget_modify_font #}- (toWidget self)- (fromMaybe (FontDescription nullForeignPtr) fontDesc)---- | Creates a new 'PangoContext' with the appropriate colormap, font description,--- and base direction for drawing text for this widget. See also--- 'widgetGetPangoContext'.----widgetCreatePangoContext :: WidgetClass self => self- -> IO PangoContext -- ^ returns the new 'PangoContext'-widgetCreatePangoContext self =- constructNewGObject mkPangoContext $- {# call gtk_widget_create_pango_context #}- (toWidget self)---- | Gets a 'PangoContext' with the appropriate font description and base--- direction for this widget. Unlike the context returned by--- 'widgetCreatePangoContext', this context is owned by the widget (it can be--- used until the screen for the widget changes or the widget is removed from--- its toplevel), and will be updated to match any changes to the widget's--- attributes.------ If you create and keep a 'PangoLayout' using this context, you must deal--- with changes to the context by calling--- 'layoutContextChanged' on the layout--- in response to the 'onStyleChanged' and 'onDirectionChanged' signals for the--- widget.----widgetGetPangoContext :: WidgetClass self => self- -> IO PangoContext -- ^ returns the 'PangoContext' for the widget.-widgetGetPangoContext self =- makeNewGObject mkPangoContext $- {# call gtk_widget_get_pango_context #}- (toWidget self)---- | Prepare text for display.------ The 'PangoLayout' represents the rendered text. It can be shown on screen--- by calling 'drawLayout'.------ The returned 'PangoLayout' shares the same font information ('PangoContext') as this--- widget. If this information changes, the 'PangoLayout' should change. The--- following code ensures that the displayed text always reflects the widget's--- settings:------ > l <- widgetCreateLayout w "My Text."--- > let update = do--- > layoutContextChanged l--- > -- update the Drawables which show this layout--- > w `onDirectionChanged` update--- > w `onStyleChanged` update----widgetCreateLayout :: WidgetClass self => self- -> String -- ^ @text@ - text to set on the layout- -> IO PangoLayout-widgetCreateLayout self text = do- pl <- constructNewGObject mkPangoLayoutRaw $- withUTFString text $ \textPtr ->- {# call unsafe widget_create_pango_layout #}- (toWidget self)- textPtr- ps <- makeNewPangoString text- psRef <- newIORef ps- return (PangoLayout psRef pl)---- %hash c:cee d:1d29--- | A convenience function that uses the theme engine and RC file settings--- for @widget@ to look up the stock icon and render it to a--- 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf'.--- The icon should be one of the stock id constants such as--- 'Graphics.UI.Gtk.General.StockItems.stockOpen'. @size@ should be a--- size such as 'Graphics.UI.Gtk.General.IconFactory.IconSizeMenu'.--- @detail@ should be a string that identifies the--- widget or code doing the rendering, so that theme engines can special-case--- rendering for that widget or code.------ The pixels in the returned 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' are--- shared with the rest of the--- application and should not be modified.----widgetRenderIcon :: WidgetClass self => self- -> String -- ^ @stockId@ - a stock ID- -> IconSize -- ^ @size@ - a stock size- -> String -- ^ @detail@ - render detail to pass to theme engine- -> IO (Maybe Pixbuf) -- ^ returns a new pixbuf, or @Nothing@ if the stock ID- -- wasn't known-widgetRenderIcon self stockId size detail =- maybeNull (makeNewGObject mkPixbuf) $- withUTFString detail $ \detailPtr ->- withUTFString stockId $ \stockIdPtr ->- {# call gtk_widget_render_icon #}- (toWidget self)- stockIdPtr- ((fromIntegral . fromEnum) size)- detailPtr---- %hash c:62f d:1863--- | Invalidates the rectangular area of @widget@ defined by @x@, @y@, @width@--- and @height@ by calling--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' on the widget's--- 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawWindow' and all its child windows. Once--- the main loop becomes idle (after the current batch of events has been--- processed, roughly), the window will receive expose events for the union of--- all regions that have been invalidated.------ Normally you would only use this function in widget implementations. In--- particular, you might use it, or--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' directly, to--- schedule a redraw of a 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawingArea' or some--- portion thereof.------ Frequently you can just call--- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRect' or--- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRegion' instead of this--- function. Those functions will invalidate only a single window, instead of--- the widget and all its children.------ The advantage of adding to the invalidated region compared to simply--- drawing immediately is efficiency; using an invalid region ensures that you--- only have to redraw one time.----widgetQueueDrawArea :: WidgetClass self => self- -> Int -- ^ @x@ - x coordinate of upper-left corner of rectangle to redraw- -> Int -- ^ @y@ - y coordinate of upper-left corner of rectangle to redraw- -> Int -- ^ @width@ - width of region to draw- -> Int -- ^ @height@ - height of region to draw- -> IO ()-widgetQueueDrawArea self x y width height =- {# call gtk_widget_queue_draw_area #}- (toWidget self)- (fromIntegral x)- (fromIntegral y)- (fromIntegral width)- (fromIntegral height)---- %hash c:5ffb d:3e1a--- | Recursively resets the shape on this widget and its descendants.----widgetResetShapes :: WidgetClass self => self -> IO ()-widgetResetShapes self =- {# call gtk_widget_reset_shapes #}- (toWidget self)---- | Sets whether the application intends to draw on the widget in response--- to an 'onExpose' signal.------ * This is a hint to the widget and does not affect the behavior of the--- GTK+ core; many widgets ignore this flag entirely. For widgets that do--- pay attention to the flag, such as 'EventBox' and 'Window', the effect--- is to suppress default themed drawing of the widget's background.--- (Children of the widget will still be drawn.) The application is then--- entirely responsible for drawing the widget background.----widgetSetAppPaintable :: WidgetClass self => self- -> Bool -- ^ @appPaintable@ - @True@ if the application will paint on the- -- widget- -> IO ()-widgetSetAppPaintable self appPaintable =- {# call widget_set_app_paintable #}- (toWidget self)- (fromBool appPaintable)---- %hash c:89b2 d:e14d--- | Widgets are double buffered by default; you can use this function to turn--- off the buffering. \"Double buffered\" simply means that--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' and--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint' are called automatically--- around expose events sent to the widget.--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' diverts all--- drawing to a widget's window to an offscreen buffer, and--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint'--- draws the buffer to the screen. The result is that users see the window--- update in one smooth step, and don't see individual graphics primitives--- being rendered.------ In very simple terms, double buffered widgets don't flicker, so you would--- only use this function to turn off double buffering if you had special needs--- and really knew what you were doing.------ Note: if you turn off double-buffering, you have to handle expose events,--- since even the clearing to the background color or pixmap will not happen--- automatically (as it is done in--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaint').----widgetSetDoubleBuffered :: WidgetClass self => self- -> Bool -- ^ @doubleBuffered@ - @True@ to double-buffer a widget- -> IO ()-widgetSetDoubleBuffered self doubleBuffered =- {# call gtk_widget_set_double_buffered #}- (toWidget self)- (fromBool doubleBuffered)---- %hash c:d61 d:ac24--- | Sets whether the entire widget is queued for drawing when its size--- allocation changes. By default, this setting is @True@ and the entire widget--- is redrawn on every size change. If your widget leaves the upper left--- unchanged when made bigger, turning this setting on will improve--- performance.------ Note that for \"no window\" widgets setting this flag to @False@ turns off--- all allocation on resizing: the widget will not even redraw if its position--- changes; this is to allow containers that don't draw anything to avoid--- excess invalidations. If you set this flag on a \"no window\" widget that--- /does/ draw its window, you are responsible for invalidating both--- the old and new allocation of the widget when the widget is moved and--- responsible for invalidating regions newly when the widget increases size.----widgetSetRedrawOnAllocate :: WidgetClass self => self- -> Bool -- ^ @redrawOnAllocate@ - if @True@, the entire widget will be- -- redrawn when it is allocated to a new size. Otherwise, only the- -- new portion of the widget will be redrawn.- -> IO ()-widgetSetRedrawOnAllocate self redrawOnAllocate =- {# call gtk_widget_set_redraw_on_allocate #}- (toWidget self)- (fromBool redrawOnAllocate)---- | Sets a widgets composite name. A child widget of a container is--- composite if it serves as an internal widget and, thus, is not--- added by the user.----widgetSetCompositeName :: WidgetClass self => self- -> String -- ^ @name@ - the name to set.- -> IO ()-widgetSetCompositeName self name =- withUTFString name $ \namePtr ->- {# call gtk_widget_set_composite_name #}- (toWidget self)- namePtr---- %hash c:5c58 d:6895--- | For widgets that support scrolling, sets the scroll adjustments and--- returns @True@. For widgets that don't support scrolling, does nothing and--- returns @False@. Widgets that don't support scrolling can be scrolled by--- placing them in a 'Viewport', which does support scrolling.----widgetSetScrollAdjustments :: WidgetClass self => self- -> Maybe Adjustment -- ^ @hadjustment@ - an adjustment for horizontal scrolling, or- -- @Nothing@- -> Maybe Adjustment -- ^ @vadjustment@ - an adjustment for vertical scrolling, or- -- @Nothing@- -> IO Bool -- ^ returns @True@ if the widget supports scrolling-widgetSetScrollAdjustments self hadjustment vadjustment =- liftM toBool $- {# call gtk_widget_set_scroll_adjustments #}- (toWidget self)- (fromMaybe (Adjustment nullForeignPtr) hadjustment)- (fromMaybe (Adjustment nullForeignPtr) vadjustment)---- | Computes the intersection of a widget's area and @region@, returning--- the intersection. The result may be empty, use--- 'Graphics.UI.Gtk.Gdk.Region.regionEmpty' to check.----widgetRegionIntersect :: WidgetClass self => self- -> Region -- ^ @region@ - a 'Region' in the same coordinate system as the- -- widget's allocation. That is, relative to the widget's- -- 'DrawWindow' for 'NoWindow' widgets; relative to the parent- -- 'DrawWindow' of the widget's 'DrawWindow' for widgets with- -- their own 'DrawWindow'.- -> IO Region -- ^ returns A region holding the intersection of the widget and- -- @region@. The coordinates of the return value are relative to- -- the widget's 'DrawWindow', if it has one, otherwise- -- it is relative to the parent's 'DrawWindow'.-widgetRegionIntersect self region = do- intersectionPtr <- {# call gtk_widget_region_intersect #}- (toWidget self)- region- makeNewRegion intersectionPtr---- %hash c:3c94 d:cdb6--- | Returns the accessible object that describes the widget to an assistive--- technology.------ If no accessibility library is loaded (i.e. no ATK implementation library--- is loaded via GTK_MODULES or via another application library, such as--- libgnome), then this 'Object' instance may be a no-op. Likewise, if no--- class-specific 'Object' implementation is available for the widget instance--- in question, it will inherit an 'Object' implementation from the first--- ancestor class for which such an implementation is defined.------ The documentation of the ATK library contains more information about--- accessible objects and their uses.----widgetGetAccessible :: WidgetClass self => self- -> IO Object -- ^ returns the 'Object' associated with @widget@-widgetGetAccessible self =- makeNewGObject mkObject $- liftM castPtr $- {# call gtk_widget_get_accessible #}- (toWidget self)---- %hash c:713d d:c4fc--- | This function is used by custom widget implementations; if you\'re--- writing an app, you\'d use 'widgetGrabFocus' to move the focus to a--- particular widget, and 'containerSetFocusChain' to change the focus tab--- order. So you may want to investigate those functions instead.------ The \"focus\" default handler for a widget should return @True@ if moving--- in @direction@ left the focus on a focusable location inside that widget,--- and @False@ if moving in @direction@ moved the focus outside the widget. If--- returning @True@, widgets normally call 'widgetGrabFocus' to place the focus--- accordingly; if returning @False@, they don't modify the current focus--- location.----widgetChildFocus :: WidgetClass self => self- -> DirectionType -- ^ @direction@ - direction of focus movement- -> IO Bool -- ^ returns @True@ if focus ended up inside @widget@-widgetChildFocus self direction =- liftM toBool $- {# call gtk_widget_child_focus #}- (toWidget self)- ((fromIntegral . fromEnum) direction)---- %hash c:de20 d:5300--- | Gets the value set with 'widgetSetChildVisible'. If you feel a need to--- use this function, your code probably needs reorganization.------ This function is only useful for container implementations and never--- should be called by an application.----widgetGetChildVisible :: WidgetClass self => self- -> IO Bool -- ^ returns @True@ if the widget is mapped with the parent.-widgetGetChildVisible self =- liftM toBool $- {# call gtk_widget_get_child_visible #}- (toWidget self)---- %hash c:9320 d:367--- | Returns the parent container of @widget@.------ * Returns the parent container of @widget@ if it has one.----widgetGetParent :: WidgetClass self => self- -> IO (Maybe Widget) -widgetGetParent self = do- parentPtr <- {# call gtk_widget_get_parent #} (toWidget self)- if parentPtr==nullPtr then return Nothing else- liftM Just $ makeNewObject mkWidget (return parentPtr)---- %hash c:85e3 d:a962--- | Gets the settings object holding the settings (global property settings,--- RC file information, etc) used for this widget.------ Note that this function can only be called when the 'Widget' is attached--- to a toplevel, since the settings object is specific to a particular--- 'Screen'.----widgetGetSettings :: WidgetClass self => self- -> IO Settings -- ^ returns the relevant 'Settings' object-widgetGetSettings self =- makeNewGObject mkSettings $- {# call gtk_widget_get_settings #}- (toWidget self)--#if GTK_CHECK_VERSION(2,2,0)---- %hash c:45ed d:52ef--- | Get the 'Display' for the toplevel window associated with this widget.--- This function can only be called after the widget has been added to a widget--- hierarchy with a 'Window' at the top.------ In general, you should only create display specific resources when a--- widget has been realized, and you should free those resources when the--- widget is unrealized.------ * Available since Gtk+ version 2.2----widgetGetDisplay :: WidgetClass self => self- -> IO Display -- ^ returns the 'Display' for the toplevel for this widget.-widgetGetDisplay self =- makeNewGObject mkDisplay $- {# call gtk_widget_get_display #}- (toWidget self)---- %hash c:8e4e d:252b--- | Get the root window where this widget is located. This function can only--- be called after the widget has been added to a widget heirarchy with--- 'Window' at the top.------ The root window is useful for such purposes as creating a popup--- 'DrawWindow' associated with the window. In general, you should only create--- display specific resources when a widget has been realized, and you should--- free those resources when the widget is unrealized.------ * Available since Gtk+ version 2.2----widgetGetRootWindow :: WidgetClass self => self- -> IO DrawWindow -- ^ returns the 'DrawWindow' root window for the toplevel- -- for this widget.-widgetGetRootWindow self =- makeNewGObject mkDrawWindow $- {# call gtk_widget_get_root_window #}- (toWidget self)---- %hash c:b929 d:67f0--- | Get the 'Screen' from the toplevel window associated with this widget.--- This function can only be called after the widget has been added to a widget--- hierarchy with a 'Window' at the top.------ In general, you should only create screen specific resources when a--- widget has been realized, and you should free those resources when the--- widget is unrealized.------ * Available since Gtk+ version 2.2----widgetGetScreen :: WidgetClass self => self- -> IO Screen -- ^ returns the 'Screen' for the toplevel for this widget.-widgetGetScreen self =- makeNewGObject mkScreen $- {# call gtk_widget_get_screen #}- (toWidget self)---- %hash c:4fab d:aae2--- | Checks whether there is a 'Screen' is associated with this widget. All--- toplevel widgets have an associated screen, and all widgets added into a--- heirarchy with a toplevel window at the top.------ * Available since Gtk+ version 2.2----widgetHasScreen :: WidgetClass self => self- -> IO Bool -- ^ returns @True@ if there is a 'Screen' associcated with the- -- widget.-widgetHasScreen self =- liftM toBool $- {# call gtk_widget_has_screen #}- (toWidget self)-#endif---- %hash c:dabc d:8275--- | Gets the size request that was explicitly set for the widget using--- 'widgetSetSizeRequest'. A value of -1 for @width@ or @height@--- indicates that that dimension has not been set explicitly and the natural--- requisition of the widget will be used intead. See 'widgetSetSizeRequest'.--- To get the size a widget will actually use, call 'widgetSizeRequest' instead--- of this function.----widgetGetSizeRequest :: WidgetClass self => self- -> IO (Int, Int) -- ^ @(width, height)@-widgetGetSizeRequest self =- alloca $ \widthPtr ->- alloca $ \heightPtr -> do- {# call gtk_widget_get_size_request #}- (toWidget self)- widthPtr- heightPtr- width <- peek widthPtr- height <- peek heightPtr- return (fromIntegral width, fromIntegral height)---- %hash c:546d d:3c7f--- | Sets whether @widget@ should be mapped along with its when its parent is--- mapped and @widget@ has been shown with 'widgetShow'.------ The child visibility can be set for widget before it is added to a--- container with 'widgetSetParent', to avoid mapping children unnecessary--- before immediately unmapping them. However it will be reset to its default--- state of @True@ when the widget is removed from a container.------ Note that changing the child visibility of a widget does not queue a--- resize on the widget. Most of the time, the size of a widget is computed--- from all visible children, whether or not they are mapped. If this is not--- the case, the container can queue a resize itself.------ This function is only useful for container implementations and never--- should be called by an application.----widgetSetChildVisible :: WidgetClass self => self- -> Bool -- ^ @isVisible@ - if @True@, @widget@ should be mapped along with- -- its parent.- -> IO ()-widgetSetChildVisible self isVisible =- {# call gtk_widget_set_child_visible #}- (toWidget self)- (fromBool isVisible)---- | Sets the minimum size of a widget; that is, the widget's size request--- will be @width@ by @height@. You can use this function to force a widget to--- be either larger or smaller than it normally would be.------ In most cases, 'Graphics.UI.Gtk.Windows.Window.windowSetDefaultSize'--- is a better choice for toplevel--- windows than this function; setting the default size will still allow users--- to shrink the window. Setting the size request will force them to leave the--- window at least as large as the size request. When dealing with window--- sizes, 'Graphics.UI.Gtk.Windows.Window.windowSetGeometryHints' can be a--- useful function as well.------ Note the inherent danger of setting any fixed size - themes, translations--- into other languages, different fonts, and user action can all change the--- appropriate size for a given widget. So, it's basically impossible to--- hardcode a size that will always be correct.------ The size request of a widget is the smallest size a widget can accept--- while still functioning well and drawing itself correctly. However in some--- strange cases a widget may be allocated less than its requested size, and in--- many cases a widget may be allocated more space than it requested.------ If the size request in a given direction is -1 (unset), then the--- \"natural\" size request of the widget will be used instead.------ Widgets can't actually be allocated a size less than 1 by 1, but you can--- pass 0,0 to this function to mean \"as small as possible.\"----widgetSetSizeRequest :: WidgetClass self => self- -> Int -- ^ @width@ - width @widget@ should request, or -1 to unset- -> Int -- ^ @height@ - height @widget@ should request, or -1 to unset- -> IO ()-widgetSetSizeRequest self width height =- {# call widget_set_size_request #}- (toWidget self)- (fromIntegral width)- (fromIntegral height)--#if GTK_CHECK_VERSION(2,4,0)--- %hash c:83c3 d:e6f1--- | Sets the 'noShowAll' property, which determines whether calls to--- 'widgetShowAll' and 'widgetHideAll' will affect this widget.------ This is mostly for use in constructing widget hierarchies with externally--- controlled visibility, see 'UIManager'.------ * Available since Gtk+ version 2.4----widgetSetNoShowAll :: WidgetClass self => self- -> Bool -- ^ @noShowAll@ - the new value for the 'noShowAll' property- -> IO ()-widgetSetNoShowAll self noShowAll =- {# call gtk_widget_set_no_show_all #}- (toWidget self)- (fromBool noShowAll)---- %hash c:218d d:e07e--- | Returns the current value of the 'noShowAll' property, which--- determines whether calls to 'widgetShowAll' and 'widgetHideAll' will affect--- this widget.------ * Available since Gtk+ version 2.4----widgetGetNoShowAll :: WidgetClass self => self- -> IO Bool -- ^ returns the current value of the \"no_show_all\" property.-widgetGetNoShowAll self =- liftM toBool $- {# call gtk_widget_get_no_show_all #}- (toWidget self)---- %hash c:205b d:c518--- | Returns a list of the widgets, normally labels, for which--- this widget is a the target of a mnemonic (see for example,--- 'labelSetMnemonicWidget').------ * Available since Gtk+ version 2.4----widgetListMnemonicLabels :: WidgetClass self => self- -> IO [Widget] -- ^ returns the list of mnemonic labels-widgetListMnemonicLabels self =- {# call gtk_widget_list_mnemonic_labels #}- (toWidget self)- >>= fromGList- >>= mapM (makeNewGObject mkWidget . return)---- %hash c:eb76 d:28a2--- | Adds a widget to the list of mnemonic labels for this widget. (See--- 'widgetListMnemonicLabels'). Note the list of mnemonic labels for the widget--- is cleared when the widget is destroyed, so the caller must make sure to--- update its internal state at this point as well, by using a connection to--- the 'destroy' signal or a weak notifier.------ * Available since Gtk+ version 2.4----widgetAddMnemonicLabel :: (WidgetClass self, WidgetClass label) => self- -> label -- ^ @label@ - a 'Widget' that acts as a mnemonic label for- -- @widget@.- -> IO ()-widgetAddMnemonicLabel self label =- {# call gtk_widget_add_mnemonic_label #}- (toWidget self)- (toWidget label)---- %hash c:7831 d:d10b--- | Removes a widget from the list of mnemonic labels for this widget. (See--- 'widgetListMnemonicLabels'). The widget must have previously been added to--- the list with 'widgetAddMnemonicLabel'.------ * Available since Gtk+ version 2.4----widgetRemoveMnemonicLabel :: (WidgetClass self, WidgetClass label) => self- -> label -- ^ @label@ - a 'Widget' that was previously set as a mnemnic label- -- for @widget@ with 'widgetAddMnemonicLabel'.- -> IO ()-widgetRemoveMnemonicLabel self label =- {# call gtk_widget_remove_mnemonic_label #}- (toWidget self)- (toWidget label)--#if GTK_CHECK_VERSION(2,10,0)--- %hash c:5c70 d:cbf9--- | Returns the 'Action' that @widget@ is a proxy for. See also--- 'actionGetProxies'.------ * Available since Gtk+ version 2.10----widgetGetAction :: WidgetClass self => self- -> IO (Maybe Action)- -- ^ returns the action that a widget is a proxy for, or- -- @Nothing@, if it is not attached to an action.-widgetGetAction self = do- ptr <- {# call gtk_widget_get_action #} (toWidget self)- if ptr==nullPtr then return Nothing else liftM Just $- makeNewGObject mkAction (return ptr)---- %hash c:7ea0 d:2560--- | Whether @widget@ can rely on having its alpha channel drawn correctly. On--- X11 this function returns whether a compositing manager is running for--- @widget@'s screen------ * Available since Gtk+ version 2.10----widgetIsComposited :: WidgetClass self => self- -> IO Bool -- ^ returns @True@ if the widget can rely on its alpha channel- -- being drawn correctly.-widgetIsComposited self =- liftM toBool $- {# call gtk_widget_is_composited #}- (toWidget self)-#endif-#endif---- | Moves a widget from one 'Container' to another.----widgetReparent :: (WidgetClass self, WidgetClass newParent) => self- -> newParent -- ^ @newParent@ - a 'Container' to move the widget into- -> IO ()-widgetReparent self newParent =- {# call widget_reparent #}- (toWidget self)- (toWidget newParent)--#if GTK_CHECK_VERSION(2,18,0)--- | Set if this widget can receive keyboard input.------ * To use the 'keyPress' event, the widget must be allowed--- to get the input focus. Once it has the input focus all keyboard--- input is directed to this widget.----widgetSetCanFocus :: WidgetClass self => self -> Bool -> IO ()-widgetSetCanFocus = objectSetPropertyBool "can_focus"---- | Check if this widget can receive keyboard input.----widgetGetCanFocus :: WidgetClass self => self -> IO Bool-widgetGetCanFocus = objectGetPropertyBool "can_focus"---- | Retrieves the widget's allocation.------ * Available since Gtk+ version 2.18----widgetGetAllocation :: WidgetClass self => self -> IO Allocation-widgetGetAllocation widget =- alloca $ \ allocationPtr -> do - {#call widget_get_allocation#} (toWidget widget) (castPtr allocationPtr)- peek allocationPtr-#endif---- | Rarely-used function. This function is used to emit the event signals on a widget (those signals--- should never be emitted without using this function to do so). If you want to synthesize an event--- though, don't use this function; instead, use 'mainDoEvent' so the event will behave as if it--- were in the event queue. Don't synthesize expose events; instead, use 'windowInvalidateRect'--- to invalidate a region of the window.-widgetEvent :: WidgetClass self => self -> EventM t Bool-widgetEvent widget = do- ptr <- ask- liftIO $ liftM toBool $ {#call widget_event #} (toWidget widget) (castPtr ptr)------------------------- Attributes---- %hash c:6f7f d:9384--- | The name of the widget.------ Default value: @Nothing@----widgetName :: WidgetClass self => Attr self (Maybe String)-widgetName = newAttrFromMaybeStringProperty "name"---- %hash c:1533 d:3213--- | The parent widget of this widget. Must be a Container widget.----widgetParent :: (WidgetClass self, ContainerClass container) => ReadWriteAttr self (Maybe Container) (Maybe container)-widgetParent = newAttrFromMaybeObjectProperty "parent" gTypeContainer---- %hash c:2b4c d:3c31--- | Override for width request of the widget, or -1 if natural request should--- be used.------ Allowed values: >= -1------ Default value: -1----widgetWidthRequest :: WidgetClass self => Attr self Int-widgetWidthRequest = newAttrFromIntProperty "width-request"---- %hash c:fa97 d:172a--- | Override for height request of the widget, or -1 if natural request--- should be used.------ Allowed values: >= -1------ Default value: -1----widgetHeightRequest :: WidgetClass self => Attr self Int-widgetHeightRequest = newAttrFromIntProperty "height-request"---- %hash c:70d0 d:e8e2--- | Whether the widget is visible.------ Default value: @False@----widgetVisible :: WidgetClass self => Attr self Bool-widgetVisible = newAttrFromBoolProperty "visible"---- %hash c:4dd4 d:594e--- | Whether the widget responds to input.------ Default value: @True@----widgetSensitive :: WidgetClass self => Attr self Bool-widgetSensitive = newAttrFromBoolProperty "sensitive"---- %hash c:7506 d:1dde--- | Whether the application will paint directly on the widget.------ Default value: @False@----widgetAppPaintable :: WidgetClass self => Attr self Bool-widgetAppPaintable = newAttrFromBoolProperty "app-paintable"---- %hash c:6289 d:72ab--- | Whether the widget can accept the input focus.------ Default value: @False@----widgetCanFocus :: WidgetClass self => Attr self Bool-widgetCanFocus = newAttrFromBoolProperty "can-focus"---- %hash c:8e7 d:2645--- | Whether the widget has the input focus.------ Default value: @False@----widgetHasFocus :: WidgetClass self => Attr self Bool-widgetHasFocus = newAttrFromBoolProperty "has-focus"---- %hash c:7547 d:1d78--- | Whether the widget is the focus widget within the toplevel.------ Default value: @False@----widgetIsFocus :: WidgetClass self => Attr self Bool-widgetIsFocus = newAttrFromBoolProperty "is-focus"---- %hash c:f2d8 d:1cbb--- | Whether the widget can be the default widget.------ Default value: @False@----widgetCanDefault :: WidgetClass self => Attr self Bool-widgetCanDefault = newAttrFromBoolProperty "can-default"---- %hash c:836 d:4cbe--- | Whether the widget is the default widget.------ Default value: @False@----widgetHasDefault :: WidgetClass self => Attr self Bool-widgetHasDefault = newAttrFromBoolProperty "has-default"---- %hash c:f964 d:b62f--- | If @True@, the widget will receive the default action when it is focused.------ Default value: @False@----widgetReceivesDefault :: WidgetClass self => Attr self Bool-widgetReceivesDefault = newAttrFromBoolProperty "receives-default"---- %hash c:2ca6 d:cad8--- | Whether the widget is part of a composite widget.------ Default value: @False@----widgetCompositeChild :: WidgetClass self => ReadAttr self Bool-widgetCompositeChild = readAttrFromBoolProperty "composite-child"---- %hash c:4f01 d:bd3--- | The style of the widget, which contains information about how it will--- look (colors etc).----widgetStyle :: WidgetClass self => Attr self Style-widgetStyle = newAttrFromObjectProperty "style" gTypeStyle---- %hash c:e2a4 d:9296--- | The event mask that decides what kind of GdkEvents this widget gets.------ Default value: 'StructureMask'----widgetEvents :: WidgetClass self => Attr self [EventMask]-widgetEvents = newAttrFromFlagsProperty "events"- {# call pure unsafe gdk_event_mask_get_type #}---- %hash c:ba80--- | The mask that decides what kind of extension events this widget gets.------ Default value: 'ExtensionEventsNone'----widgetExtensionEvents :: WidgetClass self => Attr self [ExtensionMode]-widgetExtensionEvents = newAttr- widgetGetExtensionEvents- widgetSetExtensionEvents---- %hash c:1605 d:48ea--- | Whether 'widgetShowAll' should not affect this widget.------ Default value: @False@----widgetNoShowAll :: WidgetClass self => Attr self Bool-widgetNoShowAll = newAttrFromBoolProperty "no-show-all"---- %hash c:cd8d d:59b2--- | \'childVisible\' property. See 'widgetGetChildVisible' and--- 'widgetSetChildVisible'----widgetChildVisible :: WidgetClass self => Attr self Bool-widgetChildVisible = newAttr- widgetGetChildVisible- widgetSetChildVisible---- %hash c:a20a d:646f--- | \'colormap\' property. See 'widgetGetColormap' and 'widgetSetColormap'----widgetColormap :: WidgetClass self => Attr self Colormap-widgetColormap = newAttr- widgetGetColormap- widgetSetColormap---- %hash c:a7fd d:55b8--- | \'compositeName\' property. See 'widgetGetCompositeName' and--- 'widgetSetCompositeName'----widgetCompositeName :: WidgetClass self => ReadWriteAttr self (Maybe String) String-widgetCompositeName = newAttr- widgetGetCompositeName- widgetSetCompositeName---- %hash c:6c03 d:ce3b--- | \'direction\' property. See 'widgetGetDirection' and 'widgetSetDirection'----widgetDirection :: WidgetClass self => Attr self TextDirection-widgetDirection = newAttr- widgetGetDirection- widgetSetDirection---- | Sets the text of tooltip to be the given string, which is marked up with the Pango text markup--- language. Also see 'tooltipSetMarkup'.--- --- This is a convenience property which will take care of getting the tooltip shown if the given string--- is not \"\": 'hasTooltip' will automatically be set to 'True' and there will be taken care of--- 'queryTooltip' in the default signal handler.--- --- Default value: \"\"--- --- * Available since Gtk+ version 2.12----widgetTooltipMarkup :: WidgetClass self => Attr self (Maybe Markup)-widgetTooltipMarkup = newAttrFromMaybeStringProperty "tooltip-markup"---- | Sets the text of tooltip to be the given string.--- --- Also see 'tooltipSetText'.--- --- This is a convenience property which will take care of getting the tooltip shown if the given string--- is not \"\": 'hasTooltip' will automatically be set to 'True' and there will be taken care of--- 'queryTooltip' in the default signal handler.--- --- Default value: \"\"--- --- * Available since Gtk+ version 2.12----widgetTooltipText :: WidgetClass self => Attr self (Maybe String)-widgetTooltipText = newAttrFromMaybeStringProperty "tooltip-text"---- | Enables or disables the emission of 'queryTooltip' on widget. A value of 'True' indicates that widget--- can have a tooltip, in this case the widget will be queried using 'queryTooltip' to determine--- whether it will provide a tooltip or not.--- --- Note that setting this property to 'True' for the first time will change the event masks of the--- 'Windows' of this widget to include leave-notify and motion-notify events. This cannot and will not--- be undone when the property is set to 'False' again.--- --- Default value: 'False'--- --- * Available since Gtk+ version 2.12----widgetHasTooltip :: WidgetClass self => Attr self Bool-widgetHasTooltip = newAttrFromBoolProperty "has-tooltip"------------------------- Signals----- %hash c:4cf5 d:af3f--- | The widget appears on screen.----mapSignal :: WidgetClass self => Signal self (IO ())-mapSignal = Signal (connect_NONE__NONE "map")---- %hash c:e33e d:af3f--- | The widget disappears from the screen.----unmapSignal :: WidgetClass self => Signal self (IO ())-unmapSignal = Signal (connect_NONE__NONE "unmap")---- %hash c:1f7f d:af3f--- | The widget should allocate any resources needed, in particular, the--- widget's 'DrawWindow' is created. If you connect to this signal and--- you rely on some of these resources to be present, you have to use--- 'System.Glib.Signals.after'.----realize :: WidgetClass self => Signal self (IO ())-realize = Signal (connect_NONE__NONE "realize")---- %hash c:7948 d:af3f--- | The widget should deallocate any resources. This signal is emitted before--- the widget is destroyed.----unrealize :: WidgetClass self => Signal self (IO ())-unrealize = Signal (connect_NONE__NONE "unrealize")---- %hash c:9f6f d:af3f--- | Query the widget for the size it likes to--- have.------ * A parent container emits this signal to its child to query the needed--- height and width of the child. There is not guarantee that the widget--- will actually get this area.----sizeRequest :: WidgetClass self => Signal self (IO Requisition)-sizeRequest = Signal (\after w fun ->- connect_PTR__NONE "size_request" after w- (\rqPtr -> fun >>= \req -> unless (rqPtr==nullPtr) $ poke rqPtr req))---- %hash c:8ec5 d:af3f--- | Inform widget about the size it has.------ * After querying a widget for the size it wants to have (through emitting--- the @\"sizeRequest\"@ signal) a container will emit this signal to--- inform the widget about the real size it should occupy.----sizeAllocate :: WidgetClass self => Signal self (Allocation -> IO ())-sizeAllocate = Signal (connect_BOXED__NONE "size_allocate" peek)---- %hash c:ae3e d:af3f--- | The widget is shown.----showSignal :: WidgetClass self => Signal self (IO ())-showSignal = Signal (connect_NONE__NONE "show")---- %hash c:f589 d:af3f--- | The widget is hidden.----hideSignal :: WidgetClass self => Signal self (IO ())-hideSignal = Signal (connect_NONE__NONE "hide")---- %hash c:a285 d:af3f--- | The widget gains focus via the given user action.----focus :: WidgetClass self => Signal self (DirectionType -> IO Bool)-focus = Signal (connect_ENUM__BOOL "focus")---- %hash c:78ae d:af3f--- | The state of the widget (input focus, insensitive, etc.) has changed.----stateChanged :: WidgetClass self => Signal self (StateType -> IO ())-stateChanged = Signal (connect_ENUM__NONE "state_changed")---- %hash c:bef2 d:1d66--- | The parent-set signal is emitted when a new parent has been set on a--- widget. The parameter is the new parent.----parentSet :: WidgetClass self => Signal self (Maybe Widget -> IO ())-parentSet = Signal (connect_MOBJECT__NONE "parent_set")---- %hash c:7e2b d:4049--- | Emitted when there is a change in the hierarchy to which a widget belong.--- More precisely, a widget is anchored when its toplevel ancestor is a--- 'Window'. This signal is emitted when a widget changes from un-anchored to--- anchored or vice-versa.----hierarchyChanged :: WidgetClass self => Signal self (Maybe Widget -> IO ())-hierarchyChanged = Signal (connect_MOBJECT__NONE "hierarchy_changed")---- %hash c:5894 d:ba10--- | The style-set signal is emitted when a new style has been set on a--- widget. Note that style-modifying functions like 'widgetModifyBase' also--- cause this signal to be emitted.----styleSet :: WidgetClass self => Signal self (Style -> IO ())-styleSet = Signal (connect_OBJECT__NONE "style_set")---- %hash c:6bb1 d:af3f--- | The default direction of text writing has changed.----directionChanged :: WidgetClass self => Signal self (TextDirection -> IO ())-directionChanged = Signal (connect_ENUM__NONE "direction_changed")---- %hash c:c28c d:d116--- | The 'grabNotify' signal is emitted when a widget becomes shadowed by a--- Gtk+ grab (not a pointer or keyboard grab) on another widget, or when it--- becomes unshadowed due to a grab being removed.------ A widget is shadowed by a 'grabAdd' when the topmost grab widget in the--- grab stack of its window group is not its ancestor.----grabNotify :: WidgetClass self => Signal self (Bool -> IO ())-grabNotify = Signal (connect_BOOL__NONE "grab_notify")---- %hash c:e06c d:a681--- | This signal gets emitted whenever a widget should pop up a--- context-sensitive menu. This usually happens through the standard key--- binding mechanism; by pressing a certain key while a widget is focused, the--- user can cause the widget to pop up a menu. For example, the 'Entry' widget--- creates a menu with clipboard commands.----popupMenuSignal :: WidgetClass self => Signal self (IO Bool)-popupMenuSignal = Signal (connect_NONE__BOOL "popup_menu")---- | Specify what kind of help the user wants.-{#enum GtkWidgetHelpType as WidgetHelpType {underscoreToCase} deriving (Eq,Show) #}---- %hash c:b18e d:af3f--- | Tell the widget to show an explanatory help text. Should return @True@--- if help has been shown.----showHelp :: WidgetClass self => Signal self (WidgetHelpType -> IO Bool)-showHelp = Signal (connect_ENUM__BOOL "show_help")---- %hash c:6a8f d:af3f--- | The set of keyboard accelerators has changed.----accelClosuresChanged :: WidgetClass self => Signal self (IO ())-accelClosuresChanged = Signal (connect_NONE__NONE "accel_closures_changed")---- %hash c:5ca d:af3f--- | The widget moved to a new screen.----screenChanged :: WidgetClass self => Signal self (Screen -> IO ())-screenChanged = Signal (connect_OBJECT__NONE "screen_changed")---- | Emitted when 'hasTooltip' is 'True' and the 'gtkTooltipTimeout' has expired with the cursor--- hovering "above" widget; or emitted when widget got focus in keyboard mode.--- --- Using the given coordinates, the signal handler should determine whether a tooltip should be shown--- for widget. If this is the case 'True' should be returned, 'False' otherwise. --- Note if widget got focus in keyboard mode, 'Point' is 'Nothing'.--- --- The signal handler is free to manipulate tooltip with the therefore destined function calls.------ * Available since Gtk+ version 2.12----queryTooltip :: WidgetClass self => Signal self (Widget -> Maybe Point -> Tooltip -> IO Bool)-queryTooltip =- Signal (\after model user -> - connect_OBJECT_INT_INT_BOOL_OBJECT__BOOL "query_tooltip" - after model (\widget x y keyb tooltip -> - user widget (if keyb then Nothing else Just (x, y)) tooltip))---- * Events------ An event is a signal that indicates that some low-level interaction like a--- button or key press, mouse movement, etc. has occurred. In particular,--- events relate to operations on 'DrawWindow's which are a concept of the--- underlying OS rather than the logical widget concept. Some widgets have no--- window and use their parent to receive these events. Widgets normally--- synthesize more sophistiacted signals from events. For instance, the--- 'focusIn' and a 'focusOut' signal indicate that the widget gains or looses--- the input focus. From these events a 'focus' signal is synthesized that--- indicates what maneuver lead to the input focus change (i.e. a tab or--- shift-tab key press).------ For applications it is often sufficient to connect to the high-level--- signals rather than the low-level events. Only in cases where a custom--- widget is built based on the 'DarwingArea' skeleton, the functionality of--- such an application-specific widget needs to be implemented using events.------ Every event is passed an 'Event' structure that contains the data of the--- event. The return value should be @True@ if the handler has dealt with the--- event and @False@ if the event should be propagated further. For instance,--- if a key press event that isn't meaningful in the widget, the handler can--- return @False@ such that the key is handled by the other widgets (the main--- menu, for instance).-------- Because there are so many similar signals (those that take an Event and--- return a Bool) we will abstract out the skeleton. As some of these events--- are emitted at a high rate often a bit has to be set to enable emission.---eventM :: WidgetClass w => SignalName -> [EventMask] ->- ConnectAfter -> w -> (EventM t Bool) -> IO (ConnectId w)-eventM name eMask after obj fun = do- id <- connect_PTR__BOOL name after obj (runReaderT fun)- widgetAddEvents obj eMask- return id---- %hash c:6cc d:af3f--- | A mouse button has been depressed while the mouse pointer was within the--- widget area. Sets the widget's 'ButtonPressMask' flag.----buttonPressEvent :: WidgetClass self => Signal self (EventM EButton Bool)-buttonPressEvent = Signal (eventM "button_press_event" [ButtonPressMask])---- %hash c:62e8 d:af3f--- | A mouse button has been released. Sets the widget's 'ButtonReleaseMask'--- flag.----buttonReleaseEvent :: WidgetClass self => Signal self (EventM EButton Bool)-buttonReleaseEvent = Signal (eventM "button_release_event" [ButtonReleaseMask])---- %hash c:23e5 d:af3f--- | The scroll wheel of the mouse has been used. Sets the widget's--- 'ScrollMask' flag.----scrollEvent :: WidgetClass self => Signal self (EventM EScroll Bool)-scrollEvent = Signal (eventM "scroll_event" [ScrollMask])---- %hash c:ee92 d:af3f--- | The mouse pointer has moved. Since receiving all mouse movements is--- expensive, it is necessary to specify exactly what mouse motions are--- required by calling 'widgetAddEvents' on this widget with one or more of--- the following flags:------ * 'PointerMotionMask': Track all movements.--- * 'ButtonMotionMask': Only track movements if a button is depressed.--- * 'Button1MotionMask': Only track movments if the left button is depressed.--- * 'Button2MotionMask': Only track movments if the middle button is depressed.--- * 'Button3MotionMask': Only track movments if the right button is depressed.------ If the application cannot respond quickly enough to all mouse motions,--- it is possible to only receive motion signals on request. In this case,--- you need to add 'PointerMotionHintMask' to the flags above and call--- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowGetPointer' each time a--- motion even is received. Motion events will then be delayed until the--- function is called.----motionNotifyEvent :: WidgetClass self => Signal self (EventM EMotion Bool)-motionNotifyEvent = Signal (eventM "motion_notify_event" [])---- %hash c:8783 d:3e27--- | The 'deleteEvent' signal is emitted if a user requests that a toplevel--- window is closed. The default handler for this signal destroys the window.--- Calling 'widgetHide' and returning @True@ on reception of this signal will--- cause the window to be hidden instead, so that it can later be shown again--- without reconstructing it.----deleteEvent :: WidgetClass self => Signal self (EventM EAny Bool)-deleteEvent = Signal (eventM "delete_event" [])---- %hash c:c408 d:5514--- | The 'destroyEvent' signal is emitted when a 'DrawWindow' is destroyed.--- You rarely get this signal, because most widgets disconnect themselves from--- their window before they destroy it, so no widget owns the window at--- destroy time. However, you might want to connect to the 'objectDestroy'--- signal of 'Object'.----destroyEvent :: WidgetClass self => Signal self (EventM EAny Bool)-destroyEvent = Signal (eventM "destroy_event" [])---- %hash c:c79e d:af3f---- | Instructs the widget to redraw.------ * The 'DrawWindow' that needs to be redrawn is available via--- 'eventWindow'.------ * The part that needs to be redrawn is available via 'eventArea' and--- 'eventRegion'. The options are, in order of efficiency: (a) redraw the--- entire window, (b) ask for the 'eventArea' and redraw that rectangle, (c)--- ask for the 'eventRegion' and redraw each of those rectangles.------ Only the exposed region will be updated; see also--- 'drawWindowBeginPaintRegion'.--exposeEvent :: WidgetClass self => Signal self (EventM EExpose Bool)-exposeEvent = Signal (eventM "expose_event" [])---- %hash c:5ccd d:af3f--- | A key has been depressed. Sets the widget's 'KeyPressMask' flag.----keyPressEvent :: WidgetClass self => Signal self (EventM EKey Bool)-keyPressEvent = Signal (eventM "key_press_event" [KeyPressMask])---- %hash c:bd29 d:af3f--- | A key has been released. Sets the widget's 'KeyReleaseMask' flag.----keyReleaseEvent :: WidgetClass self => Signal self (EventM EKey Bool)-keyReleaseEvent = Signal (eventM "key_release_event" [KeyReleaseMask])---- %hash c:602e d:af3f--- | The mouse pointer has entered the widget. Sets the widget's--- 'EnterNotifyMask' flag.----enterNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool)-enterNotifyEvent = Signal (eventM "enter_notify_event" [EnterNotifyMask])---- %hash c:3bfb d:af3f--- | The mouse pointer has left the widget. Sets the widget's--- 'LeaveNotifyMask' flag.----leaveNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool)-leaveNotifyEvent = Signal (eventM "leave_notify_event" [LeaveNotifyMask])---- %hash c:2b64 d:af3f--- | The size of the window has changed.----configureEvent :: WidgetClass self => Signal self (EventM EConfigure Bool)-configureEvent = Signal (eventM "configure_event" [])---- %hash c:427e d:af3f--- | The widget gets the input focus. Sets the widget's 'FocusChangeMask' flag.----focusInEvent :: WidgetClass self => Signal self (EventM EFocus Bool)-focusInEvent = Signal (eventM "focus_in_event" [FocusChangeMask])---- %hash c:5281 d:af3f--- | The widget lost the input focus. Sets the widget's 'FocusChangeMask' flag.----focusOutEvent :: WidgetClass self => Signal self (EventM EFocus Bool)-focusOutEvent = Signal (eventM "focus_out_event" [FocusChangeMask])---- %hash c:63c4 d:af3f--- | The window is put onto the screen.----mapEvent :: WidgetClass self => Signal self (EventM EAny Bool)-mapEvent = Signal (eventM "map_event" [])---- %hash c:342d d:af3f--- | The window is taken off the screen.----unmapEvent :: WidgetClass self => Signal self (EventM EAny Bool)-unmapEvent = Signal (eventM "unmap_event" [])---- %hash c:a1dd d:af3f--- | A 'DrawWindow' may be associated with a set of properties that are--- identified by a 'PropertyTag'. This event is triggered if a property is--- changed or deleted. Sets the widget's 'PropertyChangeMask' flag.----propertyNotifyEvent :: WidgetClass self => Signal self (EventM EProperty Bool)-propertyNotifyEvent = Signal (eventM "property_notify_event" [PropertyChangeMask])-{- not sure if these are useful--- %hash c:58cc d:af3f--- | ----selectionClearEvent :: WidgetClass self => Signal self ({-GdkEventSelection*-} Bool)-selectionClearEvent = Signal (connect_{-GdkEventSelection*-}__BOOL "selection_clear_event")---- %hash c:4f92 d:af3f--- |----selectionRequestEvent :: WidgetClass self => Signal self ({-GdkEventSelection*-} Bool)-selectionRequestEvent = Signal (connect_{-GdkEventSelection*-}__BOOL "selection_request_event")---- %hash c:b842 d:af3f--- |----selectionNotifyEvent :: WidgetClass self => Signal self ({-GdkEventSelection*-} Bool)-selectionNotifyEvent = Signal (connect_{-GdkEventSelection*-}__BOOL "selection_notify_event")--}---- %hash c:b027 d:af3f--- | The pen of a graphics tablet was put down. Sets the widget's--- 'ProximityInMask' flag.----proximityInEvent :: WidgetClass self => Signal self (EventM EProximity Bool)-proximityInEvent = Signal (eventM "proximity_in_event" [ProximityInMask])---- %hash c:faca d:af3f--- | The pen of a graphics tablet was lifted off the tablet. Sets the widget's--- 'ProximityOutMask' flag.----proximityOutEvent :: WidgetClass self => Signal self (EventM EProximity Bool)-proximityOutEvent = Signal (eventM "proximity_out_event" [ProximityOutMask])---- %hash c:db2c d:af3f--- | Emitted when the window visibility status has changed. Sets the widget's--- 'VisibilityNotifyMask' flag.----visibilityNotifyEvent :: WidgetClass self => Signal self (EventM EVisibility Bool)-visibilityNotifyEvent = Signal (eventM "visibility_notify_event" [VisibilityNotifyMask])-{---- %hash c:3f5 d:af3f--- |----clientEvent :: WidgetClass self => Signal self ({-GdkEventClient*-} Bool)-clientEvent = Signal (connect_{-GdkEventClient*-}__BOOL "client_event")--}---- %hash c:643c d:af3f--- | Generated when the area of a 'Drawable' being copied using, e.g.--- 'Graphics.UI.Gtk.Gdk.Drawable.drawDrawable', is completely available.----noExposeEvent :: WidgetClass self => Signal self (EventM EAny Bool)-noExposeEvent = Signal (eventM "no_expose_event" [])---- %hash c:63b6 d:af3f--- | Emitted when the state of the window changes, i.e. when it is minimized,--- moved to the top, etc.----windowStateEvent :: WidgetClass self => Signal self (EventM EWindowState Bool)-windowStateEvent = Signal (eventM "window_state_event" [])--#if GTK_CHECK_VERSION(2,8,0)--- %hash c:502a d:e47a--- | Emitted when a pointer or keyboard grab on a window belonging to @widget@--- gets broken.------ On X11, this happens when the grab window becomes unviewable (i.e. it or--- one of its ancestors is unmapped), or if the same application grabs the--- pointer or keyboard again.------ * Available since Gtk+ version 2.8----grabBrokenEvent :: WidgetClass self => Signal self (EventM EGrabBroken Bool)-grabBrokenEvent = Signal (eventM "grab_broken_event" [])-#endif- ------------------------ Deprecated Signals and Events--#ifndef DISABLE_DEPRECATED--event :: WidgetClass w => SignalName -> [EventMask] ->- ConnectAfter -> w -> (Event -> IO Bool) -> IO (ConnectId w)-event name eMask after obj fun = do- id <- connect_BOXED__BOOL name marshalEvent after obj fun- widgetAddEvents obj eMask- return id---- | A Button was pressed.------ * This widget is part of a button which was just pressed. The event passed--- to the user function is a 'Graphics.UI.Gtk.Gdk.Events.Button' event.----onButtonPress, afterButtonPress :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onButtonPress = event "button_press_event" [ButtonPressMask] False-afterButtonPress = event "button_press_event" [ButtonPressMask] True---- | A Button was released.----onButtonRelease, afterButtonRelease :: WidgetClass w => w ->- (Event -> IO Bool) -> IO (ConnectId w)-onButtonRelease = event "button_release_event" [ButtonReleaseMask] False-afterButtonRelease = event "button_release_event" [ButtonReleaseMask] True---- | ----onClient, afterClient :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onClient = event "client_event" [] False-afterClient = event "client_event" [] True---- | The widget's status has changed.----onConfigure, afterConfigure :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onConfigure = event "configure_event" [] False-afterConfigure = event "configure_event" [] True---- | This signal is emitted when the close icon on the--- surrounding window is pressed. The default action is to emit the--- @\"destroy\"@ signal.----onDelete, afterDelete :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onDelete = event "delete_event" [] False-afterDelete = event "delete_event" [] True---- | The widget will be destroyed.------ * The widget received a destroy event from the window manager.----onDestroyEvent, afterDestroyEvent :: WidgetClass w => - w -> (Event -> IO Bool) ->- IO (ConnectId w)-onDestroyEvent = event "destroy_event" [] False-afterDestroyEvent = event "destroy_event" [] True---- | The default text direction was changed.----onDirectionChanged, afterDirectionChanged :: WidgetClass w => w ->- (Event -> IO Bool) ->- IO (ConnectId w)-onDirectionChanged = event "direction_changed" [] False-afterDirectionChanged = event "direction_changed" [] True---- | Mouse cursor entered widget.------ * Contains a 'Crossing' event.----onEnterNotify, afterEnterNotify :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onEnterNotify = event "enter_notify_event" [EnterNotifyMask] False-afterEnterNotify = event "enter_notify_event" [EnterNotifyMask] True---- | Mouse cursor leaves widget.------ * Contains a 'Crossing' event.----onLeaveNotify, afterLeaveNotify :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onLeaveNotify = event "leave_notify_event" [LeaveNotifyMask] False-afterLeaveNotify = event "leave_notify_event" [LeaveNotifyMask] True---- | Instructs the widget to redraw.------ * This event is useful for the 'DrawingArea'. On receiving this signal--- the content of the passed Rectangle or Region needs to be redrawn.--- The return value should be 'True' if the region was completely redrawn--- and 'False' if other handlers in the chain should be invoked.--- If a client will redraw the whole area and is not interested in the--- extra information in 'Expose', it is more efficient--- to use 'onExposeRect'.------ * Widgets that are very expensive to re-render, such as an image editor,--- may prefer to use the 'onExpose' call back which delivers a--- 'Region' in addition to a 'Rectangle'. A 'Region' consists of several--- rectangles that need redrawing. The simpler 'onExposeRect' event encodes--- the area to be redrawn as a bounding rectangle which might be easier--- to deal with in a particular application.----onExpose, afterExpose :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onExpose = event "expose_event" [] False-afterExpose = event "expose_event" [] True---- | Expose event delivering a 'Rectangle'.----onExposeRect, afterExposeRect ::- WidgetClass w => w -> (Rectangle -> IO ()) -> IO (ConnectId w)-onExposeRect w act = connect_BOXED__BOOL "expose_event"- marshExposeRect False w (\r -> act r >> return True)-afterExposeRect w act = connect_BOXED__BOOL "expose_event" - marshExposeRect True w (\r -> act r >> return True)---- | This signal is called if the widget receives the input focus.----onFocus, afterFocus :: WidgetClass w => w -> (DirectionType -> IO Bool) ->- IO (ConnectId w)-onFocus = connect_ENUM__BOOL "focus" False-afterFocus = connect_ENUM__BOOL "focus" True---- | Widget gains input focus.----onFocusIn, afterFocusIn :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onFocusIn = event "focus_in_event" [FocusChangeMask] False-afterFocusIn = event "focus_in_event" [FocusChangeMask] True---- | Widget looses input focus.----onFocusOut, afterFocusOut :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onFocusOut = event "focus_out_event" [FocusChangeMask] False-afterFocusOut = event "focus_out_event" [FocusChangeMask] True---- | The widget is about to receive all events.------ * It is possible to redirect all input events to one widget to force the--- user to use only this widget. Such a situation is initiated by--- 'addGrab'.----onGrabFocus, afterGrabFocus :: WidgetClass w => w -> IO () ->- IO (ConnectId w)-onGrabFocus = connect_NONE__NONE "grab_focus" False-afterGrabFocus = connect_NONE__NONE "grab_focus" True---- | The widget will be destroyed.------ * This is the last signal this widget will receive.----onDestroy, afterDestroy :: WidgetClass w => w -> (IO ()) ->- IO (ConnectId w)-onDestroy = connect_NONE__NONE "destroy" False-afterDestroy = connect_NONE__NONE "destroy" True---- | The widget was asked to hide itself.------ * This signal is emitted each time 'widgetHide' is called. Use--- 'onUnmap' when your application needs to be informed--- when the widget is actually removed from screen.----onHide, afterHide :: WidgetClass w => w -> IO () -> IO (ConnectId w)-onHide = connect_NONE__NONE "hide" False-afterHide = connect_NONE__NONE "hide" True---- | The toplevel window changed.------ * When a subtree of widgets is removed or added from a tree with a toplevel--- window this signal is emitted. It is emitted on each widget in the--- detached or attached subtree.----onHierarchyChanged, afterHierarchyChanged :: WidgetClass w => w -> IO () ->- IO (ConnectId w)-onHierarchyChanged = connect_NONE__NONE "hierarchy_changed" False-afterHierarchyChanged = connect_NONE__NONE "hierarchy_changed" True---- | A key was pressed.----onKeyPress, afterKeyPress :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onKeyPress = event "key_press_event" [KeyPressMask] False-afterKeyPress = event "key_press_event" [KeyPressMask] True---- | A key was released.----onKeyRelease, afterKeyRelease :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onKeyRelease = event "key_release_event" [KeyReleaseMask] False-afterKeyRelease = event "key_release_event" [KeyReleaseMask] True---- | ----onMnemonicActivate, afterMnemonicActivate :: WidgetClass w => w ->- (Bool -> IO Bool) ->- IO (ConnectId w)-onMnemonicActivate = connect_BOOL__BOOL "mnemonic_activate" False-afterMnemonicActivate = connect_BOOL__BOOL "mnemonic_activate" True---- | Track mouse movements.------ * If @hint@ is False, a callback for every movement of the mouse is--- generated. To avoid a backlog of mouse messages, it is usually sufficient--- to sent @hint@ to True, generating only one event. The--- application now has to state that it is ready for the next message by--- calling 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowGetPointer'.----onMotionNotify, afterMotionNotify :: WidgetClass w => w -> Bool ->- (Event -> IO Bool) -> - IO (ConnectId w)-onMotionNotify w hint = event "motion_notify_event" - (if hint then [PointerMotionMask, PointerMotionHintMask]- else [PointerMotionMask]) False w-afterMotionNotify w hint = event "motion_notify_event" - (if hint then [PointerMotionMask, PointerMotionHintMask]- else [PointerMotionMask]) True w---- | ----onParentSet, afterParentSet :: (WidgetClass w, WidgetClass old) => w ->- (old -> IO ()) -> IO (ConnectId w)-onParentSet = connect_OBJECT__NONE "parent_set" False-afterParentSet = connect_OBJECT__NONE "parent_set" True---- | ----onPopupMenu, afterPopupMenu :: WidgetClass w => w -> IO () -> IO (ConnectId w)-onPopupMenu = connect_NONE__NONE "popup_menu" False-afterPopupMenu = connect_NONE__NONE "popup_menu" True---- | The input device became active.------ * This event indicates that a pen of a graphics tablet or similar device is--- now touching the tablet.----onProximityIn, afterProximityIn :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onProximityIn = event "proximity_in_event" [ProximityInMask] False-afterProximityIn = event "proximity_in_event" [ProximityInMask] True---- | The input device became inactive.------ * The pen was removed from the graphics tablet's surface.----onProximityOut, afterProximityOut :: WidgetClass w => w ->- (Event -> IO Bool) -> IO (ConnectId w)-onProximityOut = event "proximity_out_event" [ProximityOutMask] False-afterProximityOut = event "proximity_out_event" [ProximityOutMask] True---- | This widget's drawing area is about to be--- destroyed.----onRealize, afterRealize :: WidgetClass w => w -> IO () -> IO (ConnectId w)-onRealize = connect_NONE__NONE "realize" False-afterRealize = connect_NONE__NONE "realize" True---- | The mouse wheel has turned.------ * The 'Event' is always 'Scroll'.----onScroll, afterScroll :: WidgetClass w => w -> (Event -> IO Bool) ->- IO (ConnectId w)-onScroll = event "scroll_event" [ScrollMask] False-afterScroll = event "scroll_event" [ScrollMask] True---- | The widget was asked to show itself.------ * This signal is emitted each time 'widgetShow' is called. Use--- 'onMap' when your application needs to be informed when--- the widget is actually shown.----onShow, afterShow :: WidgetClass w => w -> IO () -> IO (ConnectId w)-onShow = connect_NONE__NONE "show" False-afterShow = connect_NONE__NONE "show" True---- | Inform widget about the size it has.------ * After querying a widget for the size it wants to have (through emitting--- the @\"sizeRequest\"@ signal) a container will emit this signal to--- inform the widget about the real size it should occupy.----onSizeAllocate, afterSizeAllocate :: WidgetClass w => w ->- (Allocation -> IO ()) -> IO (ConnectId w)-onSizeAllocate = connect_BOXED__NONE "size_allocate" peek False-afterSizeAllocate = connect_BOXED__NONE "size_allocate" peek True---- | Query the widget for the size it likes to--- have.------ * A parent container emits this signal to its child to query the needed--- height and width of the child. There is not guarantee that the widget--- will actually get this area.----onSizeRequest, afterSizeRequest :: WidgetClass w => w -> (IO Requisition) ->- IO (ConnectId w)-onSizeRequest w fun = connect_PTR__NONE "size_request" False w (\rqPtr -> do- req <- fun- unless (rqPtr==nullPtr) $ poke rqPtr req)-afterSizeRequest w fun = connect_PTR__NONE "size_request" True w (\rqPtr -> do- req <- fun- unless (rqPtr==nullPtr) $ poke rqPtr req) ---- | ----onStateChanged, afterStateChanged :: WidgetClass w => w ->- (StateType -> IO ()) -> IO (ConnectId w)-onStateChanged = connect_ENUM__NONE "state_changed" False-afterStateChanged = connect_ENUM__NONE "state_changed" True---- | The widget was removed from screen.----onUnmap, afterUnmap :: WidgetClass w => w -> IO () -> IO (ConnectId w)-onUnmap = connect_NONE__NONE "unmap" False-afterUnmap = connect_NONE__NONE "unmap" True---- | This widget's drawing area is about to be--- destroyed.----onUnrealize, afterUnrealize :: WidgetClass w => w -> IO () -> IO (ConnectId w)-onUnrealize = connect_NONE__NONE "unrealize" False-afterUnrealize = connect_NONE__NONE "unrealize" True---- | ----onVisibilityNotify, afterVisibilityNotify :: WidgetClass w => w ->- (Event -> IO Bool) ->- IO (ConnectId w)-onVisibilityNotify = - event "visibility_notify_event" [VisibilityNotifyMask] False-afterVisibilityNotify = - event "visibility_notify_event" [VisibilityNotifyMask] True---- | +-- user interaction. 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.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----Widget+-- | +----/too many to list/+-- @++-- * Types+ Widget,+ WidgetClass,+ castToWidget, gTypeWidget,+ toWidget,+ EventMask(..),+#if GTK_MAJOR_VERSION < 3+ ExtensionMode(..),+#endif+ GType,+ KeyVal,+#if GTK_MAJOR_VERSION < 3+ Region,+ Bitmap,+#endif+ Requisition(..),+ Rectangle(..),+ Color,+ IconSize(..),+ StateType(..),+ TextDirection(..),+ AccelFlags(..),+ DirectionType(..),+ StockId,+ WidgetHelpType(..),+ Allocation,++-- * Methods+ widgetShow,+ widgetShowNow,+ widgetHide,+ widgetShowAll,+#if GTK_MAJOR_VERSION < 3+ widgetHideAll,+#endif+ widgetDestroy,+#if GTK_CHECK_VERSION(3,0,0)+ widgetDraw,+#endif+ widgetQueueDraw,+ widgetQueueResize,+#if GTK_CHECK_VERSION(2,4,0)+ widgetQueueResizeNoRedraw,+#endif+#if GTK_CHECK_VERSION(3,8,0)+ widgetGetFrameClock,+#endif+#if GTK_CHECK_VERSION(3,10,0)+ widgetGetScaleFactor,+#endif+ widgetSizeRequest,+ widgetGetChildRequisition,+ widgetSizeAllocate,+#if GTK_CHECK_VERSION(3,10,0)+ widgetSizeAllocateWithBaseline,+#endif+ widgetAddAccelerator,+ widgetRemoveAccelerator,+ widgetSetAccelPath,+#if GTK_CHECK_VERSION(2,4,0)+ widgetCanActivateAccel,+#endif+ widgetActivate,+ widgetIntersect,+ widgetHasIntersection,+ widgetGetIsFocus,+ widgetGrabFocus,+ widgetGrabDefault,+ widgetSetName,+ widgetGetName,+ widgetSetSensitive,+ widgetSetSensitivity,+ widgetGetParentWindow,+#if GTK_MAJOR_VERSION < 3+ widgetGetDrawWindow,+#endif+ widgetDelEvents,+ widgetAddEvents,+ widgetGetEvents,+ widgetSetEvents,+#if GTK_MAJOR_VERSION < 3+ widgetSetExtensionEvents,+ widgetGetExtensionEvents,+#endif+ widgetGetToplevel,+ widgetGetAncestor,+#if GTK_MAJOR_VERSION < 3+ widgetGetColormap,+ widgetSetColormap,+#endif+ widgetGetPointer,+ widgetIsAncestor,+ widgetTranslateCoordinates,+ widgetSetStyle,+ widgetGetStyle,+#if GTK_MAJOR_VERSION < 3+ widgetPushColormap,+ widgetPopColormap,+ widgetSetDefaultColormap,+ widgetGetDefaultColormap,+#endif+ widgetGetDefaultStyle,+ widgetSetDirection,+ widgetGetDirection,+ widgetSetDefaultDirection,+ widgetGetDefaultDirection,+#if GTK_MAJOR_VERSION < 3+ widgetShapeCombineMask,+#if GTK_CHECK_VERSION(2,10,0)+ widgetInputShapeCombineMask,+#endif+#endif+#if GTK_CHECK_VERSION(3,0,0)+ widgetShapeCombineRegion,+ widgetInputShapeCombineRegion,+#endif+#if GTK_MAJOR_VERSION < 3+#if GTK_CHECK_VERSION(2,14,0)+ widgetGetSnapshot,+#endif+#endif+ widgetPath,+ widgetClassPath,+ widgetGetCompositeName,+#if GTK_CHECK_VERSION(3,0,0)+ widgetOverrideBackgroundColor,+ widgetOverrideColor,+ widgetOverrideFont,+ widgetOverrideSymbolicColor,+ widgetOverrideCursor,+#endif+ widgetModifyStyle,+ widgetGetModifierStyle,+ widgetModifyFg,+ widgetModifyBg,+ widgetModifyText,+ widgetModifyBase,+ widgetModifyFont,+ widgetRestoreFg,+ widgetRestoreBg,+ widgetRestoreText,+ widgetRestoreBase,+ widgetCreatePangoContext,+ widgetGetPangoContext,+ widgetCreateLayout,+ widgetRenderIcon,+ widgetQueueDrawArea,+#if GTK_CHECK_VERSION(3,0,0)+ widgetQueueDrawRegion,+#endif+#if GTK_MAJOR_VERSION < 3+ widgetResetShapes,+#endif+ widgetSetAppPaintable,+ widgetSetDoubleBuffered,+ widgetSetRedrawOnAllocate,+ widgetSetCompositeName,+ widgetMnemonicActivate,+#if GTK_MAJOR_VERSION < 3+ widgetSetScrollAdjustments,+ widgetRegionIntersect,+#endif+ widgetGetAccessible,+ widgetChildFocus,+ widgetGetChildVisible,+ widgetGetParent,+ widgetGetSettings,+#if GTK_CHECK_VERSION(2,2,0)+ widgetGetClipboard,+ widgetGetDisplay,+ widgetGetRootWindow,+ widgetGetScreen,+ widgetHasScreen,+#endif+ widgetGetSizeRequest,+#if GTK_CHECK_VERSION(3,0,0)+ widgetGetPreferredSize,+#endif+ widgetSetChildVisible,+ widgetSetSizeRequest,+#if GTK_CHECK_VERSION(2,4,0)+ widgetSetNoShowAll,+ widgetGetNoShowAll,+ widgetListMnemonicLabels,+ widgetAddMnemonicLabel,+ widgetRemoveMnemonicLabel,+#if GTK_CHECK_VERSION(2,10,0)+#if GTK_MAJOR_VERSION < 3+ widgetGetAction,+#endif+ widgetIsComposited,+#endif+#endif+#if GTK_CHECK_VERSION(2,12,0)+ widgetErrorBell,+ widgetKeynavFailed,+ widgetGetTooltipMarkup,+ widgetSetTooltipMarkup,+ widgetGetTooltipText,+ widgetSetTooltipText,+ widgetGetTooltipWindow,+ widgetSetTooltipWindow,+ widgetGetHasTooltip,+ widgetSetHasTooltip,+ widgetTriggerTooltipQuery,+#endif+#if GTK_CHECK_VERSION(2,14,0)+ widgetGetWindow,+#endif+#if GTK_CHECK_VERSION(3,8,0)+ widgetRegisterWindow,+ widgetUnregisterWindow,+#endif+#if GTK_CHECK_VERSION(3,0,0)+ cairoShouldDrawWindow,+ cairoTransformToWindow,+#endif+ widgetReparent,+#if GTK_CHECK_VERSION(2,18,0)+ widgetGetCanFocus,+ widgetSetCanFocus,+ widgetGetAllocation,+#endif+#if GTK_CHECK_VERSION(3,0,0)+ widgetGetAllocatedWidth,+ widgetGetAllocatedHeight,+#endif+#if GTK_CHECK_VERSION(3,10,0)+ widgetGetAllocatedBaseline,+#endif+#if GTK_CHECK_VERSION(3,14,0)+ widgetGetClip,+ widgetSetClip,+#endif+#if GTK_CHECK_VERSION(2,18,0)+ widgetGetAppPaintable,+ widgetGetCanDefault,+ widgetSetCanDefault,+ widgetGetHasWindow,+ widgetSetHasWindow,+ widgetGetSensitive,+ widgetIsSensitive,+ widgetGetState,+ widgetGetVisible,+#endif+#if GTK_CHECK_VERSION(3,8,0)+ widgetIsVisible,+#endif+#if GTK_CHECK_VERSION(3,0,0)+ widgetSetStateFlags,+ widgetUnsetStateFlags,+ widgetGetStateFlags,+#endif+#if GTK_CHECK_VERSION(2,18,0)+ widgetGetHasDefault,+ widgetGetHasFocus,+#endif+#if GTK_CHECK_VERSION(3,2,0)+ widgetHasVisibleFocus,+#endif+#if GTK_CHECK_VERSION(2,18,0)+ widgetHasGrab,+ widgetIsDrawable,+ widgetIsToplevel,+ widgetSetWindow,+ widgetSetReceivesDefault,+ widgetGetReceivesDefault,+#endif+#if GTK_CHECK_VERSION(3,0,0)+ widgetDeviceIsShadowed,+#endif+#if GTK_CHECK_VERSION(3,4,0)+ widgetGetModifierMask,+#endif+#if GTK_CHECK_VERSION(3,0,0)+ widgetSetSupportMultidevice,+ widgetGetSupportMultidevice,+#endif+ widgetSetState,+#if GTK_MAJOR_VERSION < 3+ widgetGetSavedState,+ widgetGetSize,+#endif+ widgetEvent,+#if GTK_CHECK_VERSION(3,0,0)+ widgetGetHAlign,+ widgetSetHAlign,+ widgetGetVAlign,+#if GTK_CHECK_VERSION(3,10,0)+ widgetGetVAlignWithBaseline,+#endif+ widgetSetVAlign,+#endif++-- * Attributes+ widgetName,+ widgetParent,+ widgetWidthRequest,+ widgetHeightRequest,+ widgetMarginLeft,+ widgetMarginRight,+#if GTK_CHECK_VERSION(3,12,0)+ widgetMarginStart,+ widgetMarginEnd,+#endif+ widgetMarginTop,+ widgetMarginBottom,+ widgetVisible,+ widgetOpacity,+ widgetSensitive,+ widgetAppPaintable,+ widgetCanFocus,+ widgetHasFocus,+ widgetIsFocus,+ widgetCanDefault,+ widgetHasDefault,+ widgetReceivesDefault,+ widgetCompositeChild,+ widgetStyle,+ widgetState,+ widgetEvents,+#if GTK_MAJOR_VERSION < 3+ widgetExtensionEvents,+#endif+ widgetExpand,+ widgetHExpand,+ widgetHExpandSet,+ widgetVExpand,+ widgetVExpandSet,+ widgetNoShowAll,+ widgetChildVisible,+#if GTK_MAJOR_VERSION < 3+ widgetColormap,+#endif+ widgetCompositeName,+ widgetDirection,+ widgetTooltipMarkup,+ widgetTooltipText,+ widgetHasTooltip,+#if GTK_CHECK_VERSION(2,20,0)+ widgetHasRcStyle,+ widgetGetRealized,+ widgetGetMapped,+ widgetSetRealized,+ widgetSetMapped,+#endif+#if GTK_CHECK_VERSION(3,0,0)+ widgetGetStyleContext,+#endif++-- * Signals+ realize,+ unrealize,+ mapSignal,+ unmapSignal,+ sizeRequest,+ sizeAllocate,+ showSignal,+ hideSignal,+ focus,+ stateChanged,+#if GTK_CHECK_VERSION(3,0,0)+ stateFlagsChanged,+#endif+ parentSet,+ hierarchyChanged,+ styleSet,+ directionChanged,+ grabNotify,+ popupMenuSignal,+ showHelp,+ accelClosuresChanged,+ screenChanged,+ queryTooltip,+#if GTK_CHECK_VERSION(3,0,0)+ draw,+#endif++-- * Events+ buttonPressEvent,+ buttonReleaseEvent,+ configureEvent,+ deleteEvent,+ destroyEvent,+ enterNotifyEvent,+ exposeEvent,+ focusInEvent,+ focusOutEvent,+#if GTK_CHECK_VERSION(2,8,0)+ grabBrokenEvent,+#endif+ keyPressEvent,+ keyReleaseEvent,+ leaveNotifyEvent,+ mapEvent,+ motionNotifyEvent,+ noExposeEvent,+ proximityInEvent,+ proximityOutEvent,+ scrollEvent,+ unmapEvent,+ visibilityNotifyEvent,+ windowStateEvent,++-- * Deprecated+#ifndef DISABLE_DEPRECATED+ onButtonPress,+ afterButtonPress,+ onButtonRelease,+ afterButtonRelease,+ onClient,+ afterClient,+ onConfigure,+ afterConfigure,+ onDelete,+ afterDelete,+ onDestroyEvent, -- you probably want onDestroy+ afterDestroyEvent,+ onDirectionChanged,+ afterDirectionChanged,+ onEnterNotify,+ afterEnterNotify,+ onLeaveNotify,+ afterLeaveNotify,+ onExpose,+ afterExpose,+ onExposeRect,+ afterExposeRect,+ onFocus,+ afterFocus,+ onFocusIn,+ afterFocusIn,+ onFocusOut,+ afterFocusOut,+ onGrabFocus,+ afterGrabFocus,+ onDestroy,+ afterDestroy,+ onHide,+ afterHide,+ onHierarchyChanged,+ afterHierarchyChanged,+ onKeyPress,+ afterKeyPress,+ onKeyRelease,+ afterKeyRelease,+ onMnemonicActivate,+ afterMnemonicActivate,+ onMotionNotify,+ afterMotionNotify,+ onParentSet,+ afterParentSet,+ onPopupMenu,+ afterPopupMenu,+ onProximityIn,+ afterProximityIn,+ onProximityOut,+ afterProximityOut,+ onRealize,+ afterRealize,+ onScroll,+ afterScroll,+ onShow,+ afterShow,+ onSizeAllocate,+ afterSizeAllocate,+ onSizeRequest,+ afterSizeRequest,+ onStateChanged,+ afterStateChanged,+ onUnmap,+ afterUnmap,+ onUnrealize,+ afterUnrealize,+ onVisibilityNotify,+ afterVisibilityNotify,+ onWindowState,+ afterWindowState+#endif+ ) where++import Control.Monad (liftM, unless)+import Data.Maybe (fromMaybe)+import Control.Monad.Reader (ask)+import Control.Monad.Trans (liftIO)+import System.Glib.FFI+import System.Glib.Flags (fromFlags, toFlags)+#if GTK_CHECK_VERSION(3,0,0)+import System.Glib.GError (failOnGError)+import System.Glib.Flags (Flags)+#endif+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+import System.Glib.GType (GType)+import System.Glib.GList (fromGList)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.General.DNDTypes (Atom (Atom), SelectionTag)+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}+import Graphics.UI.Gtk.Gdk.Enums (EventMask(..)+#if GTK_MAJOR_VERSION < 3+ , ExtensionMode(..)+#endif+ )+import Graphics.UI.Gtk.Gdk.Keys (KeyVal)+#if GTK_MAJOR_VERSION < 3+{#import Graphics.UI.Gtk.Gdk.Region#} (Region(..), makeNewRegion)+{#import Graphics.UI.Gtk.Gdk.Pixmap#} (Bitmap)+#endif+import Graphics.UI.Gtk.General.Structs (Allocation, Rectangle(..)+ ,Requisition(..), Color, IconSize(..)+ ,Point+#if !GTK_CHECK_VERSION(2,18,0)+ ,widgetGetState+#endif+#if GTK_MAJOR_VERSION < 3+ ,widgetGetSavedState+ ,widgetGetDrawWindow, widgetGetSize+#endif+ )+#ifndef DISABLE_DEPRECATED+import Graphics.UI.Gtk.Gdk.Events (Event(..), marshalEvent, marshExposeRect)+#endif+import Graphics.UI.Gtk.Gdk.EventM (EventM,+ EventM,+ EAny,+ EKey,+ EButton,+ EScroll,+ EMotion,+ EExpose,+ EVisibility,+ ECrossing,+ EFocus,+ EConfigure,+ EProperty,+ EProximity,+ EWindowState,+#if GTK_CHECK_VERSION(2,8,0)+ EGrabBroken,+#endif+ )+import Graphics.UI.Gtk.General.Enums (StateType(..), TextDirection(..),+ AccelFlags(..), DirectionType(..), Modifier+#if GTK_CHECK_VERSION(3,0,0)+ ,StateFlags(..), Align(..)+#endif+#if GTK_CHECK_VERSION(3,4,0)+ ,ModifierIntent(..)+#endif+ )+{#import Graphics.Rendering.Pango.Types#}+{#import Graphics.Rendering.Pango.BasicTypes#} (FontDescription(FontDescription),+ PangoLayout(PangoLayout), makeNewPangoString )+import Graphics.UI.Gtk.General.StockItems (StockId)+import Data.IORef ( newIORef )+import Control.Monad.Reader ( runReaderT )+#if GTK_CHECK_VERSION(3,0,0)+import Graphics.Rendering.Cairo.Types (Cairo(..), unCairo, Region(..), withRegion)+import Graphics.Rendering.Cairo.Internal (Render(..))+#endif++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Methods++-- | Flags a widget to be displayed. Any widget that isn't shown will not+-- appear on the screen. If you want to show all the widgets in a container,+-- it's easier to call 'widgetShowAll' on the container, instead of+-- individually showing the widgets.+--+-- Remember that you have to show the containers containing a widget, in+-- addition to the widget itself, before it will appear onscreen.+--+-- When a toplevel container is shown, it is immediately realized and+-- mapped; other shown widgets are realized and mapped when their toplevel+-- container is realized and mapped.+--+widgetShow :: WidgetClass self => self -> IO ()+widgetShow self =+ {# call widget_show #}+ (toWidget self)++-- | Shows a widget. If the widget is an unmapped toplevel widget (i.e. a+-- 'Window' that has not yet been shown), enter the main loop and wait for the+-- window to actually be mapped. Be careful; because the main loop is running,+-- anything can happen during this function.+--+widgetShowNow :: WidgetClass self => self -> IO ()+widgetShowNow self =+ {# call widget_show_now #}+ (toWidget self)++-- | Reverses the effects of 'widgetShow', causing the widget to be hidden+-- (invisible to the user).+--+widgetHide :: WidgetClass self => self -> IO ()+widgetHide self =+ {# call widget_hide #}+ (toWidget self)++-- | Recursively shows a widget, and any child widgets (if the widget is a+-- container).+--+widgetShowAll :: WidgetClass self => self -> IO ()+widgetShowAll self =+ {# call widget_show_all #}+ (toWidget self)++#if GTK_MAJOR_VERSION < 3+-- | Recursively hides a widget and any child widgets.+--+-- Removed in Gtk3.+widgetHideAll :: WidgetClass self => self -> IO ()+widgetHideAll self =+ {# call widget_hide_all #}+ (toWidget self)+#endif++-- | Destroys a widget. Equivalent to+-- 'Graphics.UI.Gtk.Abstract.Object.objectDestroy'.+--+-- When a widget is destroyed it will be removed from the screen and+-- unrealized. When a widget is destroyed, it will break any references it+-- holds to other objects.If the widget is inside a container, the widget will+-- be removed from the container. The widget will be garbage collected+-- (finalized) time after your last reference to the widget disappears.+--+-- In most cases, only toplevel widgets (windows) require explicit+-- destruction, because when you destroy a toplevel its children will be+-- destroyed as well.+--+widgetDestroy :: WidgetClass self => self -> IO ()+widgetDestroy self =+ {# call widget_destroy #}+ (toWidget self)++#if GTK_CHECK_VERSION(3,0,0)+-- | Draws widget to @cr@. The top left corner of the widget will be drawn+-- to the currently set origin point of @cr@.+--+-- You should pass a cairo context as cr argument that is in an original+-- state. Otherwise the resulting drawing is undefined. For example changing+-- the operator using 'Graphics.Rendering.Cairo.setOperator' or the line+-- width using 'Graphics.Rendering.Cairo.setLineWidth' might have unwanted+-- side effects. You may however change the context’s transform matrix - like+-- with 'Graphics.Rendering.Cairo.scale', 'Graphics.Rendering.Cairo.translate'+-- or 'Graphics.Rendering.Cairo.setMatrix' and clip region with+-- 'Graphics.Rendering.Cairo.clip' prior to calling this function. Also, it+-- is fine to modify the context with 'Graphics.Rendering.Cairo.save' and+-- 'Graphics.Rendering.Cairo.pushGroup' prior to calling this function.+--+-- Note that special-purpose widgets may contain special code for rendering+-- to the screen and might appear differently on screen and when rendered+-- using 'widgetDraw'.+--+widgetDraw :: WidgetClass self+ => self -- ^ the widget to draw. It must be drawable (see 'widgetIsDrawable')+ -- and a size must have been allocated.+ -> Cairo -- ^ a cairo context to draw to+ -> IO ()+widgetDraw self cr =+ {# call widget_draw #}+ (toWidget self)+ (castPtr $ unCairo cr)+#endif++-- * Functions to be used with 'Graphics.UI.Gtk.Misc.DrawingArea' or+-- container implementations.++-- | Send a redraw request to a widget. Equivalent to calling+-- 'widgetQueueDrawArea' for the entire area of a widget.+--+widgetQueueDraw :: WidgetClass self => self -> IO ()+widgetQueueDraw self =+ {# call widget_queue_draw #}+ (toWidget self)++-- | This function is only for use in widget implementations. Flags a widget+-- to have its size renegotiated; should be called when a widget for some+-- reason has a new size request. For example, when you change the text in a+-- 'Graphics.UI.Gtk.Display.Label.Label',+-- 'Graphics.UI.Gtk.Display.Label.Label' queues a resize to ensure there's+-- enough space for the new text.+--+widgetQueueResize :: WidgetClass self => self -> IO ()+widgetQueueResize self =+ {# call widget_queue_resize #}+ (toWidget self)++#if GTK_CHECK_VERSION(2,4,0)+-- | This function works like 'widgetQueueResize', except that the widget is+-- not invalidated.+--+-- * Available since Gtk+ version 2.4+--+widgetQueueResizeNoRedraw :: WidgetClass self => self -> IO ()+widgetQueueResizeNoRedraw self =+ {# call widget_queue_resize_no_redraw #}+ (toWidget self)+#endif++#if GTK_CHECK_VERSION(3,8,0)+-- | Obtains the frame clock for a widget. The frame clock is a global “ticker”+-- that can be used to drive animations and repaints. The most common reason to+-- get the frame clock is to call 'frameClockGetFrameTime', in order to get a+-- time to use for animating. For example you might record the start of the+-- animation with an initial value from 'frameClockGetFrameTime', and then+-- update the animation by calling 'frameClockGetFrameTime' again during each+-- repaint.+--+-- 'frameClockRequestPhase' will result in a new frame on the clock, but won’t+-- necessarily repaint any widgets. To repaint a widget, you have to use+-- 'widgetQueueDraw' which invalidates the widget (thus scheduling it to+-- receive a draw on the next frame). 'widgetQueueDraw' will also end up+-- requesting a frame on the appropriate frame clock.+--+-- A widget’s frame clock will not change while the widget is mapped.+-- Reparenting a widget (which implies a temporary unmap) can change the+-- widget’s frame clock.+--+-- Unrealized widgets do not have a frame clock.+--+widgetGetFrameClock :: WidgetClass self => self -> IO FrameClock+widgetGetFrameClock self =+ makeNewGObject mkFrameClock $+ {# call widget_get_frame_clock #}+ (toWidget self)+#endif++#if GTK_CHECK_VERSION(3,10,0)+-- | Retrieves the internal scale factor that maps from window coordinates to+-- the actual device pixels. On traditional systems this is 1, on high density+-- outputs, it can be a higher value (typically 2).+--+-- See 'drawWindowGetScaleFactor'.+--+widgetGetScaleFactor :: WidgetClass self => self -> IO Int+widgetGetScaleFactor self =+ liftM fromIntegral $+ {# call widget_get_scale_factor #}+ (toWidget self)+#endif++-- | This function is typically used when implementing a+-- 'Graphics.UI.Gtk.Abstract.Container.Container' subclass. Obtains the preferred size+-- of a widget. The container uses this information to arrange its child+-- widgets and decide what size allocations to give them with+-- 'widgetSizeAllocate'.+--+-- You can also call this function from an application, with some caveats.+-- Most notably, getting a size request requires the widget to be associated+-- with a screen, because font information may be needed. Multihead-aware+-- applications should keep this in mind.+--+-- Also remember that the size request is not necessarily the size a widget+-- will actually be allocated.+--+widgetSizeRequest :: WidgetClass self => self -> IO Requisition+widgetSizeRequest self = alloca $ \reqPtr -> do+ {#call widget_size_request #} (toWidget self) (castPtr reqPtr)+ peek reqPtr++-- | This function is only for use in widget implementations. Obtains the+-- cached requisition information in the widget, unless someone has forced a+-- particular geometry on the widget (e.g. with 'widgetSetSizeRequest'), in which+-- case it returns that geometry instead of the widget's requisition.+--+-- This function differs from 'widgetSizeRequest' in that it retrieves the+-- last size request value stored in the widget, while 'widgetSizeRequest'+-- actually emits the 'sizeRequest' signal on the widget to compute the size+-- request (which updates the widget's requisition information).+--+-- Since this function does not emit the 'sizeRequest' signal, it can only be+-- used when you know that the widget's requisition is up-to-date, that is,+-- 'widgetSizeRequest' has been called since the last time a resize was+-- queued. In general, only container implementations have this information;+-- applications should use 'widgetSizeRequest'.+--+widgetGetChildRequisition :: WidgetClass self => self -> IO Requisition+widgetGetChildRequisition self = alloca $ \reqPtr -> do+ {#call widget_get_child_requisition #} (toWidget self) (castPtr reqPtr)+ peek reqPtr++-- | This function is only used by+-- 'Graphics.UI.Gtk.Abstract.Container.Container' subclasses, to assign a+-- size and position to their child widgets.+--+widgetSizeAllocate :: WidgetClass self => self+ -> Allocation -- ^ The @x@ and @y@ values of the rectangle determine the+ -- the position of the widget's area relative to its parent+ -- allocation.+ -> IO ()+widgetSizeAllocate self rect = with rect $ \rectPtr ->+ {#call widget_size_allocate#} (toWidget self) (castPtr rectPtr)++#if GTK_CHECK_VERSION(3,10,0)+-- | This function is only used by+-- 'Graphics.UI.Gtk.Abstract.Container.Container' subclasses, to assign a+-- size, position and (optionally) baseline to their child widgets.+--+-- In this function, the allocation and baseline may be adjusted. It will+-- be forced to a 1x1 minimum size, and the adjust_size_allocation virtual+-- and adjust_baseline_allocation methods on the child will be used to adjust+-- the allocation and baseline. Standard adjustments include removing the+-- widget's margins, and applying the widget’s 'widgetHAlign' and+-- 'widgetVAlign' properties.+--+-- If the child widget does not have a valign of AlignBaseline the baseline+-- argument is ignored and -1 is used instead.+--+widgetSizeAllocateWithBaseline :: WidgetClass self => self+ -> Allocation -- ^ The @x@ and @y@ values of the rectangle determine the+ -- the position of the widget's area relative to its parent+ -- allocation.+ -> Int -- ^ The baseline of the child, or -1+ -> IO ()+widgetSizeAllocateWithBaseline self rect baseline = with rect $ \rectPtr ->+ {#call widget_size_allocate_with_baseline#} (toWidget self) (castPtr rectPtr) (fromIntegral baseline)+#endif++-- %hash c:1e14 d:53c5+-- | Installs an accelerator for this @widget@ in @accelGroup@ that causes+-- @accelSignal@ to be emitted if the accelerator is activated. The+-- @accelGroup@ needs to be added to the widget's toplevel via+-- 'windowAddAccelGroup', and the signal must be of type @G_RUN_ACTION@.+-- Accelerators added through this function are not user changeable during+-- runtime. If you want to support accelerators that can be changed by the+-- user, use 'accelMapAddEntry' and 'widgetSetAccelPath' or+-- 'menuItemSetAccelPath' instead.+--+widgetAddAccelerator :: (WidgetClass self, GlibString string) => self+ -> string -- ^ @accelSignal@ - widget signal to emit on accelerator+ -- activation+ -> AccelGroup -- ^ @accelGroup@ - accel group for this widget, added to+ -- its toplevel+ -> KeyVal -- ^ @accelKey@ - the key of the accelerator+ -> [Modifier] -- ^ @accelMods@ - modifier key combination of the+ -- accelerator+ -> [AccelFlags] -- ^ @accelFlags@ - flag accelerators, e.g. 'AccelVisible'+ -> IO ()+widgetAddAccelerator self accelSignal accelGroup accelKey accelMods accelFlags =+ withUTFString accelSignal $ \accelSignalPtr ->+ {# call gtk_widget_add_accelerator #}+ (toWidget self)+ accelSignalPtr+ accelGroup+ (fromIntegral accelKey)+ ((fromIntegral . fromFlags) accelMods)+ ((fromIntegral . fromFlags) accelFlags)++-- %hash c:3442 d:dfe8+-- | Removes an accelerator from @widget@, previously installed with+-- 'widgetAddAccelerator'.+--+widgetRemoveAccelerator :: WidgetClass self => self+ -> AccelGroup -- ^ @accelGroup@ - accel group for this widget+ -> KeyVal -- ^ @accelKey@ - the key of the accelerator+ -> [Modifier] -- ^ @accelMods@ - modifier key combination of the+ -- accelerator+ -> IO Bool -- ^ returns whether an accelerator was installed and could+ -- be removed+widgetRemoveAccelerator self accelGroup accelKey accelMods =+ liftM toBool $+ {# call gtk_widget_remove_accelerator #}+ (toWidget self)+ accelGroup+ (fromIntegral accelKey)+ ((fromIntegral . fromFlags) accelMods)++-- %hash c:f8d4 d:bd7f+-- | Given an accelerator group, @accelGroup@, and an accelerator path,+-- @accelPath@, sets up an accelerator in @accelGroup@ so whenever the key+-- binding that is defined for @accelPath@ is pressed, @widget@ will be+-- activated. This removes any accelerators (for any accelerator group)+-- installed by previous calls to 'widgetSetAccelPath'. Associating+-- accelerators with paths allows them to be modified by the user and the+-- modifications to be saved for future use. (See 'accelMapSave'.)+--+-- This function is a low level function that would most likely be used by a+-- menu creation system like 'ItemFactory'. If you use 'ItemFactory', setting+-- up accelerator paths will be done automatically.+--+-- Even when you you aren't using 'ItemFactory', if you only want to set up+-- accelerators on menu items 'menuItemSetAccelPath' provides a somewhat more+-- convenient interface.+--+widgetSetAccelPath :: (WidgetClass self, GlibString string) => self+ -> string -- ^ @accelPath@ - path used to look up the accelerator+ -> AccelGroup -- ^ @accelGroup@ - a 'AccelGroup'.+ -> IO ()+widgetSetAccelPath self accelPath accelGroup =+ withUTFString accelPath $ \accelPathPtr ->+ {# call gtk_widget_set_accel_path #}+ (toWidget self)+ accelPathPtr+ accelGroup++#if GTK_CHECK_VERSION(2,4,0)+-- %hash c:157e d:82ae+-- | Determines whether an accelerator that activates the signal identified by+-- @signalId@ can currently be activated. This is done by emitting the+-- 'canActivateAccel' signal on the widget the signal is attached to; if the+-- signal isn't overridden by a handler or in a derived widget, then the+-- default check is that the widget must be sensitive, and the widget and all+-- its ancestors mapped.+--+-- * Available since Gtk+ version 2.4+--+widgetCanActivateAccel :: WidgetClass self =>+ (ConnectId self) -- ^ @signalId@ - the ID of a signal installed on @widget@+ -> IO Bool -- ^ returns @True@ if the accelerator can be activated.+widgetCanActivateAccel (ConnectId signalId self) =+ liftM toBool $+ {# call gtk_widget_can_activate_accel #}+ (toWidget self)+ (fromIntegral signalId)+#endif++-- | For widgets that can be \"activated\" (buttons, menu items, etc.) this+-- function activates them. Activation is what happens when you press Enter on+-- a widget during key navigation. If @widget@ isn't activatable, the function+-- returns @False@.+--+widgetActivate :: WidgetClass self => self+ -> IO Bool -- ^ returns @True@ if the widget was activatable+widgetActivate self =+ liftM toBool $+ {# call widget_activate #}+ (toWidget self)++-- | Computes the intersection of a widget's area and @area@, returning the+-- intersection, and returns @Nothing@ if there was no intersection.+--+widgetIntersect :: WidgetClass self => self+ -> Rectangle -- ^ @area@ - a rectangle+ -> IO (Maybe Rectangle) -- ^ returns the intersection or @Nothing@+widgetIntersect self area =+ with area $ \areaPtr ->+ alloca $ \intersectionPtr -> do+ hasIntersection <- {# call unsafe widget_intersect #}+ (toWidget self)+ (castPtr areaPtr)+ (castPtr intersectionPtr)+ if (toBool hasIntersection)+ then liftM Just $ peek intersectionPtr+ else return Nothing++-- | Check if the widget intersects with a given area.+--+widgetHasIntersection :: WidgetClass self => self+ -> Rectangle -- ^ @area@ - a rectangle+ -> IO Bool -- ^ returns @True@ if there was an intersection+widgetHasIntersection self area =+ liftM toBool $+ with area $ \areaPtr ->+ {# call unsafe widget_intersect #}+ (toWidget self)+ (castPtr areaPtr)+ (castPtr nullPtr)++-- %hash d:1cab+-- | Determines if the widget is the focus widget within its toplevel. (This+-- does not mean that the 'widgetHasFocus' attribute is necessarily set;+-- 'widgetHasFocus' will only be set if the toplevel widget additionally has+-- the global input focus.)+--+widgetGetIsFocus :: WidgetClass self => self+ -> IO Bool -- ^ returns @True@ if the widget is the focus widget.+widgetGetIsFocus self =+ liftM toBool $+ {# call unsafe widget_is_focus #}+ (toWidget self)++-- %hash d:e1e+-- | Causes @widget@ to have the keyboard focus for the 'Window' it's inside.+-- @widget@ must be a focusable widget, such as a+-- 'Graphics.UI.Gtk.Entry.Entry'; something like+-- 'Graphics.UI.Gtk.Ornaments.Frame' won't work. (More precisely, it must have+-- the 'widgetCanFocus' flag set.)+--+widgetGrabFocus :: WidgetClass self => self -> IO ()+widgetGrabFocus self =+ {# call widget_grab_focus #}+ (toWidget self)++-- %hash c:e5e9 d:412a+-- | Causes @widget@ to become the default widget. @widget@ must have the+-- 'canDefault' flag set. The default widget is+-- activated when the user presses Enter in a window. Default widgets must be+-- activatable, that is, 'widgetActivate' should affect them.+--+widgetGrabDefault :: WidgetClass self => self -> IO ()+widgetGrabDefault self =+ {# call gtk_widget_grab_default #}+ (toWidget self)++-- %hash c:4f62 d:d05a+-- | Widgets can be named, which allows you to refer to them from a gtkrc+-- file. You can apply a style to widgets with a particular name in the gtkrc+-- file. See the documentation for gtkrc files.+--+-- Note that widget names are separated by periods in paths (see+-- 'widgetPath'), so names with embedded periods may cause confusion.+--+widgetSetName :: (WidgetClass self, GlibString string) => self+ -> string -- ^ @name@ - name for the widget+ -> IO ()+widgetSetName self name =+ withUTFString name $ \namePtr ->+ {# call widget_set_name #}+ (toWidget self)+ namePtr++-- | Retrieves the name of a widget. See 'widgetSetName' for the significance+-- of widget names.+--+widgetGetName :: (WidgetClass self, GlibString string) => self -> IO string+widgetGetName self =+ {# call unsafe widget_get_name #}+ (toWidget self)+ >>= peekUTFString++-- %hash c:25b1 d:f898+-- | Sets the sensitivity of a widget. A widget is sensitive if the user can+-- interact with it. Insensitive widgets are \"grayed out\" and the user can't+-- interact with them. Insensitive widgets are known as \"inactive\",+-- \"disabled\", or \"ghosted\" in some other toolkits.+--+widgetSetSensitive :: WidgetClass self => self+ -> Bool -- ^ @sensitive@ - @True@ to make the widget sensitive+ -> IO ()+widgetSetSensitive self sensitive =+ {# call gtk_widget_set_sensitive #}+ (toWidget self)+ (fromBool sensitive)++-- bad spelling backwards compatibility definition+widgetSetSensitivity :: WidgetClass self => self -> Bool -> IO ()+widgetSetSensitivity = widgetSetSensitive++-- | Gets the widget's parent window.+--+widgetGetParentWindow :: WidgetClass self => self -> IO DrawWindow+widgetGetParentWindow self =+ makeNewGObject mkDrawWindow $+ {# call gtk_widget_get_parent_window #}+ (toWidget self)++-- | Disable event signals.+--+-- * Remove events from the 'EventMask' of this widget. The event mask+-- determines which events a widget will receive. Events are signals+-- that return an 'Event' data type. On connecting to a such a signal,+-- the event mask is automatically adjusted so that he signal is emitted.+-- This function is useful to disable the reception of the signal. It+-- should be called whenever all signals receiving an 'Event'+-- have been disconnected.+--+widgetDelEvents :: WidgetClass self => self -> [EventMask] -> IO ()+widgetDelEvents self events = do+ mask <- {#call unsafe widget_get_events#} (toWidget self)+ let mask' = mask .&. (complement (fromIntegral $ fromFlags events))+ {#call unsafe widget_set_events#} (toWidget self) mask'++-- | Enable event signals.+--+-- * See 'widgetDelEvents'.+--+widgetAddEvents :: WidgetClass self => self -> [EventMask] -> IO ()+widgetAddEvents self [] = return ()+ -- special [] case to work around a GTK+ bug, see:+ -- http://bugzilla.gnome.org/show_bug.cgi?id=316702+widgetAddEvents self events =+ {# call unsafe widget_add_events #}+ (toWidget self)+ (fromIntegral $ fromFlags events)++-- | Get enabled event signals.+--+-- * See 'widgetDelEvents'.+--+widgetGetEvents :: WidgetClass self => self -> IO [EventMask]+widgetGetEvents self =+ liftM (toFlags . fromIntegral) $+ {# call unsafe widget_get_events #}+ (toWidget self)++-- %hash c:468a d:49a0+-- | Sets the event mask (see 'EventMask') for a widget. The event mask+-- determines which events a widget will receive. Keep in mind that different+-- widgets have different default event masks, and by changing the event mask+-- you may disrupt a widget's functionality, so be careful. This function must+-- be called while a widget is unrealized. Consider 'widgetAddEvents' for+-- widgets that are already realized, or if you want to preserve the existing+-- event mask. This function can't be used with 'NoWindow' widgets; to get+-- events on those widgets, place them inside a+-- 'Graphics.UI.Gtk.Misc.EventBox' and receive events on the event box.+--+widgetSetEvents :: WidgetClass self => self+ -> [EventMask] -- ^ @events@ - event mask+ -> IO ()+widgetSetEvents self events =+ {# call unsafe widget_set_events #}+ (toWidget self)+ (fromIntegral $ fromFlags events)++#if GTK_MAJOR_VERSION < 3+-- %hash c:4f2c d:781+-- | Sets the extension events mask to @mode@. See 'ExtensionMode' and+-- 'inputSetExtensionEvents'.+--+widgetSetExtensionEvents :: WidgetClass self => self+ -> [ExtensionMode]+ -> IO ()+widgetSetExtensionEvents self mode =+ {# call widget_set_extension_events #}+ (toWidget self)+ ((fromIntegral . fromFlags) mode)++-- %hash c:c824 d:e611+-- | Retrieves the extension events the widget will receive; see+-- 'widgetSetExtensionEvents'.+--+widgetGetExtensionEvents :: WidgetClass self => self+ -> IO [ExtensionMode]+widgetGetExtensionEvents self =+ liftM (toFlags . fromIntegral) $+ {# call widget_get_extension_events #}+ (toWidget self)+#endif++-- %hash c:270b d:8877+-- | This function returns the topmost widget in the container hierarchy+-- @widget@ is a part of. If @widget@ has no parent widgets, it will be+-- returned as the topmost widget.+--+widgetGetToplevel :: WidgetClass self =>+ self -- ^ @widget@ - the widget in question+ -> IO Widget -- ^ returns the topmost ancestor of @widget@, or @widget@+ -- itself if there's no ancestor.+widgetGetToplevel self =+ makeNewObject mkWidget $+ {# call unsafe widget_get_toplevel #}+ (toWidget self)++-- %hash c:17bc d:f8f9+-- | Gets the first ancestor of @widget@ with type @widgetType@. For example,+-- @widgetGetAncestor widget gTypeBox@ gets the first 'Box' that's+-- an ancestor of @widget@. See note about checking for a toplevel+-- 'Window' in the docs for 'widgetGetToplevel'.+--+-- Note that unlike 'widgetIsAncestor', 'widgetGetAncestor' considers+-- @widget@ to be an ancestor of itself.+--+widgetGetAncestor :: WidgetClass self => self+ -> GType -- ^ @widgetType@ - ancestor type+ -> IO (Maybe Widget) -- ^ returns the ancestor widget, or @Nothing@ if not found+widgetGetAncestor self widgetType = do+ ptr <- {# call gtk_widget_get_ancestor #}+ (toWidget self)+ widgetType+ if ptr==nullPtr then return Nothing else+ liftM Just $ makeNewObject mkWidget (return ptr)++#if GTK_MAJOR_VERSION < 3+-- %hash c:bd95 d:eb94+-- | Gets the colormap that will be used to render @widget@.+--+widgetGetColormap :: WidgetClass self => self+ -> IO Colormap -- ^ returns the colormap used by @widget@+widgetGetColormap self =+ makeNewGObject mkColormap $+ {# call gtk_widget_get_colormap #}+ (toWidget self)++-- %hash c:cba1 d:ffeb+-- | Sets the colormap for the widget to the given value. Widget must not have+-- been previously realized. This probably should only be used from an 'init'+-- function (i.e. from the constructor for the widget).+--+widgetSetColormap :: WidgetClass self => self+ -> Colormap -- ^ @colormap@ - a colormap+ -> IO ()+widgetSetColormap self colormap =+ {# call gtk_widget_set_colormap #}+ (toWidget self)+ colormap+#endif++-- %hash c:3522 d:5637+-- | Obtains the location of the mouse pointer in widget coordinates. Widget+-- coordinates are a bit odd; for historical reasons, they are defined as+-- 'widgetGetParentWindow' coordinates for widgets that are not 'NoWindow' widgets,+-- and are relative to the widget's allocation's (x,y) for+-- widgets that are 'NoWindow' widgets.+--+widgetGetPointer :: WidgetClass self => self+ -> IO (Int, Int) -- ^ @(x, y)@ - X Y coordinate+widgetGetPointer self =+ alloca $ \xPtr ->+ alloca $ \yPtr ->+ {# call gtk_widget_get_pointer #}+ (toWidget self)+ xPtr+ yPtr+ >>+ peek xPtr >>= \x ->+ peek yPtr >>= \y ->+ return (fromIntegral x, fromIntegral y)++-- %hash c:499d+-- | Determines whether @widget@ is somewhere inside @ancestor@, possibly with+-- intermediate containers.+--+widgetIsAncestor :: (WidgetClass self, WidgetClass ancestor) =>+ self -- ^ @widget@ - the widget in question+ -> ancestor -- ^ @ancestor@ - another 'Widget'+ -> IO Bool -- ^ returns @True@ if @ancestor@ contains @widget@ as a child,+ -- grandchild, great grandchild, etc.+widgetIsAncestor self ancestor =+ liftM toBool $+ {# call unsafe widget_is_ancestor #}+ (toWidget self)+ (toWidget ancestor)++-- %hash c:8661+-- | Translate coordinates relative to @srcWidget@'s allocation to coordinates+-- relative to @destWidget@'s allocations. In order to perform this operation,+-- both widgets must be realized, and must share a common toplevel.+--+widgetTranslateCoordinates :: (WidgetClass self, WidgetClass destWidget) =>+ self -- ^ @srcWidget@ - a 'Widget'+ -> destWidget -- ^ @destWidget@ - a 'Widget'+ -> Int -- ^ @srcX@ - X position relative to @srcWidget@+ -> Int -- ^ @srcY@ - Y position relative to @srcWidget@+ -> IO (Maybe (Int, Int)) -- ^ @Just (destX, destY)@ - X and Y position+ -- relative to @destWidget@. Returns @Nothing@ if+ -- either widget was not realized, or there was no+ -- common ancestor.+widgetTranslateCoordinates self destWidget srcX srcY =+ alloca $ \destXPtr ->+ alloca $ \destYPtr -> do+ worked <- {# call gtk_widget_translate_coordinates #}+ (toWidget self)+ (toWidget destWidget)+ (fromIntegral srcX)+ (fromIntegral srcY)+ destXPtr+ destYPtr+ if (toBool worked)+ then do destX <- peek destXPtr+ destY <- peek destYPtr+ return (Just (fromIntegral destX, fromIntegral destY))+ else return Nothing++-- %hash c:596c d:b7e5+-- | Sets the 'Style' for a widget. You probably don't want+-- to use this function; it interacts badly with themes, because themes work by+-- replacing the 'Style'. Instead, use 'widgetModifyStyle'.+--+widgetSetStyle :: WidgetClass self => self+ -> Maybe Style -- ^ @style@ - a 'Style', or @Nothing@ to remove the effect of a previous+ -- 'widgetSetStyle' and go back to the default style+ -> IO ()+widgetSetStyle self style =+ {# call gtk_widget_set_style #}+ (toWidget self)+ (fromMaybe (Style nullForeignPtr) style)++-- | Retrieve the 'Style' associated with the widget.+--+widgetGetStyle :: WidgetClass widget => widget -> IO Style+widgetGetStyle widget = do+ {# call gtk_widget_ensure_style #} (toWidget widget)+ makeNewGObject mkStyle $ {# call gtk_widget_get_style #} (toWidget widget)++#if GTK_MAJOR_VERSION < 3+-- %hash c:d5ed d:dc10+-- | Pushes @cmap@ onto a global stack of colormaps; the topmost colormap on+-- the stack will be used to create all widgets. Remove @cmap@ with+-- 'widgetPopColormap'. There's little reason to use this function.+--+widgetPushColormap ::+ Colormap -- ^ @cmap@ - a 'Colormap'+ -> IO ()+widgetPushColormap cmap =+ {# call gtk_widget_push_colormap #}+ cmap++-- %hash c:7300 d:2920+-- | Removes a colormap pushed with 'widgetPushColormap'.+--+widgetPopColormap :: IO ()+widgetPopColormap =+ {# call gtk_widget_pop_colormap #}++-- %hash c:1f73 d:590e+-- | Sets the default colormap to use when creating widgets.+-- 'widgetPushColormap' is a better function to use if you only want to affect+-- a few widgets, rather than all widgets.+--+widgetSetDefaultColormap ::+ Colormap -- ^ @colormap@ - a 'Colormap'+ -> IO ()+widgetSetDefaultColormap colormap =+ {# call gtk_widget_set_default_colormap #}+ colormap+#endif++-- %hash c:e71b d:72c2+-- | Returns the default style used by all widgets initially.+--+widgetGetDefaultStyle ::+ IO Style -- ^ returns the default style. This 'Style' object is owned by+ -- Gtk and should not be modified.+widgetGetDefaultStyle =+ makeNewGObject mkStyle $+ {# call gtk_widget_get_default_style #}++#if GTK_MAJOR_VERSION < 3+-- %hash c:d731 d:52bf+-- | Obtains the default colormap used to create widgets.+--+widgetGetDefaultColormap ::+ IO Colormap -- ^ returns default widget colormap+widgetGetDefaultColormap =+ makeNewGObject mkColormap $+ {# call gtk_widget_get_default_colormap #}+#endif++-- | Sets the reading direction on a particular widget. This direction+-- controls the primary direction for widgets containing text, and also the+-- direction in which the children of a container are packed. The ability to+-- set the direction is present in order so that correct localization into+-- languages with right-to-left reading directions can be done. Generally,+-- applications will let the default reading direction present, except for+-- containers where the containers are arranged in an order that is explicitly+-- visual rather than logical (such as buttons for text justification).+--+-- If the direction is set to 'TextDirNone', then the value set by+-- 'widgetSetDefaultDirection' will be used.+--+widgetSetDirection :: WidgetClass self => self -> TextDirection -> IO ()+widgetSetDirection self dir =+ {# call widget_set_direction #}+ (toWidget self)+ ((fromIntegral . fromEnum) dir)++-- | Gets the reading direction for a particular widget. See+-- 'widgetSetDirection'.+--+widgetGetDirection :: WidgetClass self => self -> IO TextDirection+widgetGetDirection self =+ liftM (toEnum . fromIntegral) $+ {# call widget_get_direction #}+ (toWidget self)++-- %hash c:ff9a+-- | Sets the default reading direction for widgets where the direction has+-- not been explicitly set by 'widgetSetDirection'.+--+widgetSetDefaultDirection ::+ TextDirection -- ^ @dir@ - the new default direction. This cannot be+ -- 'TextDirNone'.+ -> IO ()+widgetSetDefaultDirection dir =+ {# call gtk_widget_set_default_direction #}+ ((fromIntegral . fromEnum) dir)++-- | Obtains the current default reading direction. See+-- 'widgetSetDefaultDirection'.+--+widgetGetDefaultDirection :: IO TextDirection+widgetGetDefaultDirection =+ liftM (toEnum . fromIntegral) $+ {# call gtk_widget_get_default_direction #}++#if GTK_MAJOR_VERSION < 3+-- %hash c:c7ba d:3a9c+-- | Sets a shape for this widget's 'DrawWindow'. This allows for transparent+-- windows etc., see 'windowShapeCombineMask' for more information.+--+widgetShapeCombineMask :: WidgetClass self => self+ -> Maybe Bitmap -- ^ @shapeMask@ - shape to be added, or @Nothint@ to remove an+ -- existing shape.+ -> Int -- ^ @offsetX@ - X position of shape mask with respect to @window@.+ -> Int -- ^ @offsetY@ - Y position of shape mask with respect to @window@.+ -> IO ()+widgetShapeCombineMask self shapeMask offsetX offsetY =+ case (fromMaybe (Pixmap nullForeignPtr) shapeMask) of+ Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr ->+ {# call gtk_widget_shape_combine_mask #}+ (toWidget self)+ (castPtr bitmapPtr)+ (fromIntegral offsetX)+ (fromIntegral offsetY)+#endif++#if GTK_MAJOR_VERSION < 3+#if GTK_CHECK_VERSION(2,10,0)+-- %hash c:3c29 d:68e2+-- | Sets an input shape for this widget's GDK window. This allows for windows+-- which react to mouse click in a nonrectangular region, see+-- 'windowInputShapeCombineMask' for more information.+--+-- * Available since Gtk+ version 2.10+--+widgetInputShapeCombineMask :: WidgetClass self => self+ -> Maybe Bitmap -- ^ @shapeMask@ - shape to be added, or @Nothint@ to remove an+ -- existing shape.+ -> Int -- ^ @offsetX@ - X position of shape mask with respect to @window@.+ -> Int -- ^ @offsetY@ - Y position of shape mask with respect to @window@.+ -> IO ()+widgetInputShapeCombineMask self shapeMask offsetX offsetY =+ case (fromMaybe (Pixmap nullForeignPtr) shapeMask) of+ Pixmap fPtr -> withForeignPtr fPtr $ \bitmapPtr ->+ {# call gtk_widget_input_shape_combine_mask #}+ (toWidget self)+ (castPtr bitmapPtr)+ (fromIntegral offsetX)+ (fromIntegral offsetY)+#endif+#endif++#if GTK_CHECK_VERSION(3,0,0)+-- | Sets a shape for this widget’s GDK window. This allows for transparent+-- windows etc., see 'drawWindowShapeCombineRegion' for more information.+widgetShapeCombineRegion :: WidgetClass self => self+ -> Maybe Region+ -> IO ()+widgetShapeCombineRegion self region =+ withRegion (fromMaybe (Region nullForeignPtr) region) $ \ptrRegion ->+ {# call gtk_widget_shape_combine_region #}+ (toWidget self)+ (castPtr ptrRegion)++-- | Sets an input shape for this widget’s GDK window. This allows for windows+-- which react to mouse click in a nonrectangular region,+-- see 'drawWindowInputShapeCombineRegion' for more information.+widgetInputShapeCombineRegion :: WidgetClass self => self+ -> Maybe Region+ -> IO ()+widgetInputShapeCombineRegion self region =+ withRegion (fromMaybe (Region nullForeignPtr) region) $ \ptrRegion ->+ {# call gtk_widget_input_shape_combine_region #}+ (toWidget self)+ (castPtr ptrRegion)+#endif++#if GTK_MAJOR_VERSION < 3+#if GTK_CHECK_VERSION(2,14,0)+-- | Create a 'Pixmap' of the contents of the widget and its children.+--+-- Works even if the widget is obscured. The depth and visual of the resulting pixmap is dependent on+-- the widget being snapshot and likely differs from those of a target widget displaying the+-- pixmap. The function 'pixbufGetFromDrawable' can be used to convert the pixmap to a visual+-- independent representation.+--+-- The snapshot area used by this function is the widget's allocation plus any extra space occupied by+-- additional windows belonging to this widget (such as the arrows of a spin button). Thus, the+-- resulting snapshot pixmap is possibly larger than the allocation.+--+-- The resulting pixmap is shrunken to match the specified @clipRect@. The+-- (x,y) coordinates of @clipRect@ are interpreted widget relative. If width or height of @clipRect@ are+-- 0 or negative, the width or height of the resulting pixmap will be shrunken by the respective+-- amount. For instance a @clipRect@ { +5, +5, -10, -10 } will chop off 5 pixels at each side of the+-- snapshot pixmap. @clipRect@ will contain the exact widget-relative snapshot coordinates+-- upon return. A @clipRect@ of { -1, -1, 0, 0 } can be used to preserve the auto-grown snapshot area+-- and use @clipRect@ as a pure output parameter.+--+-- The returned pixmap can be 'Nothing', if the resulting @clipArea@ was empty.+widgetGetSnapshot :: WidgetClass self => self+ -> Rectangle+ -> IO (Maybe Pixmap) -- ^ returns 'Pixmap' snapshot of the widget+widgetGetSnapshot widget clipRect =+ maybeNull (wrapNewGObject mkPixmap) $+ with clipRect $ \ clipRectPtr ->+ {#call gtk_widget_get_snapshot #}+ (toWidget widget)+ (castPtr clipRectPtr)+#endif+#endif++-- %hash c:7e36 d:616f+-- | Obtains the full path to @widget@. The path is simply the name of a+-- widget and all its parents in the container hierarchy, separated by periods.+-- The name of a widget comes from 'widgetGetName'. Paths are used to apply+-- styles to a widget in gtkrc configuration files. Widget names are the type+-- of the widget by default (e.g. \"GtkButton\") or can be set to an+-- application-specific value with 'widgetSetName'. By setting the name of a+-- widget, you allow users or theme authors to apply styles to that specific+-- widget in their gtkrc file. Also returns the path in reverse+-- order, i.e. starting with the widget's name instead of starting with the+-- name of the widget's outermost ancestor.+--+widgetPath :: (WidgetClass self, GlibString string) => self+ -> IO (Int, string, string) -- ^ @(pathLength, path, pathReversed)@ - length+ -- of the path, path string and reverse path+ -- string+widgetPath self =+ alloca $ \pathLengthPtr ->+ alloca $ \pathPtr ->+ alloca $ \pathReversedPtr ->+ {# call gtk_widget_path #}+ (toWidget self)+ pathLengthPtr+ pathPtr+ pathReversedPtr+ >>+ peek pathLengthPtr >>= \pathLength ->+ peek pathPtr >>= readUTFString >>= \path ->+ peek pathReversedPtr >>= readUTFString >>= \pathReversed ->+ return (fromIntegral pathLength, path, pathReversed)++-- %hash c:d4a6+-- | Same as 'widgetPath', but always uses the name of a widget's type, never+-- uses a custom name set with 'widgetSetName'.+--+widgetClassPath :: (WidgetClass self, GlibString string) => self+ -> IO (Int, string, string) -- ^ @(pathLength, path, pathReversed)@ - length+ -- of the path, path string and reverse path+ -- string+widgetClassPath self =+ alloca $ \pathLengthPtr ->+ alloca $ \pathPtr ->+ alloca $ \pathReversedPtr ->+ {# call gtk_widget_class_path #}+ (toWidget self)+ pathLengthPtr+ pathPtr+ pathReversedPtr+ >>+ peek pathLengthPtr >>= \pathLength ->+ peek pathPtr >>= readUTFString >>= \path ->+ peek pathReversedPtr >>= readUTFString >>= \pathReversed ->+ return (fromIntegral pathLength, path, pathReversed)++-- %hash c:769e+-- | Obtains the composite name of a widget.+--+widgetGetCompositeName :: (WidgetClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns the composite name of @widget@, or+ -- @Nothing@ if @widget@ is not a composite child.+widgetGetCompositeName self =+ {# call gtk_widget_get_composite_name #}+ (toWidget self)+ >>= maybePeek peekUTFString++#if GTK_CHECK_VERSION(3,0,0)+-- | Sets the background color to use for a widget.+--+-- All other style values are left untouched. See 'widgetOverrideColor'.+widgetOverrideBackgroundColor :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to set the background color.+ -> Maybe Color -- ^ @color@ - the color to assign, or Nothing to undo the+ -- effect of previous calls to 'widgetOverrideBackgroundColor'+ -> IO ()+widgetOverrideBackgroundColor self state color =+ maybeWith with color $ \colorPtr ->+ {# call widget_override_background_color #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ (castPtr colorPtr)++-- | Sets the color to use for a widget.+--+-- All other style values are left untouched.+--+-- This function does not act recursively. Setting the color of a container+-- does not affect its children. Note that some widgets that you may not think+-- of as containers, for instance 'Button's, are actually containers.+--+-- This API is mostly meant as a quick way for applications to change a+-- widget appearance. If you are developing a widgets library and intend this+-- change to be themeable, it is better done by setting meaningful CSS classes+-- and regions in your widget/container implementation through+-- 'styleContextAddClass' and 'styleContextAddRegion'.+--+-- This way, your widget library can install a 'CssProvider' with the+-- GTK_STYLE_PROVIDER_PRIORITY_FALLBACK priority in order to provide a default+-- styling for those widgets that need so, and this theming may fully overridden+-- by the user’s theme.+--+-- Note that for complex widgets this may bring in undesired results (such as+-- uniform background color everywhere), in these cases it is better to fully+-- style such widgets through a CssProvider with the+-- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION priority.+widgetOverrideColor :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to set the color.+ -> Maybe Color -- ^ @color@ - the color to assign, or @Nothing@ to undo the+ -- effect of previous calls to 'widgetOverrideColor'+ -> IO ()+widgetOverrideColor self state color =+ maybeWith with color $ \colorPtr ->+ {# call widget_override_color #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ (castPtr colorPtr)++-- | Sets the font to use for a widget. All other style values are left untouched.+-- See 'widgetOverrideColor'.+widgetOverrideFont :: WidgetClass self => self+ -> Maybe FontDescription -- ^ @fontDesc@ - the font description to use, or+ -- @Nothing@ to undo the effect of previous calls to+ -- 'widgetOverrideFont'.+ -> IO ()+widgetOverrideFont self fontDesc =+ {# call widget_override_font #}+ (toWidget self)+ (fromMaybe (FontDescription nullForeignPtr) fontDesc)++-- | Sets the symbolic color to use for a widget.+--+-- All other style values are left untouched. See 'widgetOverrideColor'.+widgetOverrideSymbolicColor :: (WidgetClass self, GlibString string) => self+ -> string -- ^ @name@ - the name of the symbolic color to modify.+ -> Maybe Color -- ^ @color@ - the color to assign, or @Nothing@ to undo the+ -- effect of previous calls to 'widgetOverrideSymbolicColor'+ -> IO ()+widgetOverrideSymbolicColor self name color =+ withUTFString name $ \namePtr ->+ maybeWith with color $ \colorPtr ->+ {# call widget_override_symbolic_color #}+ (toWidget self)+ namePtr+ (castPtr colorPtr)++-- | Sets the cursor color to use in a widget, overriding the cursor-color+-- and secondary-cursor-color style properties. All other style values are+-- left untouched. See also 'widgetModifyStyle'.+--+-- Note that the alpha values will be ignored.+widgetOverrideCursor :: WidgetClass self => self+ -> Maybe Color -- ^ @cursor@ - the color to use for primary cursor, or @Nothing@+ -- to undo the effect of previous calls to of 'widgetOverrideCursor'.+ -> Maybe Color -- ^ @secondaryCursor@ - the color to use for secondary cursor, or @Nothing@+ -- to undo the effect of previous calls to of 'widgetOverrideCursor'.+ -> IO ()+widgetOverrideCursor self cursor secondaryCursor =+ maybeWith with cursor $ \cursorPtr ->+ maybeWith with secondaryCursor $ \secondaryCursorPtr ->+ {# call widget_override_cursor #}+ (toWidget self)+ (castPtr cursorPtr)+ (castPtr secondaryCursorPtr)+#endif++-- | Modifies style values on the widget. Modifications made using this+-- technique take precedence over style values set via an RC file, however,+-- they will be overridden if a style is explicitly set on the widget using+-- 'widgetSetStyle'. The 'RcStyle' structure is designed so each field can+-- either be set or unset, so it is possible, using this function, to modify+-- some style values and leave the others unchanged.+--+-- Note that modifications made with this function are not cumulative with+-- previous calls to 'widgetModifyStyle' or with such functions as+-- 'widgetModifyFg'. If you wish to retain previous values, you must first call+-- 'widgetGetModifierStyle', make your modifications to the returned style,+-- then call 'widgetModifyStyle' with that style. On the other hand, if you+-- first call 'widgetModifyStyle', subsequent calls to such functions+-- 'widgetModifyFg' will have a cumulative effect with the initial+-- modifications.+--+widgetModifyStyle :: (WidgetClass self, RcStyleClass style) => self+ -> style -- ^ @style@ - the 'RcStyle' holding the style modifications+ -> IO ()+widgetModifyStyle self style =+ {# call gtk_widget_modify_style #}+ (toWidget self)+ (toRcStyle style)++-- | Returns the current modifier style for the widget. (As set by+-- 'widgetModifyStyle'.) If no style has previously set, a new 'RcStyle' will+-- be created with all values unset, and set as the modifier style for the+-- widget. If you make changes to this rc style, you must call+-- 'widgetModifyStyle', passing in the returned rc style, to make sure that+-- your changes take effect.+--+-- Caution: passing the style back to 'widgetModifyStyle' will normally end+-- up destroying it, because 'widgetModifyStyle' copies the passed-in style and+-- sets the copy as the new modifier style, thus dropping any reference to the+-- old modifier styl e. Add a reference to the modifier style if you want to+-- keep it alive.+--+widgetGetModifierStyle :: WidgetClass self => self -> IO RcStyle+widgetGetModifierStyle self =+ makeNewGObject mkRcStyle $+ {# call gtk_widget_get_modifier_style #}+ (toWidget self)++-- %hash c:5550+-- | Sets the foreground color for a widget in a particular state. All other+-- style values are left untouched. See also 'widgetModifyStyle'.+--+widgetModifyFg :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to set the foreground color.+ -> Color -- ^ @color@ - the color to assign (does not need to be+ -- allocated)+ -> IO ()+widgetModifyFg self state color =+ with color $ \colorPtr ->+ {# call gtk_widget_modify_fg #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ (castPtr colorPtr)++-- | Restores the foreground color for a widget in a particular state. This+-- undoes the effects of previous calls to `widgetModifyFg'.+--+widgetRestoreFg :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to restore the foreground color.+ -> IO ()+widgetRestoreFg self state =+ {# call gtk_widget_modify_fg #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ nullPtr++-- %hash c:2c5+-- | Sets the background color for a widget in a particular state. All other+-- style values are left untouched. See also 'widgetModifyStyle'.+--+-- Note that \"no window\" widgets (which have the 'NoWindow' flag set) draw+-- on their parent container's window and thus may not draw any background+-- themselves. This is the case for e.g. 'Label'. To modify the background of+-- such widgets, you have to set the background color on their parent; if you+-- want to set the background of a rectangular area around a label, try placing+-- the label in a 'EventBox' widget and setting the background color on that.+--+widgetModifyBg :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to set the background color.+ -> Color -- ^ @color@ - the color to assign (does not need to be+ -- allocated).+ -> IO ()+widgetModifyBg self state color =+ with color $ \colorPtr ->+ {# call gtk_widget_modify_bg #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ (castPtr colorPtr)++-- | Restores the background color for a widget in a particular state. This+-- undoes the effects of previous calls to `widgetModifyBg'.+--+widgetRestoreBg :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to restore the background color.+ -> IO ()+widgetRestoreBg self state =+ {# call gtk_widget_modify_bg #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ nullPtr++-- %hash c:d2ba+-- | Sets the text color for a widget in a particular state. All other style+-- values are left untouched. The text color is the foreground color used along+-- with the base color (see 'widgetModifyBase') for widgets such as 'Entry' and+-- 'TextView'. See also 'widgetModifyStyle'.+--+widgetModifyText :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to set the text color.+ -> Color -- ^ @color@ - the color to assign (does not need to be+ -- allocated).+ -> IO ()+widgetModifyText self state color =+ with color $ \colorPtr ->+ {# call gtk_widget_modify_text #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ (castPtr colorPtr)++-- | Restores the text color for a widget in a particular state. This+-- undoes the effects of previous calls to `widgetModifyText'.+--+widgetRestoreText :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to restore the text color.+ -> IO ()+widgetRestoreText self state =+ {# call gtk_widget_modify_text #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ nullPtr++-- %hash c:ac08+-- | Sets the base color for a widget in a particular state. All other style+-- values are left untouched. The base color is the background color used along+-- with the text color (see 'widgetModifyText') for widgets such as 'Entry' and+-- 'TextView'. See also 'widgetModifyStyle'.+--+-- Note that \"no window\" widgets (which have the 'NoWindow' flag set) draw+-- on their parent container's window and thus may not draw any background+-- themselves. This is the case for e.g. 'Label'. To modify the background of+-- such widgets, you have to set the base color on their parent; if you want to+-- set the background of a rectangular area around a label, try placing the+-- label in a 'EventBox' widget and setting the base color on that.+--+widgetModifyBase :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to set the base color.+ -> Color -- ^ @color@ - the color to assign (does not need to be+ -- allocated).+ -> IO ()+widgetModifyBase self state color =+ with color $ \colorPtr ->+ {# call gtk_widget_modify_base #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ (castPtr colorPtr)++-- | Restores the base color for a widget in a particular state. This undoes+-- the effects of previous calls to widgetModifyBase.+--+widgetRestoreBase :: WidgetClass self => self+ -> StateType -- ^ @state@ - the state for which to restore the base color.+ -> IO ()+widgetRestoreBase self state =+ {# call gtk_widget_modify_base #}+ (toWidget self)+ ((fromIntegral . fromEnum) state)+ nullPtr+++-- %hash c:38d7+-- | Sets the font to use for a widget. All other style values are left+-- untouched. See also 'widgetModifyStyle'.+--+widgetModifyFont :: WidgetClass self => self+ -> Maybe FontDescription -- ^ @fontDesc@ - the font description to use, or+ -- @Nothing@ to undo the effect of previous calls to+ -- 'widgetModifyFont'.+ -> IO ()+widgetModifyFont self fontDesc =+ {# call gtk_widget_modify_font #}+ (toWidget self)+ (fromMaybe (FontDescription nullForeignPtr) fontDesc)++-- | Creates a new 'PangoContext' with the appropriate colormap, font description,+-- and base direction for drawing text for this widget. See also+-- 'widgetGetPangoContext'.+--+widgetCreatePangoContext :: WidgetClass self => self+ -> IO PangoContext -- ^ returns the new 'PangoContext'+widgetCreatePangoContext self =+ wrapNewGObject mkPangoContext $+ {# call gtk_widget_create_pango_context #}+ (toWidget self)++-- | Gets a 'PangoContext' with the appropriate font description and base+-- direction for this widget. Unlike the context returned by+-- 'widgetCreatePangoContext', this context is owned by the widget (it can be+-- used until the screen for the widget changes or the widget is removed from+-- its toplevel), and will be updated to match any changes to the widget's+-- attributes.+--+-- If you create and keep a 'PangoLayout' using this context, you must deal+-- with changes to the context by calling+-- 'layoutContextChanged' on the layout+-- in response to the 'onStyleChanged' and 'onDirectionChanged' signals for the+-- widget.+--+widgetGetPangoContext :: WidgetClass self => self+ -> IO PangoContext -- ^ returns the 'PangoContext' for the widget.+widgetGetPangoContext self =+ makeNewGObject mkPangoContext $+ {# call gtk_widget_get_pango_context #}+ (toWidget self)++-- | Prepare text for display.+--+-- The 'PangoLayout' represents the rendered text. It can be shown on screen+-- by calling 'drawLayout'.+--+-- The returned 'PangoLayout' shares the same font information ('PangoContext') as this+-- widget. If this information changes, the 'PangoLayout' should change. The+-- following code ensures that the displayed text always reflects the widget's+-- settings:+--+-- > l <- widgetCreateLayout w "My Text."+-- > let update = do+-- > layoutContextChanged l+-- > -- update the Drawables which show this layout+-- > w `onDirectionChanged` update+-- > w `onStyleChanged` update+--+widgetCreateLayout :: (WidgetClass self, GlibString string) => self+ -> string -- ^ @text@ - text to set on the layout+ -> IO PangoLayout+widgetCreateLayout self text = do+ pl <- wrapNewGObject mkPangoLayoutRaw $+ withUTFString text $ \textPtr ->+ {# call unsafe widget_create_pango_layout #}+ (toWidget self)+ textPtr+ ps <- makeNewPangoString text+ psRef <- newIORef ps+ return (PangoLayout psRef pl)++-- %hash c:cee d:1d29+-- | A convenience function that uses the theme engine and RC file settings+-- for @widget@ to look up the stock icon and render it to a+-- 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf'.+-- The icon should be one of the stock id constants such as+-- 'Graphics.UI.Gtk.General.StockItems.stockOpen'. @size@ should be a+-- size such as 'Graphics.UI.Gtk.General.IconFactory.IconSizeMenu'.+-- @detail@ should be a string that identifies the+-- widget or code doing the rendering, so that theme engines can special-case+-- rendering for that widget or code.+--+-- The pixels in the returned 'Graphics.UI.Gtk.Gdk.Pixbuf.Pixbuf' are+-- shared with the rest of the+-- application and should not be modified.+--+widgetRenderIcon :: (WidgetClass self, GlibString string) => self+ -> string -- ^ @stockId@ - a stock ID+ -> IconSize -- ^ @size@ - a stock size+ -> string -- ^ @detail@ - render detail to pass to theme engine+ -> IO (Maybe Pixbuf) -- ^ returns a new pixbuf, or @Nothing@ if the stock ID+ -- wasn't known+widgetRenderIcon self stockId size detail =+ maybeNull (wrapNewGObject mkPixbuf) $+ withUTFString detail $ \detailPtr ->+ withUTFString stockId $ \stockIdPtr ->+ {# call gtk_widget_render_icon #}+ (toWidget self)+ stockIdPtr+ ((fromIntegral . fromEnum) size)+ detailPtr++-- %hash c:62f d:1863+-- | Invalidates the rectangular area of @widget@ defined by @x@, @y@, @width@+-- and @height@ by calling+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' on the widget's+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawWindow' and all its child windows. Once+-- the main loop becomes idle (after the current batch of events has been+-- processed, roughly), the window will receive expose events for the union of+-- all regions that have been invalidated.+--+-- Normally you would only use this function in widget implementations. In+-- particular, you might use it, or+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowInvalidateRect' directly, to+-- schedule a redraw of a 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawingArea' or some+-- portion thereof.+--+-- Frequently you can just call+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRect' or+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.windowInvalidateRegion' instead of this+-- function. Those functions will invalidate only a single window, instead of+-- the widget and all its children.+--+-- The advantage of adding to the invalidated region compared to simply+-- drawing immediately is efficiency; using an invalid region ensures that you+-- only have to redraw one time.+--+widgetQueueDrawArea :: WidgetClass self => self+ -> Int -- ^ @x@ - x coordinate of upper-left corner of rectangle to redraw+ -> Int -- ^ @y@ - y coordinate of upper-left corner of rectangle to redraw+ -> Int -- ^ @width@ - width of region to draw+ -> Int -- ^ @height@ - height of region to draw+ -> IO ()+widgetQueueDrawArea self x y width height =+ {# call gtk_widget_queue_draw_area #}+ (toWidget self)+ (fromIntegral x)+ (fromIntegral y)+ (fromIntegral width)+ (fromIntegral height)++#if GTK_CHECK_VERSION(3,0,0)+-- | Invalidates the area of widget defined by @region@ by calling+-- 'drawWindowInvalidateRegion' on the widget’s window and all its child+-- windows. Once the main loop becomes idle (after the current batch of+-- events has been processed, roughly), the window will receive expose events+-- for the union of all regions that have been invalidated.+--+-- Normally you would only use this function in widget implementations. You+-- might also use it to schedule a redraw of a DrawingArea or some portion+-- thereof.+widgetQueueDrawRegion :: WidgetClass self => self+ -> Region+ -> IO ()+widgetQueueDrawRegion self region =+ withRegion region $ \regionPtr ->+ {# call gtk_widget_queue_draw_region #}+ (toWidget self)+ (castPtr regionPtr)+#endif++#if GTK_MAJOR_VERSION < 3+-- %hash c:5ffb d:3e1a+-- | Recursively resets the shape on this widget and its descendants.+--+widgetResetShapes :: WidgetClass self => self -> IO ()+widgetResetShapes self =+ {# call gtk_widget_reset_shapes #}+ (toWidget self)+#endif++-- | Sets whether the application intends to draw on the widget in response+-- to an 'onExpose' signal.+--+-- * This is a hint to the widget and does not affect the behavior of the+-- GTK+ core; many widgets ignore this flag entirely. For widgets that do+-- pay attention to the flag, such as 'EventBox' and 'Window', the effect+-- is to suppress default themed drawing of the widget's background.+-- (Children of the widget will still be drawn.) The application is then+-- entirely responsible for drawing the widget background.+--+widgetSetAppPaintable :: WidgetClass self => self+ -> Bool -- ^ @appPaintable@ - @True@ if the application will paint on the+ -- widget+ -> IO ()+widgetSetAppPaintable self appPaintable =+ {# call widget_set_app_paintable #}+ (toWidget self)+ (fromBool appPaintable)++-- %hash c:89b2 d:e14d+-- | Widgets are double buffered by default; you can use this function to turn+-- off the buffering. \"Double buffered\" simply means that+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' and+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint' are called automatically+-- around expose events sent to the widget.+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaintRegion' diverts all+-- drawing to a widget's window to an offscreen buffer, and+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowEndPaint'+-- draws the buffer to the screen. The result is that users see the window+-- update in one smooth step, and don't see individual graphics primitives+-- being rendered.+--+-- In very simple terms, double buffered widgets don't flicker, so you would+-- only use this function to turn off double buffering if you had special needs+-- and really knew what you were doing.+--+-- Note: if you turn off double-buffering, you have to handle expose events,+-- since even the clearing to the background color or pixmap will not happen+-- automatically (as it is done in+-- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowBeginPaint').+--+widgetSetDoubleBuffered :: WidgetClass self => self+ -> Bool -- ^ @doubleBuffered@ - @True@ to double-buffer a widget+ -> IO ()+widgetSetDoubleBuffered self doubleBuffered =+ {# call gtk_widget_set_double_buffered #}+ (toWidget self)+ (fromBool doubleBuffered)++-- %hash c:d61 d:ac24+-- | Sets whether the entire widget is queued for drawing when its size+-- allocation changes. By default, this setting is @True@ and the entire widget+-- is redrawn on every size change. If your widget leaves the upper left+-- unchanged when made bigger, turning this setting on will improve+-- performance.+--+-- Note that for \"no window\" widgets setting this flag to @False@ turns off+-- all allocation on resizing: the widget will not even redraw if its position+-- changes; this is to allow containers that don't draw anything to avoid+-- excess invalidations. If you set this flag on a \"no window\" widget that+-- /does/ draw its window, you are responsible for invalidating both+-- the old and new allocation of the widget when the widget is moved and+-- responsible for invalidating regions newly when the widget increases size.+--+widgetSetRedrawOnAllocate :: WidgetClass self => self+ -> Bool -- ^ @redrawOnAllocate@ - if @True@, the entire widget will be+ -- redrawn when it is allocated to a new size. Otherwise, only the+ -- new portion of the widget will be redrawn.+ -> IO ()+widgetSetRedrawOnAllocate self redrawOnAllocate =+ {# call gtk_widget_set_redraw_on_allocate #}+ (toWidget self)+ (fromBool redrawOnAllocate)++-- | Sets a widgets composite name. A child widget of a container is+-- composite if it serves as an internal widget and, thus, is not+-- added by the user.+--+widgetSetCompositeName :: (WidgetClass self, GlibString string) => self+ -> string -- ^ @name@ - the name to set.+ -> IO ()+widgetSetCompositeName self name =+ withUTFString name $ \namePtr ->+ {# call gtk_widget_set_composite_name #}+ (toWidget self)+ namePtr++-- | Emits the “mnemonic-activate” signal.+--+-- The default handler for this signal activates the widget if groupCycling+-- is @False@, and just grabs the focus if @groupCycling@ is @True@.+widgetMnemonicActivate :: WidgetClass self => self+ -> Bool+ -> IO Bool+widgetMnemonicActivate self groupCycling =+ liftM toBool $+ {# call widget_mnemonic_activate #}+ (toWidget self)+ (fromBool groupCycling)++#if GTK_MAJOR_VERSION < 3+-- %hash c:5c58 d:6895+-- | For widgets that support scrolling, sets the scroll adjustments and+-- returns @True@. For widgets that don't support scrolling, does nothing and+-- returns @False@. Widgets that don't support scrolling can be scrolled by+-- placing them in a 'Viewport', which does support scrolling.+--+-- Removed in Gtk3.+widgetSetScrollAdjustments :: WidgetClass self => self+ -> Maybe Adjustment -- ^ @hadjustment@ - an adjustment for horizontal scrolling, or+ -- @Nothing@+ -> Maybe Adjustment -- ^ @vadjustment@ - an adjustment for vertical scrolling, or+ -- @Nothing@+ -> IO Bool -- ^ returns @True@ if the widget supports scrolling+widgetSetScrollAdjustments self hadjustment vadjustment =+ liftM toBool $+ {# call gtk_widget_set_scroll_adjustments #}+ (toWidget self)+ (fromMaybe (Adjustment nullForeignPtr) hadjustment)+ (fromMaybe (Adjustment nullForeignPtr) vadjustment)+#endif+++#if GTK_MAJOR_VERSION < 3+-- | Computes the intersection of a widget's area and @region@, returning+-- the intersection. The result may be empty, use+-- 'Graphics.UI.Gtk.Gdk.Region.regionEmpty' to check.+--+widgetRegionIntersect :: WidgetClass self => self+ -> Region -- ^ @region@ - a 'Region' in the same coordinate system as the+ -- widget's allocation. That is, relative to the widget's+ -- 'DrawWindow' for 'NoWindow' widgets; relative to the parent+ -- 'DrawWindow' of the widget's 'DrawWindow' for widgets with+ -- their own 'DrawWindow'.+ -> IO Region -- ^ returns A region holding the intersection of the widget and+ -- @region@. The coordinates of the return value are relative to+ -- the widget's 'DrawWindow', if it has one, otherwise+ -- it is relative to the parent's 'DrawWindow'.+widgetRegionIntersect self region = do+ intersectionPtr <- {# call gtk_widget_region_intersect #}+ (toWidget self)+ region+ makeNewRegion intersectionPtr+#endif++-- %hash c:3c94 d:cdb6+-- | Returns the accessible object that describes the widget to an assistive+-- technology.+--+-- If no accessibility library is loaded (i.e. no ATK implementation library+-- is loaded via GTK_MODULES or via another application library, such as+-- libgnome), then this 'Object' instance may be a no-op. Likewise, if no+-- class-specific 'Object' implementation is available for the widget instance+-- in question, it will inherit an 'Object' implementation from the first+-- ancestor class for which such an implementation is defined.+--+-- The documentation of the ATK library contains more information about+-- accessible objects and their uses.+--+-- Returns a GObject in Gtk3.+widgetGetAccessible :: WidgetClass self => self+#if GTK_MAJOR_VERSION < 3+ -> IO Object -- ^ returns the 'Object' associated with @widget@+#else+ -> IO GObject -- ^ returns the 'GObject' associated with @widget@+#endif+widgetGetAccessible self =+#if GTK_MAJOR_VERSION < 3+ makeNewGObject mkObject $+#else+ makeNewGObject mkGObject $+#endif+ liftM castPtr $+ {# call gtk_widget_get_accessible #}+ (toWidget self)++-- %hash c:713d d:c4fc+-- | This function is used by custom widget implementations; if you\'re+-- writing an app, you\'d use 'widgetGrabFocus' to move the focus to a+-- particular widget, and 'containerSetFocusChain' to change the focus tab+-- order. So you may want to investigate those functions instead.+--+-- The \"focus\" default handler for a widget should return @True@ if moving+-- in @direction@ left the focus on a focusable location inside that widget,+-- and @False@ if moving in @direction@ moved the focus outside the widget. If+-- returning @True@, widgets normally call 'widgetGrabFocus' to place the focus+-- accordingly; if returning @False@, they don't modify the current focus+-- location.+--+widgetChildFocus :: WidgetClass self => self+ -> DirectionType -- ^ @direction@ - direction of focus movement+ -> IO Bool -- ^ returns @True@ if focus ended up inside @widget@+widgetChildFocus self direction =+ liftM toBool $+ {# call gtk_widget_child_focus #}+ (toWidget self)+ ((fromIntegral . fromEnum) direction)++-- %hash c:de20 d:5300+-- | Gets the value set with 'widgetSetChildVisible'. If you feel a need to+-- use this function, your code probably needs reorganization.+--+-- This function is only useful for container implementations and never+-- should be called by an application.+--+widgetGetChildVisible :: WidgetClass self => self+ -> IO Bool -- ^ returns @True@ if the widget is mapped with the parent.+widgetGetChildVisible self =+ liftM toBool $+ {# call gtk_widget_get_child_visible #}+ (toWidget self)++-- %hash c:9320 d:367+-- | Returns the parent container of @widget@.+--+-- * Returns the parent container of @widget@ if it has one.+--+widgetGetParent :: WidgetClass self => self+ -> IO (Maybe Widget)+widgetGetParent self = do+ parentPtr <- {# call gtk_widget_get_parent #} (toWidget self)+ if parentPtr==nullPtr then return Nothing else+ liftM Just $ makeNewObject mkWidget (return parentPtr)++-- %hash c:85e3 d:a962+-- | Gets the settings object holding the settings (global property settings,+-- RC file information, etc) used for this widget.+--+-- Note that this function can only be called when the 'Widget' is attached+-- to a toplevel, since the settings object is specific to a particular+-- 'Screen'.+--+widgetGetSettings :: WidgetClass self => self+ -> IO Settings -- ^ returns the relevant 'Settings' object+widgetGetSettings self =+ makeNewGObject mkSettings $+ {# call gtk_widget_get_settings #}+ (toWidget self)++#if GTK_CHECK_VERSION(2,2,0)++-- | Returns the clipboard object for the given selection to+-- be used with widget. widget must have a 'Display'+-- associated with it, so must be attached to a toplevel+-- window.+widgetGetClipboard :: WidgetClass self => self+ -> SelectionTag -- ^ @selection@ a 'Atom' which identifies the clipboard+ -- to use. 'selectionClipboard' gives the+ -- default clipboard. Another common value+ -- is 'selectionPrimary', which gives+ -- the primary X selection.+ -> IO Clipboard -- ^ returns the appropriate clipboard object. If no+ -- clipboard already exists, a new one will+ -- be created.+widgetGetClipboard self (Atom tagPtr) =+ makeNewGObject mkClipboard $+ {#call gtk_widget_get_clipboard #}+ (toWidget self)+ tagPtr++-- %hash c:45ed d:52ef+-- | Get the 'Display' for the toplevel window associated with this widget.+-- This function can only be called after the widget has been added to a widget+-- hierarchy with a 'Window' at the top.+--+-- In general, you should only create display specific resources when a+-- widget has been realized, and you should free those resources when the+-- widget is unrealized.+--+-- * Available since Gtk+ version 2.2+--+widgetGetDisplay :: WidgetClass self => self+ -> IO Display -- ^ returns the 'Display' for the toplevel for this widget.+widgetGetDisplay self =+ makeNewGObject mkDisplay $+ {# call gtk_widget_get_display #}+ (toWidget self)++-- %hash c:8e4e d:252b+-- | Get the root window where this widget is located. This function can only+-- be called after the widget has been added to a widget hierarchy with+-- 'Window' at the top.+--+-- The root window is useful for such purposes as creating a popup+-- 'DrawWindow' associated with the window. In general, you should only create+-- display specific resources when a widget has been realized, and you should+-- free those resources when the widget is unrealized.+--+-- * Available since Gtk+ version 2.2+--+widgetGetRootWindow :: WidgetClass self => self+ -> IO DrawWindow -- ^ returns the 'DrawWindow' root window for the toplevel+ -- for this widget.+widgetGetRootWindow self =+ makeNewGObject mkDrawWindow $+ {# call gtk_widget_get_root_window #}+ (toWidget self)++-- %hash c:b929 d:67f0+-- | Get the 'Screen' from the toplevel window associated with this widget.+-- This function can only be called after the widget has been added to a widget+-- hierarchy with a 'Window' at the top.+--+-- In general, you should only create screen specific resources when a+-- widget has been realized, and you should free those resources when the+-- widget is unrealized.+--+-- * Available since Gtk+ version 2.2+--+widgetGetScreen :: WidgetClass self => self+ -> IO Screen -- ^ returns the 'Screen' for the toplevel for this widget.+widgetGetScreen self =+ makeNewGObject mkScreen $+ {# call gtk_widget_get_screen #}+ (toWidget self)++-- %hash c:4fab d:aae2+-- | Checks whether there is a 'Screen' is associated with this widget. All+-- toplevel widgets have an associated screen, and all widgets added into a+-- hierarchy with a toplevel window at the top.+--+-- * Available since Gtk+ version 2.2+--+widgetHasScreen :: WidgetClass self => self+ -> IO Bool -- ^ returns @True@ if there is a 'Screen' associated with the+ -- widget.+widgetHasScreen self =+ liftM toBool $+ {# call gtk_widget_has_screen #}+ (toWidget self)+#endif++-- %hash c:dabc d:8275+-- | Gets the size request that was explicitly set for the widget using+-- 'widgetSetSizeRequest'. A value of -1 for @width@ or @height@+-- indicates that that dimension has not been set explicitly and the natural+-- requisition of the widget will be used instead. See 'widgetSetSizeRequest'.+-- To get the size a widget will actually use, call 'widgetSizeRequest' instead+-- of this function.+--+widgetGetSizeRequest :: WidgetClass self => self+ -> IO (Int, Int) -- ^ @(width, height)@+widgetGetSizeRequest self =+ alloca $ \widthPtr ->+ alloca $ \heightPtr -> do+ {# call gtk_widget_get_size_request #}+ (toWidget self)+ widthPtr+ heightPtr+ width <- peek widthPtr+ height <- peek heightPtr+ return (fromIntegral width, fromIntegral height)++#if GTK_CHECK_VERSION(3,0,0)+-- | Retrieves the minimum and natural size of a widget, taking into account the+-- widget’s preference for height-for-width management.+--+-- This is used to retrieve a suitable size by container widgets which do not+-- impose any restrictions on the child placement. It can be used to deduce+-- toplevel window and menu sizes as well as child widgets in free-form containers+-- such as GtkLayout.+--+-- Handle with care. Note that the natural height of a height-for-width widget+-- will generally be a smaller size than the minimum height, since the required+-- height for the natural width is generally smaller than the required height for+-- the minimum width.+--+-- Use gtk_widget_get_preferred_height_and_baseline_for_width() if you want+-- to support baseline alignment.+--+-- * Available since Gtk+ version 3.0+--++widgetGetPreferredSize :: WidgetClass self => self+ -> IO (Requisition, Requisition) -- ^ @(minimumSize, naturalSize)@+widgetGetPreferredSize self =+ alloca $ \minReqPtr ->+ alloca $ \natReqPtr -> do+ {#call gtk_widget_get_preferred_size #} (toWidget self) (castPtr minReqPtr) (castPtr natReqPtr)+ min <- peek minReqPtr+ nat <- peek natReqPtr+ return (min, nat)+#endif++-- %hash c:546d d:3c7f+-- | Sets whether @widget@ should be mapped along with its when its parent is+-- mapped and @widget@ has been shown with 'widgetShow'.+--+-- The child visibility can be set for widget before it is added to a+-- container with 'widgetSetParent', to avoid mapping children unnecessary+-- before immediately unmapping them. However it will be reset to its default+-- state of @True@ when the widget is removed from a container.+--+-- Note that changing the child visibility of a widget does not queue a+-- resize on the widget. Most of the time, the size of a widget is computed+-- from all visible children, whether or not they are mapped. If this is not+-- the case, the container can queue a resize itself.+--+-- This function is only useful for container implementations and never+-- should be called by an application.+--+widgetSetChildVisible :: WidgetClass self => self+ -> Bool -- ^ @isVisible@ - if @True@, @widget@ should be mapped along with+ -- its parent.+ -> IO ()+widgetSetChildVisible self isVisible =+ {# call gtk_widget_set_child_visible #}+ (toWidget self)+ (fromBool isVisible)++-- | Sets the minimum size of a widget; that is, the widget's size request+-- will be @width@ by @height@. You can use this function to force a widget to+-- be either larger or smaller than it normally would be.+--+-- In most cases, 'Graphics.UI.Gtk.Windows.Window.windowSetDefaultSize'+-- is a better choice for toplevel+-- windows than this function; setting the default size will still allow users+-- to shrink the window. Setting the size request will force them to leave the+-- window at least as large as the size request. When dealing with window+-- sizes, 'Graphics.UI.Gtk.Windows.Window.windowSetGeometryHints' can be a+-- useful function as well.+--+-- Note the inherent danger of setting any fixed size - themes, translations+-- into other languages, different fonts, and user action can all change the+-- appropriate size for a given widget. So, it's basically impossible to+-- hardcode a size that will always be correct.+--+-- The size request of a widget is the smallest size a widget can accept+-- while still functioning well and drawing itself correctly. However in some+-- strange cases a widget may be allocated less than its requested size, and in+-- many cases a widget may be allocated more space than it requested.+--+-- If the size request in a given direction is -1 (unset), then the+-- \"natural\" size request of the widget will be used instead.+--+-- Widgets can't actually be allocated a size less than 1 by 1, but you can+-- pass 0,0 to this function to mean \"as small as possible.\"+--+widgetSetSizeRequest :: WidgetClass self => self+ -> Int -- ^ @width@ - width @widget@ should request, or -1 to unset+ -> Int -- ^ @height@ - height @widget@ should request, or -1 to unset+ -> IO ()+widgetSetSizeRequest self width height =+ {# call widget_set_size_request #}+ (toWidget self)+ (fromIntegral width)+ (fromIntegral height)++#if GTK_CHECK_VERSION(2,4,0)+-- %hash c:83c3 d:e6f1+-- | Sets the 'noShowAll' property, which determines whether calls to+-- 'widgetShowAll' and 'widgetHideAll' will affect this widget.+--+-- This is mostly for use in constructing widget hierarchies with externally+-- controlled visibility, see 'UIManager'.+--+-- * Available since Gtk+ version 2.4+--+widgetSetNoShowAll :: WidgetClass self => self+ -> Bool -- ^ @noShowAll@ - the new value for the 'noShowAll' property+ -> IO ()+widgetSetNoShowAll self noShowAll =+ {# call gtk_widget_set_no_show_all #}+ (toWidget self)+ (fromBool noShowAll)++-- %hash c:218d d:e07e+-- | Returns the current value of the 'noShowAll' property, which+-- determines whether calls to 'widgetShowAll' and 'widgetHideAll' will affect+-- this widget.+--+-- * Available since Gtk+ version 2.4+--+widgetGetNoShowAll :: WidgetClass self => self+ -> IO Bool -- ^ returns the current value of the \"no_show_all\" property.+widgetGetNoShowAll self =+ liftM toBool $+ {# call gtk_widget_get_no_show_all #}+ (toWidget self)++-- %hash c:205b d:c518+-- | Returns a list of the widgets, normally labels, for which+-- this widget is a the target of a mnemonic (see for example,+-- 'labelSetMnemonicWidget').+--+-- * Available since Gtk+ version 2.4+--+widgetListMnemonicLabels :: WidgetClass self => self+ -> IO [Widget] -- ^ returns the list of mnemonic labels+widgetListMnemonicLabels self =+ {# call gtk_widget_list_mnemonic_labels #}+ (toWidget self)+ >>= fromGList+ >>= mapM (makeNewGObject mkWidget . return)++-- %hash c:eb76 d:28a2+-- | Adds a widget to the list of mnemonic labels for this widget. (See+-- 'widgetListMnemonicLabels'). Note the list of mnemonic labels for the widget+-- is cleared when the widget is destroyed, so the caller must make sure to+-- update its internal state at this point as well, by using a connection to+-- the 'destroy' signal or a weak notifier.+--+-- * Available since Gtk+ version 2.4+--+widgetAddMnemonicLabel :: (WidgetClass self, WidgetClass label) => self+ -> label -- ^ @label@ - a 'Widget' that acts as a mnemonic label for+ -- @widget@.+ -> IO ()+widgetAddMnemonicLabel self label =+ {# call gtk_widget_add_mnemonic_label #}+ (toWidget self)+ (toWidget label)++-- %hash c:7831 d:d10b+-- | Removes a widget from the list of mnemonic labels for this widget. (See+-- 'widgetListMnemonicLabels'). The widget must have previously been added to+-- the list with 'widgetAddMnemonicLabel'.+--+-- * Available since Gtk+ version 2.4+--+widgetRemoveMnemonicLabel :: (WidgetClass self, WidgetClass label) => self+ -> label -- ^ @label@ - a 'Widget' that was previously set as a mnemnic label+ -- for @widget@ with 'widgetAddMnemonicLabel'.+ -> IO ()+widgetRemoveMnemonicLabel self label =+ {# call gtk_widget_remove_mnemonic_label #}+ (toWidget self)+ (toWidget label)++#if GTK_CHECK_VERSION(2,10,0)+#if GTK_MAJOR_VERSION < 3+-- %hash c:5c70 d:cbf9+-- | Returns the 'Action' that @widget@ is a proxy for. See also+-- 'actionGetProxies'.+--+-- * Available since Gtk+ version 2.10+--+-- Removed in Gtk3.+widgetGetAction :: WidgetClass self => self+ -> IO (Maybe Action)+ -- ^ returns the action that a widget is a proxy for, or+ -- @Nothing@, if it is not attached to an action.+widgetGetAction self = do+ ptr <- {# call gtk_widget_get_action #} (toWidget self)+ if ptr==nullPtr then return Nothing else liftM Just $+ makeNewGObject mkAction (return ptr)+#endif++-- %hash c:7ea0 d:2560+-- | Whether @widget@ can rely on having its alpha channel drawn correctly. On+-- X11 this function returns whether a compositing manager is running for+-- @widget@'s screen+--+-- * Available since Gtk+ version 2.10+--+widgetIsComposited :: WidgetClass self => self+ -> IO Bool -- ^ returns @True@ if the widget can rely on its alpha channel+ -- being drawn correctly.+widgetIsComposited self =+ liftM toBool $+ {# call gtk_widget_is_composited #}+ (toWidget self)+#endif+#endif++#if GTK_CHECK_VERSION(2,12,0)+-- | Notifies the user about an input-related error on this widget.+-- If the "gtk-error-bell" setting is @True@, it calls 'drawWindowBeep',+-- otherwise it does nothing.+--+-- Note that the effect of 'drawWindow_beep' can be configured in many+-- ways, depending on the windowing backend and the desktop environment+-- or window manager that is used.+widgetErrorBell :: WidgetClass self => self+ -> IO ()+widgetErrorBell self =+ {# call widget_error_bell #}+ (toWidget self)++-- | This function should be called whenever keyboard navigation within+-- a single widget hits a boundary. The function emits the "keynav-failed"+-- signal on the widget and its return value should be interpreted in a+-- way similar to the return value of 'widgetChildFocus':+--+-- When @True@ is returned, stay in the widget, the failed keyboard+-- navigation is Ok and/or there is nowhere we can/should move the+-- focus to.+--+-- When @False@ is returned, the caller should continue with keyboard+-- navigation outside the widget, e.g. by calling 'widgetChildFocus' on+-- the widget’s toplevel.+--+-- The default ::keynav-failed handler returns @True@ for 'DirTabForward'+-- and 'DirTabBackward'. For the other values of 'DirectionType' it+-- returns @False@.+--+-- Whenever the default handler returns @True@, it also calls+-- 'widgetErrorBell' to notify the user of the failed keyboard+-- navigation.+--+-- A use case for providing an own implementation of ::keynav-failed+-- (either by connecting to it or by overriding it) would be a row of+-- 'Entry' widgets where the user should be able to navigate the entire+-- row with the cursor keys, as e.g. known from user interfaces that+-- require entering license keys.+widgetKeynavFailed :: WidgetClass self => self+ -> DirectionType -- ^ @direction@ - direction of focus movement+ -> IO Bool -- ^ returns @True@ if stopping keyboard navigation is+ -- fine, @False@ if the emitting widget should try to handle+ -- the keyboard navigation attempt in its parent container(s).+widgetKeynavFailed self direction =+ liftM toBool $+ {# call widget_keynav_failed #}+ (toWidget self)+ ((fromIntegral . fromEnum) direction)++-- | Gets the contents of the tooltip for widget.+widgetGetTooltipMarkup :: (WidgetClass self, GlibString markup) => self+ -> IO (Maybe markup) -- Returns the tooltip text, or Nothing.+widgetGetTooltipMarkup self =+ {# call widget_get_tooltip_markup #}+ (toWidget self)+ >>= maybePeek peekUTFString++-- | Sets @markup@ as the contents of the tooltip, which is marked up with the+-- Pango text markup language.+--+-- This function will take care of setting "has-tooltip" to True and of the+-- default handler for the "query-tooltip" signal.+--+-- See also the "tooltip-markup" property and 'tooltipSetMarkup'.+widgetSetTooltipMarkup :: (WidgetClass self, GlibString markup) => self+ -> Maybe markup -- ^ the contents of the tooltip for widget, or @Nothing@.+ -> IO ()+widgetSetTooltipMarkup self markup =+ maybeWith withUTFString markup $ \ markupPtr ->+ {# call widget_set_tooltip_markup #}+ (toWidget self)+ markupPtr++-- | Gets the contents of the tooltip for widget.+widgetGetTooltipText :: (WidgetClass self, GlibString text) => self+ -> IO (Maybe text) -- Returns the tooltip text, or Nothing.+widgetGetTooltipText self =+ {# call widget_get_tooltip_text #}+ (toWidget self)+ >>= maybePeek peekUTFString++-- | Sets @text@ as the contents of the tooltip. This function will take care+-- of setting "has-tooltip" to @True@ and of the default handler for the+-- "query-tooltip" signal.+--+-- See also the "tooltip-text" property and 'tooltipSetText'.+widgetSetTooltipText :: (WidgetClass widget, GlibString text) => widget+ -> Maybe text -- ^ the contents of the tooltip for widget, or @Nothing@.+ -> IO ()+widgetSetTooltipText widget text =+ maybeWith withUTFString text $ \ textPtr ->+ {# call widget_set_tooltip_text #}+ (toWidget widget)+ textPtr++-- | Returns the 'Window' of the current tooltip. This can be the 'Window' created by default, or the+-- custom tooltip window set using 'widgetSetTooltipWindow'.+--+-- * Available since Gtk+ version 2.12+--+widgetGetTooltipWindow :: WidgetClass self => self+ -> IO Window -- ^ returns The 'Window' of the current tooltip+widgetGetTooltipWindow self =+ makeNewObject mkWindow $+ {# call gtk_widget_get_tooltip_window #}+ (toWidget self)++-- | Replaces the default, usually yellow, window used for displaying tooltips with @customWindow@. GTK++-- will take care of showing and hiding @customWindow@ at the right moment, to behave likewise as the+-- default tooltip window. If @customWindow@ is 'Nothing', the default tooltip window will be used.+--+-- If the custom window should have the default theming it needs to have the name 'gtk-tooltip', see+-- 'widgetSetName'.+--+-- * Available since Gtk+ version 2.12+--+widgetSetTooltipWindow :: (WidgetClass self, WindowClass customWindow) => self+ -> Maybe customWindow -- ^ @customWindow@ a 'Window', or 'Nothing'. allow-none.+ -> IO ()+widgetSetTooltipWindow self customWindow =+ {# call gtk_widget_set_tooltip_window #}+ (toWidget self)+ (maybe (Window nullForeignPtr) toWindow customWindow)++-- | Returns the current value of the has-tooltip property.+-- See 'widgetHasTooltip' for more information.+widgetGetHasTooltip :: WidgetClass widget => widget+ -> IO Bool -- ^ current value of 'widgetHasTooltip' on @widget@.+widgetGetHasTooltip widget =+ liftM toBool $+ {# call widget_get_has_tooltip #}+ (toWidget widget)++-- | Sets the has-tooltip property on @widget@ to @hasTooltip@.+-- See 'widgetHasTooltip' for more information.+widgetSetHasTooltip :: WidgetClass widget => widget+ -> Bool -- ^ @hasTooltip@ whether or not @widget@ has a tooltip.+ -> IO ()+widgetSetHasTooltip widget hasTooltip =+ {# call widget_set_has_tooltip #}+ (toWidget widget)+ (fromBool hasTooltip)++-- | Triggers a tooltip query on the display where the toplevel of @widget@ is+-- located. See 'tooltipTriggerTooltipQuery' for more information.+--+-- * Available since Gtk+ version 2.12+--+widgetTriggerTooltipQuery :: WidgetClass self => self -> IO ()+widgetTriggerTooltipQuery self =+ {# call gtk_widget_trigger_tooltip_query #}+ (toWidget self)+#endif++#if GTK_CHECK_VERSION(2,14,0)+-- | Returns the widget's window if it is realized, Nothing otherwise+--+-- * Available since Gtk+ version 2.14+--+widgetGetWindow :: WidgetClass self => self -> IO (Maybe DrawWindow)+widgetGetWindow self =+ maybeNull (makeNewGObject mkDrawWindow) $+ {# call gtk_widget_get_window #}+ (toWidget self)+#endif++#if GTK_CHECK_VERSION(3,8,0)+-- | Registers a 'DrawWindow' with the widget and sets it up so that the+-- widget receives events for it. Call 'widgetUnregisterWindow' when+-- destroying the window.+widgetRegisterWindow :: (WidgetClass widget, DrawWindowClass window) => widget+ -> window+ -> IO ()+widgetRegisterWindow widget window =+ {# call widget_register_window #}+ (toWidget widget)+ (toDrawWindow window)++-- | Unregisters a 'DrawWindow' from the widget that was previously set up+-- with 'widgetRegisterWindow'. You need to call this when the window is no+-- longer used by the widget, such as when you destroy it.+widgetUnregisterWindow :: (WidgetClass widget, DrawWindowClass window) => widget+ -> window+ -> IO ()+widgetUnregisterWindow widget window =+ {# call widget_unregister_window #}+ (toWidget widget)+ (toDrawWindow window)+#endif++#if GTK_CHECK_VERSION(3,0,0)+-- | This function is supposed to be called in "draw" implementations for+-- widgets that support multiple windows. @cr@ must be untransformed from+-- invoking of the draw function. This function will return @True@ if the+-- contents of the given @window@ are supposed to be drawn and @False@+-- otherwise. Note that when the drawing was not initiated by the windowing+-- system this function will return @True@ for all windows, so you need to+-- draw the bottommost window first. Also, do not use “else if” statements to+-- check which window should be drawn.+cairoShouldDrawWindow :: DrawWindowClass window+ => Cairo -- ^ @cr@ a cairo context+ -> window -- ^ @window@ the window to check. @window@ may not be an input-only window.+ -> IO Bool+cairoShouldDrawWindow cr window =+ liftM toBool $+ {# call cairo_should_draw_window #}+ (castPtr $ unCairo cr)+ (toDrawWindow window)++-- | Transforms the given cairo context @cr@ that from @widget@-relative+-- coordinates to @window@-relative coordinates. If the @widget@’s window is+-- not an ancestor of @window@, no modification will be applied.+--+-- This is the inverse to the transformation GTK applies when preparing an+-- expose event to be emitted with the “draw” signal. It is intended to help+-- porting multiwindow widgets from GTK+ 2 to the rendering architecture of+-- GTK+ 3.+cairoTransformToWindow :: (WidgetClass widget, DrawWindowClass window)+ => Cairo -- ^ @cr@ the cairo context to transform+ -> widget -- ^ @widget@ the widget the context is currently centered for+ -> window -- ^ @window@ the window to transform the context to+ -> IO ()+cairoTransformToWindow cr widget window =+ {# call gtk_cairo_transform_to_window #}+ (castPtr $ unCairo cr)+ (toWidget widget)+ (toDrawWindow window)+#endif++-- | Moves a widget from one 'Container' to another.+--+widgetReparent :: (WidgetClass self, WidgetClass newParent) => self+ -> newParent -- ^ @newParent@ - a 'Container' to move the widget into+ -> IO ()+widgetReparent self newParent =+ {# call widget_reparent #}+ (toWidget self)+ (toWidget newParent)++#if GTK_CHECK_VERSION(2,18,0)+-- | Set if this widget can receive keyboard input.+--+-- * To use the 'keyPress' event, the widget must be allowed+-- to get the input focus. Once it has the input focus all keyboard+-- input is directed to this widget.+--+widgetSetCanFocus :: WidgetClass self => self -> Bool -> IO ()+widgetSetCanFocus = objectSetPropertyBool "can_focus"++-- | Check if this widget can receive keyboard input.+--+widgetGetCanFocus :: WidgetClass self => self -> IO Bool+widgetGetCanFocus = objectGetPropertyBool "can_focus"++-- | Retrieves the widget's allocation.+--+-- * Available since Gtk+ version 2.18+--+widgetGetAllocation :: WidgetClass self => self -> IO Allocation+widgetGetAllocation widget =+ alloca $ \ allocationPtr -> do+ {#call widget_get_allocation#} (toWidget widget) (castPtr allocationPtr)+ peek allocationPtr+#endif++#if GTK_CHECK_VERSION(3,0,0)+-- | Returns the width that has currently been allocated to widget. This function is intended+-- | to be used when implementing handlers for the "draw" function.+widgetGetAllocatedWidth :: WidgetClass self => self -> IO Int+widgetGetAllocatedWidth widget =+ liftM fromIntegral $ {#call widget_get_allocated_width#} (toWidget widget)++-- | Returns the height that has currently been allocated to widget. This function is intended+-- | to be used when implementing handlers for the "draw" function.+widgetGetAllocatedHeight :: WidgetClass self => self -> IO Int+widgetGetAllocatedHeight widget =+ liftM fromIntegral $ {#call widget_get_allocated_height#} (toWidget widget)+#endif++#if GTK_CHECK_VERSION(3,10,0)+-- | Returns the baseline that has currently been allocated to widget . This function is intended+-- to be used when implementing handlers for the “draw” function, and when allocating child+-- widgets in “size_allocate”.+widgetGetAllocatedBaseline :: WidgetClass self => self -> IO Int+widgetGetAllocatedBaseline widget =+ liftM fromIntegral $ {#call widget_get_allocated_baseline#} (toWidget widget)+#endif++#if GTK_CHECK_VERSION(3,14,0)+-- | Retrieves the widget’s clip area.+--+-- The clip area is the area in which all of widget's drawing will happen. Other+-- toolkits call it the bounding box.+--+-- Historically, in GTK+ the clip area has been equal to the allocation retrieved+-- via widgetGetAllocation.+widgetGetClip :: WidgetClass self => self -> IO Allocation+widgetGetClip widget =+ alloca $ \ allocationPtr -> do+ {#call widget_get_clip#} (toWidget widget) (castPtr allocationPtr)+ peek allocationPtr++-- | Sets the widget’s clip. This must not be used directly, but from within a widget’s 'sizeAllocate' method.+--+-- The clip set should be the area that widget draws on. If widget is a GtkContainer, the area+-- must contain all children's clips.+--+-- If this function is not called by widget during a 'sizeAllocate' handler, it is assumed to be+-- equal to the allocation. However, if the function is not called, certain features that might extend+-- a widget's allocation will not be available:+--+-- * The “draw” signal will be clipped to the widget's allocation to avoid overdraw.+--+-- * Calling gtk_render_background() will not draw outset shadows.+--+-- It is therefore suggested that you always call widgetSetClip during a 'sizeAllocate' handler.+widgetSetClip :: WidgetClass self => self+ -> Allocation+ -> IO ()+widgetSetClip self clip = with clip $ \clipPtr ->+ {#call widget_set_clip#} (toWidget self) (castPtr clipPtr)+#endif++#if GTK_CHECK_VERSION(2,18,0)+-- | Determines whether the application intends to draw on the widget in an+-- "draw" handler.+-- See 'widgetSetAppPaintable'.+widgetGetAppPaintable :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if the @widget@ is app paintable.+widgetGetAppPaintable widget =+ liftM toBool $+ {#call widget_get_app_paintable #}+ (toWidget widget)++-- | Determines whether @widget@ can be a default widget.+-- See 'widgetSetCanDefault'.+widgetGetCanDefault :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ can be a default widget, @False@ otherwise.+widgetGetCanDefault widget =+ liftM toBool $+ {#call gtk_widget_get_can_default #}+ (toWidget widget)++-- | Specifies whether @widget@ can be a default widget.+-- See 'widgetGrabDefault' for details about the meaning of "default".+widgetSetCanDefault :: WidgetClass widget => widget+ -> Bool -- ^ @canDefault@ whether or not @widget@ can be a default widget.+ -> IO ()+widgetSetCanDefault widget canDefault =+ {# call widget_set_can_default #}+ (toWidget widget)+ (fromBool canDefault)++-- | Determines whether @widget@ has a 'DrawWindow' of its own. See 'widgetSetHasWindow'.+widgetGetHasWindow :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ has a window, @False@ otherwise.+widgetGetHasWindow widget =+ liftM toBool $+ {#call widget_get_has_window #}+ (toWidget widget)++-- | Specifies whether @widget@ has a 'DrawWindow' of its own. Note that all+-- realized widgets have a non-NULL "window" pointer ('widgetGetWindow' never+-- returns a NULL window when a widget is realized), but for many of them it's+-- actually the 'DrawWindow' of one of its parent widgets. Widgets that do not+-- create a window for themselves in "realize" must announce this by calling+-- this function with @hasWindow@ = @False@.+--+-- This function should only be called by widget implementations, and they+-- should call it in their @init()@ function.+widgetSetHasWindow :: WidgetClass widget => widget+ -> Bool -- ^ @hasWindow@ whether or not @widget@ has a window.+ -> IO ()+widgetSetHasWindow widget hasWindow =+ {# call widget_set_has_window #}+ (toWidget widget)+ (fromBool hasWindow)++-- | Returns the @widget@’s sensitivity (in the sense of returning the value+-- that has been set using 'widgetSetSensitive').+--+-- The effective sensitivity of a widget is however determined by both its own+-- and its parent widget’s sensitivity. See 'widgetIsSensitive'.+widgetGetSensitive :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if the widget is sensitive.+widgetGetSensitive widget =+ liftM toBool $+ {#call widget_get_sensitive #}+ (toWidget widget)++-- | Returns the widget’s effective sensitivity, which means it is sensitive+-- itself and also its parent widget is sensitive.+widgetIsSensitive :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if the widget is effectively sensitive.+widgetIsSensitive widget =+ liftM toBool $+ {#call widget_is_sensitive #}+ (toWidget widget)++-- | Retrieve the current state of the widget.+--+-- * The state refers to different modes of user interaction, see+-- 'StateType' for more information.+--+widgetGetState :: WidgetClass self => self -> IO StateType+widgetGetState widget =+ liftM (toEnum . fromIntegral) $+ {#call widget_get_state#}+ (toWidget widget)++-- | Determines whether the widget is visible. If you want to take into+-- account whether the widget’s parent is also marked as visible, use+-- 'widgetIsVisible' instead.+--+-- This function does not check if the widget is obscured in any way.+-- See 'widgetSetVisible'.+widgetGetVisible :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if the widget is visible.+widgetGetVisible widget =+ liftM toBool $+ {#call widget_get_visible #}+ (toWidget widget)+#endif++#if GTK_CHECK_VERSION(3,8,0)+-- | Determines whether the widget and all its parents are marked as visible.+--+-- This function does not check if the widget is obscured in any way.+--+-- See also 'widgetGetVisible' and 'widgetSetVisible'+widgetIsVisible :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if the widget and all its parents are visible.+widgetIsVisible widget =+ liftM toBool $+ {#call widget_is_visible #}+ (toWidget widget)+#endif++#if GTK_CHECK_VERSION(3,0,0)+-- | This function is for use in widget implementations. Turns on flag values+-- in the current widget state (insensitive, prelighted, etc.).+--+-- This function accepts the values 'StateFlagDirLtr' and 'StateFlagDirRtl'+-- but ignores them. If you want to set the widget's direction, use+-- 'widgetSetDirection'.+--+-- It is worth mentioning that any other state than StateFlagInsensitive',+-- will be propagated down to all non-internal children if @widget@ is a+-- 'Container', while 'StateFlagInsensitive' itself will be propagated down+-- to all 'Container' children by different means than turning on the state+-- flag down the hierarchy, both 'widgetGetStateFlags' and+-- 'widgetIsSensitive' will make use of these.+widgetSetStateFlags :: WidgetClass widget => widget+ -> [StateFlags] -- ^ @flags@ State flags to turn on+ -> Bool -- ^ @clear@ Whether to clear state before turning on @flags@+ -> IO ()+widgetSetStateFlags widget flags clear =+ {# call widget_set_state_flags #}+ (toWidget widget)+ (fromIntegral $ fromFlags flags)+ (fromBool clear)++-- | This function is for use in widget implementations. Turns off flag+-- values for the current widget state (insensitive, prelighted, etc.).+-- See 'widgetSetStateFlags'.+widgetUnsetStateFlags :: WidgetClass widget => widget+ -> [StateFlags] -- ^ @flags@ State flags to turn off+ -> IO ()+widgetUnsetStateFlags widget flags =+ {# call widget_unset_state_flags #}+ (toWidget widget)+ (fromIntegral $ fromFlags flags)++-- | Returns the widget state as a flag set. It is worth mentioning that the+-- effective StateFlagInsensitive state will be returned, that is, also based+-- on parent insensitivity, even if @widget@ itself is sensitive.+widgetGetStateFlags :: WidgetClass widget => widget+ -> IO [StateFlags] -- ^ Returns the state flags for @widget@+widgetGetStateFlags widget =+ liftM (toFlags . fromIntegral) $+ {# call widget_get_state_flags #}+ (toWidget widget)+#endif++#if GTK_CHECK_VERSION(2,18,0)+-- | Determines whether @widget@ is the current default widget within its+-- toplevel. See 'widgetSetCanDefault'.+widgetGetHasDefault :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ is the current default widget within its toplevel, @False@ otherwise.+widgetGetHasDefault widget =+ liftM toBool $+ {#call widget_has_default #}+ (toWidget widget)++-- | Determines if the @widget@ has the global input focus.+-- See 'widgetIsFocus' for the difference between having the global input+-- focus, and only having the focus within a toplevel.+widgetGetHasFocus :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ has the global input focus.+widgetGetHasFocus widget =+ liftM toBool $+ {#call widget_has_focus #}+ (toWidget widget)+#endif++#if GTK_CHECK_VERSION(3,2,0)+-- | Determines if the widget should show a visible indication that it has the+-- global input focus. This is a convenience function for use in ::draw+-- handlers that takes into account whether focus indication should currently+-- be shown in the toplevel window of @widget@. See 'windowGetFocusVisible'+-- for more information about focus indication.+--+-- To find out if the widget has the global input focus, use 'widgetHasFocus'.+widgetHasVisibleFocus :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if the widget should display a “focus rectangle”+widgetHasVisibleFocus widget =+ liftM toBool $+ {# call widget_has_visible_focus #}+ (toWidget widget)+#endif++#if GTK_CHECK_VERSION(2,18,0)+-- | Determines whether the widget is currently grabbing events, so it is the+-- only widget receiving input events (keyboard and mouse).+--+-- See also 'grabAdd'.+widgetHasGrab :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if the widget is in the grab_widgets stack+widgetHasGrab widget =+ liftM toBool $+ {# call widget_has_grab #}+ (toWidget widget)++-- | Determines whether @widget@ can be drawn to. A widget can be drawn to if+-- it is mapped and visible.+widgetIsDrawable :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ is drawable, @False@ otherwise+widgetIsDrawable widget =+ liftM toBool $+ {# call widget_is_drawable #}+ (toWidget widget)++-- | Determines whether @widget@ is a toplevel widget.+--+-- Currently only 'Window' and 'Invisible' (and out-of-process 'Plugs') are+-- toplevel widgets. Toplevel widgets have no parent widget.+widgetIsToplevel :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ is a toplevel, @False@ otherwise+widgetIsToplevel widget =+ liftM toBool $+ {# call widget_is_toplevel #}+ (toWidget widget)++-- | Sets a widget’s window. This function should only be used in a widget’s+-- “realize” implementation. The window passed is usually either new window+-- created with 'drawWindowNew', or the window of its parent widget as+-- returned by 'widgetGetParentWindow'.+--+-- Widgets must indicate whether they will create their own 'DrawWindow' by+-- calling 'widgetSetHasWindow'. This is usually done in the widget’s init()+-- function.+--+-- Note that this function does not add any reference to window.+widgetSetWindow :: (WidgetClass widget, DrawWindowClass window) => widget+ -> window+ -> IO ()+widgetSetWindow widget window =+ {# call widget_set_window #}+ (toWidget widget)+ (toDrawWindow window)++-- | Specifies whether @widget@ will be treated as the default widget within+-- its toplevel when it has the focus, even if another widget is the default.+--+-- See 'widgetGrabDefault' for details about the meaning of “default”.+widgetSetReceivesDefault :: WidgetClass widget => widget+ -> Bool -- ^ @receivesDefault@ whether or not widget can be a default widget.+ -> IO ()+widgetSetReceivesDefault widget receivesDefault =+ {# call widget_set_receives_default #}+ (toWidget widget)+ (fromBool receivesDefault)++-- | Determines whether @widget@ is always treated as the default widget+-- within its toplevel when it has the focus, even if another widget is the+-- default.+--+-- See 'widgetSetReceivesDefault'.+widgetGetReceivesDefault :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ acts as the default widget when focussed, @False@ otherwise+widgetGetReceivesDefault widget =+ liftM toBool $+ {# call widget_get_receives_default #}+ (toWidget widget)+#endif++#if GTK_CHECK_VERSION(3,0,0)+-- | Returns @True@ if device has been shadowed by a GTK+ device grab on+-- another widget, so it would stop sending events to widget. This may be+-- used in the “grab-notify” signal to check for specific devices.+-- See 'deviceGrabAdd'.+widgetDeviceIsShadowed :: (WidgetClass widget, DeviceClass device) => widget+ -> device+ -> IO Bool -- ^ Returns @True@ if there is an ongoing grab on device by another 'Widget' than widget.+widgetDeviceIsShadowed widget device =+ liftM toBool $+ {# call widget_device_is_shadowed #}+ (toWidget widget)+ (toDevice device)+#endif++#if GTK_CHECK_VERSION(3,4,0)+-- | Returns the modifier mask the @widget@’s windowing system backend uses+-- for a particular purpose.+--+-- See 'keymapGetModifierMask'.+widgetGetModifierMask :: WidgetClass widget => widget+ -> ModifierIntent -- ^ @intent@ the use case for the modifier mask+ -> IO [Modifier] -- ^ Returns the modifier mask used for @intent@.+widgetGetModifierMask widget intent =+ liftM (toFlags . fromIntegral) $+ {# call widget_get_modifier_mask #}+ (toWidget widget)+ ((fromIntegral . fromEnum) intent)+#endif++#if GTK_CHECK_VERSION(3,0,0)+-- | Enables or disables multiple pointer awareness. If this setting is+-- @True@, widget will start receiving multiple, per device enter/leave+-- events. Note that if custom 'DrawWindows' are created in “realize”,+-- 'windowSetSupportMultidevice' will have to be called manually on them.+widgetSetSupportMultidevice :: WidgetClass widget => widget+ -> Bool -- ^ @supportMultidevice@ @True@ to support input from multiple devices.+ -> IO ()+widgetSetSupportMultidevice widget supportMultidevice =+ {# call widget_set_support_multidevice #}+ (toWidget widget)+ (fromBool supportMultidevice)++-- | Returns @True@ if @widget@ is multiple pointer aware.+-- See 'widgetSetSupportMultidevice' for more information.+widgetGetSupportMultidevice :: WidgetClass widget => widget+ -> IO Bool -- ^ Returns @True@ if @widget@ is multidevice aware.+widgetGetSupportMultidevice widget =+ liftM toBool $+ {# call widget_get_support_multidevice #}+ (toWidget widget)+#endif++-- | This function is for use in widget implementations. Sets the state of a+-- widget (insensitive, prelighted, etc.) Usually you should set the state+-- using wrapper functions such as 'widgetSetSensitive'.+--+widgetSetState :: WidgetClass self => self -> StateType -> IO ()+widgetSetState widget state =+ {#call widget_set_state#}+ (toWidget widget)+ ((fromIntegral . fromEnum) state)++-- | Rarely-used function. This function is used to emit the event signals on a widget (those signals+-- should never be emitted without using this function to do so). If you want to synthesize an event+-- though, don't use this function; instead, use 'mainDoEvent' so the event will behave as if it+-- were in the event queue. Don't synthesize expose events; instead, use 'windowInvalidateRect'+-- to invalidate a region of the window.+widgetEvent :: WidgetClass self => self -> EventM t Bool+widgetEvent widget = do+ ptr <- ask+ liftIO $ liftM toBool $ {#call widget_event #} (toWidget widget) (castPtr ptr)++--------------------+-- Attributes++-- %hash c:6f7f d:9384+-- | The name of the widget.+--+-- Default value: @Nothing@+--+widgetName :: (WidgetClass self, GlibString string) => Attr self (Maybe string)+widgetName = newAttrFromMaybeStringProperty "name"++widgetMarginLeft :: WidgetClass self => Attr self Int+widgetMarginLeft = newAttrFromIntProperty "margin-left"++widgetMarginRight :: WidgetClass self => Attr self Int+widgetMarginRight = newAttrFromIntProperty "margin-right"++#if GTK_CHECK_VERSION(3,12,0)+widgetMarginStart :: WidgetClass self => Attr self Int+widgetMarginStart = newAttrFromIntProperty "margin-start"++widgetMarginEnd :: WidgetClass self => Attr self Int+widgetMarginEnd = newAttrFromIntProperty "margin-end"+#endif++widgetMarginTop :: WidgetClass self => Attr self Int+widgetMarginTop = newAttrFromIntProperty "margin-top"++widgetMarginBottom :: WidgetClass self => Attr self Int+widgetMarginBottom = newAttrFromIntProperty "margin-bottom"++-- %hash c:1533 d:3213+-- | The parent widget of this widget. Must be a Container widget.+--+widgetParent :: (WidgetClass self, ContainerClass container) => ReadWriteAttr self (Maybe Container) (Maybe container)+widgetParent = newAttrFromMaybeObjectProperty "parent" gTypeContainer++-- %hash c:2b4c d:3c31+-- | Override for width request of the widget, or -1 if natural request should+-- be used.+--+-- Allowed values: >= -1+--+-- Default value: -1+--+widgetWidthRequest :: WidgetClass self => Attr self Int+widgetWidthRequest = newAttrFromIntProperty "width-request"++-- %hash c:fa97 d:172a+-- | Override for height request of the widget, or -1 if natural request+-- should be used.+--+-- Allowed values: >= -1+--+-- Default value: -1+--+widgetHeightRequest :: WidgetClass self => Attr self Int+widgetHeightRequest = newAttrFromIntProperty "height-request"++-- %hash c:70d0 d:e8e2+-- | Whether the widget is visible.+--+-- Default value: @False@+--+widgetVisible :: WidgetClass self => Attr self Bool+widgetVisible = newAttrFromBoolProperty "visible"++-- | The opacity of the widget+--+-- Default value: @1.0@+--+widgetOpacity :: WidgetClass self => Attr self Double+widgetOpacity = newAttrFromDoubleProperty "opacity"++-- %hash c:4dd4 d:594e+-- | Whether the widget responds to input.+--+-- Default value: @True@+--+widgetSensitive :: WidgetClass self => Attr self Bool+widgetSensitive = newAttrFromBoolProperty "sensitive"++-- %hash c:7506 d:1dde+-- | Whether the application will paint directly on the widget.+--+-- Default value: @False@+--+widgetAppPaintable :: WidgetClass self => Attr self Bool+widgetAppPaintable = newAttrFromBoolProperty "app-paintable"++-- %hash c:6289 d:72ab+-- | Whether the widget can accept the input focus.+--+-- Default value: @False@+--+widgetCanFocus :: WidgetClass self => Attr self Bool+widgetCanFocus = newAttrFromBoolProperty "can-focus"++-- %hash c:8e7 d:2645+-- | Whether the widget has the input focus.+--+-- Default value: @False@+--+widgetHasFocus :: WidgetClass self => Attr self Bool+widgetHasFocus = newAttrFromBoolProperty "has-focus"++-- %hash c:7547 d:1d78+-- | Whether the widget is the focus widget within the toplevel.+--+-- Default value: @False@+--+widgetIsFocus :: WidgetClass self => Attr self Bool+widgetIsFocus = newAttrFromBoolProperty "is-focus"++-- %hash c:f2d8 d:1cbb+-- | Whether the widget can be the default widget.+--+-- Default value: @False@+--+widgetCanDefault :: WidgetClass self => Attr self Bool+widgetCanDefault = newAttrFromBoolProperty "can-default"++-- %hash c:836 d:4cbe+-- | Whether the widget is the default widget.+--+-- Default value: @False@+--+widgetHasDefault :: WidgetClass self => Attr self Bool+widgetHasDefault = newAttrFromBoolProperty "has-default"++-- %hash c:f964 d:b62f+-- | If @True@, the widget will receive the default action when it is focused.+--+-- Default value: @False@+--+widgetReceivesDefault :: WidgetClass self => Attr self Bool+widgetReceivesDefault = newAttrFromBoolProperty "receives-default"++-- %hash c:2ca6 d:cad8+-- | Whether the widget is part of a composite widget.+--+-- Default value: @False@+--+widgetCompositeChild :: WidgetClass self => ReadAttr self Bool+widgetCompositeChild = readAttrFromBoolProperty "composite-child"++-- %hash c:4f01 d:bd3+-- | The style of the widget, which contains information about how it will+-- look (colors etc).+--+widgetStyle :: WidgetClass self => Attr self Style+widgetStyle = newAttrFromObjectProperty "style" gTypeStyle++-- | The current visual user interaction state of the widget (insensitive,+-- prelighted, selected etc). See 'StateType' for more information.+--+widgetState :: WidgetClass self => Attr self StateType+widgetState = newAttr+ widgetGetState+ widgetSetState++-- %hash c:e2a4 d:9296+-- | The event mask that decides what kind of GdkEvents this widget gets.+--+-- Default value: 'StructureMask'+--+widgetEvents :: WidgetClass self => Attr self [EventMask]+widgetEvents = newAttrFromFlagsProperty "events"+ {# call pure unsafe gdk_event_mask_get_type #}++#if GTK_MAJOR_VERSION < 3+-- %hash c:ba80+-- | The mask that decides what kind of extension events this widget gets.+--+-- Default value: 'ExtensionEventsNone'+--+-- Removed in Gtk3.+widgetExtensionEvents :: WidgetClass self => Attr self [ExtensionMode]+widgetExtensionEvents = newAttr+ widgetGetExtensionEvents+ widgetSetExtensionEvents+#endif++-- | Whether to expand in both directions. Setting this sets both 'widgetHExpand' and 'widgetVExpand'+--+-- Default value: @False@+--+widgetExpand :: WidgetClass self => Attr self Bool+widgetExpand = newAttrFromBoolProperty "expand"++-- | Whether to expand horizontally. See 'widgetSetHExpand'+--+-- Default value: @False@+--+widgetHExpand :: WidgetClass self => Attr self Bool+widgetHExpand = newAttrFromBoolProperty "hexpand"++-- | Whether to use the “hexpand” property. See 'widgetGetHExpandSet'.+--+-- Default value: @False@+--+widgetHExpandSet :: WidgetClass self => Attr self Bool+widgetHExpandSet = newAttrFromBoolProperty "hexpand-set"++-- | Whether to expand vertically. See 'widgetSetVExpand'.+--+-- Default value: @False@+--+widgetVExpand :: WidgetClass self => Attr self Bool+widgetVExpand = newAttrFromBoolProperty "vexpand"++-- | Whether to use the “vexpand” property. See 'widgetGetVExpandSet'.+--+-- Default value: @False@+--+widgetVExpandSet :: WidgetClass self => Attr self Bool+widgetVExpandSet = newAttrFromBoolProperty "vexpand-set"++-- %hash c:1605 d:48ea+-- | Whether 'widgetShowAll' should not affect this widget.+--+-- Default value: @False@+--+widgetNoShowAll :: WidgetClass self => Attr self Bool+widgetNoShowAll = newAttrFromBoolProperty "no-show-all"++-- %hash c:cd8d d:59b2+-- | \'childVisible\' property. See 'widgetGetChildVisible' and+-- 'widgetSetChildVisible'+--+widgetChildVisible :: WidgetClass self => Attr self Bool+widgetChildVisible = newAttr+ widgetGetChildVisible+ widgetSetChildVisible++#if GTK_MAJOR_VERSION < 3+-- %hash c:a20a d:646f+-- | \'colormap\' property. See 'widgetGetColormap' and 'widgetSetColormap'+--+-- Removed in Gtk3.+widgetColormap :: WidgetClass self => Attr self Colormap+widgetColormap = newAttr+ widgetGetColormap+ widgetSetColormap+#endif++-- %hash c:a7fd d:55b8+-- | \'compositeName\' property. See 'widgetGetCompositeName' and+-- 'widgetSetCompositeName'+--+widgetCompositeName :: (WidgetClass self, GlibString string) => ReadWriteAttr self (Maybe string) string+widgetCompositeName = newAttr+ widgetGetCompositeName+ widgetSetCompositeName++-- %hash c:6c03 d:ce3b+-- | \'direction\' property. See 'widgetGetDirection' and 'widgetSetDirection'+--+widgetDirection :: WidgetClass self => Attr self TextDirection+widgetDirection = newAttr+ widgetGetDirection+ widgetSetDirection++-- | Sets the text of tooltip to be the given string, which is marked up with the Pango text markup+-- language. Also see 'tooltipSetMarkup'.+--+-- This is a convenience property which will take care of getting the tooltip shown if the given string+-- is not \"\": 'hasTooltip' will automatically be set to 'True' and there will be taken care of+-- 'queryTooltip' in the default signal handler.+--+-- Default value: \"\"+--+-- * Available since Gtk+ version 2.12+--+widgetTooltipMarkup :: (WidgetClass self, GlibString markup) => Attr self (Maybe markup)+widgetTooltipMarkup = newAttrFromMaybeStringProperty "tooltip-markup"++-- | Sets the text of tooltip to be the given string.+--+-- Also see 'tooltipSetText'.+--+-- This is a convenience property which will take care of getting the tooltip shown if the given string+-- is not \"\": 'hasTooltip' will automatically be set to 'True' and there will be taken care of+-- 'queryTooltip' in the default signal handler.+--+-- Default value: \"\"+--+-- * Available since Gtk+ version 2.12+--+widgetTooltipText :: (WidgetClass self, GlibString string) => Attr self (Maybe string)+widgetTooltipText = newAttrFromMaybeStringProperty "tooltip-text"++-- | Enables or disables the emission of 'queryTooltip' on widget. A value of 'True' indicates that widget+-- can have a tooltip, in this case the widget will be queried using 'queryTooltip' to determine+-- whether it will provide a tooltip or not.+--+-- Note that setting this property to 'True' for the first time will change the event masks of the+-- 'Windows' of this widget to include leave-notify and motion-notify events. This cannot and will not+-- be undone when the property is set to 'False' again.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.12+--+widgetHasTooltip :: WidgetClass self => Attr self Bool+widgetHasTooltip = newAttrFromBoolProperty "has-tooltip"++#if GTK_CHECK_VERSION(2,20,0)+-- | Determines if the widget style has been looked up through the rc mechanism.+widgetHasRcStyle :: WidgetClass self => self+ -> IO Bool -- ^ returns 'True' if the widget has been looked up through the rc mechanism, 'False' otherwise.+widgetHasRcStyle self =+ liftM toBool $+ {#call gtk_widget_has_rc_style #}+ (toWidget self)++-- | Determines whether widget is realized.+widgetGetRealized :: WidgetClass self => self+ -> IO Bool -- ^ returns 'True' if widget is realized, 'False' otherwise+widgetGetRealized self =+ liftM toBool $+ {#call gtk_widget_get_realized #}+ (toWidget self)++-- | Whether the widget is mapped.+widgetGetMapped :: WidgetClass self => self+ -> IO Bool -- ^ returns 'True' if the widget is mapped, 'False' otherwise.+widgetGetMapped self =+ liftM toBool $+ {#call gtk_widget_get_mapped #}+ (toWidget self)++-- | Marks the @widget@ as being realized. This function must only be called+-- after all 'DrawWindows' for the widget have been created and registered.+--+-- This function should only ever be called in a derived widget's “realize”+-- or “unrealize” implementation.+widgetSetRealized :: WidgetClass widget => widget+ -> Bool -- ^ @realized@ @True@ to mark the widget realized.+ -> IO ()+widgetSetRealized widget realized =+ {# call widget_set_realized #}+ (toWidget widget)+ (fromBool realized)++-- | Marks the @widget@ as being realized.+--+-- This function should only ever be called in a derived widget's “map” or+-- “unmap” implementation.+widgetSetMapped :: WidgetClass widget => widget+ -> Bool -- ^ @mapped@ @True@ to mark the widget as mapped.+ -> IO ()+widgetSetMapped widget mapped =+ {# call widget_set_mapped #}+ (toWidget widget)+ (fromBool mapped)+#endif++#if GTK_CHECK_VERSION(3,0,0)+-- | Returns the style context associated to @widget@.+widgetGetStyleContext :: WidgetClass widget+ => widget -- ^ @widget@ : a @Widget@+ -> IO StyleContext -- ^ a @StyleContext@+widgetGetStyleContext widget =+ makeNewGObject mkStyleContext $+ {# call gtk_widget_get_style_context #}+ (toWidget widget)++-- | Gets the value of the `widgetHAlign` property.+--+-- For backwards compatibility reasons this method will never return AlignBaseline,+-- but instead it will convert it to AlignFill. Baselines are not supported for+-- horizontal alignment.+--+widgetGetHAlign :: WidgetClass self => self -> IO Align+widgetGetHAlign self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_widget_get_halign #}+ (toWidget self)++-- | Sets the horizontal alignment of widget. See the 'widgetHAlign' property.+--+widgetSetHAlign :: WidgetClass self => self -> Align -> IO ()+widgetSetHAlign self align =+ {# call gtk_widget_set_halign #}+ (toWidget self)+ (fromIntegral $ fromEnum align)++-- | Gets the value of the 'widgetVAlign' property.+--+-- For backwards compatibility reasons this method will never return AlignBaseline,+-- but instead it will convert it to AlignFill. If your widget want to support+-- baseline aligned children it must use 'widgetGetVAlignWithBaseline', or+-- 'widgetVAlign', which will also report the true value.+widgetGetVAlign :: WidgetClass self => self -> IO Align+widgetGetVAlign self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_widget_get_valign #}+ (toWidget self)++#if GTK_CHECK_VERSION(3,10,0)+-- | Gets the value of the 'widgetVAlign' property, including AlignBaseline.+widgetGetVAlignWithBaseline :: WidgetClass self => self -> IO Align+widgetGetVAlignWithBaseline self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_widget_get_valign_with_baseline #}+ (toWidget self)+#endif++-- | Sets the vertical alignment of widget . See the 'widgetVAlign' property.+widgetSetVAlign :: WidgetClass self => self -> Align -> IO ()+widgetSetVAlign self align =+ {# call gtk_widget_set_valign #}+ (toWidget self)+ (fromIntegral $ fromEnum align)+#endif++--------------------+-- Signals+++-- %hash c:4cf5 d:af3f+-- | The widget appears on screen.+--+mapSignal :: WidgetClass self => Signal self (IO ())+mapSignal = Signal (connect_NONE__NONE "map")++-- %hash c:e33e d:af3f+-- | The widget disappears from the screen.+--+unmapSignal :: WidgetClass self => Signal self (IO ())+unmapSignal = Signal (connect_NONE__NONE "unmap")++-- %hash c:1f7f d:af3f+-- | The widget should allocate any resources needed, in particular, the+-- widget's 'DrawWindow' is created. If you connect to this signal and+-- you rely on some of these resources to be present, you have to use+-- 'System.Glib.Signals.after'.+--+realize :: WidgetClass self => Signal self (IO ())+realize = Signal (connect_NONE__NONE "realize")++-- %hash c:7948 d:af3f+-- | The widget should deallocate any resources. This signal is emitted before+-- the widget is destroyed.+--+unrealize :: WidgetClass self => Signal self (IO ())+unrealize = Signal (connect_NONE__NONE "unrealize")++-- %hash c:9f6f d:af3f+-- | Query the widget for the size it likes to+-- have.+--+-- * A parent container emits this signal to its child to query the needed+-- height and width of the child. There is not guarantee that the widget+-- will actually get this area.+--+sizeRequest :: WidgetClass self => Signal self (IO Requisition)+sizeRequest = Signal (\after w fun ->+ connect_PTR__NONE "size-request" after w+ (\rqPtr -> fun >>= \req -> unless (rqPtr==nullPtr) $ poke rqPtr req))++-- %hash c:8ec5 d:af3f+-- | Inform widget about the size it has.+--+-- * After querying a widget for the size it wants to have (through emitting+-- the @\"sizeRequest\"@ signal) a container will emit this signal to+-- inform the widget about the real size it should occupy.+--+sizeAllocate :: WidgetClass self => Signal self (Allocation -> IO ())+sizeAllocate = Signal (connect_BOXED__NONE "size-allocate" peek)++-- %hash c:ae3e d:af3f+-- | The widget is shown.+--+showSignal :: WidgetClass self => Signal self (IO ())+showSignal = Signal (connect_NONE__NONE "show")++-- %hash c:f589 d:af3f+-- | The widget is hidden.+--+hideSignal :: WidgetClass self => Signal self (IO ())+hideSignal = Signal (connect_NONE__NONE "hide")++-- %hash c:a285 d:af3f+-- | The widget gains focus via the given user action.+--+focus :: WidgetClass self => Signal self (DirectionType -> IO Bool)+focus = Signal (connect_ENUM__BOOL "focus")++-- %hash c:78ae d:af3f+-- | The state of the widget (input focus, insensitive, etc.) has changed.+--+stateChanged :: WidgetClass self => Signal self (StateType -> IO ())+stateChanged = Signal (connect_ENUM__NONE "state-changed")++#if GTK_CHECK_VERSION(3,0,0)+connect_FLAGS__NONE ::+ (Flags a, GObjectClass obj) => SignalName ->+ ConnectAfter -> obj ->+ ([a] -> IO ()) ->+ IO (ConnectId obj)+connect_FLAGS__NONE signal after obj user =+ connectGeneric signal after obj action+ where action :: Ptr GObject -> Int -> IO ()+ action _ flags1 =+ failOnGError $+ user (toFlags flags1)++-- | The state of the widget (input focus, insensitive, etc.) has changed.+--+stateFlagsChanged :: WidgetClass self => Signal self ([StateFlags] -> IO ())+stateFlagsChanged = Signal (connect_FLAGS__NONE "state-flags-changed")+#endif++-- %hash c:bef2 d:1d66+-- | The 'parentSet' signal is emitted when a new parent has been set on a+-- widget. The parameter is the new parent.+--+parentSet :: WidgetClass self => Signal self (Maybe Widget -> IO ())+parentSet = Signal (connect_MOBJECT__NONE "parent-set")++-- %hash c:7e2b d:4049+-- | Emitted when there is a change in the hierarchy to which a widget belong.+-- More precisely, a widget is anchored when its toplevel ancestor is a+-- 'Window'. This signal is emitted when a widget changes from un-anchored to+-- anchored or vice-versa.+--+hierarchyChanged :: WidgetClass self => Signal self (Maybe Widget -> IO ())+hierarchyChanged = Signal (connect_MOBJECT__NONE "hierarchy-changed")++-- %hash c:5894 d:ba10+-- | The 'styleSet' signal is emitted when a new style has been set on a+-- widget. Note that style-modifying functions like 'widgetModifyBase' also+-- cause this signal to be emitted.+--+styleSet :: WidgetClass self => Signal self (Style -> IO ())+styleSet = Signal (connect_OBJECT__NONE "style-set")++-- %hash c:6bb1 d:af3f+-- | The default direction of text writing has changed.+--+directionChanged :: WidgetClass self => Signal self (TextDirection -> IO ())+directionChanged = Signal (connect_ENUM__NONE "direction-changed")++-- %hash c:c28c d:d116+-- | The 'grabNotify' signal is emitted when a widget becomes shadowed by a+-- Gtk+ grab (not a pointer or keyboard grab) on another widget, or when it+-- becomes unshadowed due to a grab being removed.+--+-- A widget is shadowed by a 'grabAdd' when the topmost grab widget in the+-- grab stack of its window group is not its ancestor.+--+grabNotify :: WidgetClass self => Signal self (Bool -> IO ())+grabNotify = Signal (connect_BOOL__NONE "grab-notify")++-- %hash c:e06c d:a681+-- | This signal gets emitted whenever a widget should pop up a+-- context-sensitive menu. This usually happens through the standard key+-- binding mechanism; by pressing a certain key while a widget is focused, the+-- user can cause the widget to pop up a menu. For example, the 'Entry' widget+-- creates a menu with clipboard commands.+--+popupMenuSignal :: WidgetClass self => Signal self (IO Bool)+popupMenuSignal = Signal (connect_NONE__BOOL "popup-menu")++-- | Specify what kind of help the user wants.+{#enum GtkWidgetHelpType as WidgetHelpType {underscoreToCase} deriving (Eq,Show) #}++-- %hash c:b18e d:af3f+-- | Tell the widget to show an explanatory help text. Should return @True@+-- if help has been shown.+--+showHelp :: WidgetClass self => Signal self (WidgetHelpType -> IO Bool)+showHelp = Signal (connect_ENUM__BOOL "show-help")++-- %hash c:6a8f d:af3f+-- | The set of keyboard accelerators has changed.+--+accelClosuresChanged :: WidgetClass self => Signal self (IO ())+accelClosuresChanged = Signal (connect_NONE__NONE "accel-closures-changed")++-- %hash c:5ca d:af3f+-- | The widget moved to a new screen.+--+screenChanged :: WidgetClass self => Signal self (Screen -> IO ())+screenChanged = Signal (connect_OBJECT__NONE "screen-changed")++-- | Emitted when 'hasTooltip' is 'True' and the 'gtkTooltipTimeout' has expired with the cursor+-- hovering "above" widget; or emitted when widget got focus in keyboard mode.+--+-- Using the given coordinates, the signal handler should determine whether a tooltip should be shown+-- for widget. If this is the case 'True' should be returned, 'False' otherwise.+-- Note if widget got focus in keyboard mode, 'Point' is 'Nothing'.+--+-- The signal handler is free to manipulate tooltip with the therefore destined function calls.+--+-- * Available since Gtk+ version 2.12+--+queryTooltip :: WidgetClass self => Signal self (Widget -> Maybe Point -> Tooltip -> IO Bool)+queryTooltip =+ Signal (\after model user ->+ connect_OBJECT_INT_INT_BOOL_OBJECT__BOOL "query-tooltip"+ after model (\widget x y keyb tooltip ->+ user widget (if keyb then Nothing else Just (x, y)) tooltip))++#if GTK_CHECK_VERSION(3,0,0)+draw :: WidgetClass self => Signal self (Render ())+draw =+ Signal (\after model (Render user) ->+ connect_PTR__NONE "draw" after model (\ptr -> runReaderT user (Cairo ptr)))+#endif++-- * Events+--+-- An event is a signal that indicates that some low-level interaction like a+-- button or key press, mouse movement, etc. has occurred. In particular,+-- events relate to operations on 'DrawWindow's which are a concept of the+-- underlying OS rather than the logical widget concept. Some widgets have no+-- window and use their parent to receive these events. Widgets normally+-- synthesize more sophistiacted signals from events. For instance, the+-- 'focusIn' and a 'focusOut' signal indicate that the widget gains or looses+-- the input focus. From these events a 'focus' signal is synthesized that+-- indicates what maneuver lead to the input focus change (i.e. a tab or+-- shift-tab key press).+--+-- For applications it is often sufficient to connect to the high-level+-- signals rather than the low-level events. Only in cases where a custom+-- widget is built based on the 'DarwingArea' skeleton, the functionality of+-- such an application-specific widget needs to be implemented using events.+--+-- Every event is passed an 'Event' structure that contains the data of the+-- event. The return value should be @True@ if the handler has dealt with the+-- event and @False@ if the event should be propagated further. For instance,+-- if a key press event that isn't meaningful in the widget, the handler can+-- return @False@ such that the key is handled by the other widgets (the main+-- menu, for instance).+--+++-- Because there are so many similar signals (those that take an Event and+-- return a Bool) we will abstract out the skeleton. As some of these events+-- are emitted at a high rate often a bit has to be set to enable emission.+++eventM :: WidgetClass w => SignalName -> [EventMask] ->+ ConnectAfter -> w -> (EventM t Bool) -> IO (ConnectId w)+eventM name eMask after obj fun = do+ id <- connect_PTR__BOOL name after obj (runReaderT fun)+ widgetAddEvents obj eMask+ return id++-- %hash c:6cc d:af3f+-- | A mouse button has been depressed while the mouse pointer was within the+-- widget area. Sets the widget's 'ButtonPressMask' flag.+--+buttonPressEvent :: WidgetClass self => Signal self (EventM EButton Bool)+buttonPressEvent = Signal (eventM "button_press_event" [ButtonPressMask])++-- %hash c:62e8 d:af3f+-- | A mouse button has been released. Sets the widget's 'ButtonReleaseMask'+-- flag.+--+buttonReleaseEvent :: WidgetClass self => Signal self (EventM EButton Bool)+buttonReleaseEvent = Signal (eventM "button_release_event" [ButtonReleaseMask])++-- %hash c:23e5 d:af3f+-- | The scroll wheel of the mouse has been used. Sets the widget's+-- 'ScrollMask' flag.+--+scrollEvent :: WidgetClass self => Signal self (EventM EScroll Bool)+scrollEvent = Signal (eventM "scroll_event" [ScrollMask])++-- %hash c:ee92 d:af3f+-- | The mouse pointer has moved. Since receiving all mouse movements is+-- expensive, it is necessary to specify exactly what mouse motions are+-- required by calling 'widgetAddEvents' on this widget with one or more of+-- the following flags:+--+-- * 'PointerMotionMask': Track all movements.+--+-- * 'ButtonMotionMask': Only track movements if a button is depressed.+--+-- * 'Button1MotionMask': Only track movements if the left button is depressed.+--+-- * 'Button2MotionMask': Only track movements if the middle button is depressed.+--+-- * 'Button3MotionMask': Only track movements if the right button is depressed.+-- 'PointerMotionHintMask' is a special flag which can be used in+-- combination with any of the above and is used to reduce the number of+-- 'motionNotifyEvent's received. Normally a 'motionNotifyEvent' event is+-- received each time the mouse moves. However, if the application spends a+-- lot of time processing the event (updating the display, for example), it+-- can lag behind the position of the mouse. When using+-- 'PointerMotionHintMask', fewer 'motionNotifyEvent's will be sent, some of+-- which are marked as a hint. To receive more motion events after a motion+-- hint event, the application needs to asks for more, by calling+-- 'Graphics.UI.Gtk.Gdk.EventM.eventRequestMotions'. This effectively limits+-- the rate at which new motion events are received. (Note that you don't+-- need to check if the hint is set as+-- 'Graphics.UI.Gtk.Gdk.EventM.eventRequestMotions' does so automatically.)+--+motionNotifyEvent :: WidgetClass self => Signal self (EventM EMotion Bool)+motionNotifyEvent = Signal (eventM "motion_notify_event" [])++-- %hash c:8783 d:3e27+-- | The 'deleteEvent' signal is emitted if a user requests that a toplevel+-- window is closed. The default handler for this signal destroys the window.+-- Calling 'widgetHide' and returning @True@ on reception of this signal will+-- cause the window to be hidden instead, so that it can later be shown again+-- without reconstructing it.+--+deleteEvent :: WidgetClass self => Signal self (EventM EAny Bool)+deleteEvent = Signal (eventM "delete_event" [])++-- %hash c:c408 d:5514+-- | The 'destroyEvent' signal is emitted when a 'DrawWindow' is destroyed.+-- You rarely get this signal, because most widgets disconnect themselves from+-- their window before they destroy it, so no widget owns the window at+-- destroy time. However, you might want to connect to the 'objectDestroy'+-- signal of 'Object'.+--+destroyEvent :: WidgetClass self => Signal self (EventM EAny Bool)+destroyEvent = Signal (eventM "destroy_event" [])++-- %hash c:c79e d:af3f++-- | Instructs the widget to redraw.+--+-- * The 'DrawWindow' that needs to be redrawn is available via+-- 'eventWindow'.+--+-- * The part that needs to be redrawn is available via 'eventArea' and+-- 'eventRegion'. The options are, in order of efficiency: (a) redraw the+-- entire window, (b) ask for the 'eventArea' and redraw that rectangle, (c)+-- ask for the 'eventRegion' and redraw each of those rectangles.+--+-- Only the exposed region will be updated; see also+-- 'drawWindowBeginPaintRegion'.++exposeEvent :: WidgetClass self => Signal self (EventM EExpose Bool)+exposeEvent = Signal (eventM "expose_event" [])++-- %hash c:5ccd d:af3f+-- | A key has been depressed. Sets the widget's 'KeyPressMask' flag.+--+keyPressEvent :: WidgetClass self => Signal self (EventM EKey Bool)+keyPressEvent = Signal (eventM "key_press_event" [KeyPressMask])++-- %hash c:bd29 d:af3f+-- | A key has been released. Sets the widget's 'KeyReleaseMask' flag.+--+keyReleaseEvent :: WidgetClass self => Signal self (EventM EKey Bool)+keyReleaseEvent = Signal (eventM "key_release_event" [KeyReleaseMask])++-- %hash c:602e d:af3f+-- | The mouse pointer has entered the widget. Sets the widget's+-- 'EnterNotifyMask' flag.+--+enterNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool)+enterNotifyEvent = Signal (eventM "enter_notify_event" [EnterNotifyMask])++-- %hash c:3bfb d:af3f+-- | The mouse pointer has left the widget. Sets the widget's+-- 'LeaveNotifyMask' flag.+--+leaveNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool)+leaveNotifyEvent = Signal (eventM "leave_notify_event" [LeaveNotifyMask])++-- %hash c:2b64 d:af3f+-- | The size of the window has changed.+--+configureEvent :: WidgetClass self => Signal self (EventM EConfigure Bool)+configureEvent = Signal (eventM "configure_event" [])++-- %hash c:427e d:af3f+-- | The widget gets the input focus. Sets the widget's 'FocusChangeMask' flag.+--+focusInEvent :: WidgetClass self => Signal self (EventM EFocus Bool)+focusInEvent = Signal (eventM "focus_in_event" [FocusChangeMask])++-- %hash c:5281 d:af3f+-- | The widget lost the input focus. Sets the widget's 'FocusChangeMask' flag.+--+focusOutEvent :: WidgetClass self => Signal self (EventM EFocus Bool)+focusOutEvent = Signal (eventM "focus_out_event" [FocusChangeMask])++-- %hash c:63c4 d:af3f+-- | The window is put onto the screen.+--+mapEvent :: WidgetClass self => Signal self (EventM EAny Bool)+mapEvent = Signal (eventM "map_event" [])++-- %hash c:342d d:af3f+-- | The window is taken off the screen.+--+unmapEvent :: WidgetClass self => Signal self (EventM EAny Bool)+unmapEvent = Signal (eventM "unmap_event" [])++-- %hash c:a1dd d:af3f+-- | A 'DrawWindow' may be associated with a set of properties that are+-- identified by a 'PropertyTag'. This event is triggered if a property is+-- changed or deleted. Sets the widget's 'PropertyChangeMask' flag.+--+_propertyNotifyEvent :: WidgetClass self => Signal self (EventM EProperty Bool)+_propertyNotifyEvent = Signal (eventM "property_notify_event" [PropertyChangeMask])++{- not sure if these are useful+-- %hash c:58cc d:af3f+-- |+--+selectionClearEvent :: WidgetClass self => Signal self ({-GdkEventSelection*-} Bool)+selectionClearEvent = Signal (connect_{-GdkEventSelection*-}__BOOL "selection_clear_event")++-- %hash c:4f92 d:af3f+-- |+--+selectionRequestEvent :: WidgetClass self => Signal self ({-GdkEventSelection*-} Bool)+selectionRequestEvent = Signal (connect_{-GdkEventSelection*-}__BOOL "selection_request_event")++-- %hash c:b842 d:af3f+-- |+--+selectionNotifyEvent :: WidgetClass self => Signal self ({-GdkEventSelection*-} Bool)+selectionNotifyEvent = Signal (connect_{-GdkEventSelection*-}__BOOL "selection_notify_event")+-}++-- %hash c:b027 d:af3f+-- | The pen of a graphics tablet was put down. Sets the widget's+-- 'ProximityInMask' flag.+--+proximityInEvent :: WidgetClass self => Signal self (EventM EProximity Bool)+proximityInEvent = Signal (eventM "proximity_in_event" [ProximityInMask])++-- %hash c:faca d:af3f+-- | The pen of a graphics tablet was lifted off the tablet. Sets the widget's+-- 'ProximityOutMask' flag.+--+proximityOutEvent :: WidgetClass self => Signal self (EventM EProximity Bool)+proximityOutEvent = Signal (eventM "proximity_out_event" [ProximityOutMask])++-- %hash c:db2c d:af3f+-- | Emitted when the window visibility status has changed. Sets the widget's+-- 'VisibilityNotifyMask' flag.+--+visibilityNotifyEvent :: WidgetClass self => Signal self (EventM EVisibility Bool)+visibilityNotifyEvent = Signal (eventM "visibility_notify_event" [VisibilityNotifyMask])+{-+-- %hash c:3f5 d:af3f+-- |+--+clientEvent :: WidgetClass self => Signal self ({-GdkEventClient*-} Bool)+clientEvent = Signal (connect_{-GdkEventClient*-}__BOOL "client_event")+-}++-- %hash c:643c d:af3f+-- | Generated when the area of a 'Drawable' being copied using, e.g.+-- 'Graphics.UI.Gtk.Gdk.Drawable.drawDrawable', is completely available.+--+noExposeEvent :: WidgetClass self => Signal self (EventM EAny Bool)+noExposeEvent = Signal (eventM "no_expose_event" [])++-- %hash c:63b6 d:af3f+-- | Emitted when the state of the window changes, i.e. when it is minimized,+-- moved to the top, etc.+--+windowStateEvent :: WidgetClass self => Signal self (EventM EWindowState Bool)+windowStateEvent = Signal (eventM "window_state_event" [])++#if GTK_CHECK_VERSION(2,8,0)+-- %hash c:502a d:e47a+-- | Emitted when a pointer or keyboard grab on a window belonging to @widget@+-- gets broken.+--+-- On X11, this happens when the grab window becomes unviewable (i.e. it or+-- one of its ancestors is unmapped), or if the same application grabs the+-- pointer or keyboard again.+--+-- * Available since Gtk+ version 2.8+--+grabBrokenEvent :: WidgetClass self => Signal self (EventM EGrabBroken Bool)+grabBrokenEvent = Signal (eventM "grab_broken_event" [])+#endif++--------------------+-- Deprecated Signals and Events++#ifndef DISABLE_DEPRECATED++event :: WidgetClass w => SignalName -> [EventMask] ->+ ConnectAfter -> w -> (Event -> IO Bool) -> IO (ConnectId w)+event name eMask after obj fun = do+ id <- connect_BOXED__BOOL name marshalEvent after obj fun+ widgetAddEvents obj eMask+ return id++-- | A Button was pressed.+--+-- * This widget is part of a button which was just pressed. The event passed+-- to the user function is a 'Graphics.UI.Gtk.Gdk.Events.Button' event.+--+onButtonPress, afterButtonPress :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onButtonPress = event "button_press_event" [ButtonPressMask] False+afterButtonPress = event "button_press_event" [ButtonPressMask] True++-- | A Button was released.+--+onButtonRelease, afterButtonRelease :: WidgetClass w => w ->+ (Event -> IO Bool) -> IO (ConnectId w)+onButtonRelease = event "button_release_event" [ButtonReleaseMask] False+afterButtonRelease = event "button_release_event" [ButtonReleaseMask] True++-- |+--+onClient, afterClient :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onClient = event "client_event" [] False+afterClient = event "client_event" [] True++-- | The widget's status has changed.+--+onConfigure, afterConfigure :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onConfigure = event "configure_event" [] False+afterConfigure = event "configure_event" [] True++-- | This signal is emitted when the close icon on the+-- surrounding window is pressed. The default action is to emit the+-- @\"destroy\"@ signal.+--+onDelete, afterDelete :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onDelete = event "delete_event" [] False+afterDelete = event "delete_event" [] True++-- | The widget will be destroyed.+--+-- * The widget received a destroy event from the window manager.+--+onDestroyEvent, afterDestroyEvent :: WidgetClass w =>+ w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onDestroyEvent = event "destroy_event" [] False+afterDestroyEvent = event "destroy_event" [] True++-- | The default text direction was changed.+--+onDirectionChanged, afterDirectionChanged :: WidgetClass w => w ->+ (Event -> IO Bool) ->+ IO (ConnectId w)+onDirectionChanged = event "direction_changed" [] False+afterDirectionChanged = event "direction_changed" [] True++-- | Mouse cursor entered widget.+--+-- * Contains a 'Crossing' event.+--+onEnterNotify, afterEnterNotify :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onEnterNotify = event "enter_notify_event" [EnterNotifyMask] False+afterEnterNotify = event "enter_notify_event" [EnterNotifyMask] True++-- | Mouse cursor leaves widget.+--+-- * Contains a 'Crossing' event.+--+onLeaveNotify, afterLeaveNotify :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onLeaveNotify = event "leave_notify_event" [LeaveNotifyMask] False+afterLeaveNotify = event "leave_notify_event" [LeaveNotifyMask] True++-- | Instructs the widget to redraw.+--+-- * This event is useful for the 'DrawingArea'. On receiving this signal+-- the content of the passed Rectangle or Region needs to be redrawn.+-- The return value should be 'True' if the region was completely redrawn+-- and 'False' if other handlers in the chain should be invoked.+-- If a client will redraw the whole area and is not interested in the+-- extra information in 'Expose', it is more efficient+-- to use 'onExposeRect'.+--+-- * Widgets that are very expensive to re-render, such as an image editor,+-- may prefer to use the 'onExpose' call back which delivers a+-- 'Region' in addition to a 'Rectangle'. A 'Region' consists of several+-- rectangles that need redrawing. The simpler 'onExposeRect' event encodes+-- the area to be redrawn as a bounding rectangle which might be easier+-- to deal with in a particular application.+--+onExpose, afterExpose :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onExpose = event "expose_event" [] False+afterExpose = event "expose_event" [] True++-- | Expose event delivering a 'Rectangle'.+--+onExposeRect, afterExposeRect ::+ WidgetClass w => w -> (Rectangle -> IO ()) -> IO (ConnectId w)+onExposeRect w act = connect_BOXED__BOOL "expose_event"+ marshExposeRect False w (\r -> act r >> return True)+afterExposeRect w act = connect_BOXED__BOOL "expose_event"+ marshExposeRect True w (\r -> act r >> return True)++-- | This signal is called if the widget receives the input focus.+--+onFocus, afterFocus :: WidgetClass w => w -> (DirectionType -> IO Bool) ->+ IO (ConnectId w)+onFocus = connect_ENUM__BOOL "focus" False+afterFocus = connect_ENUM__BOOL "focus" True++-- | Widget gains input focus.+--+onFocusIn, afterFocusIn :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onFocusIn = event "focus_in_event" [FocusChangeMask] False+afterFocusIn = event "focus_in_event" [FocusChangeMask] True++-- | Widget looses input focus.+--+onFocusOut, afterFocusOut :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onFocusOut = event "focus_out_event" [FocusChangeMask] False+afterFocusOut = event "focus_out_event" [FocusChangeMask] True++-- | The widget is about to receive all events.+--+-- * It is possible to redirect all input events to one widget to force the+-- user to use only this widget. Such a situation is initiated by+-- 'addGrab'.+--+onGrabFocus, afterGrabFocus :: WidgetClass w => w -> IO () ->+ IO (ConnectId w)+onGrabFocus = connect_NONE__NONE "grab_focus" False+afterGrabFocus = connect_NONE__NONE "grab_focus" True++-- | The widget will be destroyed.+--+-- * This is the last signal this widget will receive.+--+onDestroy, afterDestroy :: WidgetClass w => w -> (IO ()) ->+ IO (ConnectId w)+onDestroy = connect_NONE__NONE "destroy" False+afterDestroy = connect_NONE__NONE "destroy" True++-- | The widget was asked to hide itself.+--+-- * This signal is emitted each time 'widgetHide' is called. Use+-- 'onUnmap' when your application needs to be informed+-- when the widget is actually removed from screen.+--+onHide, afterHide :: WidgetClass w => w -> IO () -> IO (ConnectId w)+onHide = connect_NONE__NONE "hide" False+afterHide = connect_NONE__NONE "hide" True++-- | The toplevel window changed.+--+-- * When a subtree of widgets is removed or added from a tree with a toplevel+-- window this signal is emitted. It is emitted on each widget in the+-- detached or attached subtree.+--+onHierarchyChanged, afterHierarchyChanged :: WidgetClass w => w -> IO () ->+ IO (ConnectId w)+onHierarchyChanged = connect_NONE__NONE "hierarchy_changed" False+afterHierarchyChanged = connect_NONE__NONE "hierarchy_changed" True++-- | A key was pressed.+--+onKeyPress, afterKeyPress :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onKeyPress = event "key_press_event" [KeyPressMask] False+afterKeyPress = event "key_press_event" [KeyPressMask] True++-- | A key was released.+--+onKeyRelease, afterKeyRelease :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onKeyRelease = event "key_release_event" [KeyReleaseMask] False+afterKeyRelease = event "key_release_event" [KeyReleaseMask] True++-- |+--+onMnemonicActivate, afterMnemonicActivate :: WidgetClass w => w ->+ (Bool -> IO Bool) ->+ IO (ConnectId w)+onMnemonicActivate = connect_BOOL__BOOL "mnemonic_activate" False+afterMnemonicActivate = connect_BOOL__BOOL "mnemonic_activate" True++-- | Track mouse movements.+--+-- * If @hint@ is False, a callback for every movement of the mouse is+-- generated. To avoid a backlog of mouse messages, it is usually sufficient+-- to sent @hint@ to True, generating only one event. The+-- application now has to state that it is ready for the next message by+-- calling 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowGetPointer'.+--+onMotionNotify, afterMotionNotify :: WidgetClass w => w -> Bool ->+ (Event -> IO Bool) ->+ IO (ConnectId w)+onMotionNotify w hint = event "motion_notify_event"+ (if hint then [PointerMotionMask, PointerMotionHintMask]+ else [PointerMotionMask]) False w+afterMotionNotify w hint = event "motion_notify_event"+ (if hint then [PointerMotionMask, PointerMotionHintMask]+ else [PointerMotionMask]) True w++-- |+--+onParentSet, afterParentSet :: (WidgetClass w, WidgetClass old) => w ->+ (old -> IO ()) -> IO (ConnectId w)+onParentSet = connect_OBJECT__NONE "parent_set" False+afterParentSet = connect_OBJECT__NONE "parent_set" True++-- |+--+onPopupMenu, afterPopupMenu :: WidgetClass w => w -> IO () -> IO (ConnectId w)+onPopupMenu = connect_NONE__NONE "popup_menu" False+afterPopupMenu = connect_NONE__NONE "popup_menu" True++-- | The input device became active.+--+-- * This event indicates that a pen of a graphics tablet or similar device is+-- now touching the tablet.+--+onProximityIn, afterProximityIn :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onProximityIn = event "proximity_in_event" [ProximityInMask] False+afterProximityIn = event "proximity_in_event" [ProximityInMask] True++-- | The input device became inactive.+--+-- * The pen was removed from the graphics tablet's surface.+--+onProximityOut, afterProximityOut :: WidgetClass w => w ->+ (Event -> IO Bool) -> IO (ConnectId w)+onProximityOut = event "proximity_out_event" [ProximityOutMask] False+afterProximityOut = event "proximity_out_event" [ProximityOutMask] True++-- | This widget's drawing area is about to be+-- destroyed.+--+onRealize, afterRealize :: WidgetClass w => w -> IO () -> IO (ConnectId w)+onRealize = connect_NONE__NONE "realize" False+afterRealize = connect_NONE__NONE "realize" True++-- | The mouse wheel has turned.+--+-- * The 'Event' is always 'Scroll'.+--+onScroll, afterScroll :: WidgetClass w => w -> (Event -> IO Bool) ->+ IO (ConnectId w)+onScroll = event "scroll_event" [ScrollMask] False+afterScroll = event "scroll_event" [ScrollMask] True++-- | The widget was asked to show itself.+--+-- * This signal is emitted each time 'widgetShow' is called. Use+-- 'onMap' when your application needs to be informed when+-- the widget is actually shown.+--+onShow, afterShow :: WidgetClass w => w -> IO () -> IO (ConnectId w)+onShow = connect_NONE__NONE "show" False+afterShow = connect_NONE__NONE "show" True++-- | Inform widget about the size it has.+--+-- * After querying a widget for the size it wants to have (through emitting+-- the @\"sizeRequest\"@ signal) a container will emit this signal to+-- inform the widget about the real size it should occupy.+--+onSizeAllocate, afterSizeAllocate :: WidgetClass w => w ->+ (Allocation -> IO ()) -> IO (ConnectId w)+onSizeAllocate = connect_BOXED__NONE "size_allocate" peek False+afterSizeAllocate = connect_BOXED__NONE "size_allocate" peek True++-- | Query the widget for the size it likes to+-- have.+--+-- * A parent container emits this signal to its child to query the needed+-- height and width of the child. There is not guarantee that the widget+-- will actually get this area.+--+onSizeRequest, afterSizeRequest :: WidgetClass w => w -> (IO Requisition) ->+ IO (ConnectId w)+onSizeRequest w fun = connect_PTR__NONE "size_request" False w (\rqPtr -> do+ req <- fun+ unless (rqPtr==nullPtr) $ poke rqPtr req)+afterSizeRequest w fun = connect_PTR__NONE "size_request" True w (\rqPtr -> do+ req <- fun+ unless (rqPtr==nullPtr) $ poke rqPtr req)++-- |+--+onStateChanged, afterStateChanged :: WidgetClass w => w ->+ (StateType -> IO ()) -> IO (ConnectId w)+onStateChanged = connect_ENUM__NONE "state_changed" False+afterStateChanged = connect_ENUM__NONE "state_changed" True++-- | The widget was removed from screen.+--+onUnmap, afterUnmap :: WidgetClass w => w -> IO () -> IO (ConnectId w)+onUnmap = connect_NONE__NONE "unmap" False+afterUnmap = connect_NONE__NONE "unmap" True++-- | This widget's drawing area is about to be+-- destroyed.+--+onUnrealize, afterUnrealize :: WidgetClass w => w -> IO () -> IO (ConnectId w)+onUnrealize = connect_NONE__NONE "unrealize" False+afterUnrealize = connect_NONE__NONE "unrealize" True++-- |+--+onVisibilityNotify, afterVisibilityNotify :: WidgetClass w => w ->+ (Event -> IO Bool) ->+ IO (ConnectId w)+onVisibilityNotify =+ event "visibility_notify_event" [VisibilityNotifyMask] False+afterVisibilityNotify =+ event "visibility_notify_event" [VisibilityNotifyMask] True++-- | -- onWindowState, afterWindowState :: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w)
Graphics/UI/Gtk/ActionMenuToolbar/Action.chs view
@@ -2,11 +2,12 @@ -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Action ----- Author : Duncan Coutts+-- Author : Duncan Coutts, Andy Stewart -- -- Created: 6 April 2005 -- -- Copyright (C) 2005 Duncan Coutts+-- Copyright (C) 2010 Andy Stewart -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public@@ -29,7 +30,7 @@ -- module Graphics.UI.Gtk.ActionMenuToolbar.Action ( -- * Detail--- +-- -- | Actions represent operations that the user can be perform, along with -- some information how it should be presented in the interface. Each action -- provides methods to create icons, menu items and toolbar items representing@@ -99,8 +100,10 @@ actionActivate, actionCreateMenuItem, actionCreateToolItem,+#if GTK_MAJOR_VERSION < 3 actionConnectProxy, actionDisconnectProxy,+#endif actionGetProxies, actionConnectAccelerator, actionDisconnectAccelerator,@@ -128,6 +131,9 @@ actionVisible, actionAccelPath, #endif+#if GTK_CHECK_VERSION(2,20,0)+ actionAlwaysShowImage,+#endif -- * Signals actionActivated,@@ -140,15 +146,14 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.GList import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (constructNewGObject)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.StockItems@@ -165,16 +170,16 @@ -- See "Graphics.UI.Gtk.ActionMenuToolbar.UIManager#XML-UI" for information on -- allowed action names. ---actionNew :: - String -- ^ @name@ - A unique name for the action- -> String -- ^ @label@ - the label displayed in menu items and on+actionNew :: GlibString string+ => string -- ^ @name@ - A unique name for the action+ -> string -- ^ @label@ - the label displayed in menu items and on -- buttons- -> Maybe String -- ^ @tooltip@ - a tooltip for the action+ -> Maybe string -- ^ @tooltip@ - a tooltip for the action -> Maybe StockId -- ^ @stockId@ - the stock icon to display in widgets -- representing the action -> IO Action actionNew name label tooltip stockId =- constructNewGObject mkAction $+ wrapNewGObject mkAction $ maybeWith withUTFString stockId $ \stockIdPtr -> maybeWith withUTFString tooltip $ \tooltipPtr -> withUTFString label $ \labelPtr ->@@ -190,7 +195,7 @@ -- | Returns the name of the action. ---actionGetName :: ActionClass self => self -> IO String+actionGetName :: (ActionClass self, GlibString string) => self -> IO string actionGetName self = {# call gtk_action_get_name #} (toAction self)@@ -296,6 +301,7 @@ {# call gtk_action_create_tool_item #} (toAction self) +#if GTK_MAJOR_VERSION < 3 -- | Connects a widget to an action object as a proxy. Synchronises various -- properties of the action with the widget (such as label text, icon, tooltip, -- etc), and attaches a callback so that the action gets activated when the@@ -304,6 +310,7 @@ -- If the widget is already connected to an action, it is disconnected -- first. --+-- Removed in Gtk3. actionConnectProxy :: (ActionClass self, WidgetClass proxy) => self -> proxy -- ^ @proxy@ - the proxy widget -> IO ()@@ -314,6 +321,7 @@ -- | Disconnects a proxy widget from an action. --+-- Removed in Gtk3. actionDisconnectProxy :: (ActionClass self, WidgetClass proxy) => self -> proxy -- ^ @proxy@ - the proxy widget -> IO ()@@ -321,6 +329,7 @@ {# call gtk_action_disconnect_proxy #} (toAction self) (toWidget proxy)+#endif -- | Returns the proxy widgets for an action. --@@ -356,8 +365,8 @@ -- -- * Available since Gtk+ version 2.6 ---actionGetAccelPath :: ActionClass self => self- -> IO (Maybe String) -- ^ returns the accel path for this action, or+actionGetAccelPath :: (ActionClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns the accel path for this action, or -- @Nothing@ if none is set. actionGetAccelPath self = {# call gtk_action_get_accel_path #}@@ -369,8 +378,8 @@ -- the action will have this accel path, so that their accelerators are -- consistent. ---actionSetAccelPath :: ActionClass self => self- -> String -- ^ @accelPath@ - the accelerator path+actionSetAccelPath :: (ActionClass self, GlibString string) => self+ -> string -- ^ @accelPath@ - the accelerator path -> IO () actionSetAccelPath self accelPath = withUTFString accelPath $ \accelPathPtr ->@@ -394,35 +403,35 @@ -- -- Default value: \"\" ---actionName :: ActionClass self => Attr self String+actionName :: GlibString string => ActionClass self => Attr self string actionName = newAttrFromStringProperty "name" -- | The label used for menu items and buttons that activate this action. -- -- Default value: \"\" ---actionLabel :: ActionClass self => Attr self String+actionLabel :: GlibString string => ActionClass self => Attr self string actionLabel = newAttrFromStringProperty "label" -- | A shorter label that may be used on toolbar buttons. -- -- Default value: \"\" ---actionShortLabel :: ActionClass self => Attr self String+actionShortLabel :: GlibString string => ActionClass self => Attr self string actionShortLabel = newAttrFromStringProperty "short-label" -- | A tooltip for this action. -- -- Default value: @Nothing@ ---actionTooltip :: ActionClass self => Attr self (Maybe String)+actionTooltip :: GlibString string => ActionClass self => Attr self (Maybe string) actionTooltip = newAttrFromMaybeStringProperty "tooltip" -- | The stock icon displayed in widgets representing this action. -- -- Default value: @Nothing@ ---actionStockId :: ActionClass self => Attr self (Maybe String)+actionStockId :: GlibString string => ActionClass self => Attr self (Maybe string) actionStockId = newAttrFromMaybeStringProperty "stock_id" -- | Whether the toolbar item is visible when the toolbar is in a horizontal@@ -496,10 +505,23 @@ -- -- * Available since Gtk+ version 2.6 ---actionAccelPath :: ActionClass self => ReadWriteAttr self (Maybe String) String+actionAccelPath :: GlibString string => ActionClass self => ReadWriteAttr self (Maybe string) string actionAccelPath = newAttr actionGetAccelPath actionSetAccelPath+#endif++#if GTK_CHECK_VERSION(2,20,0)+-- | If 'True', the action's menu item proxies will ignore the 'menuImages' setting and always show+-- their image, if available.+--+-- Use this property if the menu item would be useless or hard to use without their image.+--+-- Default value: 'False'+--+-- Since 2.20+actionAlwaysShowImage :: ActionClass self => Attr self Bool+actionAlwaysShowImage = newAttrFromBoolProperty "always-show-image" #endif --------------------
Graphics/UI/Gtk/ActionMenuToolbar/ActionGroup.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup ( -- * Detail--- +-- -- | Actions are organised into groups. An action group is essentially a map -- from names to 'Action' objects. --@@ -65,7 +65,7 @@ ActionEntry(..), ToggleActionEntry(..), RadioActionEntry(..),- + -- * Constructors actionGroupNew, @@ -106,15 +106,13 @@ #endif ) where -import Control.Monad (liftM, foldM, when)+import Control.Monad (liftM, foldM, when) import System.Glib.FFI import System.Glib.UTFString import System.Glib.GList import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (constructNewGObject,- makeNewGObject, destroyFunPtr) {#import Graphics.UI.Gtk.Types#} import System.Glib.Signals (on) @@ -131,11 +129,11 @@ -- | Creates a new 'ActionGroup' object. The name of the action group is used -- when associating keybindings with the actions. ---actionGroupNew :: - String -- ^ @name@ - the name of the action group.+actionGroupNew :: GlibString string+ => string -- ^ @name@ - the name of the action group. -> IO ActionGroup actionGroupNew name =- constructNewGObject mkActionGroup $+ wrapNewGObject mkActionGroup $ withUTFString name $ \namePtr -> {# call gtk_action_group_new #} namePtr@@ -145,8 +143,8 @@ -- | Gets the name of the action group. ---actionGroupGetName :: ActionGroup- -> IO String -- ^ returns the name of the action group.+actionGroupGetName :: GlibString string => ActionGroup+ -> IO string -- ^ returns the name of the action group. actionGroupGetName self = {# call gtk_action_group_get_name #} self@@ -190,8 +188,8 @@ -- | Looks up an action in the action group by name. ---actionGroupGetAction :: ActionGroup- -> String -- ^ @actionName@ - the name of the action+actionGroupGetAction :: GlibString string => ActionGroup+ -> string -- ^ @actionName@ - the name of the action -> IO (Maybe Action) -- ^ returns the action, or @Nothing@ if no action by -- that name exists actionGroupGetAction self actionName =@@ -230,9 +228,9 @@ -- -- Accel paths are set to @\<Actions>\/group-name\/action-name@. ---actionGroupAddActionWithAccel :: ActionClass action => ActionGroup+actionGroupAddActionWithAccel :: (ActionClass action, GlibString string) => ActionGroup -> action -- ^ @action@ - the action to add- -> Maybe String -- ^ @accelerator@ - the accelerator for the action, in the+ -> Maybe string -- ^ @accelerator@ - the accelerator for the action, in the -- format understood by 'acceleratorParse', or \"\" for no -- accelerator, or @Nothing@ to use the stock accelerator -> IO ()@@ -251,18 +249,18 @@ self (toAction action) --- Note: for these next few funtions we cannot use the C version because the--- callback doesn't allow for propper memory management. So like pygtk we--- implement them natively since they are only convenience functions afterall.+-- Note: for these next few functions we cannot use the C version because the+-- callback doesn't allow for proper memory management. So like pygtk we+-- implement them natively since they are only convenience functions after all. -- | A description of an action. data ActionEntry = ActionEntry {- actionEntryName :: String,- actionEntryLabel :: String,- actionEntryStockId :: Maybe String,- actionEntryAccelerator :: Maybe String,- actionEntryTooltip :: Maybe String,+ actionEntryName :: DefaultGlibString,+ actionEntryLabel :: DefaultGlibString,+ actionEntryStockId :: Maybe DefaultGlibString,+ actionEntryAccelerator :: Maybe DefaultGlibString,+ actionEntryTooltip :: Maybe DefaultGlibString, actionEntryCallback :: IO () } @@ -284,11 +282,11 @@ -- | A description of an action for an entry that can be toggled. data ToggleActionEntry = ToggleActionEntry {- toggleActionName :: String,- toggleActionLabel :: String,- toggleActionStockId :: Maybe String,- toggleActionAccelerator :: Maybe String,- toggleActionTooltip :: Maybe String,+ toggleActionName :: DefaultGlibString,+ toggleActionLabel :: DefaultGlibString,+ toggleActionStockId :: Maybe DefaultGlibString,+ toggleActionAccelerator :: Maybe DefaultGlibString,+ toggleActionTooltip :: Maybe DefaultGlibString, toggleActionCallback :: IO (), toggleActionIsActive :: Bool }@@ -312,11 +310,11 @@ -- | A description of an action for an entry that provides a multiple choice. data RadioActionEntry = RadioActionEntry {- radioActionName :: String,- radioActionLabel :: String,- radioActionStockId :: Maybe String,- radioActionAccelerator :: Maybe String,- radioActionTooltip :: Maybe String,+ radioActionName :: DefaultGlibString,+ radioActionLabel :: DefaultGlibString,+ radioActionStockId :: Maybe DefaultGlibString,+ radioActionAccelerator :: Maybe DefaultGlibString,+ radioActionTooltip :: Maybe DefaultGlibString, radioActionValue :: Int } @@ -333,18 +331,18 @@ -- initially, or -1 if no action should be activated -> (RadioAction -> IO ()) -- ^ @onChange@ - the callback for the changed signal -> IO ()-actionGroupAddRadioActions self entries value onChange = do+actionGroupAddRadioActions self entries initialValue onChange = do group <- foldM- (\group (n, RadioActionEntry name label stockId+ (\group (RadioActionEntry name label stockId accelerator tooltip value) -> do action <- radioActionNew name label tooltip stockId value case group of Nothing -> return () Just group -> radioActionSetGroup action group- when (n == value) (toggleActionSetActive action True)+ when (initialValue == value) (toggleActionSetActive action True) actionGroupAddActionWithAccel self action accelerator return (Just action))- Nothing (zip [0..] entries)+ Nothing entries case group of Nothing -> return () Just group -> do@@ -357,8 +355,8 @@ -- If you\'re using \'gettext\', it is enough to set the translation domain -- with 'actionGroupSetTranslationDomain'. ---actionGroupSetTranslateFunc :: ActionGroup- -> (String -> IO String) -- ^ @(\label -> ...)@ - a translation function+actionGroupSetTranslateFunc :: GlibString string => ActionGroup+ -> (string -> IO string) -- ^ @(\label -> ...)@ - a translation function -> IO () actionGroupSetTranslateFunc self func = do funcPtr <- mkTranslateFunc $ \strPtr _ -> do@@ -382,8 +380,8 @@ -- If you\'re not using \'gettext\' for localization, see -- 'actionGroupSetTranslateFunc'. ---actionGroupSetTranslationDomain :: ActionGroup- -> String -- ^ @domain@ - the translation domain to use for \'dgettext\'+actionGroupSetTranslationDomain :: GlibString string => ActionGroup+ -> string -- ^ @domain@ - the translation domain to use for \'dgettext\' -- calls -> IO () actionGroupSetTranslationDomain self domain =@@ -397,9 +395,9 @@ -- -- * Available since Gtk+ version 2.6 ---actionGroupTranslateString :: ActionGroup- -> String -- ^ @string@ - a string- -> IO String -- ^ returns the translation of @string@+actionGroupTranslateString :: GlibString string => ActionGroup+ -> string -- ^ @string@ - a string+ -> IO string -- ^ returns the translation of @string@ actionGroupTranslateString self string = withUTFString string $ \stringPtr -> {# call gtk_action_group_translate_string #}@@ -415,7 +413,7 @@ -- -- Default value: \"\" ---actionGroupName :: Attr ActionGroup String+actionGroupName :: GlibString string => Attr ActionGroup string actionGroupName = newAttrFromStringProperty "name" -- | Whether the action group is enabled.
Graphics/UI/Gtk/ActionMenuToolbar/RadioAction.chs view
@@ -19,7 +19,7 @@ -- Lesser General Public License for more details. -- -- TODO--- I don't know what the elemnt type of the group GSList is for+-- I don't know what the element type of the group GSList is for -- radioActionSetGroup / radioActionGetGroup -- -- Also, the signals clash with those from other modules@@ -35,7 +35,7 @@ -- module Graphics.UI.Gtk.ActionMenuToolbar.RadioAction ( -- * Detail--- +-- -- | A 'RadioAction' is similar to 'RadioMenuItem'. A number of radio actions -- can be linked together so that only one may be active at any one time. @@ -72,7 +72,7 @@ -- * Signals radioActionChanged,- + #ifndef DISABLE_DEPRECATED -- * Deprecated onRadioActionChanged,@@ -81,14 +81,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.GList import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (constructNewGObject, makeNewGObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.StockItems@@ -103,18 +102,18 @@ -- and set the accelerator for the action, call -- 'Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup.actionGroupAddActionWithAccel'. ---radioActionNew :: - String -- ^ @name@ - A unique name for the action- -> String -- ^ @label@ - The label displayed in menu items and on+radioActionNew :: GlibString string+ => string -- ^ @name@ - A unique name for the action+ -> string -- ^ @label@ - The label displayed in menu items and on -- buttons- -> Maybe String -- ^ @tooltip@ - A tooltip for this action+ -> Maybe string -- ^ @tooltip@ - A tooltip for this action -> Maybe StockId -- ^ @stockId@ - The stock icon to display in widgets -- representing this action -> Int -- ^ @value@ - The value which 'radioActionGetCurrentValue' -- should return if this action is selected. -> IO RadioAction radioActionNew name label tooltip stockId value =- constructNewGObject mkRadioAction $+ wrapNewGObject mkRadioAction $ maybeWith withUTFString stockId $ \stockIdPtr -> maybeWith withUTFString tooltip $ \tooltipPtr -> withUTFString label $ \labelPtr ->
+ Graphics/UI/Gtk/ActionMenuToolbar/RecentAction.chs view
@@ -0,0 +1,139 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget RecentAction+--+-- Author : Andy Stewart+--+-- Created: 24 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- An action of which represents a list of recently used files+--+-- * Module available since Gtk+ version 2.12+--+module Graphics.UI.Gtk.ActionMenuToolbar.RecentAction (++-- * Detail+--+-- | A 'RecentAction' represents a list of recently used files, which can be+-- shown by widgets such as 'RecentChooserDialog' or 'RecentChooserMenu'.+--+-- To construct a submenu showing recently used files, use a 'RecentAction'+-- as the action for a \<menuitem>. To construct a menu toolbutton showing the+-- recently used files in the popup menu, use a 'RecentAction' as the action+-- for a \<toolitem> element.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Action'+-- | +----RecentAction+-- @++#if GTK_CHECK_VERSION(2,12,0)+-- * Types+ RecentAction,+ RecentActionClass,+ castToRecentAction,+ toRecentAction,++-- * Constructors+ recentActionNew,+ recentActionNewForManager,++-- * Attributes+ recentActionShowNumbers,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import System.Glib.UTFString+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,12,0)+--------------------+-- Constructors++-- | Creates a new 'RecentAction' object. To add the action to a 'ActionGroup'+-- and set the accelerator for the action, call+-- 'actionGroupAddActionWithAccel'.+--+recentActionNew :: GlibString string+ => string -- ^ @name@ - a unique name for the action+ -> Maybe string -- ^ @label@ - the label displayed in menu items and on buttons, or 'Nothing'+ -> Maybe string -- ^ @tooltip@ - a tooltip for the action, or 'Nothing'+ -> Maybe string -- ^ @stockId@ - the stock icon to display in widgets representing+ -- the action, or 'Nothing'+ -> IO RecentAction+recentActionNew name label tooltip stockId =+ wrapNewGObject mkRecentAction $+ liftM castPtr $+ withUTFString name $ \namePtr ->+ maybeWith withUTFString label $ \labelPtr ->+ maybeWith withUTFString tooltip $ \tooltipPtr ->+ maybeWith withUTFString stockId $ \stockIdPtr ->+ {# call gtk_recent_action_new #}+ namePtr+ labelPtr+ tooltipPtr+ stockIdPtr++-- | Creates a new 'RecentAction' object. To add the action to a 'ActionGroup'+-- and set the accelerator for the action, call+-- 'actionGroupAddActionWithAccel'.+--+recentActionNewForManager :: (RecentManagerClass manager, GlibString string) =>+ string -- ^ @name@ - a unique name for the action+ -> Maybe string -- ^ @label@ - the label displayed in menu items and on buttons,+ -- or 'Nothing'+ -> Maybe string -- ^ @tooltip@ - a tooltip for the action, or 'Nothing'+ -> Maybe string -- ^ @stockId@ - the stock icon to display in widgets representing+ -- the action, or 'Nothing'+ -> Maybe manager -- ^ @manager@ - a 'RecentManager', or 'Nothing' for the+ -- default 'RecentManager'+ -> IO RecentAction+recentActionNewForManager name label tooltip stockId manager =+ wrapNewGObject mkRecentAction $ liftM castPtr $+ withUTFString name $ \namePtr ->+ maybeWith withUTFString label $ \labelPtr ->+ maybeWith withUTFString tooltip $ \tooltipPtr ->+ maybeWith withUTFString stockId $ \stockIdPtr -> do+ {# call gtk_recent_action_new_for_manager #}+ namePtr+ labelPtr+ tooltipPtr+ stockIdPtr+ (maybe (RecentManager nullForeignPtr) toRecentManager manager)++--------------------+-- Attributes++-- | If recent items should be shown with numbers next to them.+--+recentActionShowNumbers :: RecentActionClass self => Attr self Bool+recentActionShowNumbers = newAttrFromBoolProperty "show-numbers"+#endif
Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction ( -- * Detail--- +-- -- | A 'ToggleAction' corresponds roughly to a 'CheckMenuItem'. It has an -- \"active\" state specifying whether the action has been checked or not. @@ -77,13 +77,12 @@ #endif ) where -import Control.Monad (liftM)+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) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.StockItems@@ -98,16 +97,16 @@ -- and set the accelerator for the action, call -- 'Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup.actionGroupAddActionWithAccel'. ---toggleActionNew :: - String -- ^ @name@ - A unique name for the action- -> String -- ^ @label@ - The label displayed in menu items and on+toggleActionNew :: GlibString string+ => string -- ^ @name@ - A unique name for the action+ -> string -- ^ @label@ - The label displayed in menu items and on -- buttons- -> Maybe String -- ^ @tooltip@ - A tooltip for the action+ -> Maybe string -- ^ @tooltip@ - A tooltip for the action -> Maybe StockId -- ^ @stockId@ - The stock icon to display in widgets -- representing the action -> IO ToggleAction toggleActionNew name label tooltip stockId =- constructNewGObject mkToggleAction $+ wrapNewGObject mkToggleAction $ maybeWith withUTFString stockId $ \stockIdPtr -> maybeWith withUTFString tooltip $ \tooltipPtr -> withUTFString label $ \labelPtr ->
Graphics/UI/Gtk/ActionMenuToolbar/UIManager.chs view
@@ -33,13 +33,13 @@ -- module Graphics.UI.Gtk.ActionMenuToolbar.UIManager ( -- * Detail--- +-- -- | A 'UIManager' constructs a user interface (menus and toolbars) from one -- or more UI definitions, which reference actions from one or more action -- groups. -- ** UI Definitions--- +-- -- | #XML-UI# The UI definitions are specified in an XML format which can be roughly -- described by the following DTD. --@@ -53,11 +53,11 @@ -- > <!ELEMENT toolitem EMPTY > -- > <!ELEMENT separator EMPTY > -- > <!ELEMENT accelerator EMPTY >--- > <!ATTLIST menubar name #IMPLIED +-- > <!ATTLIST menubar name #IMPLIED -- > action #IMPLIED >--- > <!ATTLIST toolbar name #IMPLIED +-- > <!ATTLIST toolbar name #IMPLIED -- > action #IMPLIED >--- > <!ATTLIST popup name #IMPLIED +-- > <!ATTLIST popup name #IMPLIED -- > action #IMPLIED > -- > <!ATTLIST placeholder name #IMPLIED -- > action #IMPLIED@@ -144,26 +144,26 @@ -- \"top\", the widget is prepended, otherwise it is appended. -- ** UI Merging--- +-- -- | The most remarkable feature of 'UIManager' is that it can overlay a set -- of menuitems and toolitems over another one, and demerge them later. -- -- Merging is done based on the names of the XML elements. Each element is--- identified by a path which consists of the names of its anchestors,+-- identified by a path which consists of the names of its ancestors, -- separated by slashes. For example, the menuitem named \"Left\" in the -- example above has the path @\/ui\/menubar\/JustifyMenu\/Left@ and the -- toolitem with the same name has path -- @\/ui\/toolbar1\/JustifyToolItems\/Left@. -- ** Accelerators--- +-- -- | Every action has an accelerator path. Accelerators are installed together -- with menuitem proxies, but they can also be explicitly added with -- \<accelerator> elements in the UI definition. This makes it possible to have -- accelerators for actions even if they have no visible proxies. -- ** Smart Separators--- +-- -- | The separators created by 'UIManager' are \"smart\", i.e. they do not -- show up in the UI unless they end up between two visible menu or tool items. -- Separators which are located at the very beginning or end of the menu or@@ -177,7 +177,7 @@ -- following an expanding separator are effectively right-aligned. -- ** Empty Menus--- +-- -- | Submenus pose similar problems to separators inconnection with merging. -- It is impossible to know in advance whether they will end up empty after -- merging. 'UIManager' offers two ways to treat empty submenus:@@ -188,7 +188,7 @@ -- -- The behaviour is chosen based on the \"hide_if_empty\" property of the -- action to which the submenu is associated.--- +-- -- * Class Hierarchy -- |@@ -253,17 +253,16 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Flags (Flags, fromFlags)+import System.Glib.Flags (Flags, fromFlags) import System.Glib.UTFString import System.Glib.GList import System.Glib.GError import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (constructNewGObject, makeNewGObject)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -285,7 +284,7 @@ -- uiManagerNew :: IO UIManager uiManagerNew =- constructNewGObject mkUIManager $+ wrapNewGObject mkUIManager $ {# call gtk_ui_manager_new #} --------------------@@ -375,8 +374,8 @@ -- Note that the widget found by following a path that ends in a \<menu> -- element is the menuitem to which the menu is attached, not the menu itself. ---uiManagerGetWidget :: UIManager- -> String -- ^ @path@ - a path+uiManagerGetWidget :: GlibString string => UIManager+ -> string -- ^ @path@ - a path -> IO (Maybe Widget) -- ^ returns the widget found by following the path, or -- @Nothing@ if no widget was found. uiManagerGetWidget self path =@@ -405,8 +404,8 @@ -- | Looks up an action by following a path. See 'uiManagerGetWidget' for more -- information about paths. ---uiManagerGetAction :: UIManager- -> String -- ^ @path@ - a path+uiManagerGetAction :: GlibString string => UIManager+ -> string -- ^ @path@ - a path -> IO (Maybe Action) -- ^ returns the action whose proxy widget is found by -- following the path, or @Nothing@ if no widget was -- found.@@ -422,8 +421,8 @@ -- -- If a parse error occurres, an exception is thrown. ---uiManagerAddUiFromString :: UIManager- -> String -- ^ @buffer@ - the string to parse+uiManagerAddUiFromString :: GlibString string => UIManager+ -> string -- ^ @buffer@ - the string to parse -> IO MergeId -- ^ returns The merge id for the merged UI. The merge id can be -- used to unmerge the UI with 'uiManagerRemoveUi'. uiManagerAddUiFromString self buffer =@@ -441,15 +440,15 @@ -- -- If a parse or IO error occurres, an exception is thrown. ---uiManagerAddUiFromFile :: UIManager- -> String -- ^ @filename@ - the name of the file to parse+uiManagerAddUiFromFile :: GlibString string => UIManager+ -> string -- ^ @filename@ - the name of the file to parse -> IO MergeId -- ^ returns The merge id for the merged UI. The merge id can be -- used to unmerge the UI with 'uiManagerRemoveUi'. uiManagerAddUiFromFile self filename = liftM MergeId $ propagateGError $ \errorPtr -> withUTFString filename $ \filenamePtr ->-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_ui_manager_add_ui_from_file_utf8 #} #else {# call gtk_ui_manager_add_ui_from_file #}@@ -468,12 +467,12 @@ -- If @path@ points to a menuitem or toolitem, the new element will be -- inserted before or after this item, depending on @top@. ---uiManagerAddUi :: UIManager+uiManagerAddUi :: GlibString string => UIManager -> MergeId -- ^ @mergeId@ - the merge id for the merged UI, see -- 'uiManagerNewMergeId'- -> String -- ^ @path@ - a path- -> String -- ^ @name@ - the name for the added UI element- -> Maybe String -- ^ @action@ - the name of the action to be proxied,+ -> string -- ^ @path@ - a path+ -> string -- ^ @name@ - the name for the added UI element+ -> Maybe string -- ^ @action@ - the name of the action to be proxied, -- or @Nothing@ to add a separator -> [UIManagerItemType] -- ^ @type@ - the type of UI element to add. -> Bool -- ^ @top@ - if @True@, the UI element is added before@@ -506,8 +505,8 @@ -- | Creates a UI definition of the merged UI. ---uiManagerGetUi :: UIManager- -> IO String -- ^ returns string containing an XML representation of the+uiManagerGetUi :: GlibString string => UIManager+ -> IO string -- ^ returns string containing an XML representation of the -- merged UI. uiManagerGetUi self = {# call gtk_ui_manager_get_ui #}@@ -520,7 +519,7 @@ -- an idle function. A typical example where this function is useful is to -- enforce that the menubar and toolbar have been added to the main window -- before showing it:--- +-- -- > do -- > containerAdd window vbox -- > onAddWidget merge (addWidget vbox)@@ -554,7 +553,7 @@ -- -- Default value: @\"\<ui\>\\n\<\/ui\>\\n\"@ ---uiManagerUi :: ReadAttr UIManager String+uiManagerUi :: GlibString string => ReadAttr UIManager string uiManagerUi = readAttrFromStringProperty "ui" --------------------@@ -566,14 +565,14 @@ -- 'uiManagerGetWidget'. -- addWidget :: UIManagerClass self => Signal self (Widget -> IO ())-addWidget = Signal (connect_OBJECT__NONE "add_widget")+addWidget = Signal (connect_OBJECT__NONE "add-widget") -- %hash c:2480 d:366c -- | The \"actions-changed\" signal is emitted whenever the set of actions -- changes. -- actionsChanged :: UIManagerClass self => Signal self (IO ())-actionsChanged = Signal (connect_NONE__NONE "actions_changed")+actionsChanged = Signal (connect_NONE__NONE "actions-changed") -------------------- -- Deprecated Signals
Graphics/UI/Gtk/Builder.chs view
@@ -48,7 +48,7 @@ -- A 'Builder' holds a reference to all objects that it has constructed and -- drops these references when it is finalized. This finalization can cause -- the destruction of non-widget objects or widgets which are not contained--- in a toplevel window. For toplevel windows constructed by a builder, it +-- in a toplevel window. For toplevel windows constructed by a builder, it -- is the responsibility of the user to perform 'widgetDestroy' to get rid -- of them and all the widgets they contain. --@@ -100,7 +100,6 @@ import System.Glib.GError import System.Glib.GList import System.Glib.UTFString-import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -113,7 +112,7 @@ -- | Creates a new 'Builder' object. builderNew :: IO Builder builderNew =- makeNewObject mkBuilder $+ wrapNewGObject mkBuilder $ {# call unsafe builder_new #} -- | Parses a file containing a GtkBuilder UI definition and merges it with@@ -123,10 +122,10 @@ -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the -- error codes in 'BuilderError'. ---builderAddFromFile :: Builder -> FilePath -> IO ()+builderAddFromFile :: GlibFilePath fp => Builder -> fp -> IO () builderAddFromFile builder path = propagateGError $ \errPtrPtr ->- withUTFString path $ \pathPtr ->+ withUTFFilePath path $ \pathPtr -> {# call unsafe builder_add_from_file #} builder pathPtr errPtrPtr >> return ()@@ -138,7 +137,7 @@ -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the -- error codes in 'BuilderError'. ---builderAddFromString :: Builder -> String -> IO ()+builderAddFromString :: GlibString string => Builder -> string -> IO () builderAddFromString builder str = propagateGError $ \errPtrPtr -> withUTFStringLen str $ \(strPtr, strLen) ->@@ -155,14 +154,14 @@ -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the -- error codes in 'BuilderError'. ---builderAddObjectsFromFile ::- Builder- -> FilePath- -> [String] -- ^ Object IDs+builderAddObjectsFromFile :: (GlibString string, GlibFilePath fp)+ => Builder+ -> fp+ -> [string] -- ^ Object IDs -> IO () builderAddObjectsFromFile builder path ids = propagateGError $ \errPtrPtr ->- withUTFString path $ \pathPtr ->+ withUTFFilePath path $ \pathPtr -> withUTFStringArray0 ids $ \idsPtr -> {# call unsafe builder_add_objects_from_file #} builder pathPtr idsPtr errPtrPtr@@ -176,10 +175,10 @@ -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the -- error codes in 'BuilderError'. ---builderAddObjectsFromString ::- Builder- -> String- -> [String] -- ^ Object IDs+builderAddObjectsFromString :: GlibString string+ => Builder+ -> string+ -> [string] -- ^ Object IDs -> IO () builderAddObjectsFromString builder str ids = propagateGError $ \errPtrPtr ->@@ -195,8 +194,8 @@ -- | Gets the object with the given name. Note that this computation does -- not increment the reference count of the returned object.-builderGetObjectRaw :: Builder- -> String -- The ID of the object in the UI file, eg \"button1\".+builderGetObjectRaw :: GlibString string => Builder+ -> string -- The ID of the object in the UI file, eg \"button1\". -> IO (Maybe GObject) builderGetObjectRaw builder name = withUTFString name $ \namePtr ->@@ -211,11 +210,11 @@ -- If the object with the given ID is not of the requested type, an -- exception will be thrown. ---builderGetObject :: GObjectClass cls =>+builderGetObject :: (GObjectClass cls, GlibString string) => Builder -> (GObject -> cls) -- ^ A dynamic cast function which returns an object -- of the expected type, eg 'castToButton'- -> String -- The ID of the object in the UI file, eg \"button1\".+ -> string -- The ID of the object in the UI file, eg \"button1\". -> IO cls builderGetObject builder cast name = do raw <- builderGetObjectRaw builder name@@ -235,14 +234,14 @@ >>= mapM (makeNewGObject mkGObject . return) -- | Sets the translation domain of the 'Builder'.-builderSetTranslationDomain :: Builder -> Maybe String -> IO ()+builderSetTranslationDomain :: GlibString string => Builder -> Maybe string -> IO () builderSetTranslationDomain builder domain = maybeWith withUTFString domain $ \domainPtr -> {# call unsafe builder_set_translation_domain #} builder domainPtr -- | Gets the translation domain of the 'Builder'.-builderGetTranslationDomain :: Builder -> IO (Maybe String)+builderGetTranslationDomain :: GlibString string => Builder -> IO (Maybe string) builderGetTranslationDomain builder = {# call unsafe builder_get_translation_domain #} builder
Graphics/UI/Gtk/Buttons/Button.chs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Button --@@ -27,7 +28,7 @@ -- module Graphics.UI.Gtk.Buttons.Button ( -- * Detail--- +-- -- | The 'Button' widget is generally used to attach a function to that is -- called when the button is pressed. The various signals and how to use them -- are outlined below.@@ -93,6 +94,9 @@ buttonSetImagePosition, buttonGetImagePosition, #endif+#if GTK_CHECK_VERSION(2,22,0)+ buttonGetEventWindow,+#endif -- * Attributes buttonLabel,@@ -133,16 +137,16 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Enums (ReliefStyle(..), PositionType(..))+import Graphics.UI.Gtk.General.Enums (ReliefStyle(..), PositionType(..)) import Graphics.UI.Gtk.General.StockItems {# context lib="gtk" prefix="gtk" #}@@ -161,8 +165,8 @@ -- | Creates a 'Button' widget with a 'Label' child containing the given text. ---buttonNewWithLabel :: - String -- ^ @label@ - The text you want the 'Label' to hold.+buttonNewWithLabel :: GlibString string+ => string -- ^ @label@ - The text you want the 'Label' to hold. -> IO Button buttonNewWithLabel label = makeNewObject mkButton $@@ -177,8 +181,8 @@ -- underlined character represents a keyboard accelerator called a mnemonic. -- Pressing Alt and that key activates the button. ---buttonNewWithMnemonic :: - String -- ^ @label@ - The text of the button, with an underscore in+buttonNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - The text of the button, with an underscore in -- front of the mnemonic character -> IO Button buttonNewWithMnemonic label =@@ -193,14 +197,14 @@ -- If @stockId@ is unknown, then it will be treated as a mnemonic label (as -- for 'buttonNewWithMnemonic'). ---buttonNewFromStock :: +buttonNewFromStock :: StockId -- ^ @stockId@ - the name of the stock item -> IO Button buttonNewFromStock stockId = makeNewObject mkButton $ liftM (castPtr :: Ptr Widget -> Ptr Button) $ withUTFString stockId $ \stockIdPtr ->- throwIfNull "buttonNewFromStock: Invalid stock identifier." $ + throwIfNull "buttonNewFromStock: Invalid stock identifier." $ {# call unsafe button_new_from_stock #} stockIdPtr @@ -265,42 +269,12 @@ {# call unsafe button_get_relief #} (toButton self) -#if GTK_CHECK_VERSION(2,4,0)--- %hash c:d8cb d:1e7d--- | If the child of the button is a 'Misc' or 'Alignment', this property can--- be used to control it's horizontal alignment. 0.0 is left aligned, 1.0 is--- right aligned.------ Allowed values: [0,1]------ Default value: 0.5------ * Available since Gtk+ version 2.4----buttonXAlign :: ButtonClass self => Attr self Float-buttonXAlign = newAttrFromFloatProperty "xalign"---- %hash c:ce4e d:4fec--- | If the child of the button is a 'Misc' or 'Alignment', this property can--- be used to control it's vertical alignment. 0.0 is top aligned, 1.0 is--- bottom aligned.------ Allowed values: [0,1]------ Default value: 0.5------ * Available since Gtk+ version 2.4----buttonYAlign :: ButtonClass self => Attr self Float-buttonYAlign = newAttrFromFloatProperty "yalign"-#endif- -- | Sets the text of the label of the button. This text is also used -- to select the stock item if 'buttonSetUseStock' is used. -- -- This will also clear any previously set labels. ---buttonSetLabel :: ButtonClass self => self -> String -> IO ()+buttonSetLabel :: (ButtonClass self, GlibString string) => self -> string -> IO () buttonSetLabel self label = withUTFString label $ \labelPtr -> {# call button_set_label #}@@ -313,7 +287,7 @@ -- This will be the case if you create an empty button with 'buttonNew' to use -- as a container. ---buttonGetLabel :: ButtonClass self => self -> IO String+buttonGetLabel :: (ButtonClass self, GlibString string) => self -> IO string buttonGetLabel self = do strPtr <- {# call unsafe button_get_label #} (toButton self)@@ -439,7 +413,7 @@ #endif #if GTK_CHECK_VERSION(2,6,0)--- | Gets the widget that is currenty set as the image of the button. This may+-- | Gets the widget that is currently set as the image of the button. This may -- have been explicitly set by 'buttonSetImage' or constructed by -- 'buttonNewFromStock'. --@@ -493,6 +467,19 @@ (toButton self) #endif +#if GTK_CHECK_VERSION(2,22,0)+-- | Returns the button's event window if it is realized, 'Nothing' otherwise.+--+-- * Available since Gtk+ version 2.22+--+buttonGetEventWindow :: ButtonClass self => self+ -> IO (Maybe DrawWindow) -- ^ returns button's event window or 'Nothing'+buttonGetEventWindow self =+ maybeNull (makeNewGObject mkDrawWindow) $+ {#call gtk_button_get_event_window #}+ (toButton self)+#endif+ -------------------- -- Attributes @@ -501,7 +488,7 @@ -- -- Default value: @\"\"@ ---buttonLabel :: ButtonClass self => Attr self String+buttonLabel :: (ButtonClass self, GlibString string) => Attr self string buttonLabel = newAttr buttonGetLabel buttonSetLabel
Graphics/UI/Gtk/Buttons/CheckButton.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget CheckButton --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Buttons.CheckButton ( -- * Detail--- +-- -- | A 'CheckButton' places a discrete 'ToggleButton' next to a widget, -- (usually a 'Label'). See the section on 'ToggleButton' widgets for more -- information about toggle\/check buttons.@@ -59,11 +60,11 @@ checkButtonNewWithMnemonic, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -81,8 +82,8 @@ -- | Creates a new 'CheckButton' with a 'Label' to the right of it. ---checkButtonNewWithLabel :: - String -- ^ @label@ - the text for the check button.+checkButtonNewWithLabel :: GlibString string+ => string -- ^ @label@ - the text for the check button. -> IO CheckButton checkButtonNewWithLabel label = makeNewObject mkCheckButton $@@ -95,8 +96,8 @@ -- using 'Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic', so underscores -- in @label@ indicate the mnemonic for the check button. ---checkButtonNewWithMnemonic :: - String -- ^ @label@ - The text of the button, with an underscore+checkButtonNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - The text of the button, with an underscore -- in front of the mnemonic character -> IO CheckButton checkButtonNewWithMnemonic label =
+ Graphics/UI/Gtk/Buttons/LinkButton.chs view
@@ -0,0 +1,177 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget LinkButton+--+-- Author : Andy Stewart+--+-- Created: 22 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Create buttons bound to a URL+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Buttons.LinkButton (++-- * Detail+--+-- | A 'LinkButton' is a 'Button' with a hyperlink, similar to the one used by+-- web browsers, which triggers an action when clicked. It is useful to show+-- quick links to resources.+--+-- A link button is created by calling either 'linkButtonNew' or+-- 'linkButtonNewWithLabel'. If using the former, the URI you pass to the+-- constructor is used as a label for the widget.+--+-- The URI bound to a 'LinkButton' can be set specifically using+-- \"set linkButton [linkButtonURI := uri]\", and retrieved using \"uri <- get linkButton linkButtonURI\".+--+-- 'LinkButton' offers a global hook, which is called when the used clicks+-- on it: see 'linkButtonSetURIHook'.+--+-- 'LinkButton' was added in Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'Bin'+-- | +----'Button'+-- | +----LinkButton+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ LinkButton,+ LinkButtonClass,+ castToLinkButton,+ toLinkButton,++-- * Constructors+ linkButtonNew,+ linkButtonNewWithLabel,++-- * Methods+#if GTK_MAJOR_VERSION < 3+ linkButtonSetUriHook,+#endif++-- * Attributes+ linkButtonURI,+#if GTK_CHECK_VERSION(2,14,0)+ linkButtonVisited,+#endif+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)++--------------------+-- Constructors++-- | Creates a new 'LinkButton' with the URI as its text.+--+linkButtonNew :: GlibString string+ => string -- ^ @uri@ - a valid URI+ -> IO LinkButton+linkButtonNew uri =+ makeNewObject mkLinkButton $+ liftM (castPtr :: Ptr Widget -> Ptr LinkButton) $+ withUTFString uri $ \uriPtr ->+ {# call gtk_link_button_new #}+ uriPtr++-- | Creates a new 'LinkButton' containing a label.+--+linkButtonNewWithLabel :: GlibString string+ => string -- ^ @uri@ - a valid URI+ -> string -- ^ @label@ - the text of the button+ -> IO LinkButton+linkButtonNewWithLabel uri label =+ makeNewObject mkLinkButton $+ liftM (castPtr :: Ptr Widget -> Ptr LinkButton) $+ withUTFString label $ \labelPtr ->+ withUTFString uri $ \uriPtr ->+ {# call gtk_link_button_new_with_label #}+ uriPtr+ labelPtr++--------------------+-- Methods+#if GTK_MAJOR_VERSION < 3+-- | Sets @func@ as the function that should be invoked every time a user+-- clicks a 'LinkButton'. This function is called before every callback+-- registered for the 'buttonClicked' signal.+--+-- If no uri hook has been set, Gtk+ defaults to calling 'showURI'.+--+-- Removed in Gtk3.+linkButtonSetUriHook :: (String -> IO ()) -> IO ()+linkButtonSetUriHook func = do+ pfPtr <- mkLinkButtonUriFunc $ \_ cstr _ -> do+ str <- peekCString cstr+ func str+ {# call link_button_set_uri_hook #} pfPtr (castFunPtrToPtr pfPtr) destroyFunPtr+ freeHaskellFunPtr pfPtr++{#pointer LinkButtonUriFunc#}++foreign import ccall "wrapper" mkLinkButtonUriFunc ::+ (Ptr LinkButton -> CString -> Ptr () -> IO ())+ -> IO LinkButtonUriFunc+#endif++--------------------+-- Attributes++-- | The URI bound to this button.+--+-- Default value: \"\"+--+-- * Available since Gtk+ version 2.10+--+linkButtonURI :: (LinkButtonClass self, GlibString string) => Attr self string+linkButtonURI = newAttrFromStringProperty "uri"++#if GTK_CHECK_VERSION(2,14,0)+-- | The 'visited' state of this button. A visited link is drawn in a different color.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.14+--+linkButtonVisited :: LinkButtonClass self => Attr self Bool+linkButtonVisited = newAttrFromBoolProperty "visited"+#endif+#endif
Graphics/UI/Gtk/Buttons/RadioButton.chs view
@@ -33,7 +33,7 @@ -- module Graphics.UI.Gtk.Buttons.RadioButton ( -- * Detail--- +-- -- | A single radio button performs the same basic function as a -- 'CheckButton', as its position in the object hierarchy reflects. It is only -- when multiple radio buttons are grouped together that they become a@@ -58,27 +58,27 @@ -- -- * How to create a group of two radio buttons. ----- > +-- > -- > createRadioButtons :: IO () -- > createRadioButtons = do -- > window <- windowNew -- > box <- vBoxNew True 2--- > +-- > -- > -- Create a radio button with a Entry widget -- > radio1 <- radioButtonNew -- > entry <- entryNew -- > containerAdd radio1 entry--- > +-- > -- > -- Create a radio button with a label -- > radio2 <- radioButtonNewWithLabelFromWidget -- > radio1 "I'm the second radio button."--- > +-- > -- > -- Pack them into a box, then show all the widgets -- > boxPackStart box radio1 PackGrow 2 -- > boxPackStart box radio2 PackGrow 2 -- > containerAdd window box -- > widgetShowAll window--- > +-- > -- -- When an unselected button in the group is clicked the clicked button -- receives the \"toggled\" signal, as does the previously selected button.@@ -114,7 +114,7 @@ radioButtonNewWithLabelFromWidget, radioButtonNewWithMnemonicFromWidget, - -- * Compatibilty aliases+ -- * Compatibility aliases radioButtonNewJoinGroup, radioButtonNewJoinGroupWithLabel, radioButtonNewJoinGroupWithMnemonic,@@ -140,13 +140,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.GList import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -167,7 +167,7 @@ -- | Creates a new 'RadioButton' with a text label. ---radioButtonNewWithLabel :: String -> IO RadioButton+radioButtonNewWithLabel :: GlibString string => string -> IO RadioButton radioButtonNewWithLabel label = makeNewObject mkRadioButton $ liftM (castPtr :: Ptr Widget -> Ptr RadioButton) $@@ -181,8 +181,8 @@ -- so underscores in @label@ indicate the mnemonic -- for the button. ---radioButtonNewWithMnemonic :: - String -- ^ @label@ - the text of the button, with an underscore+radioButtonNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - the text of the button, with an underscore -- in front of the mnemonic character -> IO RadioButton radioButtonNewWithMnemonic label =@@ -197,7 +197,7 @@ -- which @groupMember@ belongs. As with 'radioButtonNew', a widget should be -- packed into the radio button. ---radioButtonNewFromWidget :: +radioButtonNewFromWidget :: RadioButton -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added. -> IO RadioButton@@ -210,10 +210,10 @@ -- | Creates a new 'RadioButton' with a text label, adding it to the same group -- as the group to which @groupMember@ belongs. ---radioButtonNewWithLabelFromWidget :: - RadioButton -- ^ @groupMember@ - a member of an existing radio button+radioButtonNewWithLabelFromWidget :: GlibString string+ => RadioButton -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added.- -> String -- ^ @label@ - a text string to display next to the radio+ -> string -- ^ @label@ - a text string to display next to the radio -- button. -> IO RadioButton radioButtonNewWithLabelFromWidget group label =@@ -229,10 +229,10 @@ -- 'Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic', -- so underscores in @label@ indicate the mnemonic for the button. ---radioButtonNewWithMnemonicFromWidget :: - RadioButton -- ^ @groupMember@ - a member of an existing radio button+radioButtonNewWithMnemonicFromWidget :: GlibString string+ => RadioButton -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added.- -> String -- ^ @label@ - the text of the button, with an underscore+ -> string -- ^ @label@ - the text of the button, with an underscore -- in front of the mnemonic character -> IO RadioButton radioButtonNewWithMnemonicFromWidget group label =@@ -244,7 +244,7 @@ labelPtr -- | Alias for 'radioButtonNewFromWidget'.-radioButtonNewJoinGroup :: +radioButtonNewJoinGroup :: RadioButton -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added. -> IO RadioButton@@ -252,20 +252,20 @@ {-# DEPRECATED radioButtonNewJoinGroup "use radioButtonNewFromWidget instead" #-} -- | Alias for 'radioButtonNewWithLabelFromWidget'.-radioButtonNewJoinGroupWithLabel :: - RadioButton -- ^ @groupMember@ - a member of an existing radio button+radioButtonNewJoinGroupWithLabel :: GlibString string+ => RadioButton -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added.- -> String -- ^ @label@ - a text string to display next to the radio+ -> string -- ^ @label@ - a text string to display next to the radio -- button. -> IO RadioButton radioButtonNewJoinGroupWithLabel = radioButtonNewWithLabelFromWidget {-# DEPRECATED radioButtonNewJoinGroupWithLabel "use radioButtonNewWithLabelFromWidget instead" #-} -- | Alias for 'radioButtonNewWithMnemonicFromWidget'.-radioButtonNewJoinGroupWithMnemonic :: - RadioButton -- ^ @groupMember@ - a member of an existing radio button+radioButtonNewJoinGroupWithMnemonic :: GlibString string+ => RadioButton -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added.- -> String -- ^ @label@ - the text of the button, with an underscore+ -> string -- ^ @label@ - the text of the button, with an underscore -- in front of the mnemonic character -> IO RadioButton radioButtonNewJoinGroupWithMnemonic = radioButtonNewWithMnemonicFromWidget@@ -318,7 +318,7 @@ -- | Emitted when the group of radio buttons that a radio button belongs to -- changes. This is emitted when a radio button switches from being alone to -- being part of a group of 2 or more buttons, or vice-versa, and when a--- buttton is moved from one group of 2 or more buttons to a different one, but+-- button is moved from one group of 2 or more buttons to a different one, but -- not when the composition of the group that a button belongs to changes. -- -- * Available since Gtk+ version 2.4@@ -336,7 +336,7 @@ -- | Emitted when the group of radio buttons that a radio button belongs to -- changes. This is emitted when a radio button switches from being alone to -- being part of a group of 2 or more buttons, or vice-versa, and when a--- buttton is moved from one group of 2 or more buttons to a different one, but+-- button is moved from one group of 2 or more buttons to a different one, but -- not when the composition of the group that a button belongs to changes. -- onGroupChanged, afterGroupChanged :: RadioButtonClass self => self
+ Graphics/UI/Gtk/Buttons/ScaleButton.chs view
@@ -0,0 +1,235 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget ScaleButton+--+-- Author : Andy Stewart+--+-- Created: 22 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A button which pops up a scale+--+-- * Module available since Gtk+ version 2.12+--+module Graphics.UI.Gtk.Buttons.ScaleButton (++-- * Detail+--+-- | 'ScaleButton' provides a button which pops up a scale widget. This kind+-- of widget is commonly used for volume controls in multimedia applications,+-- and Gtk+ provides a 'VolumeButton' subclass that is tailored for this use+-- case.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'Bin'+-- | +----'Button'+-- | +----ScaleButton+-- | +----'VolumeButton'+-- @++#if GTK_CHECK_VERSION(2,12,0)+-- * Types+ ScaleButton,+ ScaleButtonClass,+ castToScaleButton,+ toScaleButton,++-- * Constructors+ scaleButtonNew,++-- * Methods+ scaleButtonSetIcons,+#if GTK_CHECK_VERSION(2,14,0)+ scaleButtonGetPopup,+ scaleButtonGetPlusButton,+ scaleButtonGetMinusButton,+#endif++-- * Attributes+ scaleButtonValue,+ scaleButtonSize,+ scaleButtonAdjustment,+ scaleButtonIcons,++-- * Signals+ scaleButtonPopdown,+ scaleButtonPopup,+ scaleButtonValueChanged,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.General.Structs (IconSize(..))+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,12,0)+--------------------+-- Interfaces++-- instance OrientableClass ScaleButton++--------------------+-- Constructors++-- | Creates a 'ScaleButton', with a range between @min@ and @max@, with a+-- stepping of @step@.+--+scaleButtonNew :: GlibString string+ => IconSize -- ^ @size@ - a stock icon size+ -> Double -- ^ @min@ - the minimum value of the scale (usually 0)+ -> Double -- ^ @max@ - the maximum value of the scale (usually 100)+ -> Double -- ^ @step@ - the stepping of value when a scroll-wheel event, or+ -- up\/down arrow event occurs (usually 2)+ -> [string] -- ^ @icons@+ -> IO ScaleButton+scaleButtonNew size min max step icons =+ makeNewObject mkScaleButton $+ liftM (castPtr :: Ptr Widget -> Ptr ScaleButton) $+ withUTFStringArray0 icons $ \iconsPtr ->+ {# call gtk_scale_button_new #}+ ((fromIntegral . fromEnum) size)+ (realToFrac min)+ (realToFrac max)+ (realToFrac step)+ iconsPtr++--------------------+-- Methods++-- | Sets the icons to be used by the scale button. For details, see the "icons" property.+scaleButtonSetIcons :: (ScaleButtonClass self, GlibString string) => self+ -> [string] -- ^ @icons@+ -> IO ()+scaleButtonSetIcons self icons =+ withUTFStringArray0 icons $ \iconsPtr ->+ {# call gtk_scale_button_set_icons #}+ (toScaleButton self)+ iconsPtr++#if GTK_CHECK_VERSION(2,14,0)+-- | Retrieves the popup of the 'ScaleButton'.+--+-- * Available since Gtk+ version 2.14+--+scaleButtonGetPopup :: ScaleButtonClass self => self+ -> IO Widget -- ^ returns the popup of the 'ScaleButton'+scaleButtonGetPopup self =+ makeNewObject mkWidget $+ {# call gtk_scale_button_get_popup #}+ (toScaleButton self)++-- | Retrieves the plus button of the 'ScaleButton'.+--+-- * Available since Gtk+ version 2.14+--+scaleButtonGetPlusButton :: ScaleButtonClass self => self+ -> IO Widget -- ^ returns the plus button of the 'ScaleButton'.+scaleButtonGetPlusButton self =+ makeNewObject mkWidget $+ {# call gtk_scale_button_get_plus_button #}+ (toScaleButton self)++-- | Retrieves the minus button of the 'ScaleButton'.+--+-- * Available since Gtk+ version 2.14+--+scaleButtonGetMinusButton :: ScaleButtonClass self => self+ -> IO Widget -- ^ returns the minus button of the 'ScaleButton'.+scaleButtonGetMinusButton self =+ makeNewObject mkWidget $+ {# call gtk_scale_button_get_minus_button #}+ (toScaleButton self)+#endif++--------------------+-- Attributes++-- | The value of the scale.+--+-- Default value: 0+scaleButtonValue :: ScaleButtonClass self => Attr self Double+scaleButtonValue = newAttrFromDoubleProperty "value"++-- | The icon size.+--+-- Default value: ''IconSizeSmallToolbar''+scaleButtonSize :: ScaleButtonClass self => Attr self IconSize+scaleButtonSize = newAttrFromEnumProperty "size"+ {# call pure unsafe gtk_icon_size_get_type #}++-- | The 'Adjustment' that contains the current value of this scale button object.+scaleButtonAdjustment :: ScaleButtonClass self => Attr self Adjustment+scaleButtonAdjustment = newAttrFromObjectProperty "adjustment"+ {# call pure unsafe gtk_adjustment_get_type #}++-- | The names of the icons to be used by the scale button. The first item in the array will be used in+-- the button when the current value is the lowest value, the second item for the highest value. All+-- the subsequent icons will be used for all the other values, spread evenly over the range of values.+--+-- If there's only one icon name in the icons array, it will be used for all the values. If only two+-- icon names are in the icons array, the first one will be used for the bottom 50% of the scale, and+-- the second one for the top 50%.+--+-- It is recommended to use at least 3 icons so that the 'ScaleButton' reflects the current value of+-- the scale better for the users.+--+-- Since 2.12+scaleButtonIcons :: (ScaleButtonClass self, GlibString string) => ReadWriteAttr self [string] (Maybe [string])+scaleButtonIcons =+ newAttr (objectGetPropertyBoxedOpaque (peekUTFStringArray0 . castPtr) gtype "search-path")+ (objectSetPropertyBoxedOpaque (\dirs f -> maybeWith withUTFStringArray0 dirs (f . castPtr)) gtype "search-path")+ where gtype = {#call pure g_strv_get_type#}+++--------------------+-- Signals++-- | The 'scaleButtonValueChanged' signal is emitted when the value field has changed.+--+scaleButtonValueChanged :: ScaleButtonClass self => Signal self (Double -> IO ())+scaleButtonValueChanged = Signal (connect_DOUBLE__NONE "value_changed")++-- | The 'popup' signal is a keybinding signal which gets emitted to popup the scale widget.+--+-- The default bindings for this signal are Space, Enter and Return.+scaleButtonPopup :: ScaleButtonClass self => Signal self (IO ())+scaleButtonPopup = Signal (connect_NONE__NONE "popup")++-- | The 'popdown' signal is a keybinding signal which gets emitted to popdown the scale widget.+--+-- The default binding for this signal is Escape.+scaleButtonPopdown :: ScaleButtonClass self => Signal self (IO ())+scaleButtonPopdown = Signal (connect_NONE__NONE "popdown")+#endif
Graphics/UI/Gtk/Buttons/ToggleButton.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Buttons.ToggleButton ( -- * Detail--- +-- -- | A 'ToggleButton' is a 'Button' which will remain \'pressed-in\' when -- clicked. Clicking again will cause the toggle button to return to its normal -- state.@@ -92,13 +92,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -118,8 +118,8 @@ -- | Creates a new toggle button with a text label. ---toggleButtonNewWithLabel :: - String -- ^ @label@ - a string containing the message to be+toggleButtonNewWithLabel :: GlibString string+ => string -- ^ @label@ - a string containing the message to be -- placed in the toggle button. -> IO ToggleButton toggleButtonNewWithLabel label =@@ -134,8 +134,8 @@ -- so underscores in @label@ indicate the -- mnemonic for the button. ---toggleButtonNewWithMnemonic :: - String -- ^ @label@ - the text of the button, with an underscore+toggleButtonNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - the text of the button, with an underscore -- in front of the mnemonic character -> IO ToggleButton toggleButtonNewWithMnemonic label =
+ Graphics/UI/Gtk/Buttons/VolumeButton.chs view
@@ -0,0 +1,85 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget VolumeButton+--+-- Author : Andy Stewart+--+-- Created: 22 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A button which pops up a volume control+--+-- * Module available since Gtk+ version 2.12+--+module Graphics.UI.Gtk.Buttons.VolumeButton (++-- * Detail+--+-- | 'VolumeButton' is a subclass of 'ScaleButton' that has been tailored for+-- use as a volume control widget with suitable icons, tooltips and accessible+-- labels.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'Bin'+-- | +----'Button'+-- | +----'ScaleButton'+-- | +----VolumeButton+-- @++#if GTK_CHECK_VERSION(2,12,0)+-- * Types+ VolumeButton,+ VolumeButtonClass,+ castToVolumeButton,+ toVolumeButton,++-- * Constructors+ volumeButtonNew,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,12,0)+--------------------+-- Constructors++-- | Creates a 'VolumeButton', with a range between 0.0 and 1.0, with a+-- stepping of 0.02. Volume values can be obtained and modified using the+-- functions from 'ScaleButton'.+--+volumeButtonNew :: IO VolumeButton+volumeButtonNew =+ makeNewObject mkVolumeButton $+ liftM (castPtr :: Ptr Widget -> Ptr VolumeButton) $+ {# call gtk_volume_button_new #}+#endif
Graphics/UI/Gtk/Cairo.chs view
@@ -25,9 +25,9 @@ -- Stability : provisional -- Portability : portable (depends on GHC) ----- --- Gtk specific functions to for redering with Cairo. --+-- Gtk specific functions to for rendering with Cairo.+-- -- Cairo is a graphics library that supports vector graphics and image -- compositing that can be used with Gdk. -- The Cairo API is an addition to Gdk\/Gtk (rather than a replacement).@@ -50,10 +50,16 @@ cairoContextSetFontOptions, cairoContextGetFontOptions, -- * Functions for the 'Render' monad.+#if GTK_MAJOR_VERSION < 3 renderWithDrawable,+#else+ getClipRectangle,+ renderWithDrawWindow,+#endif+ region, setSourceColor, setSourcePixbuf,- region,+ rectangle, updateContext, createLayout, updateLayout,@@ -70,16 +76,23 @@ import System.Glib.FFI {#import Graphics.UI.Gtk.Types#}+#if GTK_MAJOR_VERSION < 3 {#import Graphics.UI.Gtk.Gdk.Region#} (Region(..))+#endif {#import Graphics.Rendering.Pango.Cairo#} #if GTK_CHECK_VERSION(2,8,0)+#if GTK_MAJOR_VERSION < 3+{#import Graphics.Rendering.Cairo.Types#} as Cairo hiding (Region)+#else {#import Graphics.Rendering.Cairo.Types#} as Cairo+#endif import qualified Graphics.Rendering.Cairo.Internal as Cairo.Internal-import qualified Graphics.Rendering.Cairo as Cairo import Graphics.Rendering.Cairo.Internal (Render(Render)) import Control.Monad.Reader+import Graphics.UI.Gtk.General.Structs (Rectangle(..)) #endif+import Control.Monad (unless, liftM) {# context lib="gdk" prefix="gdk" #} @@ -87,8 +100,10 @@ -- Methods #if GTK_CHECK_VERSION(2,8,0)+#if GTK_MAJOR_VERSION < 3 -- | Creates a Cairo context for drawing to a 'Drawable'. --+-- Removed in Gtk3. renderWithDrawable :: DrawableClass drawable => drawable -- ^ @drawable@ - a 'Drawable' -> Render a -- ^ A newly created Cairo context.@@ -100,7 +115,37 @@ unless (status == Cairo.StatusSuccess) $ fail =<< Cairo.Internal.statusToString status) (\context -> runReaderT (Cairo.Internal.runRender m) context)+#endif +#if GTK_MAJOR_VERSION >= 3+-- | Creates a Cairo context for drawing to a 'DrawWindow'.+renderWithDrawWindow :: DrawWindowClass drawWindow =>+ drawWindow -- ^ @drawWindow@ - a 'DrawWindow'+ -> Render a -- ^ A newly created Cairo context.+ -> IO a+renderWithDrawWindow drawWindow m =+ bracket (liftM Cairo.Cairo $ {#call unsafe gdk_cairo_create#} (toDrawWindow drawWindow))+ (\context -> do status <- Cairo.Internal.status context+ Cairo.Internal.destroy context+ unless (status == Cairo.StatusSuccess) $+ fail =<< Cairo.Internal.statusToString status)+ (\context -> runReaderT (Cairo.Internal.runRender m) context)++-- | Compute a bounding box in user coordinates covering the area inside+-- the current clip. It rounds the bounding box to integer coordinates.+-- Returns 'Nothing' indicating if a clip area doesn't exist.+getClipRectangle :: Render (Maybe Rectangle)+getClipRectangle = Render $ do+ cr <- ask+ liftIO $ alloca $ \rectPtr -> do+ ok <- {# call unsafe gdk_cairo_get_clip_rectangle #}+ cr+ (castPtr rectPtr)+ if ok /= 0+ then fmap Just (peek rectPtr)+ else return Nothing+#endif+ -- | Sets the given pixbuf as the source pattern for the Cairo context. The -- pattern has an extend mode of 'ExtendNone' and is aligned so that the -- origin of pixbuf is @(x, y)@.@@ -119,11 +164,20 @@ (realToFrac pixbufY) -- | Adds the given region to the current path of the 'Render' context.---+rectangle :: Rectangle -> Render ()+rectangle rect = Render $ do+ cr <- ask+ liftIO $ with rect $ \ rectPtr ->+ {# call unsafe gdk_cairo_rectangle #}+ cr+ (castPtr rectPtr)++-- | Adds the given region to the current path of the 'Render' context. region :: Region -> Render () region region = Render $ do cr <- ask liftIO $ {# call unsafe gdk_cairo_region #} cr region+ #endif
Graphics/UI/Gtk/Display/AccelLabel.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget AccelLabel --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Display.AccelLabel ( -- * Detail--- +-- -- | The 'AccelLabel' widget is a subclass of 'Label' that also displays an -- accelerator key on the right of the label text, e.g. \'Ctl+S\'. It is -- commonly used in menus to show the keyboard short-cuts for commands.@@ -41,7 +42,7 @@ -- 'accelLabelSetAccelWidget' is called with the 'MenuItem' as the second -- argument. The 'AccelLabel' will now display \'Ctl+S\' after its label. ----- Note that creating a 'MenuItem' with +-- Note that creating a 'MenuItem' with -- 'Graphics.UI.Gtk.MenuComboToolbar.MenuItem.menuItemNewWithLabel' (or one of -- the similar functions for 'CheckMenuItem' and 'RadioMenuItem') automatically -- adds a 'AccelLabel' to the 'MenuItem' and calls 'accelLabelSetAccelWidget'@@ -82,12 +83,12 @@ accelLabelAccelWidget, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -97,8 +98,8 @@ -- | Creates a new 'AccelLabel'. ---accelLabelNew :: - String -- ^ @string@ - the label string.+accelLabelNew :: GlibString string+ => string -- ^ @string@ - the label string. -> IO AccelLabel accelLabelNew string = makeNewObject mkAccelLabel $
Graphics/UI/Gtk/Display/Image.chs view
@@ -27,7 +27,7 @@ -- only functions are bound that allow loading images from disc or by stock -- names. ----- Another function for extracting the 'Pixbuf' is added for +-- Another function for extracting the 'Pixbuf' is added for -- 'CellRenderer'. -- -- |@@ -39,7 +39,7 @@ -- module Graphics.UI.Gtk.Display.Image ( -- * Detail--- +-- -- | The 'Image' widget displays an image. Various kinds of object can be -- displayed as an image; most typically, you would load a 'Pixbuf' (\"pixel -- buffer\") from a file, and then display that. There's a convenience function@@ -92,7 +92,7 @@ castToImage, gTypeImage, toImage, ImageType(..),- + -- * Constructors imageNewFromFile, imageNewFromPixbuf,@@ -123,10 +123,12 @@ -- * Attributes imagePixbuf,+#if GTK_MAJOR_VERSION < 3 imagePixmap,+ imageMask,+#endif imageAnimation, imageImage,- imageMask, imageFile, imageStock, imageIconSize,@@ -139,17 +141,16 @@ imageStorageType, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import System.Glib.GObject (makeNewGObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.General.StockItems-import Graphics.UI.Gtk.General.Structs (IconSize(..))+import Graphics.UI.Gtk.General.Structs (IconSize(..)) {# context lib="gtk" prefix="gtk" #} @@ -183,12 +184,12 @@ -- The storage type ('imageGetStorageType') of the returned image is not -- defined, it will be whatever is appropriate for displaying the file. ---imageNewFromFile :: FilePath -> IO Image+imageNewFromFile :: GlibFilePath fp => fp -> IO Image imageNewFromFile filename = makeNewObject mkImage $ liftM (castPtr :: Ptr Widget -> Ptr Image) $- withUTFString filename $ \filenamePtr ->-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+ withUTFFilePath filename $ \filenamePtr ->+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call unsafe gtk_image_new_from_file_utf8 #} #else {# call unsafe gtk_image_new_from_file #}@@ -245,8 +246,8 @@ -- -- * Available since Gtk+ version 2.6 ---imageNewFromIconName ::- String -- ^ @iconName@ - an icon name+imageNewFromIconName :: GlibString string+ => string -- ^ @iconName@ - an icon name -> IconSize -- ^ @size@ - a stock icon size -> IO Image imageNewFromIconName iconName size =@@ -288,10 +289,10 @@ -- | See 'imageNewFromFile' for details. ---imageSetFromFile :: Image -> FilePath -> IO ()+imageSetFromFile :: GlibFilePath fp => Image -> fp -> IO () imageSetFromFile self filename =- withUTFString filename $ \filenamePtr ->-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+ withUTFFilePath filename $ \filenamePtr ->+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_image_set_from_file_utf8 #} #else {# call gtk_image_set_from_file #}@@ -317,8 +318,8 @@ -- -- * Available since Gtk+ version 2.6 ---imageSetFromIconName :: Image- -> String -- ^ @iconName@ - an icon name+imageSetFromIconName :: GlibString string => Image+ -> string -- ^ @iconName@ - an icon name -> IconSize -- ^ @size@ - an icon size -> IO () imageSetFromIconName self iconName size =@@ -378,36 +379,38 @@ imageAnimation = newAttrFromObjectProperty "pixbuf-animation" {# call pure unsafe gdk_pixbuf_get_type #} +#if GTK_MAJOR_VERSION < 3 -- | A 'Pixmap' to display. -- imagePixmap :: PixmapClass pixmap => ReadWriteAttr Image Pixmap pixmap imagePixmap = newAttrFromObjectProperty "pixmap" {# call pure unsafe gdk_pixmap_get_type #} --- | A 'Image' to display.----imageImage :: ImageClass image => ReadWriteAttr Image Image image-imageImage = newAttrFromObjectProperty "image"- {# call pure unsafe gtk_image_get_type #}- -- | Mask bitmap to use with 'Image' or 'Pixmap'. -- imageMask :: PixmapClass pixmap => ReadWriteAttr Image Pixmap pixmap imageMask = newAttrFromObjectProperty "mask" {# call pure unsafe gdk_pixmap_get_type #}+#endif +-- | A 'Image' to display.+--+imageImage :: ImageClass image => ReadWriteAttr Image Image image+imageImage = newAttrFromObjectProperty "image"+ {# call pure unsafe gtk_image_get_type #}+ -- | Filename to load and display. -- -- Default value: \"\" ---imageFile :: Attr Image String+imageFile :: GlibString string => Attr Image string imageFile = newAttrFromStringProperty "file" -- | Stock ID for a stock image to display. -- -- Default value: \"\" ---imageStock :: Attr Image String+imageStock :: GlibString string => Attr Image string imageStock = newAttrFromStringProperty "stock" -- | Symbolic size to use for stock icon, icon set or named icon.@@ -439,7 +442,7 @@ -- -- Default value: \"\" ---imageIconName :: Attr Image String+imageIconName :: GlibString string => Attr Image string imageIconName = newAttrFromStringProperty "icon-name" #endif
+ Graphics/UI/Gtk/Display/InfoBar.chs view
@@ -0,0 +1,272 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget InfoBar+--+-- Author : Andy Stewart+--+-- Created: 27 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- 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.+--+-- The following varargs functions can't bound:+--+-- gtk_info_bar_new_with_buttons+-- gtk_info_bar_add_buttons+--+-- Use 'infoBarAddButton' replace.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Report important messages to the user+--+module Graphics.UI.Gtk.Display.InfoBar (++-- * Detail+--+-- | 'InfoBar' is a widget that can be used to show messages to the user+-- without showing a dialog. It is often temporarily shown at the top or bottom+-- of a document. In contrast to 'Dialog', which has a horizontal action area+-- at the bottom, 'InfoBar' has a vertical action area at the side.+--+-- The API of 'InfoBar' is very similar to 'Dialog', allowing you to add+-- buttons to the action area with 'infoBarAddButton'.+-- The sensitivity of action widgets can be controlled+-- with 'infoBarSetResponseSensitive'. To add widgets to the main content area+-- of a 'InfoBar', use 'infoBarGetContentArea' and add your widgets to the+-- container.+--+-- Similar to 'MessageDialog', the contents of a 'InfoBar' can by classified+-- as error message, warning, informational message, etc, by using+-- 'infoBarSetMessageType'. Gtk+ uses the message type to determine the+-- background color of the message area.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'Box'+-- | +----'HBox'+-- | +----InfoBar+-- @++#if GTK_CHECK_VERSION(2,18,0)+-- * Types+ InfoBar,+ InfoBarClass,+ castToInfoBar,+ toInfoBar,++-- * Constructors+ infoBarNew,++-- * Methods+ infoBarAddActionWidget,+ infoBarAddButton,+ infoBarSetResponseSensitive,+ infoBarSetDefaultResponse,+ infoBarEmitResponse,+ infoBarGetActionArea,+ infoBarGetContentArea,++-- * Attributes+ infoBarMessageType,++-- * Signals+ infoBarResponse,+ infoBarClose,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject)+{#import Graphics.UI.Gtk.Windows.MessageDialog#} (MessageType)+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Interfaces++-- instance BuildableClass InfoBar++--------------------+-- Constructors++#if GTK_CHECK_VERSION(2,18,0)+-- | Creates a new 'InfoBar' object.+--+-- * Available since Gtk+ version 2.18+--+infoBarNew :: IO InfoBar+infoBarNew =+ makeNewObject mkInfoBar $+ liftM (castPtr :: Ptr Widget -> Ptr InfoBar) $+ {# call gtk_info_bar_new #}++--------------------+-- Methods++-- | Add an activatable widget to the action area of a 'InfoBar', connecting a signal handler that will+-- emit the "response" signal on the message area when the widget is activated. The widget is appended+-- to the end of the message areas action area.+--+-- * Available since Gtk+ version 2.18+--+infoBarAddActionWidget :: (InfoBarClass self, WidgetClass child) => self+ -> child -- ^ @child@ - an activatable widget+ -> Int -- ^ @responseId@ - response ID for @child@+ -> IO ()+infoBarAddActionWidget self child responseId =+ {# call gtk_info_bar_add_action_widget #}+ (toInfoBar self)+ (toWidget child)+ (fromIntegral responseId)++-- | Adds a button with the given text (or a stock button, if buttonText is a+-- stock ID) and sets things up so that clicking the button will emit the+-- \"response\" signal with the given responseId. The button is appended to+-- the end of the info bars's action area. The button widget is returned, but+-- usually you don't need it.+--+-- * Available since Gtk+ version 2.18+--+infoBarAddButton :: (InfoBarClass self, GlibString string) => self+ -> string -- ^ @buttonText@ - text of button, or stock ID+ -> Int -- ^ @responseId@ - response ID for the button+ -> IO Button -- ^ returns the button widget that was added+infoBarAddButton self buttonText responseId =+ makeNewObject mkButton $+ withUTFString buttonText $ \buttonTextPtr ->+ liftM (castPtr :: Ptr Widget -> Ptr Button) $+ {# call gtk_info_bar_add_button #}+ (toInfoBar self)+ buttonTextPtr+ (fromIntegral responseId)++-- | Calls 'widgetSetSensitive' for each widget in the+-- info bars's action area with the given responseId. A convenient way to+-- sensitize\/desensitize dialog buttons.+--+-- * Available since Gtk+ version 2.18+--+infoBarSetResponseSensitive :: InfoBarClass self => self+ -> Int -- ^ @responseId@ - a response ID+ -> Bool -- ^ @setting@ - @True@ for sensitive+ -> IO ()+infoBarSetResponseSensitive self responseId setting =+ {# call gtk_info_bar_set_response_sensitive #}+ (toInfoBar self)+ (fromIntegral responseId)+ (fromBool setting)++-- | Sets the last widget in the info bar's action area with the given+-- responseId as the default widget for the dialog. Pressing \"Enter\"+-- normally activates the default widget.+--+-- * Available since Gtk+ version 2.18+--+infoBarSetDefaultResponse :: InfoBarClass self => self+ -> Int -- ^ @responseId@ - a response ID+ -> IO ()+infoBarSetDefaultResponse self responseId =+ {# call gtk_info_bar_set_default_response #}+ (toInfoBar self)+ (fromIntegral responseId)++-- | Emits the \'response\' signal with the given @responseId@.+--+-- * Available since Gtk+ version 2.18+--+infoBarEmitResponse :: InfoBarClass self => self+ -> Int -- ^ @responseId@ - a response ID+ -> IO ()+infoBarEmitResponse self responseId =+ {# call gtk_info_bar_response #}+ (toInfoBar self)+ (fromIntegral responseId)++-- | Returns the action area of @infoBar@.+--+-- * Available since Gtk+ version 2.18+--+infoBarGetActionArea :: InfoBarClass self => self+ -> IO Widget -- ^ returns the action area.+infoBarGetActionArea self =+ makeNewObject mkWidget $+ {# call gtk_info_bar_get_action_area #}+ (toInfoBar self)++-- | Returns the content area of @infoBar@.+--+-- * Available since Gtk+ version 2.18+--+infoBarGetContentArea :: InfoBarClass self => self+ -> IO Widget -- ^ returns the content area.+infoBarGetContentArea self =+ makeNewObject mkWidget $+ {# call gtk_info_bar_get_content_area #}+ (toInfoBar self)++--------------------+-- Attributes++-- | The type of the message.+--+-- The type is used to determine the colors to use in the info bar.+--+-- If the type is 'MessageOther', no info bar is painted but the colors are still set.+--+-- Default value: 'MessageInfo'+--+-- * Available since Gtk+ version 2.18+--+infoBarMessageType :: InfoBarClass self => Attr self MessageType+infoBarMessageType = newAttrFromEnumProperty "message-type"+ {# call pure unsafe gtk_message_type_get_type #}++--------------------+-- Signals++-- | The 'close' signal is a keybinding signal which gets emitted when the user uses a keybinding to+-- dismiss the info bar.+--+-- The default binding for this signal is the Escape key.+--+-- Since 2.18+infoBarClose :: InfoBarClass self => Signal self (IO ())+infoBarClose = Signal (connect_NONE__NONE "close")+++-- | Emitted when an action widget is clicked or the application programmer+-- calls 'dialogResponse'. The @responseId@ depends on which action widget was+-- clicked.+--+-- * Available since Gtk+ version 2.18+--+infoBarResponse :: InfoBarClass self => Signal self (Int -> IO ())+infoBarResponse = Signal (connect_INT__NONE "response")+#endif+
Graphics/UI/Gtk/Display/Label.chs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE ScopedTypeVariables #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Label --@@ -28,13 +29,13 @@ -- module Graphics.UI.Gtk.Display.Label ( -- * Detail--- +-- -- | The 'Label' widget displays a small amount of text. As the name implies, -- most labels are used to label another widget such as a 'Button', a -- 'MenuItem', or a 'OptionMenu'. -- ** Mnemonics--- +-- -- | Labels may contain mnemonics. Mnemonics are underlined characters in the -- label, used for keyboard navigation. Mnemonics are created by providing a -- string with an underscore before the mnemonic character, such as@@ -49,7 +50,7 @@ -- label already inside: To create a mnemonic for a widget alongside the label, -- such as a 'Entry', you have to point the label at the entry with -- 'labelSetMnemonicWidget':--- +-- -- > -- Pressing Alt+H will activate this button -- > button <- buttonNew -- > label <- labelNewWithMnemonic "_Hello"@@ -64,7 +65,7 @@ -- > labelSetMnemonicWidget label entry -- ** Markup (styled text)--- +-- -- | To make it easy to format text in a label (changing colors, fonts, etc.), -- label text can be provided in a simple markup format. Here's how to create a -- label with a small font: (See complete documentation of available tags in@@ -80,14 +81,14 @@ -- want to escape it with 'Graphics.Rendering.Pango.Layout.escapeMarkup'. -- ** Selectable labels--- +-- -- | Labels can be made selectable with 'labelSetSelectable'. Selectable -- labels allow the user to copy the label contents to the clipboard. Only -- labels that contain useful-to-copy information - such as error messages - -- should be made selectable. -- ** Text layout--- +-- -- | A label can contain any number of paragraphs, but will have performance -- problems if it contains more than a small number. Paragraphs are separated -- by newlines or other paragraph separators understood by Pango.@@ -97,7 +98,7 @@ -- 'labelSetJustify' sets how the lines in a label align with one another. -- If you want to set how the label as a whole aligns in its available space, -- see 'Graphics.UI.Gtk.Abstract.Misc.miscSetAlignment'.--- +-- -- * Class Hierarchy -- |@@ -189,30 +190,35 @@ #endif labelLineWrap, labelText,++-- * Signals+ labelActiveCurrentLink,+ labelActiveLink,+ labelCopyClipboard,+ labelMoveCursor,+ labelPopulatePopup ) where import Control.Monad (liftM)+import Data.Text (Text)+import qualified Data.Text as T (pack) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (makeNewGObject) {#import Graphics.Rendering.Pango.Layout#} import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} import Graphics.Rendering.Pango.Attributes ( withAttrList, fromAttrList) import Graphics.UI.Gtk.Gdk.Keys (KeyVal)-import Graphics.UI.Gtk.General.Enums (Justification(..))-import Graphics.Rendering.Pango.Markup+import Graphics.UI.Gtk.General.Enums (Justification(..), MovementStep (..)) {#import Graphics.Rendering.Pango.BasicTypes#} (PangoLayout(PangoLayout), makeNewPangoString, PangoString(..) ) import Graphics.Rendering.Pango.Types (mkPangoLayoutRaw, PangoLayoutRaw) import Graphics.Rendering.Pango.Enums (PangoAttribute)-#if GTK_CHECK_VERSION(2,6,0)-import Graphics.Rendering.Pango.Enums (EllipsizeMode(..))-#endif import Data.IORef ( newIORef )+{#import Graphics.UI.Gtk.Signals#} {# context lib="gtk" prefix="gtk" #} @@ -222,7 +228,7 @@ -- | Creates a new label with the given text inside it. You can pass @Nothing@ -- to get an empty label widget. ---labelNew :: Maybe String -> IO Label+labelNew :: GlibString string => Maybe string -> IO Label labelNew str = makeNewObject mkLabel $ liftM (castPtr :: Ptr Widget -> Ptr Label) $@@ -244,8 +250,8 @@ -- if the label is inside a button or menu item, the button or menu item will -- automatically become the mnemonic widget and be activated by the mnemonic. ---labelNewWithMnemonic :: - String -- ^ @str@ - The text of the label, with an underscore in front+labelNewWithMnemonic :: GlibString string+ => string -- ^ @str@ - The text of the label, with an underscore in front -- of the mnemonic character -> IO Label labelNewWithMnemonic str =@@ -263,7 +269,7 @@ -- -- This will also clear any previously set mnemonic accelerators. ---labelSetText :: LabelClass self => self -> String -> IO ()+labelSetText :: (LabelClass self, GlibString string) => self -> string -> IO () labelSetText self str = withUTFString str $ \strPtr -> {# call label_set_text #}@@ -274,7 +280,7 @@ -- embedded underlines and\/or Pango markup depending on the markup and -- underline properties. ---labelSetLabel :: LabelClass self => self -> String -> IO ()+labelSetLabel :: (LabelClass self, GlibString string) => self -> string -> IO () labelSetLabel self str = withUTFString str $ \strPtr -> {# call label_set_label #}@@ -290,23 +296,23 @@ -- with manually set attributes, if you must; know that the attributes will be -- applied to the label after the markup string is parsed. ---labelSetAttributes :: LabelClass self => self +labelSetAttributes :: LabelClass self => self -> [PangoAttribute] -- ^ @attr@ 'PangoAttribute' -> IO () labelSetAttributes self attrs = do- txt <- labelGetText self+ (txt :: Text) <- labelGetText self ps <- makeNewPangoString txt withAttrList ps attrs $ \alPtr -> {#call unsafe label_set_attributes #} (toLabel self) alPtr --- | Gets the attribute list that was set on the label using 'labelSetAttributes', if any. --- This function does not reflect attributes that come from the labels markup (see 'labelSetMarkup'). +-- | Gets the attribute list that was set on the label using 'labelSetAttributes', if any.+-- This function does not reflect attributes that come from the labels markup (see 'labelSetMarkup'). -- If you want to get the effective attributes for the label, use 'layoutGetAttributes' ('labelGetLayout' (label)). -- labelGetAttributes :: LabelClass self => self- -> IO [PangoAttribute] -- ^ return the attribute list, or Emtpy if none was set. + -> IO [PangoAttribute] -- ^ return the attribute list, or Empty if none was set. labelGetAttributes self = do- txt <- labelGetText self+ (txt :: Text) <- labelGetText self (PangoString correct _ _ ) <- makeNewPangoString txt attrListPtr <- {# call unsafe label_get_attributes #} (toLabel self) attr <- fromAttrList correct attrListPtr@@ -317,8 +323,8 @@ -- setting the label's text and attribute list based on the parse results. If -- the @str@ is external data, you may need to escape it. ---labelSetMarkup :: LabelClass self => self- -> Markup -- ^ @str@ - a markup string (see Pango markup format)+labelSetMarkup :: (LabelClass self, GlibString markup) => self+ -> markup -- ^ @str@ - a markup string (see Pango markup format) -> IO () labelSetMarkup self str = withUTFString str $ \strPtr ->@@ -335,8 +341,8 @@ -- The mnemonic key can be used to activate another widget, chosen -- automatically, or explicitly using 'labelSetMnemonicWidget'. ---labelSetMarkupWithMnemonic :: LabelClass self => self- -> Markup -- ^ @str@ - a markup string (see Pango markup format)+labelSetMarkupWithMnemonic :: (LabelClass self, GlibString markup) => self+ -> markup -- ^ @str@ - a markup string (see Pango markup format) -> IO () labelSetMarkupWithMnemonic self str = withUTFString str $ \strPtr ->@@ -349,7 +355,7 @@ -- labelSetPattern :: LabelClass l => l -> [Int] -> IO () labelSetPattern self list =- withUTFString str $+ withUTFString (T.pack str) $ {# call label_set_pattern #} (toLabel self) where@@ -381,9 +387,9 @@ -- labelGetLayout :: LabelClass self => self -> IO PangoLayout labelGetLayout self = do- plr <- makeNewGObject mkPangoLayoutRaw $ + plr <- makeNewGObject mkPangoLayoutRaw $ {# call unsafe label_get_layout #} (toLabel self)- txt <- labelGetText self+ (txt :: Text) <- labelGetText self ps <- makeNewPangoString txt psRef <- newIORef ps return (PangoLayout psRef plr)@@ -411,13 +417,13 @@ {# call unsafe label_get_line_wrap #} (toLabel self) --- | If line wrapping is on (see 'labelSetLineWrap') this controls how the line wrapping is done. +-- | If line wrapping is on (see 'labelSetLineWrap') this controls how the line wrapping is done. -- The default is 'WrapWholeWords' which means wrap on word boundaries. -- -- * Available since Gtk+ version 2.10 -- labelSetLineWrapMode :: LabelClass self => self- -> LayoutWrapMode -- ^ @wrapMode@ - the line wrapping mode + -> LayoutWrapMode -- ^ @wrapMode@ - the line wrapping mode -> IO () labelSetLineWrapMode self wrapMode = {# call label_set_line_wrap_mode #}@@ -430,7 +436,7 @@ -- labelGetLineWrapMode :: LabelClass self => self -> IO LayoutWrapMode -- ^ return the line wrapping mode-labelGetLineWrapMode self = liftM (toEnum . fromIntegral) $ +labelGetLineWrapMode self = liftM (toEnum . fromIntegral) $ {# call label_get_line_wrap_mode #} (toLabel self) @@ -515,7 +521,7 @@ -- does not include any embedded underlines indicating mnemonics or Pango -- markup. (See 'labelGetLabel') ---labelGetText :: LabelClass self => self -> IO String+labelGetText :: (LabelClass self, GlibString string) => self -> IO string labelGetText self = {# call unsafe label_get_text #} (toLabel self)@@ -524,7 +530,7 @@ -- | Gets the text from a label widget including any embedded underlines -- indicating mnemonics and Pango markup. (See 'labelGetText'). ---labelGetLabel :: LabelClass self => self -> IO String+labelGetLabel :: (LabelClass self, GlibString string) => self -> IO string labelGetLabel self = {# call unsafe label_get_label #} (toLabel self)@@ -617,7 +623,7 @@ -- used to activate another widget, chosen automatically, or explicitly using -- 'labelSetMnemonicWidget'. ---labelSetTextWithMnemonic :: LabelClass self => self -> String -> IO ()+labelSetTextWithMnemonic :: (LabelClass self, GlibString string) => self -> string -> IO () labelSetTextWithMnemonic self str = withUTFString str $ \strPtr -> {# call label_set_text_with_mnemonic #}@@ -753,7 +759,7 @@ -- | The text of the label. ---labelLabel :: LabelClass self => Attr self String+labelLabel :: (LabelClass self, GlibString string) => Attr self string labelLabel = newAttr labelGetLabel labelSetLabel@@ -779,7 +785,7 @@ -- | The alignment of the lines in the text of the label relative to each -- other. This does NOT affect the alignment of the label within its--- allocation. +-- allocation. -- -- Default value: 'JustifyLeft' --@@ -795,7 +801,7 @@ labelWrap :: LabelClass self => Attr self Bool labelWrap = newAttrFromBoolProperty "wrap" --- | If line wrapping is on (see the 'labelWrap' property) this controls how the line wrapping is done. +-- | If line wrapping is on (see the 'labelWrap' property) this controls how the line wrapping is done. -- The default is 'WrapWholeWords', which means wrap on word boundaries. -- -- Default value: 'WrapWholeWords'@@ -833,7 +839,7 @@ -- -- Default value: "\\" ---labelPattern :: LabelClass self => WriteAttr self String+labelPattern :: (LabelClass self, GlibString string) => WriteAttr self string labelPattern = writeAttrFromStringProperty "pattern" -- | The current position of the insertion cursor in chars.@@ -946,7 +952,48 @@ -- | \'text\' property. See 'labelGetText' and 'labelSetText' ---labelText :: LabelClass self => Attr self String+labelText :: (LabelClass self, GlibString string) => Attr self string labelText = newAttr labelGetText labelSetText++--------------------+-- Signals++-- | The 'labelActiveCurrentLink' signal a keybinding signal which gets emitted when the user activates+-- a link in the label.+labelActiveCurrentLink :: LabelClass self => Signal self (IO ())+labelActiveCurrentLink = Signal (connect_NONE__NONE "activate-current-link")++-- | The 'labelActiveLink' signal is emitted when a URI is activated. Default is to use showURI.+labelActiveLink :: (LabelClass self, GlibString string) => Signal self (string -> IO ())+labelActiveLink = Signal (connect_GLIBSTRING__NONE "activate-link")++-- | The 'labelCopyClipboard' signal is a keybinding signal which gets emitted to copy the selection to the+-- clipboard.+labelCopyClipboard :: LabelClass self => Signal self (IO ())+labelCopyClipboard = Signal (connect_NONE__NONE "copy-clipboard")++-- | The 'labelMoveCursor' signal is a keybinding signal which gets emitted when the user initiates a cursor+-- movement. If the cursor is not visible in label, this signal causes the viewport to be moved+-- instead.+--+-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to+-- control the cursor programmatically.+--+-- The default bindings for this signal come in two variants, the variant with the Shift modifier+-- extends the selection, the variant without the Shift modifier does not. There are too many key+-- combinations to list them all here.+--+-- * Arrow keys move by individual characters\/lines+-- * Ctrl-arrow key combinations move by words\/paragraphs+-- * Home\/End keys move to the ends of the buffer+labelMoveCursor :: LabelClass self => Signal self (MovementStep -> Int -> Bool -> IO ())+labelMoveCursor = Signal (connect_ENUM_INT_BOOL__NONE "move-cursor")++-- | The 'labelPopulatePopup' signal gets emitted before showing the context menu of the label.+--+-- If you need to add items to the context menu, connect to this signal and append your menuitems to+-- the menu.+labelPopulatePopup :: LabelClass self=> Signal self (Menu -> IO ())+labelPopulatePopup = Signal (connect_OBJECT__NONE "populate-popup")
Graphics/UI/Gtk/Display/ProgressBar.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Display.ProgressBar ( -- * Detail--- +-- -- | The 'ProgressBar' is typically used to display the progress of a long -- running operation. It provides a visual clue that processing is underway. -- The 'ProgressBar' can be used in two different modes: percentage mode and@@ -43,7 +43,7 @@ -- When an application has no accurate way of knowing the amount of work to -- do, it can use the 'ProgressBar' in activity mode, which shows activity by a -- block moving back and forth within the progress area. In this mode, the--- application is required to call 'progressBarPulse' perodically to update the+-- application is required to call 'progressBarPulse' periodically to update the -- progress bar. -- -- There is quite a bit of flexibility provided to control the appearance of@@ -77,16 +77,20 @@ progressBarGetFraction, progressBarGetPulseStep, progressBarGetText,+#if GTK_MAJOR_VERSION < 3 ProgressBarOrientation(..), progressBarSetOrientation, progressBarGetOrientation,+#endif #if GTK_CHECK_VERSION(2,6,0) progressBarSetEllipsize, progressBarGetEllipsize, #endif -- * Attributes+#if GTK_MAJOR_VERSION < 3 progressBarOrientation,+#endif progressBarDiscreteBlocks, progressBarFraction, progressBarPulseStep,@@ -96,17 +100,19 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (ProgressBarOrientation(..))+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.General.Enums (ProgressBarOrientation(..))+#endif #if GTK_CHECK_VERSION(2,6,0)-import Graphics.Rendering.Pango.Enums (EllipsizeMode(..))+import Graphics.Rendering.Pango.Enums (EllipsizeMode(..)) #endif {# context lib="gtk" prefix="gtk" #}@@ -138,7 +144,7 @@ -- | Causes the given @text@ to appear superimposed on the progress bar. ---progressBarSetText :: ProgressBarClass self => self -> String -> IO ()+progressBarSetText :: (ProgressBarClass self, GlibString string) => self -> string -> IO () progressBarSetText self text = withUTFString text $ \textPtr -> {# call unsafe progress_bar_set_text #}@@ -188,13 +194,14 @@ -- | Retrieves the text displayed superimposed on the progress bar, if any, -- otherwise @Nothing@. ---progressBarGetText :: ProgressBarClass self => self- -> IO (Maybe String) -- ^ returns text, or @Nothing@+progressBarGetText :: (ProgressBarClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns text, or @Nothing@ progressBarGetText self = {# call unsafe progress_bar_get_text #} (toProgressBar self) >>= maybePeek peekUTFString +#if GTK_MAJOR_VERSION < 3 -- | Causes the progress bar to switch to a different orientation -- (left-to-right, right-to-left, top-to-bottom, or bottom-to-top). --@@ -211,6 +218,7 @@ liftM (toEnum . fromIntegral) $ {# call unsafe progress_bar_get_orientation #} (toProgressBar self)+#endif #if GTK_CHECK_VERSION(2,6,0) -- | Sets the mode used to ellipsize (add an ellipsis: \"...\") the text if@@ -238,15 +246,17 @@ -------------------- -- Attributes-+#if GTK_MAJOR_VERSION < 3 -- | Orientation and growth direction of the progress bar. -- -- Default value: 'ProgressLeftToRight' --+-- Removed in Gtk3. progressBarOrientation :: ProgressBarClass self => Attr self ProgressBarOrientation progressBarOrientation = newAttr progressBarGetOrientation progressBarSetOrientation+#endif -- | The number of discrete blocks in a progress bar (when shown in the -- discrete style).@@ -284,7 +294,7 @@ -- -- Default value: \"%P %%\" ---progressBarText :: ProgressBarClass self => ReadWriteAttr self (Maybe String) String+progressBarText :: (ProgressBarClass self, GlibString string) => ReadWriteAttr self (Maybe string) string progressBarText = newAttr progressBarGetText progressBarSetText
+ Graphics/UI/Gtk/Display/Spinner.chs view
@@ -0,0 +1,99 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget Spinner+--+-- Author : Andy Stewart+--+-- Created: 17 Aug 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Report messages of minor importance to the user+--+module Graphics.UI.Gtk.Display.Spinner (+#if GTK_CHECK_VERSION(2,20,0)+-- * Detail+--+-- | A 'Spinner' widget displays an icon-size spinning animation. It is often used as an alternative to+-- a 'ProgressBar' for displaying indefinite activity, instead of actual progress.+--+-- To start the animation, use 'spinnerStart'.++-- * Types+ Spinner,+ SpinnerClass,+ castToSpinner, gTypeSpinner,+ toSpinner,++-- * Constructors+ spinnerNew,++-- * Methods+ spinnerStart,+ spinnerStop,++-- * Attributes+ spinnerActive,+#endif+) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,20,0)+--------------------+-- Constructors++-- | Returns a new spinner widget. Not yet started.+spinnerNew :: IO Spinner+spinnerNew =+ makeNewObject mkSpinner $+ liftM (castPtr :: Ptr Widget -> Ptr Spinner) $+ {# call unsafe spinner_new #}++--------------------+-- Methods++-- | Starts the animation of the spinner.+spinnerStart :: SpinnerClass spinner => spinner -> IO ()+spinnerStart spinner =+ {#call spinner_start #}+ (toSpinner spinner)++-- | Stops the animation of the spinner.+spinnerStop :: SpinnerClass spinner => spinner -> IO ()+spinnerStop spinner =+ {#call spinner_stop #}+ (toSpinner spinner)++--------------------+-- Attributes++-- | Whether the spinner is active.+--+-- Default value: 'False'+spinnerActive :: SpinnerClass spinner => Attr spinner Bool+spinnerActive = newAttrFromBoolProperty "active"+#endif
Graphics/UI/Gtk/Display/StatusIcon.chs view
@@ -2,11 +2,12 @@ -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget StatusIcon ----- Author : Andrea Vezzosi+-- Author : Andrea Vezzosi, Andy Stewart -- -- Created: 19 July 2007 -- -- Copyright (C) 2007 Axel Simon+-- Copyright (C) 2010 Andy Stewart -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public@@ -85,14 +86,37 @@ statusIconGetStock, statusIconGetIconName, statusIconGetSize,+#if GTK_MAJOR_VERSION < 3 statusIconSetTooltip,+#endif statusIconSetVisible, statusIconGetVisible,+#if GTK_MAJOR_VERSION < 3 statusIconSetBlinking, statusIconGetBlinking,+#endif statusIconIsEmbedded, statusIconPositionMenu, statusIconGetGeometry,+#if GTK_CHECK_VERSION(2,12,0)+ statusIconSetScreen,+ statusIconGetScreen,+#endif+#if GTK_CHECK_VERSION(2,16,0)+ statusIconSetTooltipText,+ statusIconGetTooltipText,+ statusIconSetTooltipMarkup,+ statusIconGetTooltipMarkup,+ statusIconSetHasTooltip,+ statusIconGetHasTooltip,+#endif+#if GTK_CHECK_VERSION(2,18,0)+ statusIconSetTitle,+ statusIconGetTitle,+#endif+#if GTK_CHECK_VERSION(2,20,0)+ statusIconSetName,+#endif -- * Attributes statusIconPixbuf,@@ -101,11 +125,25 @@ statusIconIconName, statusIconStorageType, statusIconSize,+#if GTK_MAJOR_VERSION < 3 statusIconBlinking,+#endif statusIconVisible,+#if GTK_CHECK_VERSION(2,12,0)+ statusIconScreen,+#endif+#if GTK_CHECK_VERSION(2,16,0)+ statusIconTooltipText,+ statusIconTooltipMarkup,+ statusIconHasTooltip,+#endif+#if GTK_CHECK_VERSION(2,18,0)+ statusIconTitle,+#endif -- * Signals statusIconSizeChanged,+ statusIconActivated, statusIconActivate, statusIconPopupMenu, @@ -121,13 +159,12 @@ #endif ) where -import Control.Monad (liftM)+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@@ -148,7 +185,7 @@ -- statusIconNew :: IO StatusIcon statusIconNew =- constructNewGObject mkStatusIcon $+ wrapNewGObject mkStatusIcon $ {# call gtk_status_icon_new #} -- %hash c:3318 d:cd70@@ -161,7 +198,7 @@ Pixbuf -- ^ @pixbuf@ - a 'Pixbuf' -> IO StatusIcon statusIconNewFromPixbuf pixbuf =- constructNewGObject mkStatusIcon $+ wrapNewGObject mkStatusIcon $ {# call gtk_status_icon_new_from_pixbuf #} pixbuf @@ -171,11 +208,11 @@ -- The image will be scaled down to fit in the available space in the -- notification area, if necessary. ---statusIconNewFromFile ::- String -- ^ @filename@ - a filename+statusIconNewFromFile :: GlibString string+ => string -- ^ @filename@ - a filename -> IO StatusIcon statusIconNewFromFile filename =- constructNewGObject mkStatusIcon $+ wrapNewGObject mkStatusIcon $ withUTFString filename $ \filenamePtr -> {# call gtk_status_icon_new_from_file #} filenamePtr@@ -190,7 +227,7 @@ StockId -- ^ @stockId@ - a stock icon id -> IO StatusIcon statusIconNewFromStock stockId =- constructNewGObject mkStatusIcon $+ wrapNewGObject mkStatusIcon $ withUTFString stockId $ \stockIdPtr -> {# call gtk_status_icon_new_from_stock #} stockIdPtr@@ -199,11 +236,11 @@ -- | 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+statusIconNewFromIconName :: GlibString string+ => string -- ^ @iconName@ - an icon name -> IO StatusIcon statusIconNewFromIconName iconName =- constructNewGObject mkStatusIcon $+ wrapNewGObject mkStatusIcon $ withUTFString iconName $ \iconNamePtr -> {# call gtk_status_icon_new_from_icon_name #} iconNamePtr@@ -227,8 +264,8 @@ -- | Makes @statusIcon@ display the file @filename@. See -- 'statusIconNewFromFile' for details. ---statusIconSetFromFile :: StatusIconClass self => self- -> String -- ^ @filename@ - a filename+statusIconSetFromFile :: (StatusIconClass self, GlibString string) => self+ -> string -- ^ @filename@ - a filename -> IO () statusIconSetFromFile self filename = withUTFString filename $ \filenamePtr ->@@ -253,8 +290,8 @@ -- | 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+statusIconSetFromIconName :: (StatusIconClass self, GlibString string) => self+ -> string -- ^ @iconName@ - an icon name -> IO () statusIconSetFromIconName self iconName = withUTFString iconName $ \iconNamePtr ->@@ -288,8 +325,8 @@ 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 -- 'Graphics.UI.Gtk.Display.Image.ImageEmpty' or@@ -312,8 +349,8 @@ -- '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@+statusIconGetIconName :: (StatusIconClass self, GlibString string) => 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 #}@@ -323,7 +360,7 @@ -- %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+-- area changes. For other storage types, the 'sizeChanged' signal can be used -- to react to size changes. -- statusIconGetSize :: StatusIconClass self => self@@ -333,17 +370,20 @@ {# call gtk_status_icon_get_size #} (toStatusIcon self) +#if GTK_MAJOR_VERSION < 3 -- %hash c:7644 d:d87b -- | Sets the tooltip of the status icon. ---statusIconSetTooltip :: StatusIconClass self => self- -> String -- ^ @tooltipText@ - the tooltip text+-- Removed in Gtk3.+statusIconSetTooltip :: (StatusIconClass self, GlibString string) => self+ -> string -- ^ @tooltipText@ - the tooltip text -> IO () statusIconSetTooltip self tooltipText = withUTFString tooltipText $ \tooltipTextPtr -> {# call gtk_status_icon_set_tooltip #} (toStatusIcon self) tooltipTextPtr+#endif -- %hash c:7bd8 d:74fd -- | Shows or hides a status icon.@@ -368,11 +408,13 @@ {# call gtk_status_icon_get_visible #} (toStatusIcon self) +#if GTK_MAJOR_VERSION < 3 -- %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. --+-- Removed in Gtk3. statusIconSetBlinking :: StatusIconClass self => self -> Bool -- ^ @blinking@ - @True@ to turn blinking on, @False@ to turn it off -> IO ()@@ -384,12 +426,14 @@ -- %hash c:2168 d:3189 -- | Returns whether the icon is blinking, see 'statusIconSetBlinking'. --+-- Removed in Gtk3. 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)+#endif -- %hash c:ffa d:8c83 -- | Returns whether the status icon is embedded in a notification area.@@ -426,7 +470,7 @@ yPtr pushInPtr (castPtr . unsafeForeignPtrToPtr . unStatusIcon $ toStatusIcon userData)- x <- peek xPtr + x <- peek xPtr y <- peek yPtr pushIn <- peek pushInPtr return (fromIntegral x, fromIntegral y, toBool pushIn)@@ -444,17 +488,146 @@ statusIconGetGeometry :: StatusIconClass self => self -> IO (Maybe (Rectangle,Orientation)) statusIconGetGeometry self = alloca $ \recPtr ->- alloca $ \orPtr -> + alloca $ \orPtr -> (liftM toBool $ {# call gtk_status_icon_get_geometry #} (toStatusIcon self) nullPtr (castPtr recPtr) orPtr) >>= \b ->- if b + if b then do rec_ <- peek recPtr or <- peek orPtr return $ Just (rec_,toEnum $ fromIntegral or) else return Nothing +#if GTK_CHECK_VERSION(2,12,0)+-- | Sets the 'Screen' where status icon is displayed; if the icon is already+-- mapped, it will be unmapped, and then remapped on the new screen.+--+statusIconSetScreen :: (StatusIconClass self, ScreenClass screen) => self+ -> Maybe screen+ -> IO ()+statusIconSetScreen self screen =+ {# call gtk_status_icon_set_screen #}+ (toStatusIcon self)+ (maybe (Screen nullForeignPtr) toScreen screen) +-- | Returns the 'Screen' associated with the status icon.+--+statusIconGetScreen :: StatusIconClass self => self+ -> IO (Maybe Screen)+statusIconGetScreen self =+ maybeNull (makeNewGObject mkScreen) $+ {# call gtk_status_icon_get_screen #}+ (toStatusIcon self)+#endif++#if GTK_CHECK_VERSION(2,16,0)+-- | Sets text as the contents of the tooltip.+--+-- This function will take care of setting "has-tooltip" to 'True' and of the default+-- handler for the "query-tooltip" signal.+--+-- See also the "tooltip-text" property and 'tooltipSetText'.+--+statusIconSetTooltipText :: (StatusIconClass self, GlibString string) => self+ -> Maybe string+ -> IO ()+statusIconSetTooltipText self text =+ maybeWith withUTFString text $ \textPtr ->+ {# call gtk_status_icon_set_tooltip_text #}+ (toStatusIcon self)+ textPtr++-- | Gets the contents of the tooltip for status icon.+--+statusIconGetTooltipText :: (StatusIconClass self, GlibString string) => self+ -> IO (Maybe string)+statusIconGetTooltipText self =+ {# call gtk_status_icon_get_tooltip_text #}+ (toStatusIcon self)+ >>= maybePeek peekUTFString++-- | Sets markup as the contents of the tooltip, which is marked up with the+-- Pango text markup language.+--+-- This function will take care of setting 'statusIconHasTooltip' to 'True' and of the default+-- handler for the 'queryTooltip' signal.+--+-- See also the 'tooltipMarkup' property and 'tooltipSetMarkup'.+--+statusIconSetTooltipMarkup :: (StatusIconClass self, GlibString string) => self+ -> Maybe string+ -> IO ()+statusIconSetTooltipMarkup self markup =+ maybeWith withUTFString markup $ \markupPtr ->+ {# call gtk_status_icon_set_tooltip_markup #}+ (toStatusIcon self)+ markupPtr++-- | Gets the contents of the tooltip for status icon.+--+statusIconGetTooltipMarkup :: (StatusIconClass self, GlibString string) => self+ -> IO (Maybe string)+statusIconGetTooltipMarkup self =+ {# call gtk_status_icon_get_tooltip_markup #}+ (toStatusIcon self)+ >>= maybePeek peekUTFString++-- | Sets the has-tooltip property on the status icon to @hasTooltip@.+-- See 'statusIconHasTooltip' for more information.+--+statusIconSetHasTooltip :: StatusIconClass self => self+ -> Bool+ -> IO ()+statusIconSetHasTooltip self hasTooltip =+ {# call gtk_status_icon_set_has_tooltip #}+ (toStatusIcon self)+ (fromBool hasTooltip)++-- | Returns the current value of the has-tooltip property. See 'statusIconHasTooltip' for more information.+--+statusIconGetHasTooltip :: StatusIconClass self => self+ -> IO Bool+statusIconGetHasTooltip self =+ liftM toBool $+ {# call gtk_status_icon_get_has_tooltip #}+ (toStatusIcon self)+#endif++#if GTK_CHECK_VERSION(2,18,0)+-- | Sets the title of this tray icon. This should be a short, human-readable, localized+-- string describing the tray icon. It may be used by tools like screen readers to+-- render the tray icon.+--+statusIconSetTitle :: (StatusIconClass self, GlibString string) => self+ -> Maybe string+ -> IO ()+statusIconSetTitle self title =+ maybeWith withUTFString title $ \titlePtr ->+ {# call gtk_status_icon_set_title #}+ (toStatusIcon self)+ titlePtr++-- | Gets the title of this tray icon. See 'statusIconSetTitle'.+--+statusIconGetTitle :: (StatusIconClass self, GlibString string) => self+ -> IO (Maybe string)+statusIconGetTitle self =+ {# call gtk_status_icon_get_title #}+ (toStatusIcon self)+ >>= maybePeek peekUTFString+#endif++#if GTK_CHECK_VERSION(2,20,0)+-- | Sets the name of this tray icon. This should be a string identifying this icon. It is may be used+-- for sorting the icons in the tray and will not be shown to the user.+statusIconSetName :: (StatusIconClass self, GlibString string) => self -> string -> IO ()+statusIconSetName self name =+ withUTFString name $ \ namePtr ->+ {#call gtk_status_icon_set_name #}+ (toStatusIcon self)+ namePtr+#endif+ -------------------- -- Attributes @@ -470,7 +643,7 @@ -- -- Default value: @Nothing@ ---statusIconFile :: StatusIconClass self => WriteAttr self (Maybe String)+statusIconFile :: (StatusIconClass self, GlibString string) => WriteAttr self (Maybe string) statusIconFile = writeAttrFromMaybeStringProperty "file" -- %hash c:3fc3 d:7ec1@@ -478,7 +651,7 @@ -- -- Default value: @Nothing@ ---statusIconStock :: StatusIconClass self => Attr self (Maybe String)+statusIconStock :: (StatusIconClass self, GlibString string) => Attr self (Maybe string) statusIconStock = newAttrFromMaybeStringProperty "stock" -- %hash c:3502 d:9b7a@@ -486,7 +659,7 @@ -- -- Default value: @Nothing@ ---statusIconIconName :: StatusIconClass self => Attr self (Maybe String)+statusIconIconName :: (StatusIconClass self, GlibString string) => Attr self (Maybe string) statusIconIconName = newAttrFromMaybeStringProperty "icon-name" -- %hash c:570e d:983f@@ -508,13 +681,16 @@ statusIconSize :: StatusIconClass self => ReadAttr self Int statusIconSize = readAttrFromIntProperty "size" +#if GTK_MAJOR_VERSION < 3 -- %hash c:eb d:655d -- | Whether or not the status icon is blinking. -- -- Default value: @False@ --+-- Removed in Gtk3. statusIconBlinking :: StatusIconClass self => Attr self Bool statusIconBlinking = newAttrFromBoolProperty "blinking"+#endif -- %hash c:4e2b d:7712 -- | Whether or not the status icon is visible.@@ -524,6 +700,72 @@ statusIconVisible :: StatusIconClass self => Attr self Bool statusIconVisible = newAttrFromBoolProperty "visible" +#if GTK_CHECK_VERSION(2,12,0)+-- | The screen where this status icon will be displayed.+statusIconScreen :: StatusIconClass self => Attr self Screen+statusIconScreen = newAttrFromObjectProperty "screen"+ {# call pure unsafe gdk_screen_get_type #}+#endif++#if GTK_CHECK_VERSION(2,16,0)+-- | Sets the text of tooltip to be the given string.+--+-- Also see 'tooltipSetText'.+--+-- This is a convenience property which will take care of getting the tooltip+-- shown if the given value is not 'Nothing'. "has-tooltip" will automatically+-- be set to 'True' and the default handler for the "query-tooltip" signal will+-- take care of displaying the tooltip.+--+-- Note that some platforms have limitations on the length of tooltips that+-- they allow on status icons, e.g. Windows only shows the first 64 characters.+--+-- Default value: 'Nothing'+statusIconTooltipText :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)+statusIconTooltipText = newAttrFromMaybeStringProperty "tooltip-text"++-- | Sets the text of tooltip to be the given string, which is marked up with the+-- Pango text markup language. Also see 'tooltipSetMarkup'.+--+-- This is a convenience property which will take care of getting the tooltip+-- shown if the given value is not 'Nothing'. "has-tooltip" will automatically+-- be set to 'True' and the default handler for the "query-tooltip" signal will+-- take care of displaying the tooltip.+--+-- On some platforms, embedded markup will be ignored.+--+-- Default value: 'Nothing'+statusIconTooltipMarkup :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)+statusIconTooltipMarkup = newAttrFromMaybeStringProperty "tooltip-markup"++-- | Enables or disables the emission of "query-tooltip" on status_icon. A value+-- of 'True' indicates that status_icon can have a tooltip, in this case the status+-- icon will be queried using "query-tooltip" to determine whether it will provide+-- a tooltip or not.+--+-- Note that setting this property to 'True' for the first time will change the+-- event masks of the windows of this status icon to include leave-notify and+-- motion-notify events. This will not be undone when the property is set to+-- 'False' again.+--+-- Whether this property is respected is platform dependent. For plain text+-- tooltips, use "tooltip-text" in preference.+--+-- Default value: 'False'+statusIconHasTooltip :: StatusIconClass self => Attr self Bool+statusIconHasTooltip = newAttrFromBoolProperty "has-tooltip"+#endif++#if GTK_CHECK_VERSION(2,18,0)+-- | The title of this tray icon. This should be a short, human-readable,+-- localized string describing the tray icon. It may be used by tools+-- like screen readers to render the tray icon.+--+-- Default value: 'Nothing'+statusIconTitle :: (StatusIconClass self, GlibString string) => Attr self (Maybe string)+statusIconTitle = newAttrFromMaybeStringProperty "title"+#endif+ -------------------- -- Signals @@ -532,18 +774,22 @@ -- the notification area got resized. -- statusIconSizeChanged :: StatusIconClass self => Signal self (Int -> IO Bool)-statusIconSizeChanged = Signal (connect_INT__BOOL "size_changed")+statusIconSizeChanged = Signal (connect_INT__BOOL "size-changed") --- | Gets emitted when the user activates the status icon. +-- | Gets emitted when the user activates the status icon. -- If and how status icons can activated is platform-dependent.+statusIconActivated :: StatusIconClass self => Signal self (IO ())+statusIconActivated = Signal (connect_NONE__NONE "activate")++-- | Deprecated. See 'statusIconActivated'. statusIconActivate :: StatusIconClass self => Signal self (IO ())-statusIconActivate = Signal (connect_NONE__NONE "activate")- +statusIconActivate = statusIconActivated+ -- | Gets emitted when the user brings up the context menu--- of the status icon. Whether status icons can have context +-- 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 +-- The 'MouseButton' and 'TimeStamp' parameters should be -- passed as the last to arguments to 'Graphics.UI.Gtk.menuPopup'. statusIconPopupMenu :: StatusIconClass self => Signal self (Maybe MouseButton -> TimeStamp -> IO ()) statusIconPopupMenu = Signal wrap@@ -574,7 +820,7 @@ onPopupMenu :: StatusIconClass self => self -> (Maybe MouseButton -> TimeStamp -> IO ()) -> IO (ConnectId self)-onPopupMenu = wrap False +onPopupMenu = wrap False {-# DEPRECATED onPopupMenu "instead of 'onPopupMenu obj' use 'on obj popupMenu'" #-} -- %hash c:1904
Graphics/UI/Gtk/Display/Statusbar.chs view
@@ -2,11 +2,12 @@ -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Statusbar ----- Author : Axel Simon+-- Author : Axel Simon, Andy Stewart -- -- Created: 23 May 2001 -- -- Copyright (C) 1999-2005 Axel Simon+-- Copyright (C) 2010 Andy Stewart -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public@@ -27,7 +28,7 @@ -- module Graphics.UI.Gtk.Display.Statusbar ( -- * Detail--- +-- -- | A 'Statusbar' is usually placed along the bottom of an application's main -- 'Window'. It may provide a regular commentary of the application's status -- (as is usually the case in a web browser, for example), or may be used to@@ -82,11 +83,21 @@ statusbarPush, statusbarPop, statusbarRemove,+#if GTK_MAJOR_VERSION < 3 statusbarSetHasResizeGrip, statusbarGetHasResizeGrip,+#endif+#if GTK_CHECK_VERSION(2,20,0)+ statusbarGetMessageArea,+#endif+#if GTK_CHECK_VERSION(2,22,0)+ statusbarRemoveAll,+#endif -- * Attributes+#if GTK_MAJOR_VERSION < 3 statusbarHasResizeGrip,+#endif -- * Signals textPopped,@@ -101,12 +112,14 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString+#if GTK_MAJOR_VERSION < 3 import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+#endif+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -131,8 +144,8 @@ -- | Returns a new context identifier, given a description of the actual -- context. This id can be used to later remove entries form the Statusbar. ---statusbarGetContextId :: StatusbarClass self => self- -> String -- ^ @contextDescription@ - textual description of what context the+statusbarGetContextId :: (StatusbarClass self, GlibString string) => self+ -> string -- ^ @contextDescription@ - textual description of what context the -- new message is being used in. -> IO ContextId -- ^ returns an id that can be used to later remove entries -- ^ from the Statusbar.@@ -147,10 +160,10 @@ -- | Pushes a new message onto the Statusbar's stack. It will -- be displayed as long as it is on top of the stack. ---statusbarPush :: StatusbarClass self => self+statusbarPush :: (StatusbarClass self, GlibString string) => self -> ContextId -- ^ @contextId@ - the message's context id, as returned by -- 'statusbarGetContextId'.- -> String -- ^ @text@ - the message to add to the statusbar.+ -> string -- ^ @text@ - the message to add to the statusbar. -> IO MessageId -- ^ returns the message's new message id for use with -- 'statusbarRemove'. statusbarPush self contextId text =@@ -186,6 +199,7 @@ contextId messageId +#if GTK_MAJOR_VERSION < 3 -- | Sets whether the statusbar has a resize grip. @True@ by default. -- statusbarSetHasResizeGrip :: StatusbarClass self => self -> Bool -> IO ()@@ -201,18 +215,47 @@ liftM toBool $ {# call unsafe statusbar_get_has_resize_grip #} (toStatusbar self)+#endif +#if GTK_CHECK_VERSION(2,20,0)+-- | Retrieves the box containing the label widget.+statusbarGetMessageArea :: StatusbarClass self => self -> IO Box+statusbarGetMessageArea self =+ makeNewObject mkBox $+ liftM (castPtr :: Ptr Widget -> Ptr Box) $+ {# call unsafe gtk_statusbar_get_message_area #}+ (toStatusbar self)++#endif++#if GTK_CHECK_VERSION(2,22,0)+-- | Forces the removal of all messages from a statusbar's stack with the exact @contextId@.+--+-- * Available since Gtk+ version 2.22+--+statusbarRemoveAll :: StatusbarClass self => self+ -> ContextId -- ^ @contextId@ a context identifier+ -> IO ()+statusbarRemoveAll self contextId =+ {#call gtk_statusbar_remove_all #}+ (toStatusbar self)+ contextId+#endif+ -------------------- -- Attributes +#if GTK_MAJOR_VERSION < 3 -- | Whether the statusbar has a grip for resizing the toplevel window. -- -- Default value: @True@ --+-- Removed in Gtk3. statusbarHasResizeGrip :: StatusbarClass self => Attr self Bool statusbarHasResizeGrip = newAttr statusbarGetHasResizeGrip statusbarSetHasResizeGrip+#endif -------------------- -- Signals@@ -220,14 +263,14 @@ -- %hash c:4eb7 d:d0ef -- | Is emitted whenever a new message gets pushed onto a statusbar's stack. ---textPushed :: StatusbarClass self => Signal self (ContextId -> String -> IO ())-textPushed = Signal (\a self user -> connect_WORD_STRING__NONE "text_pushed" a self (\w s -> user (fromIntegral w) s))+textPushed :: (StatusbarClass self, GlibString string) => Signal self (ContextId -> string -> IO ())+textPushed = Signal (\a self user -> connect_WORD_GLIBSTRING__NONE "text-pushed" a self (\w s -> user (fromIntegral w) s)) -- %hash c:2614 d:c1d2 -- | Is emitted whenever a new message is popped off a statusbar's stack. ---textPopped :: StatusbarClass self => Signal self (ContextId -> String -> IO ())-textPopped = Signal (\a self user -> connect_WORD_STRING__NONE "text_popped" a self (\w s -> user (fromIntegral w) s))+textPopped :: (StatusbarClass self, GlibString string) => Signal self (ContextId -> string -> IO ())+textPopped = Signal (\a self user -> connect_WORD_GLIBSTRING__NONE "text-popped" a self (\w s -> user (fromIntegral w) s)) -------------------- -- Deprecated Signals@@ -235,18 +278,18 @@ #ifndef DISABLE_DEPRECATED -- | Called if a message is removed. ---onTextPopped, afterTextPopped :: StatusbarClass self => self- -> (ContextId -> String -> IO ())+onTextPopped, afterTextPopped :: (StatusbarClass self, GlibString string) => self+ -> (ContextId -> string -> IO ()) -> IO (ConnectId self)-onTextPopped self user = connect_WORD_STRING__NONE "text-popped" False self (user . fromIntegral)-afterTextPopped self user = connect_WORD_STRING__NONE "text-popped" True self (user . fromIntegral)+onTextPopped self user = connect_WORD_GLIBSTRING__NONE "text-popped" False self (user . fromIntegral)+afterTextPopped self user = connect_WORD_GLIBSTRING__NONE "text-popped" True self (user . fromIntegral) -- | Called if a message is pushed on top of the -- stack. ---onTextPushed, afterTextPushed :: StatusbarClass self => self- -> (ContextId -> String -> IO ())+onTextPushed, afterTextPushed :: (StatusbarClass self, GlibString string) => self+ -> (ContextId -> string -> IO ()) -> IO (ConnectId self)-onTextPushed self user = connect_WORD_STRING__NONE "text-pushed" False self (user . fromIntegral)-afterTextPushed self user = connect_WORD_STRING__NONE "text-pushed" True self (user . fromIntegral)+onTextPushed self user = connect_WORD_GLIBSTRING__NONE "text-pushed" False self (user . fromIntegral)+afterTextPushed self user = connect_WORD_GLIBSTRING__NONE "text-pushed" True self (user . fromIntegral) #endif
Graphics/UI/Gtk/Embedding/Embedding.hsc view
@@ -27,21 +27,22 @@ -- Portability : portable (depends on GHC) -- module Graphics.UI.Gtk.Embedding.Embedding (-#if !defined(WIN32) || GTK_CHECK_VERSION(2,8,0)+#if defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0)) && GTK_MAJOR_VERSION < 3 socketHasPlug, #endif ) where +#if defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0)) && GTK_MAJOR_VERSION < 3 import System.Glib.FFI import Graphics.UI.Gtk.Types+import Graphics.UI.Gtk.Embedding.Types -#if !defined(WIN32) || GTK_CHECK_VERSION(2,8,0) -- | Test if a Plug is connected to the socket.--- +-- socketHasPlug :: SocketClass s => s -> IO Bool socketHasPlug socket = do plugPtr <- withForeignPtr (unSocket (toSocket socket))- #{peek GtkSocket, plug_window}+ #{peek GtkSocket, plug_window} return (plugPtr/=nullPtr) #endif
Graphics/UI/Gtk/Embedding/Plug.chs view
@@ -28,7 +28,7 @@ -- module Graphics.UI.Gtk.Embedding.Plug ( -- * Detail--- +-- -- | Together with 'Socket', 'Plug' provides the ability to embed widgets from -- one process into another process in a fashion that is transparent to the -- user. One process creates a 'Socket' widget and, passes the ID of that@@ -48,7 +48,7 @@ -- | +----Plug -- @ -#if !defined(WIN32) || GTK_CHECK_VERSION(2,8,0)+#if (defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0))) || defined(GDK_WINDOWING_X11) -- * Types Plug, PlugClass,@@ -78,22 +78,25 @@ #endif ) where -import Control.Monad (liftM)-import Data.Maybe (fromMaybe)+#if (defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0))) || defined(GDK_WINDOWING_X11) +import Control.Monad (liftM)+import Data.Maybe (fromMaybe)+ import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Embedding.Types#} {#import Graphics.UI.Gtk.Signals#}+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Embedding.Embedding+#endif import Graphics.UI.Gtk.General.Structs {# context lib="gtk" prefix="gtk" #} -#if !defined(WIN32) || GTK_CHECK_VERSION(2,8,0)- -------------------- -- Constructors @@ -102,11 +105,11 @@ -- plugged into a 'Socket' by 'Graphics.UI.Gtk.Embedding.Socket.socketAddId'. -- -- If a NativeWindowId is supplied the foreign application window will--- immediatly appear in this 'Plug' once it is shown. If @Nothing@ is passed+-- immediately appear in this 'Plug' once it is shown. If @Nothing@ is passed -- then a 'NativeWindowId' can be extracted from this 'Plug' using 'plugGetId' -- and be passed to the application which is to be embedded. ---plugNew :: +plugNew :: Maybe NativeWindowId -- ^ @socketId@ - the window ID of the socket, or -- @Nothing@. -> IO Plug@@ -178,7 +181,7 @@ -- | @True@ if the plug is embedded in a socket. -- -- Default value: @False@--- +-- -- * Available since Gtk+ version 2.12 -- plugAttrEmbedded :: PlugClass self => ReadAttr self Bool@@ -187,10 +190,14 @@ -- | The window of the socket the plug is embedded in. -- -- * Available since Gtk+ version 2.14--- +-- plugAttrSocketWindow :: PlugClass self => ReadAttr self (Maybe DrawWindow) plugAttrSocketWindow = readAttrFromMaybeObjectProperty "socket-window"+#if GTK_MAJOR_VERSION < 3 {# call pure unsafe gdk_window_object_get_type #}+#else+ {# call pure unsafe gdk_window_get_type #}+#endif -------------------- -- Signals
Graphics/UI/Gtk/Embedding/Socket.chs view
@@ -28,7 +28,7 @@ -- module Graphics.UI.Gtk.Embedding.Socket ( -- * Detail--- +-- -- | Together with 'Plug', 'Socket' provides the ability to embed widgets from -- one process into another process in a fashion that is transparent to the -- user. One process creates a 'Socket' widget and, passes the that widget's@@ -41,11 +41,11 @@ -- added to its parent. -- -- * Obtaining the window ID of a socket.--- +-- -- > socket <- socketNew -- > widgetShow socket -- > containerAdd parent socket--- > +-- > -- > -- The following call is only necessary if one of -- > -- the ancestors of the socket is not yet visible. -- > --@@ -82,7 +82,7 @@ -- | +----Socket -- @ -#if !defined(WIN32) || GTK_CHECK_VERSION(2,8,0)+#if (defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0))) || defined(GDK_WINDOWING_X11) -- * Types Socket, SocketClass,@@ -115,21 +115,25 @@ #endif ) where -import Control.Monad (liftM)+#if (defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0))) || defined(GDK_WINDOWING_X11) +import Control.Monad (liftM)+import Data.Maybe (isJust)+ import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Embedding.Types#} {#import Graphics.UI.Gtk.Signals#}+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Embedding.Embedding+#endif import Graphics.UI.Gtk.General.Structs {# context lib="gtk" prefix="gtk" #} -#if !defined(WIN32) || GTK_CHECK_VERSION(2,8,0)- -------------------- -- Constructors @@ -190,13 +194,18 @@ -- * Available since Gtk+ version 2.14 -- socketGetPlugWindow :: SocketClass self => self- -> IO DrawWindow -- ^ returns the window of the plug if available, or- -- {@NULL@, FIXME: this should probably be converted to a- -- Maybe data type}+ -> IO (Maybe DrawWindow) -- ^ returns the window of the plug if available,+ -- or Nothing socketGetPlugWindow self =- makeNewGObject mkDrawWindow $+ maybeNull (makeNewGObject mkDrawWindow) $ {# call gtk_socket_get_plug_window #} (toSocket self)++#if GTK_MAJOR_VERSION >= 3+socketHasPlug :: SocketClass s => s -> IO Bool+socketHasPlug = liftM isJust . socketGetPlugWindow+#endif+ #endif --------------------
+ Graphics/UI/Gtk/Embedding/Types.chs view
@@ -0,0 +1,129 @@+{-# LANGUAGE CPP #-}+{-# OPTIONS_HADDOCK hide #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-}+-- -*-haskell-*-+-- -------------------- automatically generated file - do not edit ----------+-- Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell+--+-- Author : Hamish Mackenzie+--+-- Copyright (C) 2001-2005 Axel Simon+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- #hide++-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+module Graphics.UI.Gtk.Embedding.Types (++#if (defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0))) || defined(GDK_WINDOWING_X11)+ Socket(Socket), SocketClass,+ toSocket, + mkSocket, unSocket,+ castToSocket, gTypeSocket,+ Plug(Plug), PlugClass,+ toPlug, + mkPlug, unPlug,+ castToPlug, gTypePlug,+#endif+ ) where++#if (defined(HAVE_PLUG_AND_SOCKET) && (!defined(WIN32) || GTK_CHECK_VERSION(2,8,0))) || defined(GDK_WINDOWING_X11)+import Foreign.ForeignPtr (ForeignPtr, castForeignPtr)+-- TODO work around cpphs https://ghc.haskell.org/trac/ghc/ticket/13553+#if __GLASGOW_HASKELL__ >= 707 || __GLASGOW_HASKELL__ == 0+import Foreign.ForeignPtr.Unsafe (unsafeForeignPtrToPtr)+#else+import Foreign.ForeignPtr (unsafeForeignPtrToPtr)+#endif+import Foreign.C.Types (CULong(..), CUInt(..), CULLong(..))+import System.Glib.GType (GType, typeInstanceIsA)+{#import System.Glib.GObject#}+import Graphics.UI.Gtk.General.Threading+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++-- The usage of foreignPtrToPtr should be safe as the evaluation will only be+-- forced if the object is used afterwards+--+castTo :: (GObjectClass obj, GObjectClass obj') => GType -> String+ -> (obj -> obj')+castTo gtype objTypeName obj =+ case toGObject obj of+ gobj@(GObject objFPtr)+ | typeInstanceIsA ((unsafeForeignPtrToPtr.castForeignPtr) objFPtr) gtype+ -> unsafeCastGObject gobj+ | otherwise -> error $ "Cannot cast object to " ++ objTypeName+++-- ****************************************************************** Socket++{#pointer *GtkSocket as Socket foreign newtype #} deriving (Eq,Ord)++mkSocket = (Socket, objectUnrefFromMainloop)+unSocket (Socket o) = o++class ContainerClass o => SocketClass o+toSocket :: SocketClass o => o -> Socket+toSocket = unsafeCastGObject . toGObject++instance SocketClass Socket+instance ContainerClass Socket+instance WidgetClass Socket+#if GTK_MAJOR_VERSION < 3+instance ObjectClass Socket+#endif+instance GObjectClass Socket where+ toGObject = GObject . castForeignPtr . unSocket+ unsafeCastGObject = Socket . castForeignPtr . unGObject++castToSocket :: GObjectClass obj => obj -> Socket+castToSocket = castTo gTypeSocket "Socket"++gTypeSocket :: GType+gTypeSocket =+ {# call fun unsafe gtk_socket_get_type #}++-- ****************************************************************** Plug++{#pointer *GtkPlug as Plug foreign newtype #} deriving (Eq,Ord)++mkPlug = (Plug, objectUnrefFromMainloop)+unPlug (Plug o) = o++class WindowClass o => PlugClass o+toPlug :: PlugClass o => o -> Plug+toPlug = unsafeCastGObject . toGObject++instance PlugClass Plug+instance WindowClass Plug+instance BinClass Plug+instance ContainerClass Plug+instance WidgetClass Plug+#if GTK_MAJOR_VERSION < 3+instance ObjectClass Plug+#endif+instance GObjectClass Plug where+ toGObject = GObject . castForeignPtr . unPlug+ unsafeCastGObject = Plug . castForeignPtr . unGObject++castToPlug :: GObjectClass obj => obj -> Plug+castToPlug = castTo gTypePlug "Plug"++gTypePlug :: GType+gTypePlug =+ {# call fun unsafe plug_get_type #}+#endif
Graphics/UI/Gtk/Entry/Editable.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Entry.Editable ( -- * Detail--- +-- -- | The 'Editable' interface is an interface which should be implemented by -- text editing widgets, such as 'Entry'. -- It contains functions for generically manipulating an editable@@ -69,14 +69,21 @@ editableEditable, -- * Signals+ editableChanged,+ deleteText,+ insertText,+ stopDeleteText,+ stopInsertText,++-- * Deprecated+#ifndef DISABLE_DEPRECATED onEditableChanged, afterEditableChanged, onDeleteText, afterDeleteText,- stopDeleteText, onInsertText,- afterInsertText,- stopInsertText+ afterInsertText+#endif ) where import Control.Monad (liftM)@@ -131,11 +138,11 @@ -- | Inserts text at a given position. ---editableInsertText :: EditableClass self => self- -> String -- ^ @newText@ - the text to insert.+editableInsertText :: (EditableClass self, GlibString string) => self+ -> string -- ^ @newText@ - the text to insert. -> Int -- ^ @position@ - the position at which to insert the text. -> IO Int -- ^ returns the position after the newly inserted text.-editableInsertText self newText position = +editableInsertText self newText position = with (fromIntegral position) $ \positionPtr -> withUTFStringLen newText $ \(newTextPtr, newTextLength) -> do {# call editable_insert_text #}@@ -166,10 +173,10 @@ -- @endPos@. If @endPos@ is negative, then the the characters retrieved will be -- those characters from @startPos@ to the end of the text. ---editableGetChars :: EditableClass self => self+editableGetChars :: (EditableClass self, GlibString string) => self -> Int -- ^ @startPos@ - the starting position. -> Int -- ^ @endPos@ - the end position.- -> IO String -- ^ returns the characters in the indicated region.+ -> IO string -- ^ returns the characters in the indicated region. editableGetChars self startPos endPos = {# call unsafe editable_get_chars #} (toEditable self)@@ -277,34 +284,30 @@ -------------------- -- Signals --- | The 'onEditableChanged' signal is emitted at the end of a single+-- | The 'editableChanged' signal is emitted at the end of a single -- user-visible operation on the contents of the 'Editable'. ----- * For inctance, a paste operation that replaces the contents of the+-- * For instance, a paste operation that replaces the contents of the -- selection will cause only one signal emission (even though it is -- implemented by first deleting the selection, then inserting the new--- content, and may cause multiple 'onEditableInserText' signals to be+-- content, and may cause multiple 'insertText' signals to be -- emitted). ---onEditableChanged, afterEditableChanged :: EditableClass ec => ec -> IO () ->- IO (ConnectId ec)-onEditableChanged = connect_NONE__NONE "changed" False-afterEditableChanged = connect_NONE__NONE "changed" True+editableChanged :: EditableClass ec => Signal ec (IO ())+editableChanged = Signal (connect_NONE__NONE "changed") -- | Emitted when a piece of text is deleted from the 'Editable' widget. ----- * See 'onInsertText' for information on how to use this signal.+-- * See 'insertText' for information on how to use this signal. ---onDeleteText, afterDeleteText :: EditableClass self => self- -> (Int -> Int -> IO ()) -- ^ @(\startPos endPos -> ...)@- -> IO (ConnectId self)-onDeleteText = connect_INT_INT__NONE "delete_text" False-afterDeleteText = connect_INT_INT__NONE "delete_text" True+deleteText :: EditableClass self+ => Signal self (Int -> Int -> IO ()) -- ^ @(\startPos endPos -> ...)@+deleteText = Signal (connect_INT_INT__NONE "delete-text") -- | Stop the current signal that deletes text. stopDeleteText :: EditableClass self => ConnectId self -> IO () stopDeleteText (ConnectId _ obj) =- signalStopEmission obj "delete_text"+ signalStopEmission obj "delete-text" -- | Emitted when a piece of text is inserted into the 'Editable' widget. --@@ -324,7 +327,7 @@ -- The following code is an example of how to turn all input into uppercase: -- -- > idRef <- newIORef undefined--- > id <- onInsertText entry $ \str pos -> do+-- > id <- entry `on` insertText $ \str pos -> do -- > id <- readIORef idRef -- > signalBlock id -- > pos' <- editableInsertText entry (map toUpper str) pos@@ -333,12 +336,43 @@ -- > return pos' -- > writeIORef idRef id ----- Note that the 'afterInsertText' function is not very useful, except to+-- Note that binding 'insertText' using 'after' is not very useful, except to -- track editing actions. ---onInsertText, afterInsertText :: EditableClass self => self- -> (String -> Int -> IO Int)+insertText :: (EditableClass self, GlibString string) => Signal self (string -> Int -> IO Int)+insertText = Signal $ \after obj handler ->+ connect_PTR_INT_PTR__NONE "insert-text" after obj+ (\strPtr strLen posPtr -> do+ str <- if strLen<0 then peekUTFString strPtr+ else peekUTFStringLen (strPtr, strLen)+ pos <- peek (posPtr :: Ptr {#type gint#})+ pos' <- handler str (fromIntegral pos)+ poke (posPtr :: Ptr {#type gint#}) (fromIntegral pos')+ )++-- | Stop the current signal that inserts text.+stopInsertText :: EditableClass self => ConnectId self -> IO ()+stopInsertText (ConnectId _ obj) =+ signalStopEmission obj "insert-text"++#ifndef DISABLE_DEPRECATED+--------------------+-- Deprecated Signals++onEditableChanged, afterEditableChanged :: EditableClass ec => ec -> IO () ->+ IO (ConnectId ec)+onEditableChanged = connect_NONE__NONE "changed" False+afterEditableChanged = connect_NONE__NONE "changed" True++onDeleteText, afterDeleteText :: EditableClass self => self+ -> (Int -> Int -> IO ()) -- ^ @(\startPos endPos -> ...)@ -> IO (ConnectId self)+onDeleteText = connect_INT_INT__NONE "delete_text" False+afterDeleteText = connect_INT_INT__NONE "delete_text" True++onInsertText, afterInsertText :: (EditableClass self, GlibString string) => self+ -> (string -> Int -> IO Int)+ -> IO (ConnectId self) onInsertText obj handler = connect_PTR_INT_PTR__NONE "insert_text" False obj (\strPtr strLen posPtr -> do@@ -357,8 +391,4 @@ pos' <- handler str (fromIntegral pos) poke (posPtr :: Ptr {#type gint#}) (fromIntegral pos') )---- | Stop the current signal that inserts text.-stopInsertText :: EditableClass self => ConnectId self -> IO ()-stopInsertText (ConnectId _ obj) =- signalStopEmission obj "insert_text"+#endif
Graphics/UI/Gtk/Entry/Entry.chs view
@@ -2,11 +2,12 @@ -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Entry ----- Author : Axel Simon+-- Author : Axel Simon, Andy Stewart -- -- Created: 23 May 2001 -- -- Copyright (C) 1999-2005 Axel Simon+-- Copyright (C) 2010 Andy Stewart -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public@@ -18,13 +19,6 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. ----- TODO------ A couple of signals are not bound because I could not figure out what--- they mean. Some of them do not seem to be emitted at all.--- I removed onInsertAtCursor since it is internal and not emitted. The usable funtions--- are in Editable.--- -- | -- Maintainer : gtk2hs-users@lists.sourceforge.net -- Stability : provisional@@ -34,7 +28,7 @@ -- module Graphics.UI.Gtk.Entry.Entry ( -- * Detail--- +-- -- | The 'Entry' widget is a single line text entry widget. A fairly large set -- of key bindings are supported by default. If the entered text is longer than -- the allocation of the widget, the widget will scroll so that the cursor@@ -58,14 +52,19 @@ -- * Constructors entryNew,+#if GTK_CHECK_VERSION(2,18,0)+ entryNewWithBuffer,+#endif -- * Methods entrySetText, entryGetText,+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED entryAppendText, entryPrependText, #endif+#endif entrySetVisibility, entryGetVisibility, entrySetInvisibleChar,@@ -78,12 +77,30 @@ entrySetHasFrame, entryGetWidthChars, entrySetWidthChars,+#if GTK_CHECK_VERSION(3,2,0)+ entrySetPlaceholderText,+ entryGetPlaceholderText,+#endif #if GTK_CHECK_VERSION(2,4,0) entrySetAlignment, entryGetAlignment, entrySetCompletion, entryGetCompletion, #endif+#if GTK_CHECK_VERSION (2,18,0)+ entryGetBuffer,+ entrySetBuffer,+#endif+#if GTK_MAJOR_VERSION < 3+#if GTK_CHECK_VERSION(2,20,0)+ entryGetIconWindow,+ entryGetTextWindow,+#endif+#endif+#if GTK_CHECK_VERSION(2,22,0)+ entryImContextFilterKeypress,+ entryResetImContext,+#endif -- * Attributes entryCursorPosition,@@ -97,13 +114,41 @@ entryWidthChars, entryScrollOffset, entryText,+#if GTK_CHECK_VERSION(3,2,0)+ entryPlaceholderText,+#endif #if GTK_CHECK_VERSION(2,4,0) entryXalign, entryAlignment, entryCompletion, #endif+#if GTK_CHECK_VERSION (2,18,0)+ entryBuffer,+#endif -- * Signals+ entryActivated,+ entryActivate,+ entryBackspace,+ entryCopyClipboard,+ entryCutClipboard,+ entryPasteClipboard,+ entryDeleteFromCursor,+ entryInsertAtCursor,+ entryMoveCursor,+ entryPopulatePopup,+ entryToggleOverwirte,+ entryToggleOverwrite,+#if GTK_CHECK_VERSION(2,20,0)+ entryPreeditChanged,+#endif+#if GTK_CHECK_VERSION(2,16,0)+ entryIconPress,+ entryIconRelease,+#endif++-- * Deprecated+#ifndef DISABLE_DEPRECATED onEntryActivate, afterEntryActivate, onCopyClipboard,@@ -114,17 +159,29 @@ afterPasteClipboard, onToggleOverwrite, afterToggleOverwrite,+#endif ) where -import Control.Monad (liftM)-import Data.Char (ord, chr)+import Control.Monad (liftM)+import Control.Monad.Reader (runReaderT)+import Data.Char (ord, chr) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (makeNewGObject)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.General.Enums (DeleteType (..), MovementStep (..)+#if GTK_CHECK_VERSION(2,16,0)+ , EntryIconPosition (..)+#endif+ )+import Graphics.UI.Gtk.Gdk.EventM (EventM, EButton, EKey)+import Control.Monad.Reader ( ask )+import Control.Monad.Trans ( liftIO )+#if GTK_CHECK_VERSION (2,18,0)+import Graphics.UI.Gtk.Entry.EntryBuffer+#endif {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -146,13 +203,45 @@ liftM (castPtr :: Ptr Widget -> Ptr Entry) $ {# call unsafe entry_new #} +#if GTK_CHECK_VERSION(2,18,0)+-- | Creates a new 'Entry' widget backed by a particular 'EntryBuffer'. One+-- buffer can be shared among many widgets.+--+entryNewWithBuffer :: EntryBufferClass buffer => buffer -> IO Entry+entryNewWithBuffer buffer =+ makeNewObject mkEntry $+ liftM (castPtr :: Ptr Widget -> Ptr Entry) $+ {# call unsafe entry_new_with_buffer #}+ (toEntryBuffer buffer)+ -------------------- -- Methods +-- Although the documentation doesn't say one way or the other, a look at the+-- source indicates that gtk_entry_get_buffer doesn't increment the reference+-- count of the GtkEntryBuffer it returns, so, like textViewGetBuffer, we must+-- increment it ourselves.++-- | Get the 'EntryBuffer' object which holds the text for this widget.+entryGetBuffer :: EntryClass self => self+ -> IO EntryBuffer+entryGetBuffer self =+ makeNewGObject mkEntryBuffer $+ {# call gtk_entry_get_buffer #}+ (toEntry self)++-- | Set the 'EntryBuffer' object which holds the text for this widget.+entrySetBuffer :: (EntryClass self, EntryBufferClass buffer) => self+ -> buffer -> IO ()+entrySetBuffer self =+ {# call gtk_entry_set_buffer #}+ (toEntry self) . toEntryBuffer+#endif+ -- | Sets the text in the widget to the given value, replacing the current -- contents. ---entrySetText :: EntryClass self => self -> String -> IO ()+entrySetText :: (EntryClass self, GlibString string) => self -> string -> IO () entrySetText self text = withUTFString text $ \textPtr -> {# call entry_set_text #}@@ -162,19 +251,20 @@ -- | Retrieves the contents of the entry widget. -- See also 'Graphics.UI.Gtk.Display.Entry.Editable.editableGetChars'. ---entryGetText :: EntryClass self => self -> IO String+entryGetText :: (EntryClass self, GlibString string) => self -> IO string entryGetText self = {# call entry_get_text #} (toEntry self) >>= peekUTFString-+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- | Appends the given text to the contents of the widget. -- -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---entryAppendText :: EntryClass self => self -> String -> IO ()+-- Removed in Gtk3.+entryAppendText :: (EntryClass self, GlibString string) => self -> string -> IO () entryAppendText self text = withUTFString text $ \textPtr -> {# call entry_append_text #}@@ -186,13 +276,15 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---entryPrependText :: EntryClass self => self -> String -> IO ()+-- Removed in Gtk3.+entryPrependText :: (EntryClass self, GlibString string) => self -> string -> IO () entryPrependText self text = withUTFString text $ \textPtr -> {# call entry_prepend_text #} (toEntry self) textPtr #endif+#endif -- | Sets whether the contents of the entry are visible or not. When -- visibility is set to @False@, characters are displayed as the invisible@@ -345,6 +437,38 @@ (toEntry self) (fromIntegral nChars) +#if GTK_CHECK_VERSION(3,2,0)+-- | Sets text to be displayed in entry when it is empty and unfocused.+-- This can be used to give a visual hint of the expected contents of the `Entry`.+--+-- Note that since the placeholder text gets removed when the entry received+-- focus, using this feature is a bit problematic if the entry is given the+-- initial focus in a window. Sometimes this can be worked around by delaying+-- the initial focus setting until the first key event arrives.+--+-- * Available since Gtk version 3.2+--+entrySetPlaceholderText :: (EntryClass self, GlibString text) => self+ -> Maybe text -- ^ @text@ a string to be displayed when entry is empty an unfocused, or `Nothing`+ -> IO ()+entrySetPlaceholderText self text =+ maybeWith withUTFString text $ \ textPtr ->+ {# call entry_set_placeholder_text #}+ (toEntry self)+ textPtr++-- | Retrieves the text that will be displayed when entry is empty and unfocused.+--+-- * Available since Gtk version 3.2+--+entryGetPlaceholderText :: (EntryClass self, GlibString text) => self+ -> IO (Maybe text) -- ^ returns placeholder text+entryGetPlaceholderText self =+ {# call unsafe entry_get_placeholder_text #}+ (toEntry self)+ >>= maybePeek peekUTFString+#endif+ #if GTK_CHECK_VERSION(2,4,0) -- | Sets the alignment for the contents of the entry. This controls the -- horizontal positioning of the contents when the displayed text is shorter@@ -397,6 +521,70 @@ (toEntry self) #endif +#if GTK_MAJOR_VERSION < 3+#if GTK_CHECK_VERSION(2,20,0)+-- | Returns the 'Window' which contains the entry's icon at @iconPos@. This function is useful when+-- drawing something to the entry in an 'eventExpose' callback because it enables the callback to+-- distinguish between the text window and entry's icon windows.+--+-- See also 'entryGetTextWindow'.+-- Removed in Gtk3.+entryGetIconWindow :: EntryClass self => self+ -> EntryIconPosition -- ^ @iconPos@ Icon position+ -> IO DrawWindow -- ^ returns the entry's icon window at @iconPos@.+entryGetIconWindow entry iconPos =+ makeNewGObject mkDrawWindow $+ {#call gtk_entry_get_icon_window #}+ (toEntry entry)+ ((fromIntegral . fromEnum) iconPos)++-- | Returns the 'Window' which contains the text. This function is useful when drawing something to the+-- entry in an 'eventExpose' callback because it enables the callback to distinguish between the text+-- window and entry's icon windows.+--+-- See also 'entryGetIconWindow'.+-- Removed in Gtk3.+entryGetTextWindow :: EntryClass self => self+ -> IO DrawWindow -- ^ returns the entry's text window.+entryGetTextWindow entry =+ makeNewGObject mkDrawWindow $+ {#call gtk_entry_get_text_window #}+ (toEntry entry)+#endif+#endif++#if GTK_CHECK_VERSION(2,22,0)+-- | Allow the 'Entry' input method to internally handle key press and release events. If this function+-- returns 'True', then no further processing should be done for this key event. See+-- 'imContextFilterKeypress'.+--+-- Note that you are expected to call this function from your handler when overriding key event+-- handling. This is needed in the case when you need to insert your own key handling between the input+-- method and the default key event handling of the 'Entry'. See 'textViewResetImContext' for+-- an example of use.+--+-- * Available since Gtk+ version 2.22+--+entryImContextFilterKeypress :: EntryClass self => self -> EventM EKey Bool+entryImContextFilterKeypress self = do+ ptr <- ask+ liftIO $ liftM toBool $+ {# call gtk_entry_im_context_filter_keypress #}+ (toEntry self)+ (castPtr ptr)++-- | Reset the input method context of the entry if needed.+--+-- This can be necessary in the case where modifying the buffer would confuse on-going input method+-- behavior.+--+-- * Available since Gtk+ version 2.22+--+entryResetImContext :: EntryClass self => self -> IO ()+entryResetImContext self =+ {#call gtk_entry_reset_im_context #} (toEntry self)+#endif+ -------------------- -- Attributes @@ -499,11 +687,22 @@ -- -- Default value: \"\" ---entryText :: EntryClass self => Attr self String+entryText :: (EntryClass self, GlibString string) => Attr self string entryText = newAttr entryGetText entrySetText +#if GTK_CHECK_VERSION(3,2,0)+-- | The text that will be displayed in the `Entry` when it is empty and unfocused.+--+-- Default value: Nothing+--+entryPlaceholderText :: (EntryClass self, GlibString text) => Attr self (Maybe text)+entryPlaceholderText = newAttr+ entryGetPlaceholderText+ entrySetPlaceholderText+#endif+ #if GTK_CHECK_VERSION(2,4,0) -- | The horizontal alignment, from 0 (left) to 1 (right). Reversed for RTL -- layouts.@@ -531,9 +730,134 @@ entrySetCompletion #endif +#if GTK_CHECK_VERSION(2,18,0)+-- | The buffer being displayed.+--+entryBuffer :: (EntryClass self, EntryBufferClass buffer) =>+ ReadWriteAttr self EntryBuffer buffer+entryBuffer = newAttr+ entryGetBuffer+ entrySetBuffer+#endif++ -------------------- -- Signals +-- | A keybinding signal which gets emitted when the user activates the entry.+--+-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to+-- control activation programmatically.+entryActivated :: EntryClass ec => Signal ec (IO ())+entryActivated = Signal (connect_NONE__NONE "activate")++-- | Deprecated. See 'entryActivated'.+entryActivate :: EntryClass ec => Signal ec (IO ())+entryActivate = entryActivated++-- | The 'entryBackspace' signal is a keybinding signal which gets emitted when the user asks for it.+--+-- The default bindings for this signal are Backspace and Shift-Backspace.+entryBackspace :: EntryClass ec => Signal ec (IO ())+entryBackspace = Signal (connect_NONE__NONE "backspace")++-- | The 'entryCopyClipboard' signal is a keybinding signal which gets emitted to copy the selection to the+-- clipboard.+--+-- The default bindings for this signal are Ctrl-c and Ctrl-Insert.+entryCopyClipboard :: EntryClass ec => Signal ec (IO ())+entryCopyClipboard = Signal (connect_NONE__NONE "copy-clipboard")++-- | The 'entryCutClipboard' signal is a keybinding signal which gets emitted to cut the selection to the+-- clipboard.+--+-- The default bindings for this signal are Ctrl-x and Shift-Delete.+entryCutClipboard :: EntryClass ec => Signal ec (IO ())+entryCutClipboard = Signal (connect_NONE__NONE "cut-clipboard")++-- | The 'entryDeleteFromCursor' signal is a keybinding signal which gets emitted when the user initiates a+-- text deletion.+--+-- If the type is 'DeleteChars', GTK+ deletes the selection if there is one, otherwise it deletes+-- the requested number of characters.+--+-- The default bindings for this signal are Delete for deleting a character and Ctrl-Delete for+-- deleting a word.+entryDeleteFromCursor :: EntryClass ec => Signal ec (DeleteType -> Int -> IO ())+entryDeleteFromCursor = Signal (connect_ENUM_INT__NONE "delete-from-cursor")++-- | The 'entryInsertAtCursor' signal is a keybinding signal which gets emitted when the user initiates the+-- insertion of a fixed string at the cursor.+entryInsertAtCursor :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ())+entryInsertAtCursor = Signal (connect_GLIBSTRING__NONE "insert-at-cursor")++-- | The 'entryMoveCursor' signal is a keybinding signal which gets emitted when the user initiates a cursor+-- movement. If the cursor is not visible in entry, this signal causes the viewport to be moved+-- instead.+--+-- Applications should not connect to it, but may emit it with 'signalEmitByName' if they need to+-- control the cursor programmatically.+--+-- The default bindings for this signal come in two variants, the variant with the Shift modifier+-- extends the selection, the variant without the Shift modifier does not. There are too many key+-- combinations to list them all here.+--+-- * Arrow keys move by individual characters\/lines+-- * Ctrl-arrow key combinations move by words\/paragraphs+-- * Home\/End keys move to the ends of the buffer+entryMoveCursor :: EntryClass ec => Signal ec (MovementStep -> Int -> Bool -> IO ())+entryMoveCursor = Signal (connect_ENUM_INT_BOOL__NONE "move-cursor")++-- | The 'entryPasteClipboard' signal is a keybinding signal which gets emitted to paste the contents of the+-- clipboard into the text view.+--+-- The default bindings for this signal are Ctrl-v and Shift-Insert.+entryPasteClipboard :: EntryClass ec => Signal ec (IO ())+entryPasteClipboard = Signal (connect_NONE__NONE "paste-clipboard")++-- | The 'entryPopulatePopup' signal gets emitted before showing the context menu of the entry.+--+-- If you need to add items to the context menu, connect to this signal and append your menuitems to+-- the menu.+entryPopulatePopup :: EntryClass ec => Signal ec (Menu -> IO ())+entryPopulatePopup = Signal (connect_OBJECT__NONE "populate-popup")++#if GTK_CHECK_VERSION(2,20,0)+-- | If an input method is used, the typed text will not immediately be committed to the buffer. So if+-- you are interested in the text, connect to this signal.+entryPreeditChanged :: (EntryClass ec, GlibString string) => Signal ec (string -> IO ())+entryPreeditChanged = Signal (connect_GLIBSTRING__NONE "preedit-changed")+#endif++#if GTK_CHECK_VERSION(2,16,0)+-- | The 'iconPress' signal is emitted when an activatable icon is clicked.+--+entryIconPress :: EntryClass ec =>+ Signal ec (EntryIconPosition -> EventM EButton ())+entryIconPress = Signal $ \after obj f ->+ connect_ENUM_PTR__NONE "icon-press" after obj (runReaderT . f)++-- | The 'iconRelease' signal is emitted on the button release from a mouse click over an activatable+-- icon.+--+entryIconRelease :: EntryClass ec =>+ Signal ec (EntryIconPosition -> EventM EButton ())+entryIconRelease = Signal $ \after obj f ->+ connect_ENUM_PTR__NONE "icon-press" after obj (runReaderT . f)+#endif++{-# DEPRECATED entryToggleOverwirte "Use entryToggleOverwrite" #-}+entryToggleOverwirte :: EntryClass ec => Signal ec (IO ())+entryToggleOverwirte = entryToggleOverwrite++-- | The 'entryToggleOverwrite' signal is a keybinding signal which gets emitted to toggle the overwrite mode+-- of the entry.+-- The default bindings for this signal is Insert.+--+entryToggleOverwrite :: EntryClass ec => Signal ec (IO ())+entryToggleOverwrite = Signal (connect_NONE__NONE "toggle-overwrite")++#ifndef DISABLE_DEPRECATED -- | Emitted when the user presses return within -- the 'Entry' field. --@@ -542,14 +866,6 @@ onEntryActivate = connect_NONE__NONE "activate" False afterEntryActivate = connect_NONE__NONE "activate" True --- | Emitted when the settings of the--- 'Entry' widget changes.----onEntryChanged, afterEntryChanged :: EntryClass ec => ec -> IO () ->- IO (ConnectId ec)-onEntryChanged = connect_NONE__NONE "changed" False-afterEntryChanged = connect_NONE__NONE "changed" True- -- | Emitted when the current selection has been -- copied to the clipboard. --@@ -574,14 +890,6 @@ onPasteClipboard = connect_NONE__NONE "paste_clipboard" False afterPasteClipboard = connect_NONE__NONE "paste_clipboard" True --- | Emitted when a piece of text is deleted from--- the 'Entry'.----onDeleteText, afterDeleteText :: EntryClass ec => ec ->- (Int -> Int -> IO ()) -> IO (ConnectId ec)-onDeleteText = connect_INT_INT__NONE "delete_text" False-afterDeleteText = connect_INT_INT__NONE "delete_text" True- -- | Emitted when the user changes from -- overwriting to inserting. --@@ -589,3 +897,4 @@ IO (ConnectId ec) onToggleOverwrite = connect_NONE__NONE "toggle_overwrite" False afterToggleOverwrite = connect_NONE__NONE "toggle_overwrite" True+#endif
+ Graphics/UI/Gtk/Entry/EntryBuffer.chs view
@@ -0,0 +1,248 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget EntryBuffer+--+-- Author : Andy Stewart+--+-- Created: 22 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Text buffer for 'Entry'+--+-- * Module available since Gtk+ version 2.18+--+module Graphics.UI.Gtk.Entry.EntryBuffer (++-- * Detail+--+-- | The 'EntryBuffer' class contains the actual text displayed in a 'Entry'+-- widget.+--+-- A single 'EntryBuffer' object can be shared by multiple 'Entry' widgets+-- which will then share the same text content, but not the cursor position,+-- visibility attributes, icon etc.+--+-- 'EntryBuffer' may be derived from. Such a derived class might allow text+-- to be stored in an alternate location, such as non-pageable memory, useful+-- in the case of important passwords. Or a derived class could integrate with+-- an application's concept of undo\/redo.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----EntryBuffer+-- @++#if GTK_CHECK_VERSION(2,18,0)+-- * Types+ EntryBuffer,+ EntryBufferClass,+ castToEntryBuffer,+ toEntryBuffer,++-- * Constructors+ entryBufferNew,++-- * Methods+ entryBufferGetBytes,+ entryBufferInsertText,+ entryBufferDeleteText,+ entryBufferEmitDeletedText,+ entryBufferEmitInsertedText,++-- * Attributes+ entryBufferText,+ entryBufferLength,+ entryBufferMaxLength,++-- * Signals+ entryBufferInsertedText,+ entryBufferDeletedText,+#endif+ ) where++import Control.Monad (liftM)+import Data.Maybe (fromJust)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,18,0)+--------------------+-- Constructors++-- | Create a new 'EntryBuffer' object.+--+-- Optionally, specify initial text to set in the buffer.+--+-- * Available since Gtk+ version 2.18+--+entryBufferNew :: GlibString string+ => Maybe string -- ^ @initialChars@ - initial buffer text or 'Nothing'+ -> IO EntryBuffer+entryBufferNew initialChars =+ wrapNewGObject mkEntryBuffer $+ maybeWith withUTFString initialChars $ \initialCharsPtr -> do+ let chars = if initialCharsPtr == nullPtr+ then (-1)+ else stringLength $ fromJust initialChars+ {# call gtk_entry_buffer_new #}+ initialCharsPtr+ (fromIntegral chars)++--------------------+-- Methods++-- | Retrieves the length in bytes of the buffer. See 'entryBufferGetLength'.+--+-- * Available since Gtk+ version 2.18+--+entryBufferGetBytes :: EntryBufferClass self => self+ -> IO Int -- ^ returns The byte length of the buffer.+entryBufferGetBytes self =+ liftM fromIntegral $+ {# call gtk_entry_buffer_get_bytes #}+ (toEntryBuffer self)++-- | Inserts @chars@ into the contents of the buffer,+-- at position @position@.+--+-- * Available since Gtk+ version 2.18+--+entryBufferInsertText :: (EntryBufferClass self, GlibString string) => self+ -> Int -- ^ @position@ - the position at which to insert text.+ -> string -- ^ @chars@ - the text to insert into the buffer.+ -> IO Int -- ^ returns The number of characters actually inserted.+entryBufferInsertText self position chars =+ liftM fromIntegral $+ withUTFStringLen chars $ \ (charsPtr, len) ->+ {# call gtk_entry_buffer_insert_text #}+ (toEntryBuffer self)+ (fromIntegral position)+ charsPtr+ (fromIntegral len)++-- | Deletes a sequence of characters from the buffer. @nChars@ characters are+-- deleted starting at @position@. If @nChars@ is negative, then all characters+-- until the end of the text are deleted.+--+-- * Available since Gtk+ version 2.18+--+entryBufferDeleteText :: EntryBufferClass self => self+ -> Int -- ^ @position@ - position at which to delete text+ -> Int -- ^ @nChars@ - number of characters to delete+ -> IO Int -- ^ returns The number of characters deleted.+entryBufferDeleteText self position nChars =+ liftM fromIntegral $+ {# call gtk_entry_buffer_delete_text #}+ (toEntryBuffer self)+ (fromIntegral position)+ (fromIntegral nChars)++-- | Used when subclassing 'EntryBuffer'+--+-- * Available since Gtk+ version 2.18+--+entryBufferEmitDeletedText :: EntryBufferClass self => self+ -> Int -- ^ @position@ - position at which text was deleted+ -> Int -- ^ @nChars@ - number of characters deleted+ -> IO ()+entryBufferEmitDeletedText self position nChars =+ {# call gtk_entry_buffer_emit_deleted_text #}+ (toEntryBuffer self)+ (fromIntegral position)+ (fromIntegral nChars)++-- | Used when subclassing 'EntryBuffer'+--+-- * Available since Gtk+ version 2.18+--+entryBufferEmitInsertedText :: (EntryBufferClass self, GlibString string) => self+ -> Int -- ^ @position@ - position at which text was inserted+ -> string -- ^ @chars@ - text that was inserted+ -> Int -- ^ @nChars@ - number of characters inserted+ -> IO ()+entryBufferEmitInsertedText self position chars nChars =+ withUTFString chars $ \charsPtr ->+ {# call gtk_entry_buffer_emit_inserted_text #}+ (toEntryBuffer self)+ (fromIntegral position)+ charsPtr+ (fromIntegral nChars)++--------------------+-- Attributes++-- | The contents of the buffer.+--+-- Default value: \"\"+--+-- * Available since Gtk+ version 2.18+--+entryBufferText :: (EntryBufferClass self, GlibString string) => Attr self string+entryBufferText = newAttrFromStringProperty "text"++-- | The length of the text in buffer.+--+-- Allowed values: <= 65535+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.18+--+entryBufferLength :: EntryBufferClass self => ReadAttr self Int+entryBufferLength = readAttrFromIntProperty "length"++-- | The maximum length of the text in the buffer.+--+-- Allowed values: [0,65535]+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.18+--+entryBufferMaxLength :: EntryBufferClass self => Attr self Int+entryBufferMaxLength = newAttrFromIntProperty "max-length"++--------------------+-- Signals++-- |+--+-- * Available since Gtk+ version 2.18+--+entryBufferInsertedText :: (EntryBufferClass self, GlibString string) => Signal self (Int -> string -> Int -> IO ())+entryBufferInsertedText = Signal (connect_INT_GLIBSTRING_INT__NONE "inserted_text")++-- |+--+-- * Available since Gtk+ version 2.18+--+entryBufferDeletedText :: EntryBufferClass self => Signal self (Int -> Int -> IO ())+entryBufferDeletedText = Signal (connect_INT_INT__NONE "deleted_text")++#endif
Graphics/UI/Gtk/Entry/EntryCompletion.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Entry.EntryCompletion ( -- * Detail--- +-- -- | 'EntryCompletion' is an auxiliary object to be used in conjunction with -- 'Entry' to provide the completion functionality. It implements the -- 'CellLayout' interface, to allow the user to add extra cells to the@@ -136,13 +136,11 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import System.Glib.GObject (constructNewGObject,- makeNewGObject, destroyFunPtr) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}@@ -163,7 +161,7 @@ -- entryCompletionNew :: IO EntryCompletion entryCompletionNew =- constructNewGObject mkEntryCompletion $+ wrapNewGObject mkEntryCompletion $ {# call gtk_entry_completion_new #} --------------------@@ -205,13 +203,13 @@ -- | Convenience function for setting up the most used case of this code: a -- completion list with just strings. This function will set up @completion@ to -- have a list displaying all (and just) strings in the completion list, and to--- get those strings from @model@. This functions creates and adds a +-- get those strings from @model@. This functions creates and adds a -- 'CellRendererText' which retrieves its content from the given model. ---entryCompletionSetTextModel :: (TreeModelClass (model String),- TypedTreeModelClass model)+entryCompletionSetTextModel :: (TreeModelClass (model string),+ TypedTreeModelClass model, GlibString string) => EntryCompletion -- ^ @completion@- -> model String -- ^ the model containing 'String's+ -> model string -- ^ the model containing 'string's -> IO () entryCompletionSetTextModel self model = do let strCol = makeColumnIdString 0@@ -230,7 +228,8 @@ -- or as a single precomposed character. If this is not appropriate you -- can extract the original text from the entry. ---entryCompletionSetMatchFunc :: EntryCompletion -> (String -> TreeIter -> IO Bool) -> IO ()+entryCompletionSetMatchFunc :: GlibString string+ => EntryCompletion -> (string -> TreeIter -> IO Bool) -> IO () entryCompletionSetMatchFunc ec handler = do hPtr <- mkHandler_GtkEntryCompletionMatchFunc (\_ keyPtr iterPtr _ -> do key <- peekUTFString keyPtr@@ -251,7 +250,7 @@ IO {#type gboolean#} foreign import ccall "wrapper" mkHandler_GtkEntryCompletionMatchFunc ::- GtkEntryCompletionMatchFunc -> + GtkEntryCompletionMatchFunc -> IO (FunPtr GtkEntryCompletionMatchFunc) -- | Requires the length of the search key for @completion@ to be at least@@ -290,9 +289,9 @@ -- with text @text@. If you want the action item to have markup, use -- 'entryCompletionInsertActionMarkup'. ---entryCompletionInsertActionText :: EntryCompletion+entryCompletionInsertActionText :: GlibString string => EntryCompletion -> Int -- ^ @index@ - The index of the item to insert.- -> String -- ^ @text@ - Text of the item to insert.+ -> string -- ^ @text@ - Text of the item to insert. -> IO () entryCompletionInsertActionText self index text = withUTFString text $ \textPtr ->@@ -304,9 +303,9 @@ -- | Inserts an action in @completion@'s action item list at position @index@ -- with markup @markup@. ---entryCompletionInsertActionMarkup :: EntryCompletion+entryCompletionInsertActionMarkup :: GlibString string => EntryCompletion -> Int -- ^ @index@ - The index of the item to insert.- -> String -- ^ @markup@ - Markup of the item to insert.+ -> string -- ^ @markup@ - Markup of the item to insert. -> IO () entryCompletionInsertActionMarkup self index markup = withUTFString markup $ \markupPtr ->@@ -333,8 +332,8 @@ -- This functions creates and adds a 'CellRendererText' for the selected -- column. ---entryCompletionSetTextColumn :: EntryCompletion- -> ColumnId row String -- ^ @column@ - The column in the model of @completion@ to+entryCompletionSetTextColumn :: GlibString string => EntryCompletion+ -> ColumnId row string -- ^ @column@ - The column in the model of @completion@ to -- get strings from. -> IO () entryCompletionSetTextColumn self column =@@ -356,8 +355,8 @@ -- -- * Available since Gtk+ version 2.6 ---entryCompletionGetTextColumn :: EntryCompletion- -> IO (ColumnId row String) -- ^ returns the column containing the strings+entryCompletionGetTextColumn :: GlibString string => EntryCompletion+ -> IO (ColumnId row string) -- ^ returns the column containing the strings entryCompletionGetTextColumn self = liftM (makeColumnIdString . fromIntegral) $ {# call gtk_entry_completion_get_text_column #}@@ -495,7 +494,7 @@ -- -- Default value: 'Graphics.UI.Gtk.ModelView.CustomStore.invalidColumnId' ---entryCompletionTextColumn :: Attr EntryCompletion (ColumnId row String)+entryCompletionTextColumn :: GlibString string => Attr EntryCompletion (ColumnId row string) entryCompletionTextColumn = newAttr entryCompletionGetTextColumn entryCompletionSetTextColumn@@ -559,8 +558,8 @@ -- -- * Available since Gtk+ version 2.6 ---insertPrefix :: EntryCompletionClass self => Signal self (String -> IO Bool)-insertPrefix = Signal (connect_STRING__BOOL "insert_prefix")+insertPrefix :: (EntryCompletionClass self, GlibString string) => Signal self (string -> IO Bool)+insertPrefix = Signal (connect_GLIBSTRING__BOOL "insert-prefix") #endif -- %hash c:d50e d:ad7e@@ -569,13 +568,13 @@ -- text column in the row pointed to by @iter@. -- matchSelected :: EntryCompletionClass self => Signal self (TreeModel -> TreeIter -> IO Bool)-matchSelected = Signal (connect_OBJECT_BOXED__BOOL "match_selected" peekTreeIter)+matchSelected = Signal (connect_OBJECT_BOXED__BOOL "match-selected" peekTreeIter) -- %hash c:21ac d:2cbc -- | Gets emitted when an action is activated. -- completionActionActivated :: EntryCompletionClass self => Signal self (Int -> IO ())-completionActionActivated = Signal (connect_INT__NONE "action_activated")+completionActionActivated = Signal (connect_INT__NONE "action-activated") #ifndef DISABLE_DEPRECATED #if GTK_CHECK_VERSION(2,6,0)@@ -587,11 +586,11 @@ -- part of the @prefix@ into the entry - e.g. the entry used in the -- 'FileChooser' inserts only the part of the prefix up to the next \'\/\'. ---onInsertPrefix, afterInsertPrefix :: EntryCompletionClass self => self- -> (String -> IO Bool)+onInsertPrefix, afterInsertPrefix :: (EntryCompletionClass self, GlibString string) => self+ -> (string -> IO Bool) -> IO (ConnectId self)-onInsertPrefix = connect_STRING__BOOL "insert_prefix" False-afterInsertPrefix = connect_STRING__BOOL "insert_prefix" True+onInsertPrefix = connect_GLIBSTRING__BOOL "insert_prefix" False+afterInsertPrefix = connect_GLIBSTRING__BOOL "insert_prefix" True #endif -- | Gets emitted when an action is activated.
Graphics/UI/Gtk/Entry/HScale.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget HScale --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Entry.HScale ( -- * Detail--- +-- -- | The 'HScale' widget is used to allow the user to select a value using a -- horizontal slider. To create one, use 'hScaleNewWithRange'. --@@ -55,10 +56,10 @@ hScaleNewWithRange, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -68,7 +69,7 @@ -- | Creates a new 'HScale'. ---hScaleNew :: +hScaleNew :: Adjustment -- ^ @adjustment@ - the 'Adjustment' which sets the range of -- the scale. -> IO HScale@@ -87,7 +88,7 @@ -- is a power of ten. If the resulting precision is not suitable for your -- needs, use 'Graphics.UI.Gtk.Abstract.Scale.scaleSetDigits' to correct it. ---hScaleNewWithRange :: +hScaleNewWithRange :: Double -- ^ @min@ - minimum value -> Double -- ^ @max@ - maximum value -> Double -- ^ @step@ - step increment (tick size) used with keyboard
Graphics/UI/Gtk/Entry/SpinButton.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget SpinButton --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Entry.SpinButton ( -- * Detail--- +-- -- | A 'SpinButton' is an ideal way to allow the user to set the value of some -- attribute. Rather than having to directly type a number into a 'Entry', -- 'SpinButton' allows the user to click on one of two arrows to increment or@@ -101,16 +102,16 @@ afterValueSpinned ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Structs (inputError)-import Graphics.UI.Gtk.General.Enums (SpinButtonUpdatePolicy(..), SpinType(..))+import Graphics.UI.Gtk.General.Structs (inputError)+import Graphics.UI.Gtk.General.Enums (SpinButtonUpdatePolicy(..), SpinType(..)) {# context lib="gtk" prefix="gtk" #} @@ -124,7 +125,7 @@ -- | Creates a new 'SpinButton'. ---spinButtonNew :: +spinButtonNew :: Adjustment -- ^ @adjustment@ - the 'Adjustment' object that this spin -- button should use. -> Double -- ^ @climbRate@ - specifies how much the spin button@@ -148,7 +149,7 @@ -- is a power of ten. If the resulting precision is not suitable for your -- needs, use 'spinButtonSetDigits' to correct it. ---spinButtonNewWithRange :: +spinButtonNewWithRange :: Double -- ^ @min@ - Minimum allowable value -> Double -- ^ @max@ - Maximum allowable value -> Double -- ^ @step@ - Increment added or subtracted by spinning the
Graphics/UI/Gtk/Entry/VScale.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VScale --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Entry.VScale ( -- * Detail--- +-- -- | The 'VScale' widget is used to allow the user to select a value using a -- vertical slider. To create one, use 'vScaleNewWithRange'. --@@ -55,10 +56,10 @@ vScaleNewWithRange, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -68,7 +69,7 @@ -- | Creates a new 'VScale'. ---vScaleNew :: +vScaleNew :: Adjustment -- ^ @adjustment@ - the 'Adjustment' which sets the range of -- the scale. -> IO VScale@@ -87,7 +88,7 @@ -- is a power of ten. If the resulting precision is not suitable for your -- needs, use 'Graphics.UI.Gtk.Abstract.Scale.scaleSetDigits' to correct it. ---vScaleNewWithRange :: +vScaleNewWithRange :: Double -- ^ @min@ - minimum value -> Double -- ^ @max@ - maximum value -> Double -- ^ @step@ - step increment (tick size) used with keyboard
+ Graphics/UI/Gtk/Gdk/AppLaunchContext.chs view
@@ -0,0 +1,140 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget AppLaunchContext+--+-- Author : Andy Stewart+--+-- Created: 30 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+--+module Graphics.UI.Gtk.Gdk.AppLaunchContext (+#if GTK_CHECK_VERSION(2,14,0)+-- * Types+ AppLaunchContext,+ AppLaunchContextClass,+ castToAppLaunchContext,+ gTypeAppLaunchContext,+ toAppLaunchContext,++-- * Constructors+ appLaunchContextNew,++-- * Methods+ appLaunchContextSetDisplay,+ appLaunchContextSetScreen,+ appLaunchContextSetDesktop,+ appLaunchContextSetTimestamp,+ appLaunchContextSetIconName,+#ifdef HAVE_GIO+ appLaunchContextSetIcon,+#endif+#endif+ ) where++import System.Glib.FFI+import System.Glib.UTFString+import Graphics.UI.Gtk.Gdk.EventM (TimeStamp)+{#import Graphics.UI.Gtk.Types#}+#ifdef HAVE_GIO+{#import System.GIO.Types#} (Icon (..), IconClass, toIcon)+#endif++{# context lib="gdk" prefix="gdk" #}++#if GTK_CHECK_VERSION(2,14,0)+--------------------+-- Constructors++-- | Creates a new 'AppLaunchContext'.+appLaunchContextNew :: IO AppLaunchContext+appLaunchContextNew =+ wrapNewGObject mkAppLaunchContext $+ {# call gdk_app_launch_context_new #}++--------------------+-- Methods++-- | Sets the workspace on which applications will be launched when using this context when running under+-- a window manager that supports multiple workspaces, as described in the Extended Window Manager+-- Hints.+--+-- When the workspace is not specified or desktop is set to -1, it is up to the window manager to pick+-- one, typically it will be the current workspace.+appLaunchContextSetDesktop :: AppLaunchContext -> Int -> IO ()+appLaunchContextSetDesktop self desktop =+ {# call gdk_app_launch_context_set_desktop #}+ self+ (fromIntegral desktop)++-- | Sets the display on which applications will be launched when using this context. See also+-- 'appLaunchContextSetScreen'.+appLaunchContextSetDisplay :: AppLaunchContext -> Display -> IO ()+appLaunchContextSetDisplay self display =+ {# call gdk_app_launch_context_set_display #}+ self+ display++#ifdef HAVE_GIO+-- | Sets the icon for applications that are launched with this context.+--+-- Window Managers can use this information when displaying startup notification.+appLaunchContextSetIcon :: IconClass icon => AppLaunchContext -> icon -> IO ()+appLaunchContextSetIcon self icon =+ {# call gdk_app_launch_context_set_icon #}+ self+ (toIcon icon)+#endif++-- | Sets the icon for applications that are launched with this context. The @iconName@ will be+-- interpreted in the same way as the Icon field in desktop files. See also+-- 'appLaunchContextSetIcon'.+--+-- If both icon and @iconName@ are set, the @iconName@ takes priority. If neither icon or @iconName@ is+-- set, the icon is taken from either the file that is passed to launched application or from the+-- GAppInfo for the launched application itself.+appLaunchContextSetIconName :: GlibString string => AppLaunchContext -> string -> IO ()+appLaunchContextSetIconName self iconName =+ withUTFString iconName $ \iconNamePtr ->+ {# call gdk_app_launch_context_set_icon_name #}+ self+ iconNamePtr++-- | Sets the screen on which applications will be launched when using this context. See also+-- 'appLaunchContextSetDisplay'.+--+-- If both screen and display are set, the screen takes priority. If neither screen or display are set,+-- the default screen and display are used.+appLaunchContextSetScreen :: AppLaunchContext -> Screen -> IO ()+appLaunchContextSetScreen self screen =+ {# call gdk_app_launch_context_set_screen #}+ self+ screen++-- | Sets the timestamp of context. The timestamp should ideally be taken from the event that triggered+-- the launch.+--+-- Window managers can use this information to avoid moving the focus to the newly launched application+-- when the user is busy typing in another window. This is also known as 'focus stealing prevention'.+appLaunchContextSetTimestamp :: AppLaunchContext -> TimeStamp -> IO ()+appLaunchContextSetTimestamp self timestamp =+ {# call gdk_app_launch_context_set_timestamp #}+ self+ (fromIntegral timestamp)+#endif
Graphics/UI/Gtk/Gdk/Cursor.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Cursor --@@ -7,7 +8,7 @@ -- Created: 18 November 2007 -- -- Copyright (C) 2007 Bit Connor--- Copyright (C) 2009 Andy Stewart +-- Copyright (C) 2009 Andy Stewart -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public@@ -33,11 +34,13 @@ -- * Enums CursorType(..), --- * Constructors +-- * Constructors cursorNew,- --- * Methods ++-- * Methods+#if GTK_MAJOR_VERSION < 3 cursorNewFromPixmap,+#endif cursorNewFromPixbuf, cursorNewFromName, cursorNewForDisplay,@@ -49,8 +52,9 @@ import System.Glib.FFI import System.Glib.UTFString-import Foreign.ForeignPtr (ForeignPtr, castForeignPtr, unsafeForeignPtrToPtr)-import Graphics.UI.Gtk.General.Structs+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.General.Structs (Color)+#endif {#import Graphics.UI.Gtk.Types#} hiding (Arrow) @@ -58,7 +62,7 @@ -------------------- -- Types-{#pointer *Cursor foreign newtype #}+{#pointer *GdkCursor as Cursor foreign newtype #} -------------------- -- Enums@@ -77,11 +81,11 @@ -------------------- -- Constructors--- | Creates a new cursor from the set of builtin cursors for the default display. +-- | Creates a new cursor from the set of builtin cursors for the default display. -- See 'cursorNewForDisplay'. -- To make the cursor invisible, use 'BlankCursor'.-cursorNew :: - CursorType -- ^ @cursorType@ cursor to create +cursorNew ::+ CursorType -- ^ @cursorType@ cursor to create -> IO Cursor -- ^ return a new 'Cursor' cursorNew cursorType = do cursorPtr <- {#call cursor_new#} $fromIntegral (fromEnum cursorType)@@ -89,10 +93,12 @@ -------------------- -- Methods+#if GTK_MAJOR_VERSION < 3 -- | Creates a new cursor from a given pixmap and mask. Both the pixmap and -- mask must have a depth of 1 (i.e. each pixel has only 2 values - on or off). -- The standard cursor size is 16 by 16 pixels. --+-- Removed in Gtk3. cursorNewFromPixmap :: Pixmap -- ^ @source@ - the pixmap specifying the cursor. -> Pixmap -- ^ @mask@ - the pixmap specifying the mask, which must be the@@ -109,55 +115,56 @@ with bg $ \bgPtr -> do rPtr <- {# call unsafe cursor_new_from_pixmap #} source mask (castPtr fgPtr) (castPtr bgPtr) (fromIntegral x) (fromIntegral y) makeNewCursor rPtr+#endif -- | Creates a new cursor from a pixbuf.--- Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed. --- The functions 'displaySupportsCursorAlpha' and 'displaySupportsCursorColor' can be used to determine whether RGBA cursors are supported; +-- Not all GDK backends support RGBA cursors. If they are not supported, a monochrome approximation will be displayed.+-- The functions 'displaySupportsCursorAlpha' and 'displaySupportsCursorColor' can be used to determine whether RGBA cursors are supported; -- 'displayGetDefaultCursorSize' and 'displayGetMaximalCursorSize' give information about cursor sizes.--- --- On the X backend, support for RGBA cursors requires a sufficently new version of the X Render extension.--- -cursorNewFromPixbuf :: - Display -- ^ @display@ the 'Display' for which the cursor will be created - -> Pixbuf -- ^ @pixbuf@ the 'Pixbuf' containing the cursor image - -> Int -- ^ @x@ the horizontal offset of the 'hotspot' of the cursor. - -> Int -- ^ @y@ the vertical offset of the 'hotspot' of the cursor. - -> IO Cursor -- ^ return a new 'Cursor'. +--+-- On the X backend, support for RGBA cursors requires a sufficiently new version of the X Render extension.+--+cursorNewFromPixbuf ::+ Display -- ^ @display@ the 'Display' for which the cursor will be created+ -> Pixbuf -- ^ @pixbuf@ the 'Pixbuf' containing the cursor image+ -> Int -- ^ @x@ the horizontal offset of the 'hotspot' of the cursor.+ -> Int -- ^ @y@ the vertical offset of the 'hotspot' of the cursor.+ -> IO Cursor -- ^ return a new 'Cursor'. cursorNewFromPixbuf display pixbuf x y = do cursorPtr <- {#call cursor_new_from_pixbuf#} display pixbuf (fromIntegral x) (fromIntegral y) makeNewCursor cursorPtr -- | Creates a new cursor by looking up name in the current cursor theme.-cursorNewFromName :: - Display -- ^ @display@ the 'Display' for which the cursor will be created - -> String -- ^ @name@ the name of the cursor - -> IO (Maybe Cursor) -- ^ return a new 'Cursor', or @Nothing@ if there is no cursor with the given name -cursorNewFromName display name = +cursorNewFromName :: GlibString string+ => Display -- ^ @display@ the 'Display' for which the cursor will be created+ -> string -- ^ @name@ the name of the cursor+ -> IO (Maybe Cursor) -- ^ return a new 'Cursor', or @Nothing@ if there is no cursor with the given name+cursorNewFromName display name = withUTFString name $ \namePtr -> do cursorPtr <- {#call cursor_new_from_name#} display namePtr if cursorPtr == nullPtr then return Nothing else liftM Just $ makeNewCursor cursorPtr --- | Creates a new cursor from the set of builtin cursors. -cursorNewForDisplay :: - Display -- ^ @display@ the 'Display' for which the cursor will be created - -> CursorType -- ^ @cursorType@ cursor to create +-- | Creates a new cursor from the set of builtin cursors.+cursorNewForDisplay ::+ Display -- ^ @display@ the 'Display' for which the cursor will be created+ -> CursorType -- ^ @cursorType@ cursor to create -> IO Cursor -- ^ return a new 'Cursor'-cursorNewForDisplay display cursorType = do +cursorNewForDisplay display cursorType = do cursorPtr <- {#call cursor_new_for_display#} display $fromIntegral (fromEnum cursorType) makeNewCursor cursorPtr- + -- | Returns the display on which the GdkCursor is defined.-cursorGetDisplay :: +cursorGetDisplay :: Cursor -- ^ @cursor@ 'Cursor'- -> IO Display -- ^ return the 'Display' associated to cursor + -> IO Display -- ^ return the 'Display' associated to cursor cursorGetDisplay cursor =- constructNewGObject mkDisplay $ {#call cursor_get_display#} cursor- --- | Returns a 'Pixbuf' with the image used to display the cursor. --- Note that depending on the capabilities of the windowing system and on the cursor, GDK may not be able to obtain the image data. + makeNewGObject mkDisplay $ {#call cursor_get_display#} cursor++-- | Returns a 'Pixbuf' with the image used to display the cursor.+-- Note that depending on the capabilities of the windowing system and on the cursor, GDK may not be able to obtain the image data. -- In this case, @Nothing@ is returned.-cursorGetImage :: +cursorGetImage :: Cursor -- ^ @cursor@ 'Cursor' -> IO (Maybe Pixbuf) -- ^ a 'Pixbuf' representing cursor, or @Nothing@-cursorGetImage cursor = - maybeNull (constructNewGObject mkPixbuf) $ {#call cursor_get_image#} cursor+cursorGetImage cursor =+ maybeNull (makeNewGObject mkPixbuf) $ {#call cursor_get_image#} cursor
Graphics/UI/Gtk/Gdk/Display.chs view
@@ -41,7 +41,7 @@ -- 'Display' objects are the GDK representation of the X Display which can -- be described as /a workstation consisting of a keyboard a pointing device -- (such as a mouse) and one or more screens/. It is used to open and keep--- track of various 'Screen' objects currently instanciated by the application.+-- track of various 'Screen' objects currently instantiated by the application. -- It is also used to grab and release the keyboard and the mouse pointer. -- * Class Hierarchy@@ -112,7 +112,7 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString@@ -121,7 +121,6 @@ {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.Signals import Graphics.UI.Gtk.Gdk.EventM-import Graphics.UI.Gtk.Gdk.Enums (Modifier(..)) import Graphics.UI.Gtk.General.DNDTypes (SelectionTag, TargetTag, Atom(..)) {# context lib="gdk" prefix="gdk" #}@@ -132,13 +131,13 @@ -- | Opens a display. ---displayOpen ::- String -- ^ @displayName@ - the name of the display to open+displayOpen :: GlibString string+ => string -- ^ @displayName@ - the name of the display to open -> IO (Maybe Display) -- ^ returns a 'Display', or @Nothing@ if the display -- could not be opened. displayOpen displayName =- maybeNull (makeNewGObject mkDisplay) $+ maybeNull (wrapNewGObject mkDisplay) $ withUTFString displayName $ \displayNamePtr -> {# call gdk_display_open #} displayNamePtr@@ -156,8 +155,8 @@ -- | Gets the name of the display. ---displayGetName :: Display- -> IO String -- ^ returns a string representing the display name+displayGetName :: GlibString string => Display+ -> IO string -- ^ returns a string representing the display name displayGetName self = {# call gdk_display_get_name #} self@@ -195,7 +194,7 @@ -- | Release any pointer grab. -- displayPointerUngrab :: Display- -> TimeStamp -- ^ @time@ - a timestap (e.g. 'currentTime').+ -> TimeStamp -- ^ @time@ - a timestamp (e.g. 'currentTime'). -> IO () displayPointerUngrab self time = {# call gdk_display_pointer_ungrab #}@@ -205,7 +204,7 @@ -- | Release any keyboard grab -- displayKeyboardUngrab :: Display- -> TimeStamp -- ^ @time@ - a timestap (e.g 'currentTime').+ -> TimeStamp -- ^ @time@ - a timestamp (e.g 'currentTime'). -> IO () displayKeyboardUngrab self time = {# call gdk_display_keyboard_ungrab #}@@ -246,7 +245,7 @@ -- | Flushes any requests queued for the windowing system; this happens -- automatically when the main loop blocks waiting for new events, but if your -- application is drawing without returning control to the main loop, you may--- need to call this function explicitely. A common case where this function+-- need to call this function explicitly. A common case where this function -- needs to be called is when an application is executing drawing commands from -- a thread other than the thread where the main loop is running. --@@ -410,7 +409,7 @@ #if GTK_CHECK_VERSION(2,4,0) -- | Returns @True@ if multicolored cursors are supported on @display@.--- Otherwise, cursors have only a forground and a background color.+-- Otherwise, cursors have only a foreground and a background color. -- -- * Available since Gdk version 2.4 --@@ -505,14 +504,14 @@ self selection --- | Returns whether the speicifed display supports clipboard persistance;+-- | Returns whether the speicifed display supports clipboard persistence; -- i.e. if it's possible to store the clipboard data after an application has -- quit. On X11 this checks if a clipboard daemon is running. -- -- * Available since Gdk version 2.6 -- displaySupportsClipboardPersistence :: Display- -> IO Bool -- ^ returns @True@ if the display supports clipboard persistance.+ -> IO Bool -- ^ returns @True@ if the display supports clipboard persistence. displaySupportsClipboardPersistence self = liftM toBool $ {# call gdk_display_supports_clipboard_persistence #}
+ Graphics/UI/Gtk/Gdk/DisplayManager.chs view
@@ -0,0 +1,112 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget DisplayManager+--+-- Author : Andy Stewart+--+-- Created: 29 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Maintains a list of all open GdkDisplays+--+-- * Module available since Gdk version 2.2+--+module Graphics.UI.Gtk.Gdk.DisplayManager (++-- * Detail+--+-- | The purpose of the 'DisplayManager' singleton object is to offer+-- notification when displays appear or disappear or the default display+-- changes.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----DisplayManager+-- @++#if GTK_CHECK_VERSION(2,2,0)+-- * Types+ DisplayManager,+ DisplayManagerClass,+ castToDisplayManager,+ toDisplayManager,++-- * Methods+ displayManagerGet,+ displayManagerListDisplays,++-- * Attributes+ displayManagerDefaultDisplay,++-- * Signals+ displayManagerOpened,+#endif+ ) where++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import System.Glib.GList+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gdk" prefix="gdk" #}++#if GTK_CHECK_VERSION(2,2,0)+--------------------+-- Methods++-- | Returns the global 'DisplayManager' singleton; 'parsePargs', 'init', or+-- 'initCheck' must have been called first.+--+displayManagerGet :: IO DisplayManager -- ^ returns the singleton 'DisplayManager' object.+displayManagerGet =+ constructNewGObject mkDisplayManager $+ {# call gdk_display_manager_get #}++-- | List all currently open displays.+--+displayManagerListDisplays :: DisplayManagerClass self => self+ -> IO [Display] -- ^ returns a newly allocated list of 'Display' objects.+displayManagerListDisplays self =+ {# call gdk_display_manager_list_displays #}+ (toDisplayManager self)+ >>= fromGSList+ >>= mapM (makeNewGObject mkDisplay . return)++--------------------+-- Attributes++-- | The default display.+--+displayManagerDefaultDisplay :: DisplayManagerClass self => Attr self Display+displayManagerDefaultDisplay = newAttrFromObjectProperty "default-display"+ {# call pure unsafe gdk_display_get_type #}++--------------------+-- Signals++-- | The 'displayManagerOpened' signal is emitted when a display is opened.+--+displayManagerOpened :: DisplayManagerClass self => Signal self (Display -> IO ())+displayManagerOpened = Signal (connect_OBJECT__NONE "display_opened")+#endif
Graphics/UI/Gtk/Gdk/DrawWindow.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Gdk.DrawWindow ( -- A 'DrawWindow' is used to implement high-level objects such as 'Widget' and--- 'Window' on the Gtk+ level. +-- 'Window' on the Gtk+ level. -- -- Most widgets draws its content into a 'DrawWindow', in particular -- 'DrawingArea' is nothing but a widget that contains a 'DrawWindow'.@@ -54,51 +54,68 @@ -- * Methods drawWindowGetState, drawWindowScroll,+#if GTK_MAJOR_VERSION < 3 drawWindowClear, drawWindowClearArea, drawWindowClearAreaExpose,+#endif drawWindowRaise, drawWindowLower,+ drawWindowRegisterDnd, drawWindowBeginPaintRect,+#if GTK_MAJOR_VERSION < 3 drawWindowBeginPaintRegion,+#endif drawWindowEndPaint, drawWindowInvalidateRect,+#if GTK_MAJOR_VERSION < 3 drawWindowInvalidateRegion, drawWindowGetUpdateArea,+#endif drawWindowFreezeUpdates, drawWindowThawUpdates, drawWindowProcessUpdates, #if GTK_CHECK_VERSION(2,4,0) drawWindowSetAcceptFocus, #endif+#if GTK_MAJOR_VERSION < 3 drawWindowShapeCombineMask, drawWindowShapeCombineRegion,+#endif drawWindowSetChildShapes, drawWindowMergeChildShapes, drawWindowGetPointer, drawWindowGetPointerPos, drawWindowGetOrigin,+ drawWindowSetCursor,+#if GTK_MAJOR_VERSION < 3 && !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ) drawWindowForeignNew,+#endif drawWindowGetDefaultRootWindow,+#if GTK_CHECK_VERSION(2,24,0)+ drawWindowGetWidth,+ drawWindowGetHeight,+#endif ) where import Control.Monad (liftM)+import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.Flags (toFlags)-import System.Glib.GObject (makeNewGObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Gdk.Enums#}+#if GTK_MAJOR_VERSION < 3 {#import Graphics.UI.Gtk.Gdk.Region#}-import Graphics.UI.Gtk.Gdk.EventM (Modifier, eventRegion)+#endif+{#import Graphics.UI.Gtk.Gdk.Cursor#} import Graphics.UI.Gtk.General.Structs-import Graphics.UI.Gtk.Abstract.Widget (widgetSetDoubleBuffered) {# context lib="gdk" prefix="gdk" #} -- | Gets the bitwise OR of the currently active drawWindow state flags, from -- the 'WindowState' enumeration.--- +-- drawWindowGetState :: DrawWindowClass self => self -> IO [WindowState] -- ^ returns @DrawWindow@ flags drawWindowGetState self =@@ -116,7 +133,7 @@ -- if the edges of the window's parent do not extend beyond the edges of the -- drawWindow. In other cases, a multi-step process is used to scroll the window -- which may produce temporary visual artifacts and unnecessary invalidations.)--- +-- drawWindowScroll :: DrawWindowClass self => self -> Int -- ^ @dx@ - Amount to scroll in the X direction -> Int -- ^ @dy@ - Amount to scroll in the Y direction@@ -127,16 +144,18 @@ (fromIntegral dx) (fromIntegral dy) -+#if GTK_MAJOR_VERSION < 3 -- | Clears an entire @DrawWindow@ to the background color or background pixmap.--- +--+-- Removed in Gtk3. drawWindowClear :: DrawWindowClass self => self -> IO () drawWindowClear self = {# call gdk_window_clear #} (toDrawWindow self) -- | Clears an area of @DrawWindow@ to the background color or background pixmap.--- +--+-- Removed in Gtk3. drawWindowClearArea :: DrawWindowClass self => self -> Int -- ^ @x@ - x coordinate of rectangle to clear -> Int -- ^ @y@ - y coordinate of rectangle to clear@@ -153,7 +172,8 @@ -- | Like 'drawWindowClearArea', but also generates an expose event for the -- cleared area.--- +--+-- Removed in Gtk3. drawWindowClearAreaExpose :: DrawWindowClass self => self -> Int -- ^ @x@ - x coordinate of rectangle to clear -> Int -- ^ @y@ - y coordinate of rectangle to clear@@ -167,6 +187,7 @@ (fromIntegral y) (fromIntegral width) (fromIntegral height)+#endif -- | Raises @DrawWindow@ to the top of the Z-order (stacking order), so that other -- drawWindows with the same parent drawWindow appear below @DrawWindow@. This is true@@ -175,7 +196,7 @@ -- If @DrawWindow@ is a toplevel, the window manager may choose to deny the -- request to move the drawWindow in the Z-order, 'drawWindowRaise' only requests the -- restack, does not guarantee it.--- +-- drawWindowRaise :: DrawWindowClass self => self -> IO () drawWindowRaise self = {# call gdk_window_raise #}@@ -200,7 +221,7 @@ (toDrawWindow self) -- | Registers a drawWindow as a potential drop destination.--- +-- drawWindowRegisterDnd :: DrawWindowClass self => self -> IO () drawWindowRegisterDnd self = {# call gdk_window_register_dnd #}@@ -210,13 +231,14 @@ -- rectangular region for you. -- -- * See 'drawWindowBeginPaintRegion' for details.--- +-- drawWindowBeginPaintRect :: DrawWindowClass self => self -> Rectangle -- ^ @rectangle@ - rectangle you intend to draw to -> IO () drawWindowBeginPaintRect self rectangle = with rectangle $ \rectPtr -> {#call gdk_window_begin_paint_rect#} (toDrawWindow self) (castPtr rectPtr) +#if GTK_MAJOR_VERSION < 3 -- | Indicate that you are beginning the process of redrawing @region@. -- -- * A@@ -253,7 +275,8 @@ -- drawing operations affect only the topmost backing store in the stack. One -- matching call to 'drawWindowEndPaint' is required for each call to -- 'drawWindowBeginPaintRegion'.--- +--+-- Removed in Gtk3. drawWindowBeginPaintRegion :: DrawWindowClass self => self -> Region -- ^ @region@ - region you intend to draw to -> IO ()@@ -261,6 +284,7 @@ {# call gdk_window_begin_paint_region #} (toDrawWindow self) region+#endif -- | Signal that drawing has finished. --@@ -269,7 +293,7 @@ -- next-most-recent backing store or no backing store at all as the active -- paint region. See 'drawWindowBeginPaintRegion' for full details. It is an error -- to call this function without a matching 'drawWindowBeginPaintRegion' first.--- +-- drawWindowEndPaint :: DrawWindowClass self => self -> IO () drawWindowEndPaint self = {# call gdk_window_end_paint #}@@ -277,7 +301,7 @@ -- | A convenience wrapper around 'drawWindowInvalidateRegion' which invalidates a -- rectangular region. See 'drawWindowInvalidateRegion' for details.--- +-- drawWindowInvalidateRect :: DrawWindowClass self => self -> Rectangle -- ^ @rect@ - rectangle to invalidate -> Bool -- ^ @invalidateChildren@ - whether to also invalidate@@ -290,6 +314,7 @@ (castPtr rectPtr) (fromBool invalidateChildren) +#if GTK_MAJOR_VERSION < 3 -- | Adds @region@ to the update area for @DrawWindow@. The update area is the -- region that needs to be redrawn, or \"dirty region.\". During the -- next idle period of the main look, an expose even for this region@@ -299,7 +324,7 @@ -- The @invalidateChildren@ parameter controls whether the region of each -- child drawWindow that intersects @region@ will also be invalidated. If @False@, -- then the update area for child drawWindows will remain unaffected.--- +-- drawWindowInvalidateRegion :: DrawWindowClass self => self -> Region -- ^ @region@ - a "Region" -> Bool -- ^ @invalidateChildren@ - @True@ to also invalidate child@@ -310,34 +335,38 @@ (toDrawWindow self) region (fromBool invalidateChildren)+#endif +#if GTK_MAJOR_VERSION < 3 -- | Ask for the dirty region of this window. -- -- * Transfers ownership of the update area from @DrawWindow@ to the caller of the -- function. That is, after calling this function, @DrawWindow@ will no longer have -- an invalid\/dirty region; the update area is removed from @DrawWindow@ and -- handed to you. If this window has no update area, 'drawWindowGetUpdateArea' returns 'Nothing'.--- +--+-- Removed in Gtk3. drawWindowGetUpdateArea :: DrawWindowClass self => self -> IO (Maybe Region) -- ^ returns the update area for @DrawWindow@ drawWindowGetUpdateArea self = do reg <- {# call gdk_window_get_update_area #} (toDrawWindow self) if reg==nullPtr then return Nothing else liftM Just (makeNewRegion reg)+#endif -- | Temporarily freezes a drawWindow such that it won\'t receive expose events.--- * The drawWindow will begin receiving expose events again when +-- * The drawWindow will begin receiving expose events again when -- 'drawWindowThawUpdates' -- is called. If 'drawWindowFreezeUpdates' has been called more than once, -- 'drawWindowThawUpdates' must be called an equal number of times to begin -- processing exposes.--- +-- drawWindowFreezeUpdates :: DrawWindowClass self => self -> IO () drawWindowFreezeUpdates self = {# call gdk_window_freeze_updates #} (toDrawWindow self) -- | Thaws a drawWindow frozen with 'drawWindowFreezeUpdates'.--- +-- drawWindowThawUpdates :: DrawWindowClass self => self -> IO () drawWindowThawUpdates self = {# call gdk_window_thaw_updates #}@@ -353,7 +382,7 @@ -- and synchronously (vs. the usual case, where Gtk delivers them in an idle -- handler). Occasionally this is useful to produce nicer scrolling behavior, -- for example.--- +-- drawWindowProcessUpdates :: DrawWindowClass self => self -> Bool -- ^ @updateChildren@ - whether to also process updates for child -- drawWindows@@ -371,7 +400,7 @@ -- hint. ICCCM-compliant drawWindow manager usually respect it. -- -- * Available since Gdk version 2.4--- +-- drawWindowSetAcceptFocus :: DrawWindowClass self => self -> Bool -- ^ @acceptFocus@ - @True@ if the drawWindow should receive input focus -> IO ()@@ -381,6 +410,7 @@ (fromBool acceptFocus) #endif +#if GTK_MAJOR_VERSION < 3 -- | Applies a shape mask to window. Pixels in window corresponding to set -- bits in the mask will be visible; pixels in window corresponding to -- unset bits in the mask will be transparent. This gives a non-rectangular@@ -392,7 +422,7 @@ -- -- * On the X11 platform, this uses an X server extension which is widely -- available on most common platforms, but not available on very old--- X servers, and occasionally the implementation will be buggy. +-- X servers, and occasionally the implementation will be buggy. -- On servers without the shape extension, this function will do nothing. -- On the Win32 platform the functionality is always present. --@@ -418,8 +448,9 @@ nullPtr (fromIntegral offsetX) (fromIntegral offsetY)-+#endif +#if GTK_MAJOR_VERSION < 3 -- | Makes pixels in @DrawWindow@ outside @shapeRegion@ transparent. -- -- * Makes pixels in @DrawWindow@ outside @shapeRegion@ transparent, so that@@ -435,7 +466,7 @@ -- shape extension, this function will do nothing. -- -- This function works on both toplevel and child drawWindows.--- +-- drawWindowShapeCombineRegion :: DrawWindowClass self => self -> Maybe Region -- ^ @shapeRegion@ - region of drawWindow to be non-transparent -> Int -- ^ @offsetX@ - X position of @shapeRegion@ in @DrawWindow@@@ -455,12 +486,13 @@ (Region nullForeignPtr) (fromIntegral offsetX) (fromIntegral offsetY)+#endif -- | Sets the shape mask of @DrawWindow@ to the union of shape masks for all -- children of @DrawWindow@, ignoring the shape mask of @DrawWindow@ itself. Contrast -- with 'drawWindowMergeChildShapes' which includes the shape mask of @DrawWindow@ in -- the masks to be merged.--- +-- drawWindowSetChildShapes :: DrawWindowClass self => self -> IO () drawWindowSetChildShapes self = {# call gdk_window_set_child_shapes #}@@ -472,7 +504,7 @@ -- -- This function is distinct from 'drawWindowSetChildShapes' because it includes -- @DrawWindow@'s shape mask in the set of shapes to be merged.--- +-- drawWindowMergeChildShapes :: DrawWindowClass self => self -> IO () drawWindowMergeChildShapes self = {# call gdk_window_merge_child_shapes #}@@ -483,7 +515,7 @@ -- -- * The position is -- given in coordinates relative to the given window.--- +-- -- * The return value is @Just (same, x, y, mod)@ where @same@ is @True@ -- if the passed in window is the window over which the mouse currently -- resides.@@ -510,12 +542,12 @@ -- -- * The position is -- given in coordinates relative to the given window.--- +-- -- * The return value is @(Just win, x, y, mod)@ where @win@ is the -- window over which the mouse currently resides and @mod@ denotes -- the keyboard modifiers currently being depressed. ----- * The return value is @Nothing@ for the window if the mouse cursor is +-- * The return value is @Nothing@ for the window if the mouse cursor is -- not over a known window. -- drawWindowGetPointerPos :: DrawWindowClass self => self@@ -550,17 +582,55 @@ y <- peek yPtr return (fromIntegral x, fromIntegral y) +-- | Sets the mouse pointer for a 'DrawWindow'.+--+-- Use 'cursorNewForDisplay' or 'cursorNewFromPixmap' to create the cursor.+-- To make the cursor invisible, use 'BlankCursor'. Passing @Nothing@ means+-- that the @DrawWindow@ will use the cursor of its parent @DrawWindow@.+-- Most @DrawWindow@ should use this default.+--+drawWindowSetCursor :: DrawWindow -> Maybe Cursor -> IO ()+drawWindowSetCursor self cursor =+ {# call gdk_window_set_cursor #}+ self+ (fromMaybe (Cursor nullForeignPtr) cursor) --- | Get the handle to an exising window of the windowing system. The+#if GTK_MAJOR_VERSION < 3 && !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ)+-- | Get the handle to an existing window of the windowing system. The -- passed-in handle is a reference to a native window, that is, an Xlib XID -- for X windows and a HWND for Win32.+--+-- Removed in Gtk3. drawWindowForeignNew :: NativeWindowId -> IO (Maybe DrawWindow)-drawWindowForeignNew anid = maybeNull (makeNewGObject mkDrawWindow) $+drawWindowForeignNew anid = maybeNull (wrapNewGObject mkDrawWindow) $ liftM castPtr $ {#call gdk_window_foreign_new#} (fromNativeWindowId anid)+#endif -- | Obtains the root window (parent all other windows are inside) for the default display and screen.-drawWindowGetDefaultRootWindow :: - IO DrawWindow -- ^ returns the default root window +drawWindowGetDefaultRootWindow ::+ IO DrawWindow -- ^ returns the default root window drawWindowGetDefaultRootWindow = makeNewGObject mkDrawWindow $ {#call gdk_get_default_root_window #}++#if GTK_CHECK_VERSION(2,24,0)+-- | Returns the width of the window.+--+-- On the X11 platform the returned size is the size reported in the+-- most-recently-processed configure event, rather than the current+-- size on the X server.+--+drawWindowGetWidth :: DrawWindow -> IO Int+drawWindowGetWidth self =+ liftM fromIntegral $ {# call gdk_window_get_width #} (toDrawWindow self)++-- | Returns the height of the window.+--+-- On the X11 platform the returned size is the size reported in the+-- most-recently-processed configure event, rather than the current+-- size on the X server.+--+drawWindowGetHeight :: DrawWindow -> IO Int+drawWindowGetHeight self =+ liftM fromIntegral $ {# call gdk_window_get_height #} (toDrawWindow self)+#endif
Graphics/UI/Gtk/Gdk/Drawable.chs view
@@ -34,7 +34,10 @@ -- This module defines drawing primitives that can operate on 'DrawWindow's -- and 'Pixmap's. --+-- This module is empty when built with Gtk3 because GTKDrawable has been+-- removed. module Graphics.UI.Gtk.Gdk.Drawable (+#if GTK_MAJOR_VERSION < 3 Drawable, DrawableClass, castToDrawable, gTypeDrawable,@@ -63,18 +66,22 @@ drawLayout, drawLayoutWithColors, drawDrawable,+#endif ) where -import Control.Monad (liftM)+#if GTK_MAJOR_VERSION < 3+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.General.Structs (Point, Color, drawableGetID)+import Graphics.UI.Gtk.General.Structs (Point, drawableGetID) import Graphics.Rendering.Pango.Structs {#import Graphics.Rendering.Pango.Types#} {#import Graphics.Rendering.Pango.BasicTypes#} {#import Graphics.UI.Gtk.Types#}-{#import Graphics.UI.Gtk.Gdk.Region#} (Region, makeNewRegion)-import Graphics.UI.Gtk.Gdk.Enums (Dither(..))+#if GTK_MAJOR_VERSION < 3+{#import Graphics.UI.Gtk.Gdk.Region#} (Region, makeNewRegion)+#endif+import Graphics.UI.Gtk.Gdk.Enums (Dither(..)) {# context lib="gtk" prefix="gdk" #} @@ -86,8 +93,8 @@ -- pixels in this 'Drawable'. -- drawableGetDepth :: DrawableClass d => d -> IO Int-drawableGetDepth d = liftM fromIntegral $ - {#call unsafe drawable_get_depth#} (toDrawable d)+drawableGetDepth d = liftM fromIntegral $+ {#call unsafe drawable_get_depth#} (toDrawable d) -- | Retrieve the size of the 'Drawable'. --@@ -139,7 +146,7 @@ -- drawPoints :: DrawableClass d => d -> GC -> [Point] -> IO () drawPoints d gc [] = return ()-drawPoints d gc points = +drawPoints d gc points = withArray (concatMap (\(x,y) -> [fromIntegral x, fromIntegral y]) points) $ \(aPtr :: Ptr {#type gint#}) -> {#call unsafe draw_points#} (toDrawable d) (toGC gc) (castPtr aPtr) (fromIntegral (length points))@@ -153,7 +160,7 @@ -- drawLine :: DrawableClass d => d -> GC -> Point -> Point -> IO () drawLine d gc (x1,y1) (x2,y2) = {#call unsafe draw_line#} (toDrawable d)- (toGC gc) (fromIntegral x1) (fromIntegral y1) (fromIntegral x2) + (toGC gc) (fromIntegral x1) (fromIntegral y1) (fromIntegral x2) (fromIntegral y2) -- | Draw several lines.@@ -173,7 +180,7 @@ -- | Render a 'Pixbuf'. -- -- * Usage:--- @drawPixbuf d gc pb srcX srcY destX destY srcWidth srcHeight dither@+-- @drawPixbuf d gc pb srcX srcY destX destY srcWidth srcHeight dither xDither yDither@ -- Renders a rectangular portion of a 'Pixbuf' to a -- 'Drawable'. The @srcX@, @srcY@, -- @srcWidth@ and @srcHeight@ specify what part of the@@ -186,8 +193,8 @@ -- * Since 2.2. -- drawPixbuf :: DrawableClass d => d -> GC -> Pixbuf -> Int -> Int ->- Int -> Int -> Int -> Int -> Dither ->- Int -> Int -> IO ()+ Int -> Int -> Int -> Int -> Dither ->+ Int -> Int -> IO () drawPixbuf d gc pb srcX srcY destX destY srcWidth srcHeight dither xDither yDither = {#call unsafe draw_pixbuf#} (toDrawable d) gc pb (fromIntegral srcX) (fromIntegral srcY) (fromIntegral destX)@@ -203,7 +210,7 @@ -- drawSegments :: DrawableClass d => d -> GC -> [(Point,Point)] -> IO () drawSegments d gc [] = return ()-drawSegments d gc pps = withArray (concatMap (\((x1,y1),(x2,y2)) -> +drawSegments d gc pps = withArray (concatMap (\((x1,y1),(x2,y2)) -> [fromIntegral x1, fromIntegral y1, fromIntegral x2, fromIntegral y2]) pps) $ \(aPtr :: Ptr {#type gint#}) -> {#call unsafe draw_segments#} (toDrawable d) (toGC gc)@@ -221,8 +228,14 @@ -- results in an outlined rectangle with corners at (0, 0), (0, 20), (20, -- 20), and (20, 0), which makes it 21 pixels wide and 21 pixels high. ---drawRectangle :: DrawableClass d => d -> GC -> Bool -> Int -> Int ->- Int -> Int -> IO ()+drawRectangle :: DrawableClass d => d -- ^ drawable+ -> GC -- ^ graphics context+ -> Bool -- ^ filled+ -> Int -- ^ x+ -> Int -- ^ y+ -> Int -- ^ width+ -> Int -- ^ height+ -> IO () drawRectangle d gc filled x y width height = {#call unsafe draw_rectangle#} (toDrawable d) (toGC gc) (fromBool filled) (fromIntegral x) (fromIntegral y) (fromIntegral width) (fromIntegral height)@@ -238,7 +251,7 @@ -- is measured similarly, but relative to @aStart@. -- drawArc :: DrawableClass d => d -> GC -> Bool -> Int -> Int ->- Int -> Int -> Int -> Int -> IO ()+ Int -> Int -> Int -> Int -> IO () drawArc d gc filled x y width height aStart aEnd = {#call unsafe draw_arc#} (toDrawable d) (toGC gc) (fromBool filled) (fromIntegral x) (fromIntegral y) (fromIntegral width) (fromIntegral height)@@ -251,14 +264,14 @@ -- drawPolygon :: DrawableClass d => d -> GC -> Bool -> [Point] -> IO () drawPolygon _ _ _ [] = return ()-drawPolygon d gc filled points = +drawPolygon d gc filled points = withArray (concatMap (\(x,y) -> [fromIntegral x, fromIntegral y]) points) $ \(aPtr::Ptr {#type gint#}) -> {#call unsafe draw_polygon#} (toDrawable d) (toGC gc) (fromBool filled) (castPtr aPtr) (fromIntegral (length points)) -- | Draw a segment of text. ----- * This function draws a segment of text. These segements are the result+-- * This function draws a segment of text. These segments are the result -- of itemizing a string into segments with the same characteristics -- (font, text direction, etc.) using -- 'Graphics.Rendering.Pango.Rendering.itemize'. Each item is then turned@@ -273,14 +286,14 @@ {#call unsafe draw_glyphs#} (toDrawable d) (toGC gc) font (fromIntegral x) (fromIntegral y) gs --- +-- -- | Draw a single line of text. -- -- * The @x@ coordinate specifies the start of the string, -- the @y@ coordinate specifies the base line. -- drawLayoutLine :: DrawableClass d => d -> GC -> Int -> Int -> LayoutLine ->- IO ()+ IO () drawLayoutLine d gc x y (LayoutLine _ ll) = {#call unsafe draw_layout_line#} (toDrawable d) (toGC gc) (fromIntegral x) (fromIntegral y) ll@@ -295,7 +308,7 @@ -- the graphics context. -- drawLayoutLineWithColors :: DrawableClass d => d -> GC -> Int -> Int ->- LayoutLine -> Maybe Color -> Maybe Color -> IO ()+ LayoutLine -> Maybe Color -> Maybe Color -> IO () drawLayoutLineWithColors d gc x y (LayoutLine _ ll) foreground background = let withMB :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b withMB Nothing f = f nullPtr@@ -309,7 +322,7 @@ -- | Draw a paragraph of text. -- -- * The @x@ and @y@ values specify the upper left--- point of the layout. +-- point of the layout. -- drawLayout :: DrawableClass d => d -> GC -> Int -> Int -> PangoLayout -> IO () drawLayout d gc x y (PangoLayout _ pl) =@@ -319,14 +332,14 @@ -- | Draw a paragraph of text. -- -- * The @x@ and @y@ values specify the upper left--- point of the layout. +-- point of the layout. -- -- * If both colors are @Nothing@ this function will behave like -- 'drawLayout' in that it uses the default colors from -- the graphics context. -- drawLayoutWithColors :: DrawableClass d => d -> GC -> Int -> Int ->- PangoLayout -> Maybe Color -> Maybe Color -> IO ()+ PangoLayout -> Maybe Color -> Maybe Color -> IO () drawLayoutWithColors d gc x y (PangoLayout _ pl) foreground background = let withMB :: Storable a => Maybe a -> (Ptr a -> IO b) -> IO b withMB Nothing f = f nullPtr@@ -352,16 +365,24 @@ -- in a BadMatch error from the X server.) A common cause of this -- problem is an attempt to draw a bitmap to a color drawable. The way to -- draw a bitmap is to set the bitmap as a clip mask on your--- 'GC', then use 'drawRectangle' to draw a +-- 'GC', then use 'drawRectangle' to draw a -- rectangle clipped to the bitmap. ---drawDrawable :: (DrawableClass src, DrawableClass dest) => - dest -> GC -> src -> Int -> Int -> Int -> Int -> - Int -> Int -> IO ()+drawDrawable :: (DrawableClass src, DrawableClass dest)+ => dest -- ^ destination drawable+ -> GC -- ^ graphics context+ -> src -- ^ source drawable+ -> Int -- ^ @xSrc@+ -> Int -- ^ @ySrc@+ -> Int -- ^ @xDest@+ -> Int -- ^ @yDest@+ -> Int -- ^ @width@+ -> Int -- ^ @height@+ -> IO () drawDrawable dest gc src xSrc ySrc xDest yDest width height = {#call unsafe draw_drawable#} (toDrawable dest) (toGC gc) (toDrawable src) (fromIntegral xSrc) (fromIntegral ySrc) (fromIntegral xDest) (fromIntegral yDest) (fromIntegral width) (fromIntegral height) -+#endif /* GTK_MAJOR_VERSION < 3 */
Graphics/UI/Gtk/Gdk/Enums.chs view
@@ -4,7 +4,7 @@ -- -- Author : Manuel M. T. Chakravarty, Axel Simon ----- Created: 13 Januar 1999+-- Created: 13 January 1999 -- -- Copyright (C) 1999-2005 Manuel M. T. Chakravarty, Axel Simon --@@ -26,22 +26,16 @@ -- General enumeration types. -- module Graphics.UI.Gtk.Gdk.Enums (- CapStyle(..), CrossingMode(..),- Dither(..), DragProtocol(..), DragAction(..), EventMask(..), Modifier(..),- ExtensionMode(..),- Fill(..),- Function(..),- InputCondition(..),- JoinStyle(..),- LineStyle(..),+#if GTK_CHECK_VERSION(3,4,0)+ ModifierIntent(..),+#endif NotifyType(..), ScrollDirection(..),- SubwindowMode(..), VisibilityState(..), WindowState(..), WindowEdge(..),@@ -51,15 +45,29 @@ #if GTK_CHECK_VERSION(2,6,0) OwnerChange(..), #endif+#if GTK_MAJOR_VERSION < 3+ ExtensionMode(..),+ CapStyle(..),+ Dither(..),+ Fill(..),+ Function(..),+ InputCondition(..),+ JoinStyle(..),+ LineStyle(..),+ SubwindowMode(..),+#endif ) where -import System.Glib.Flags (Flags)+import System.Glib.Flags (Flags) {#context lib="gdk" prefix ="gdk"#} +#if GTK_MAJOR_VERSION < 3 -- | Specify the how the ends of a line is drawn. --+-- Removed in Gtk3. {#enum CapStyle {underscoreToCase} deriving(Eq,Show)#}+#endif -- | How focus is crossing the widget. --@@ -91,9 +99,12 @@ instance Flags DragAction +#if GTK_MAJOR_VERSION < 3 -- | Specify how to dither colors onto the screen. --+-- Removed in Gtk3. {#enum RgbDither as Dither {underscoreToCase} deriving(Eq,Show) #}+#endif -- | Specify which events a widget will emit signals on. --@@ -104,7 +115,7 @@ -- | Keyboard modifiers that are depressed when the user presses -- a key or a mouse button. ----- * This data type is used to build lists of modifers that were active+-- * This data type is used to build lists of modifiers that were active -- during an event. -- -- * The "Apple" key on Macintoshs is mapped to 'Alt2' and the 'Meta'@@ -158,6 +169,11 @@ instance Flags Modifier +#if GTK_CHECK_VERSION(3,4,0)+{#enum ModifierIntent {underscoreToCase} deriving(Eq,Show) #}+#endif++#if GTK_MAJOR_VERSION < 3 -- | specify which input extension a widget desires -- {#enum ExtensionMode {underscoreToCase} deriving(Eq,Bounded,Show)#}@@ -166,27 +182,32 @@ -- | How objects are filled. --+-- Removed in Gtk3. {#enum Fill {underscoreToCase} deriving(Eq,Show) #} -- | Determine how bitmap operations are carried out. --+-- Removed in Gtk3. {#enum Function {underscoreToCase} deriving(Eq,Show) #} -- | Specify on what file condition a callback should be -- done. --+-- Removed in Gtk3. {#enum InputCondition {underscoreToCase} deriving(Eq,Bounded) #} instance Flags InputCondition -- | Determines how adjacent line ends are drawn. --+-- Removed in Gtk3. {#enum JoinStyle {underscoreToCase} deriving(Eq,Show)#} -- | Determines if a line is solid or dashed. --+-- Removed in Gtk3. {#enum LineStyle {underscoreToCase} deriving(Eq,Show)#}-+#endif -- | Information on from what level of the widget hierarchy the mouse -- cursor came. --@@ -215,15 +236,19 @@ -- {#enum ScrollDirection {underscoreToCase} deriving(Eq,Show) #} ++#if GTK_MAJOR_VERSION < 3 -- | Determine if child widget may be overdrawn. --+-- Removed in Gtk3. {#enum SubwindowMode {underscoreToCase} deriving(Eq,Show) #}+#endif -- | visibility of a window -- {#enum VisibilityState {underscoreToCase,- VISIBILITY_PARTIAL as VisibilityPartialObscured}- deriving(Eq,Show) #}+ VISIBILITY_PARTIAL as VisibilityPartialObscured}+ deriving(Eq,Show) #} -- | The state a @DrawWindow@ is in. --
Graphics/UI/Gtk/Gdk/EventM.hsc view
@@ -1,4 +1,8 @@ {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE EmptyDataDecls #-}+#if MIN_VERSION_base(4,8,0)+{-# LANGUAGE FlexibleContexts #-}+#endif -- -*-haskell-*- #include <gtk/gtk.h>@@ -86,7 +90,7 @@ -- print a message. Note that the return -- value of this statement must be @()@ since 'tryEvent' always -- assumes that the--- function handeled the event if no exception is thrown. A handler+-- function handled the event if no exception is thrown. A handler -- wrapped by 'tryEvent' can also indicate that it cannot handle the -- given event by calling 'stopEvent'. --@@ -94,6 +98,13 @@ -- you can (and usually have to) use @liftIO@ to execute @IO@ functions. -- +-- * Classes++ HasCoordinates,+ HasRootCoordinates,+ HasModifier,+ HasTime,+ -- * Event monad and type tags EventM, EAny,@@ -123,6 +134,7 @@ eventRootCoordinates, eventModifier, eventModifierAll,+ eventModifierMouse, eventTime, eventKeyVal, eventKeyName,@@ -135,8 +147,13 @@ ScrollDirection(..), eventScrollDirection, eventIsHint,+#if GTK_CHECK_VERSION(2,12,0)+ eventRequestMotions,+#endif eventArea,+#if GTK_MAJOR_VERSION < 3 eventRegion,+#endif VisibilityState(..), eventVisibilityState, CrossingMode(..),@@ -163,8 +180,8 @@ eventGrabWindow, #endif --- * Auxilliary Definitions- Modifier(..), -- a mask of control keys+-- * Auxiliary Definitions+ Modifier(..), -- a mask of control keys TimeStamp, currentTime, tryEvent,@@ -173,23 +190,24 @@ import Prelude hiding (catch) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Flags import System.Glib.GObject ( makeNewGObject )-import Graphics.UI.Gtk.Gdk.Keys (KeyVal, keyName)+import Graphics.UI.Gtk.Gdk.Keys (KeyVal, KeyCode, keyName)+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Gdk.Region (Region, makeNewRegion)-import Graphics.UI.Gtk.Gdk.Enums (Modifier(..), VisibilityState(..),+#endif+import Graphics.UI.Gtk.Gdk.Enums (Modifier(..), VisibilityState(..), CrossingMode(..), NotifyType(..), WindowState(..), ScrollDirection(..), #if GTK_CHECK_VERSION(2,6,0) OwnerChange(..) #endif )-import Graphics.UI.Gtk.General.Enums (MouseButton(..), Click(..))-import Graphics.UI.Gtk.General.Structs (Rectangle(..))+import Graphics.UI.Gtk.General.Enums (MouseButton(..), Click(..))+import Graphics.UI.Gtk.General.Structs (Rectangle(..)) import Graphics.UI.Gtk.General.DNDTypes (Atom(..), SelectionTag) import Graphics.UI.Gtk.Types ( DrawWindow, mkDrawWindow ) -import Data.Bits ((.|.), (.&.), testBit, shiftL, shiftR)-import Data.Maybe (catMaybes) import Data.List (isPrefixOf) import Control.Monad.Reader ( ReaderT, ask, runReaderT ) import Control.Monad.Trans ( liftIO )@@ -203,60 +221,60 @@ import Control.Exception (catch, throw, Exception(PatternMatchFail,IOException) ) #endif- + -- | A monad providing access to data in an event. ---type EventM t a = ReaderT (Ptr t) IO a +type EventM t = ReaderT (Ptr t) IO -- | A tag for events that do not carry any event-specific information.-data EAny = EAny+data EAny -- | A tag for /key/ events.-data EKey = EKey+data EKey -- | A tag for /Button/ events.-data EButton = EButton+data EButton -- | A tag for /Scroll/ events.-data EScroll = EScroll+data EScroll -- | A tag for /Motion/ events.-data EMotion = EMotion+data EMotion -- | A tag for /Expose/ events.-data EExpose = EExpose+data EExpose -- | A tag for /Visibility/ events.-data EVisibility = EVisibility+data EVisibility -- | A tag for /Crossing/ events.-data ECrossing = ECrossing+data ECrossing -- | A tag for /Focus/ events.-data EFocus = EFocus +data EFocus -- | A tag for /Configure/ events.-data EConfigure = EConfigure- +data EConfigure+ -- | A tag for /Property/ events.-data EProperty = EProperty- +data EProperty+ -- | A tag for /Proximity/ events.-data EProximity = EProximity+data EProximity -- | A tag for /WindowState/ event.-data EWindowState = EWindowState+data EWindowState #if GTK_CHECK_VERSION(2,6,0) -- | A tag for /OwnerChange/ events.-data EOwnerChange = EOwnerChange+data EOwnerChange #endif #if GTK_CHECK_VERSION(2,8,0) -- | A tag for /GrabBroken/ events.-data EGrabBroken = EGrabBroken+data EGrabBroken #endif -- | Retrieve the 'Graphics.UI.Gtk.Gdk.DrawWindow.DrawWindow' that this@@ -352,45 +370,57 @@ -- | Query the modifier keys that were depressed when the event happened. -- Sticky modifiers such as CapsLock are omitted in the return value. -- Use 'eventModifierAll' your application requires all modifiers.+-- Use 'eventModifierMouse' if you just need the mouse buttons. -- eventModifier :: HasModifier t => EventM t [Modifier]-eventModifier = eM False+eventModifier = eM defModMask -- | Query the modifier keys that were depressed when the event happened. -- The result includes sticky modifiers such as CapsLock. Normally, -- 'eventModifier' is more appropriate in applications. -- eventModifierAll :: HasModifier t => EventM t [Modifier]-eventModifierAll = eM True+eventModifierAll = eM allModMask +-- | Query the mouse buttons that were depressed when the event happened.+--+eventModifierMouse :: HasModifier t => EventM t [Modifier]+eventModifierMouse = eM mouseModMask++allModMask = -1+ foreign import ccall safe "gtk_accelerator_get_default_mod_mask" defModMask :: #gtk2hs_type guint -eM allModifs = do- let mask | allModifs = -1- | otherwise = defModMask+mouseModMask = #{const GDK_BUTTON1_MASK}+ .|. #{const GDK_BUTTON2_MASK}+ .|. #{const GDK_BUTTON3_MASK}+ .|. #{const GDK_BUTTON4_MASK}+ .|. #{const GDK_BUTTON5_MASK}++eM mask = do ptr <- ask liftIO $ do (ty :: #{gtk2hs_type GdkEventType}) <- peek (castPtr ptr) if ty `elem` [ #{const GDK_KEY_PRESS}, #{const GDK_KEY_RELEASE}] then do- (modif ::#gtk2hs_type guint) <- #{peek GdkEventKey, state} ptr+ (modif ::#gtk2hs_type guint) <- #{peek GdkEventKey, state} ptr return (toFlags (fromIntegral (modif .&. mask))) else if ty `elem` [ #{const GDK_BUTTON_PRESS}, #{const GDK_2BUTTON_PRESS}, #{const GDK_3BUTTON_PRESS}, #{const GDK_BUTTON_RELEASE}] then do- (modif ::#gtk2hs_type guint) <- #{peek GdkEventButton, state} ptr+ (modif ::#gtk2hs_type guint) <- #{peek GdkEventButton, state} ptr return (toFlags (fromIntegral (modif .&. mask))) else if ty `elem` [ #{const GDK_SCROLL} ] then do- (modif ::#gtk2hs_type guint) <- #{peek GdkEventScroll, state} ptr+ (modif ::#gtk2hs_type guint) <- #{peek GdkEventScroll, state} ptr return (toFlags (fromIntegral (modif .&. mask))) else if ty `elem` [ #{const GDK_MOTION_NOTIFY} ] then do- (modif ::#gtk2hs_type guint) <- #{peek GdkEventMotion, state} ptr+ (modif ::#gtk2hs_type guint) <- #{peek GdkEventMotion, state} ptr return (toFlags (fromIntegral (modif .&. mask))) else if ty `elem` [ #{const GDK_ENTER_NOTIFY}, #{const GDK_LEAVE_NOTIFY}] then do- (modif ::#gtk2hs_type guint) <- #{peek GdkEventCrossing, state} ptr+ (modif ::#gtk2hs_type guint) <- #{peek GdkEventCrossing, state} ptr return (toFlags (fromIntegral (modif .&. mask))) else error ("eventModifiers: none for event type "++show ty) @@ -458,26 +488,26 @@ -- | The key value. See 'Graphics.UI.Gtk.Gdk.Keys.KeyVal'. eventKeyVal :: EventM EKey KeyVal-eventKeyVal = ask >>= \ptr -> liftIO $ liftM fromIntegral - (#{peek GdkEventKey, keyval} ptr :: IO #{gtk2hs_type guint}) +eventKeyVal = ask >>= \ptr -> liftIO $ liftM fromIntegral+ (#{peek GdkEventKey, keyval} ptr :: IO #{gtk2hs_type guint}) -- | The key value as a string. See 'Graphics.UI.Gtk.Gdk.Keys.KeyVal'.-eventKeyName :: EventM EKey String+eventKeyName :: EventM EKey DefaultGlibString eventKeyName = liftM keyName $ eventKeyVal -- | The hardware key code.-eventHardwareKeycode :: EventM EKey Word16-eventHardwareKeycode = ask >>= \ptr -> liftIO $ liftM fromIntegral +eventHardwareKeycode :: EventM EKey KeyCode+eventHardwareKeycode = ask >>= \ptr -> liftIO $ liftM fromIntegral (#{peek GdkEventKey, hardware_keycode} ptr :: IO #{gtk2hs_type guint16}) -- | The keyboard group. eventKeyboardGroup :: EventM EKey Word8-eventKeyboardGroup = ask >>= \ptr -> liftIO $ liftM fromIntegral +eventKeyboardGroup = ask >>= \ptr -> liftIO $ liftM fromIntegral (#{peek GdkEventKey, group} ptr :: IO #{gtk2hs_type guint8}) -- | Query the mouse buttons. eventButton :: EventM EButton MouseButton-eventButton = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) +eventButton = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) (#{peek GdkEventButton, button} ptr :: IO #{gtk2hs_type guint}) --- | Query the mouse click.@@ -495,38 +525,66 @@ -- | Query the direction of scrolling. eventScrollDirection :: EventM EScroll ScrollDirection-eventScrollDirection = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) +eventScrollDirection = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) (#{peek GdkEventScroll, direction} ptr :: IO #{gtk2hs_type GdkScrollDirection}) -- | Check if the motion event is only a hint rather than the full mouse -- movement information. eventIsHint :: EventM EMotion Bool-eventIsHint = ask >>= \ptr -> liftIO $ liftM toBool +eventIsHint = ask >>= \ptr -> liftIO $ liftM toBool (#{peek GdkEventMotion, is_hint} ptr :: IO #{gtk2hs_type gint16}) +#if GTK_CHECK_VERSION(2,12,0)+-- | Request more motion notifies if this event is a motion notify hint event.+--+-- This action should be used instead of 'drawWindowGetPointer' to request+-- further motion notifies, because it also works for extension events where+-- motion notifies are provided for devices other than the core pointer.+--+-- Coordinate extraction, processing and requesting more motion events from a+-- 'motionNotifyEvent' usually works like this:+--+-- > on widget motionNotifyEvent $ do+-- > (x, y) <- eventCoordinates+-- > -- handle the x,y motion:+-- > ...+-- > -- finally, notify that we are ready to get more motion events:+-- > eventRequestMotions+--+eventRequestMotions :: EventM EMotion ()+eventRequestMotions = ask >>= \ptr -> liftIO $+ gdk_event_request_motions ptr++foreign import ccall "gdk_event_request_motions"+ gdk_event_request_motions :: Ptr EMotion -> IO ()+#endif+ -- | Query a bounding box of the region that needs to be updated. eventArea :: EventM EExpose Rectangle eventArea = ask >>= \ptr -> liftIO $ (#{peek GdkEventExpose, area} ptr :: IO Rectangle) +#if GTK_MAJOR_VERSION < 3 -- | Query the region that needs to be updated.+-- Removed in Gtk3. eventRegion :: EventM EExpose Region eventRegion = ask >>= \ptr -> liftIO $ do- (reg_ :: Ptr Region) <- #{peek GdkEventExpose, region} ptr+ (reg_ :: Ptr Region) <- #{peek GdkEventExpose, region} ptr reg_ <- gdk_region_copy reg_ makeNewRegion reg_ foreign import ccall "gdk_region_copy" gdk_region_copy :: Ptr Region -> IO (Ptr Region)+#endif -- | Get the visibility status of a window. eventVisibilityState :: EventM EVisibility VisibilityState-eventVisibilityState = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) +eventVisibilityState = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) (#{peek GdkEventVisibility, state} ptr :: IO #{gtk2hs_type GdkVisibilityState}) -- | Get the mode of the mouse cursor crossing a window. eventCrossingMode :: EventM ECrossing CrossingMode-eventCrossingMode = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) +eventCrossingMode = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) (#{peek GdkEventCrossing, mode} ptr :: IO #{gtk2hs_type GdkCrossingMode}) -- | Get the notify type of the mouse cursor crossing a window.@@ -541,51 +599,51 @@ -- | Query if a window gained focus (@True@) or lost the focus (@False@). eventFocusIn :: EventM EFocus Bool-eventFocusIn = ask >>= \ptr -> liftIO $ liftM toBool +eventFocusIn = ask >>= \ptr -> liftIO $ liftM toBool (#{peek GdkEventFocus, in} ptr :: IO #{gtk2hs_type gint16}) -- | Get the @(x,y)@ position of the window within the parent window. eventPosition :: EventM EConfigure (Int,Int) eventPosition = ask >>= \ptr -> liftIO $ do- (x :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, x} ptr- (y :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, y} ptr+ (x :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, x} ptr+ (y :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, y} ptr return (fromIntegral x, fromIntegral y) -- | Get the new size of the window as @(width,height)@. eventSize :: EventM EConfigure (Int,Int) eventSize = ask >>= \ptr -> liftIO $ do- (x :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, width} ptr- (y :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, height} ptr+ (x :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, width} ptr+ (y :: #{gtk2hs_type gint}) <- #{peek GdkEventConfigure, height} ptr return (fromIntegral x, fromIntegral y) eventProperty :: EventM EProperty Atom-eventProperty = ask >>= \ptr -> liftIO $ liftM Atom - (#{peek GdkEventProperty, atom} ptr :: IO (Ptr ())) +eventProperty = ask >>= \ptr -> liftIO $ liftM Atom+ (#{peek GdkEventProperty, atom} ptr :: IO (Ptr ())) -- | Query which window state bits have changed. eventWindowStateChanged :: EventM EWindowState [WindowState]-eventWindowStateChanged = ask >>= \ptr -> liftIO $ liftM (toFlags . fromIntegral) +eventWindowStateChanged = ask >>= \ptr -> liftIO $ liftM (toFlags . fromIntegral) (#{peek GdkEventWindowState, changed_mask} ptr :: IO #{gtk2hs_type GdkWindowState}) -- | Query the new window state. eventWindowState :: EventM EWindowState [WindowState]-eventWindowState = ask >>= \ptr -> liftIO $ liftM (toFlags . fromIntegral) +eventWindowState = ask >>= \ptr -> liftIO $ liftM (toFlags . fromIntegral) (#{peek GdkEventWindowState, new_window_state} ptr :: IO #{gtk2hs_type GdkWindowState}) #if GTK_CHECK_VERSION(2,6,0) -- | Query why a seleciton changed its owner. eventChangeReason :: EventM EOwnerChange OwnerChange-eventChangeReason = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) +eventChangeReason = ask >>= \ptr -> liftIO $ liftM (toEnum . fromIntegral) (#{peek GdkEventOwnerChange, reason} ptr :: IO #{gtk2hs_type GdkOwnerChange})- + -- | Query what selection changed its owner. eventSelection :: EventM EOwnerChange SelectionTag-eventSelection = ask >>= \ptr -> liftIO $ liftM Atom +eventSelection = ask >>= \ptr -> liftIO $ liftM Atom (#{peek GdkEventOwnerChange, selection} ptr :: IO (Ptr ())) -- | Query the time when the selection was taken over. eventSelectionTime :: EventM EOwnerChange TimeStamp-eventSelectionTime = ask >>= \ptr -> liftIO $ liftM fromIntegral +eventSelectionTime = ask >>= \ptr -> liftIO $ liftM fromIntegral (#{peek GdkEventOwnerChange, selection_time} ptr :: IO (#{gtk2hs_type guint32})) #endif @@ -593,12 +651,12 @@ -- | Check if a keyboard (@True@) or a mouse pointer grap (@False@) was -- broken. eventKeyboardGrab :: EventM EGrabBroken Bool-eventKeyboardGrab = ask >>= \ptr -> liftIO $ liftM toBool +eventKeyboardGrab = ask >>= \ptr -> liftIO $ liftM toBool (#{peek GdkEventGrabBroken, keyboard} ptr :: IO #{gtk2hs_type gboolean}) -- | Check if a grab was broken implicitly. eventImplicit :: EventM EGrabBroken Bool-eventImplicit = ask >>= \ptr -> liftIO $ liftM toBool +eventImplicit = ask >>= \ptr -> liftIO $ liftM toBool (#{peek GdkEventGrabBroken, implicit} ptr :: IO #{gtk2hs_type gboolean}) -- | Get the new window that owns the grab or @Nothing@ if the window@@ -611,20 +669,24 @@ -- | Execute an event handler and assume it handled the event unless it--- threw a pattern match exception.+-- threw a pattern match exception or calls mzero (e.g. via guard). tryEvent :: EventM any () -> EventM any Bool tryEvent act = do ptr <- ask liftIO $ (runReaderT (act >> return True) ptr) #if __GLASGOW_HASKELL__ >= 610 `catches` [ Handler (\ (PatternMatchFail _) -> return False)- , Handler (\ e -> if isUserError e && "Pattern" `isPrefixOf` ioeGetErrorString e+ , Handler (\ e -> if isUserError e &&+ ("Pattern" `isPrefixOf` ioeGetErrorString e ||+ "mzero" == ioeGetErrorString e) then return False else throw e) ] #else `catch` (\e -> case e of IOException e | "user error (Pattern" `isPrefixOf` show e ->+ return False+ | "user error (mzero" `isPrefixOf` show e -> return False PatternMatchFail _ -> return False _ -> throw e)
Graphics/UI/Gtk/Gdk/Events.hsc view
@@ -27,16 +27,16 @@ -- Stability : deprecated -- Portability : portable (depends on GHC) ----- Definiton of a record that contains event information. Deprecated in+-- Definition of a record that contains event information. Deprecated in -- favor of 'Graphics.UI.Gtk.Gdk.EventM' and not exported by Gtk.hs. -- module Graphics.UI.Gtk.Gdk.Events (- Modifier(..), -- a mask of control keys+ Modifier(..), -- a mask of control keys TimeStamp, currentTime, -- | Deprecated way of conveying event information.- Event(..), -- information in event callbacks from Gdk+ Event(..), -- information in event callbacks from Gdk EventButton, EventScroll, EventMotion,@@ -54,7 +54,7 @@ marshExposeRect, -- selector functions- marshalEvent, -- convert a pointer to an event data structure+ marshalEvent, -- convert a pointer to an event data structure -- used data structures VisibilityState(..), CrossingMode(..),@@ -68,23 +68,20 @@ import System.IO.Unsafe (unsafeInterleaveIO) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Flags-import System.Glib.GObject ( makeNewGObject )-import Graphics.UI.Gtk.Gdk.Keys (KeyVal, keyvalToChar, keyvalName)+import Graphics.UI.Gtk.Gdk.Keys (KeyVal, keyvalToChar, keyvalName)+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.Gdk.Region (Region, makeNewRegion)-import Graphics.UI.Gtk.Gdk.Enums (Modifier(..),+#endif+import Graphics.UI.Gtk.Gdk.Enums (Modifier(..), VisibilityState(..),- CrossingMode(..),- NotifyType(..),- WindowState(..),- ScrollDirection(..))-import Graphics.UI.Gtk.General.Enums (MouseButton(..), Click(..))-import Graphics.UI.Gtk.General.Structs (Rectangle(..))-import Graphics.UI.Gtk.Types ( DrawWindow, mkDrawWindow )--import Data.Bits ((.|.), (.&.), testBit, shiftL, shiftR)-import Data.Maybe (catMaybes)-+ CrossingMode(..),+ NotifyType(..),+ WindowState(..),+ ScrollDirection(..))+import Graphics.UI.Gtk.General.Enums (MouseButton(..), Click(..))+import Graphics.UI.Gtk.General.Structs (Rectangle(..)) -- | The time (in milliseconds) when an event happened. This is used mostly -- for ordering events and responses to events.@@ -105,7 +102,7 @@ -- -- * EventProperty is not bound since it involves Atoms and its hard to see -- how a Haskell application should extract the data. It should be possible--- to connect directly to property-changed signals. If there is a need+-- to connect directly to 'propertyChanged' signals. If there is a need -- to monitor a property for which there is no signal we could add -- a trigger for just that property. --@@ -195,29 +192,31 @@ -- 'Graphics.UI.Gtk.Abstract.Widget.widgetQueueDrawArea'. -- | Expose {- eventSent :: Bool,+ eventSent :: Bool, -- | A bounding box denoting what needs to be updated. For a more -- detailed information on the area that needs redrawing, use the -- next field.- eventArea :: Rectangle,+ eventArea :: Rectangle,+#if GTK_MAJOR_VERSION < 3 -- | A set of horizontal stripes that denote the invalid area. eventRegion :: Region,+#endif -- | The number of contiguous 'Expose' events following this- -- one. The only use for this is \"exposure compression\", i.e. + -- one. The only use for this is \"exposure compression\", i.e. -- handling all contiguous 'Expose' events in one go, though Gdk -- performs some exposure compression so this is not normally needed.- eventCount :: Int }+ eventCount :: Int } -- | Mouse motion. -- -- * Captures the movement of the mouse cursor while it is within the area -- of the widget. -- | Motion {- eventSent :: Bool,- eventTime :: TimeStamp,- eventX,eventY :: Double,- eventModifier :: [Modifier],+ eventSent :: Bool,+ eventTime :: TimeStamp,+ eventX,eventY :: Double,+ eventModifier :: [Modifier], -- | Indicate if this event is only a hint of the motion. -- -- * If the 'Graphics.UI.Gtk.Abstract.Widget.PointerMotionHintMask'@@ -226,32 +225,32 @@ -- 'Graphics.UI.Gtk.Gdk.DrawWindow.drawWindowGetPointer' -- is called. In this case 'eventIsHint' is set to @True@. --- eventIsHint :: Bool,+ eventIsHint :: Bool, eventXRoot,- eventYRoot :: Double } + eventYRoot :: Double } -- | A mouse button was pressed or released. -- -- * This event is triggered if the mouse button was pressed or released -- while the mouse cursor was within the region of the widget. -- | Button {- eventSent :: Bool,+ eventSent :: Bool, -- | The kind of button press, see 'Click'. Note that double clicks will -- trigger this event with 'eventClick' set to 'SingleClick', -- 'ReleaseClick', -- 'SingleClick', 'DoubleClick', 'ReleaseClick'. Triple clicks will -- produce this sequence followed by 'SingleClick', 'DoubleClick', -- 'TripleClick', 'ReleaseClick'.- eventClick :: Click,+ eventClick :: Click, -- | The time of the event in milliseconds.- eventTime :: TimeStamp,- eventX,eventY :: Double,- eventModifier :: [Modifier],+ eventTime :: TimeStamp,+ eventX,eventY :: Double,+ eventModifier :: [Modifier], -- | The button that was pressed.- eventButton :: MouseButton,+ eventButton :: MouseButton, -- | The coordinates of the click relative to the screen origin. eventXRoot,- eventYRoot :: Double }+ eventYRoot :: Double } -- | A key was pressed while the widget had the input focus. -- -- * If the widget has the current input focus (see@@ -268,10 +267,10 @@ -- to connect the same handler to -- 'Graphics.UI.Gtk.Abstract.Widget.onKeyPress' and -- 'Graphics.UI.Gtk.Abstract.Widget.onKeyRelease'.- eventRelease :: Bool,- eventSent :: Bool,- eventTime :: TimeStamp,- eventModifier :: [Modifier],+ eventRelease :: Bool,+ eventSent :: Bool,+ eventTime :: TimeStamp,+ eventModifier :: [Modifier], -- | This flag is @True@ if Caps Lock is on while this key was pressed. eventWithCapsLock :: Bool, -- | This flag is @True@ if Number Lock is on while this key was pressed.@@ -289,7 +288,7 @@ -- for a complete list refer to \"<gdk/gdkkeysyms.h>\" where all -- possible values are defined. The corresponding strings are the -- constants without the GDK_ prefix.- eventKeyName :: String,+ eventKeyName :: DefaultGlibString, -- | A character matching the key that was pressed. -- -- * This entry can be used to build up a whole input string.@@ -304,11 +303,11 @@ -- some GUI elements like buttons on a toolbar change their appearance. -- | Crossing {- eventSent :: Bool,- eventTime :: TimeStamp,- eventX,eventY :: Double,+ eventSent :: Bool,+ eventTime :: TimeStamp,+ eventX,eventY :: Double, eventXRoot,- eventYRoot :: Double,+ eventYRoot :: Double, -- | This flag is false if the widget was entered, it is true when the -- widget the mouse cursor left the widget. eventLeaves :: Bool,@@ -317,21 +316,21 @@ -- * The mouse cursor might enter this widget because it grabs the mouse -- cursor for e.g. a modal dialog box. --- eventCrossingMode :: CrossingMode,+ eventCrossingMode :: CrossingMode, -- | Information on from what level of the widget hierarchy the mouse -- cursor came. -- -- * See 'NotifyType'. --- eventNotifyType :: NotifyType,- eventModifier :: [Modifier]}- -- | Gaining or loosing input focus.+ eventNotifyType :: NotifyType,+ eventModifier :: [Modifier]}+ -- | Gaining or losing input focus. -- | Focus {- eventSent :: Bool,+ eventSent :: Bool, -- | This flag is @True@ if the widget receives the focus and @False@ if -- it just lost the input focus.- eventInFocus :: Bool}+ eventInFocus :: Bool} -- | The widget\'s size has changed. -- -- * In response to this event the application can allocate resources that@@ -339,23 +338,23 @@ -- is shown the first time and on every resize. -- | Configure {- eventSent :: Bool,+ eventSent :: Bool, -- | Position within the parent window.- eventXParent :: Int,+ eventXParent :: Int, -- | Position within the parent window.- eventYParent :: Int,- eventWidth :: Int,- eventHeight :: Int}+ eventYParent :: Int,+ eventWidth :: Int,+ eventHeight :: Int} -- | Change of visibility of a widget. | Visibility {- eventSent :: Bool,+ eventSent :: Bool, -- | Denote what portions of the widget is visible.- eventVisible :: VisibilityState }+ eventVisible :: VisibilityState } -- | Wheel movement of the mouse. -- -- * This action denotes that the content of the widget should be scrolled. -- The event is triggered by the movement of the mouse wheel. Surrounding- -- scroll bars are independant of this signal. Most mice do not have+ -- scroll bars are independent of this signal. Most mice do not have -- buttons for horizontal scrolling, hence 'eventDirection' will usually not -- contain 'ScrollLeft' and 'ScrollRight'. Mice with additional -- buttons may not work on X since only five buttons are supported@@ -365,23 +364,23 @@ -- surround this widget which in turn tell this widget to update. -- | Scroll {- eventSent :: Bool,- eventTime :: TimeStamp,- eventX,eventY :: Double,- eventDirection :: ScrollDirection,+ eventSent :: Bool,+ eventTime :: TimeStamp,+ eventX,eventY :: Double,+ eventDirection :: ScrollDirection, eventXRoot,- eventYRoot :: Double}+ eventYRoot :: Double} -- | Indicate how the appearance of this window has changed. | WindowState {- eventSent :: Bool,+ eventSent :: Bool, -- | The mask indicates which flags have changed.- eventWindowMask :: [WindowState],+ eventWindowMask :: [WindowState], -- | The state indicates the current state of the window.- eventWindowState :: [WindowState]} + eventWindowState :: [WindowState]} -- | The state of the pen of a graphics tablet pen or touchscreen device. | Proximity {- eventSent :: Bool,- eventTime :: TimeStamp,+ eventSent :: Bool,+ eventTime :: TimeStamp, -- | Whether the stylus has moved in or out of contact with the tablet. eventInContact :: Bool } deriving Show@@ -392,94 +391,100 @@ (case eType of #{const GDK_DELETE} -> marshAny #{const GDK_DESTROY} -> marshAny- #{const GDK_EXPOSE} -> marshExpose- #{const GDK_MOTION_NOTIFY} -> marshMotion- #{const GDK_BUTTON_PRESS} -> marshButton SingleClick+ #{const GDK_EXPOSE} -> marshExpose+ #{const GDK_MOTION_NOTIFY} -> marshMotion+ #{const GDK_BUTTON_PRESS} -> marshButton SingleClick #{const GDK_2BUTTON_PRESS} -> marshButton DoubleClick- #{const GDK_3BUTTON_PRESS} -> marshButton TripleClick- #{const GDK_BUTTON_RELEASE} -> marshButton ReleaseClick- #{const GDK_KEY_PRESS} -> marshKey False- #{const GDK_KEY_RELEASE} -> marshKey True- #{const GDK_ENTER_NOTIFY} -> marshCrossing False- #{const GDK_LEAVE_NOTIFY} -> marshCrossing True- #{const GDK_FOCUS_CHANGE} -> marshFocus- #{const GDK_CONFIGURE} -> marshConfigure+ #{const GDK_3BUTTON_PRESS} -> marshButton TripleClick+ #{const GDK_BUTTON_RELEASE} -> marshButton ReleaseClick+ #{const GDK_KEY_PRESS} -> marshKey False+ #{const GDK_KEY_RELEASE} -> marshKey True+ #{const GDK_ENTER_NOTIFY} -> marshCrossing False+ #{const GDK_LEAVE_NOTIFY} -> marshCrossing True+ #{const GDK_FOCUS_CHANGE} -> marshFocus+ #{const GDK_CONFIGURE} -> marshConfigure #{const GDK_MAP} -> marshAny- #{const GDK_UNMAP} -> marshAny + #{const GDK_UNMAP} -> marshAny -- #{const GDK_PROPERTY_NOTIFY}-> marshProperty #{const GDK_PROXIMITY_IN} -> marshProximity True- #{const GDK_PROXIMITY_OUT} -> marshProximity False+ #{const GDK_PROXIMITY_OUT} -> marshProximity False #{const GDK_VISIBILITY_NOTIFY}-> marshVisibility- #{const GDK_SCROLL} -> marshScroll- #{const GDK_WINDOW_STATE} -> marshWindowState- code -> \_ -> fail $+ #{const GDK_SCROLL} -> marshScroll+ #{const GDK_WINDOW_STATE} -> marshWindowState+ code -> \_ -> fail $ "marshalEvent: unhandled event type " ++ show code ++ "\nplease report this as a bug to gtk2hs-devel@lists.sourceforge.net" ) ptr marshAny ptr = do- (sent ::#gtk2hs_type gint8) <- #{peek GdkEventAny, send_event} ptr+ (sent ::#gtk2hs_type gint8) <- #{peek GdkEventAny, send_event} ptr return Event { eventSent = toBool sent } marshExpose ptr = do (#{const GDK_EXPOSE}::#gtk2hs_type GdkEventType) <- #{peek GdkEventAny,type} ptr- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventExpose, send_event} ptr- (area_ ::Rectangle) <- #{peek GdkEventExpose, area} ptr- (reg_ :: Ptr Region) <- #{peek GdkEventExpose, region} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventExpose, send_event} ptr+ (area_ ::Rectangle) <- #{peek GdkEventExpose, area} ptr+#if GTK_MAJOR_VERSION < 3+ (reg_ :: Ptr Region) <- #{peek GdkEventExpose, region} ptr reg_ <- gdk_region_copy reg_ region_ <- makeNewRegion reg_- (count_ ::#gtk2hs_type gint) <- #{peek GdkEventExpose, count} ptr+#endif+ (count_ ::#gtk2hs_type gint) <- #{peek GdkEventExpose, count} ptr return $ Expose { eventSent = toBool sent_, eventArea = area_,+#if GTK_MAJOR_VERSION < 3 eventRegion = region_,+#endif eventCount = fromIntegral count_} +#if GTK_MAJOR_VERSION < 3 foreign import ccall "gdk_region_copy" gdk_region_copy :: Ptr Region -> IO (Ptr Region)+#endif marshExposeRect :: Ptr Event -> IO Rectangle marshExposeRect ptr = do (#{const GDK_EXPOSE}::#gtk2hs_type GdkEventType) <- #{peek GdkEventAny,type} ptr- (area_ ::Rectangle) <- #{peek GdkEventExpose, area} ptr+ (area_ ::Rectangle) <- #{peek GdkEventExpose, area} ptr return area_ marshMotion ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventMotion, send_event} ptr- (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventMotion, time} ptr- (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, x} ptr- (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, y} ptr- (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventMotion, state} ptr- (isHint_ ::#gtk2hs_type gint16) <- #{peek GdkEventMotion, is_hint} ptr- (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, x_root} ptr- (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, y_root} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventMotion, send_event} ptr+ (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventMotion, time} ptr+ (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, x} ptr+ (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, y} ptr+ (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventMotion, state} ptr+ (isHint_ ::#gtk2hs_type gint16) <- #{peek GdkEventMotion, is_hint} ptr+ (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, x_root} ptr+ (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventMotion, y_root} ptr return $ Motion { eventSent = toBool sent_, eventTime = fromIntegral time_,- eventX = realToFrac x_,- eventY = realToFrac y_,+ eventX = realToFrac x_,+ eventY = realToFrac y_, eventModifier = (toFlags . fromIntegral) modif_, eventIsHint = toBool isHint_, eventXRoot = realToFrac xRoot_, eventYRoot = realToFrac yRoot_} marshButton but ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventButton, send_event} ptr- (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventButton, time} ptr- (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, x} ptr- (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, y} ptr- (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventButton, state} ptr- (button_ ::#gtk2hs_type guint) <- #{peek GdkEventButton, button} ptr- (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, x_root} ptr- (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, y_root} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventButton, send_event} ptr+ (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventButton, time} ptr+ (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, x} ptr+ (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, y} ptr+ (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventButton, state} ptr+ (button_ ::#gtk2hs_type guint) <- #{peek GdkEventButton, button} ptr+ (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, x_root} ptr+ (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventButton, y_root} ptr return $ Button { eventClick = but, eventSent = toBool sent_, eventTime = fromIntegral time_,- eventX = realToFrac x_,- eventY = realToFrac y_,+ eventX = realToFrac x_,+ eventY = realToFrac y_, eventModifier = (toFlags . fromIntegral) modif_, eventButton = (toEnum.fromIntegral) button_, eventXRoot = realToFrac xRoot_,@@ -487,12 +492,12 @@ marshKey up ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventKey, send_event} ptr- (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventKey, time} ptr- (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventKey, state} ptr- (keyval_ ::#gtk2hs_type guint) <- #{peek GdkEventKey, keyval} ptr- - (length_ ::#gtk2hs_type gint) <- #{peek GdkEventKey, length} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventKey, send_event} ptr+ (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventKey, time} ptr+ (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventKey, state} ptr+ (keyval_ ::#gtk2hs_type guint) <- #{peek GdkEventKey, keyval} ptr++ (length_ ::#gtk2hs_type gint) <- #{peek GdkEventKey, length} ptr keyChar <- keyvalToChar keyval_ keyName <- unsafeInterleaveIO $ keyvalName keyval_ return $ Key {@@ -508,23 +513,23 @@ eventKeyChar = keyChar } marshCrossing leave ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventCrossing, send_event} ptr- (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventCrossing, time} ptr- (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, x} ptr- (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, y} ptr- (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventCrossing, state} ptr- (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, x_root} ptr- (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, y_root} ptr- (cMode_ ::#gtk2hs_type GdkCrossingMode) - <- #{peek GdkEventCrossing, mode} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventCrossing, send_event} ptr+ (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventCrossing, time} ptr+ (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, x} ptr+ (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, y} ptr+ (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventCrossing, state} ptr+ (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, x_root} ptr+ (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventCrossing, y_root} ptr+ (cMode_ ::#gtk2hs_type GdkCrossingMode)+ <- #{peek GdkEventCrossing, mode} ptr (nType_ ::#gtk2hs_type GdkNotifyType)- <- #{peek GdkEventCrossing, detail} ptr - (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventCrossing, state} ptr+ <- #{peek GdkEventCrossing, detail} ptr+ (modif_ ::#gtk2hs_type guint) <- #{peek GdkEventCrossing, state} ptr return $ Crossing { eventSent = toBool sent_, eventTime = fromIntegral time_,- eventX = realToFrac x_,- eventY = realToFrac y_,+ eventX = realToFrac x_,+ eventY = realToFrac y_, eventXRoot = realToFrac xRoot_, eventYRoot = realToFrac yRoot_, eventLeaves = leave,@@ -534,18 +539,18 @@ marshFocus ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventFocus, send_event} ptr- (inFocus_::#gtk2hs_type gint16) <- #{peek GdkEventFocus, in} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventFocus, send_event} ptr+ (inFocus_::#gtk2hs_type gint16) <- #{peek GdkEventFocus, in} ptr return $ Focus { eventSent = toBool sent_, eventInFocus= toBool inFocus_} marshConfigure ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventConfigure, send_event} ptr- (xPar_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, x} ptr- (yPar_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, y} ptr- (width_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, width} ptr- (height_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, height} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventConfigure, send_event} ptr+ (xPar_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, x} ptr+ (yPar_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, y} ptr+ (width_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, width} ptr+ (height_ ::#gtk2hs_type gint) <- #{peek GdkEventConfigure, height} ptr return $ Configure { eventSent = toBool sent_, eventXParent = fromIntegral xPar_,@@ -555,54 +560,54 @@ {- marshProperty ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventProperty, send_event} ptr- (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventProperty, time} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventProperty, send_event} ptr+ (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventProperty, time} ptr return $ Property { eventSent = toBool sent_, eventTime = fromIntegral time_} -} marshProximity contact ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventProximity, send_event} ptr- (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventProximity, time} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventProximity, send_event} ptr+ (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventProximity, time} ptr return $ Proximity { eventSent = toBool sent_, eventTime = fromIntegral time_, eventInContact = contact} marshVisibility ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventVisibility, send_event} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventVisibility, send_event} ptr (state_ ::#gtk2hs_type GdkVisibilityState)- <- #{peek GdkEventVisibility, state} ptr+ <- #{peek GdkEventVisibility, state} ptr return $ Visibility { eventSent = toBool sent_, eventVisible= (toEnum.fromIntegral) state_} marshScroll ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventScroll, send_event} ptr- (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventScroll, time} ptr- (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, x} ptr- (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, y} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventScroll, send_event} ptr+ (time_ ::#gtk2hs_type guint32) <- #{peek GdkEventScroll, time} ptr+ (x_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, x} ptr+ (y_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, y} ptr (direc_ ::#gtk2hs_type GdkScrollDirection)- <- #{peek GdkEventScroll, direction} ptr- (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, x_root} ptr- (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, y_root} ptr+ <- #{peek GdkEventScroll, direction} ptr+ (xRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, x_root} ptr+ (yRoot_ ::#gtk2hs_type gdouble) <- #{peek GdkEventScroll, y_root} ptr return $ Scroll { eventSent = toBool sent_, eventTime = fromIntegral time_,- eventX = realToFrac x_,- eventY = realToFrac y_,+ eventX = realToFrac x_,+ eventY = realToFrac y_, eventDirection = (toEnum.fromIntegral) direc_, eventXRoot = realToFrac xRoot_, eventYRoot = realToFrac yRoot_} marshWindowState ptr = do- (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventWindowState, send_event} ptr+ (sent_ ::#gtk2hs_type gint8) <- #{peek GdkEventWindowState, send_event} ptr (wMask_ ::#gtk2hs_type GdkWindowState)- <- #{peek GdkEventWindowState, changed_mask} ptr+ <- #{peek GdkEventWindowState, changed_mask} ptr (wState_ ::#gtk2hs_type GdkWindowState)- <- #{peek GdkEventWindowState, new_window_state} ptr+ <- #{peek GdkEventWindowState, new_window_state} ptr return $ WindowState { eventSent = toBool sent_, eventWindowMask = (toFlags.fromIntegral) wMask_,
Graphics/UI/Gtk/Gdk/GC.chs view
@@ -38,7 +38,10 @@ -- Most values of a graphics context can be set at creation time by using -- 'gcNewWithValues'. A few of the values in the GC, such as the dash -- pattern, can only be set by the latter method.+--+-- Graphics Contexts are removed in Gtk3, so this module is empty. +#if GTK_MAJOR_VERSION < 3 GC, GCClass, castToGC, gTypeGC,@@ -74,23 +77,23 @@ gcGetValues, gcSetClipRectangle, gcSetClipRegion,- gcSetDashes) where--import Control.Monad (when)-import Data.Maybe (fromJust, isJust)-#ifdef HAVE_NEW_CONTROL_EXCEPTION-import Control.OldException (handle)-#else-import Control.Exception (handle)+ gcSetDashes #endif+ ) where +#if GTK_MAJOR_VERSION < 3+import Control.Monad (when)+import Data.Maybe (fromJust, isJust)+import Control.Exception (handle, ErrorCall(..))+ import System.Glib.FFI-import System.Glib.GObject (constructNewGObject) {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.General.Structs-import Graphics.UI.Gtk.General.Enums (Function(..), Fill(..), SubwindowMode(..), LineStyle(..), - CapStyle(..), JoinStyle(..))-{#import Graphics.UI.Gtk.Gdk.Region#} (Region(Region))+import Graphics.UI.Gtk.General.Enums (Function(..), Fill(..), SubwindowMode(..), LineStyle(..),+ CapStyle(..), JoinStyle(..))+#if GTK_MAJOR_VERSION < 3+{#import Graphics.UI.Gtk.Gdk.Region#} (Region(Region))+#endif {# context lib="gtk" prefix="gdk" #} @@ -100,7 +103,7 @@ gcNew d = do gcPtr <- {#call unsafe gc_new#} (toDrawable d) if (gcPtr==nullPtr) then return (error "gcNew: null graphics context.")- else constructNewGObject mkGC (return gcPtr)+ else wrapNewGObject mkGC (return gcPtr) -- | Creates a graphics context with specific values.@@ -108,13 +111,13 @@ gcNewWithValues :: DrawableClass d => d -> GCValues -> IO GC gcNewWithValues d gcv = allocaBytes (sizeOf gcv) $ \vPtr -> do mask <- pokeGCValues vPtr gcv- gc <- constructNewGObject mkGC $ {#call unsafe gc_new_with_values#} + gc <- wrapNewGObject mkGC $ {#call unsafe gc_new_with_values#} (toDrawable d) (castPtr vPtr) mask- handle (const $ return ()) $ when (isJust (tile gcv)) $ + handle (\(ErrorCall _) -> return ()) $ when (isJust (tile gcv)) $ touchForeignPtr ((unPixmap.fromJust.tile) gcv)- handle (const $ return ()) $ when (isJust (stipple gcv)) $ + handle (\(ErrorCall _) -> return ()) $ when (isJust (stipple gcv)) $ touchForeignPtr ((unPixmap.fromJust.stipple) gcv)- handle (const $ return ()) $ when (isJust (clipMask gcv)) $ + handle (\(ErrorCall _) -> return ()) $ when (isJust (clipMask gcv)) $ touchForeignPtr ((unPixmap.fromJust.clipMask) gcv) return gc @@ -124,11 +127,11 @@ gcSetValues gc gcv = allocaBytes (sizeOf gcv) $ \vPtr -> do mask <- pokeGCValues vPtr gcv gc <- {#call unsafe gc_set_values#} gc (castPtr vPtr) mask- handle (const $ return ()) $ when (isJust (tile gcv)) $ + handle (\(ErrorCall _) -> return ()) $ when (isJust (tile gcv)) $ touchForeignPtr ((unPixmap.fromJust.tile) gcv)- handle (const $ return ()) $ when (isJust (stipple gcv)) $ + handle (\(ErrorCall _) -> return ()) $ when (isJust (stipple gcv)) $ touchForeignPtr ((unPixmap.fromJust.stipple) gcv)- handle (const $ return ()) $ when (isJust (clipMask gcv)) $ + handle (\(ErrorCall _) -> return ()) $ when (isJust (clipMask gcv)) $ touchForeignPtr ((unPixmap.fromJust.clipMask) gcv) return gc @@ -160,15 +163,16 @@ -- -- * Every tuple in the list contains an even and an odd segment. Even -- segments are drawn normally, whereby the 'lineStyle'--- member of the graphics context defines if odd segements are drawn+-- member of the graphics context defines if odd segments are drawn -- or not. A @phase@ argument greater than 0 will drop -- @phase@ pixels before starting to draw. -- gcSetDashes :: GC -> Int -> [(Int,Int)] -> IO () gcSetDashes gc phase onOffList = do let onOff :: [{#type gint8#}]- onOff = concatMap (\(on,off) -> [fromIntegral on, fromIntegral off]) - onOffList+ onOff = concatMap (\(on,off) -> [fromIntegral on, fromIntegral off])+ onOffList withArray onOff $ \aPtr -> {#call unsafe gc_set_dashes#} gc (fromIntegral phase) aPtr (fromIntegral (length onOff))+#endif
Graphics/UI/Gtk/Gdk/Gdk.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Gdk --@@ -37,16 +38,22 @@ keyboardGrab, keyboardUngrab, beep+#if GTK_MAJOR_VERSION >= 3+ ,RGBA(..)+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) -import System.Glib.Flags (fromFlags)+import System.Glib.Flags (fromFlags) import System.Glib.FFI {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Gdk.Cursor#} (Cursor(..)) import Graphics.UI.Gtk.Gdk.Events-import Graphics.UI.Gtk.Gdk.Enums (EventMask, GrabStatus(..))+import Graphics.UI.Gtk.Gdk.Enums (EventMask, GrabStatus(..))+#if GTK_MAJOR_VERSION >= 3+import Graphics.UI.Gtk.General.Structs (RGBA(..))+#endif {#context lib="gdk" prefix ="gdk"#} @@ -173,7 +180,7 @@ -- for this application are reported as normal, but keyboard events -- outside this application are reported with respect to @window@. -- Both key press and key release events are always reported,- -- independant of the event mask set by the application.+ -- independent of the event mask set by the application. -> TimeStamp -- ^ @time@ - a timestamp from an 'Event', or 'currentTime' if -- no timestamp is available. -> IO GrabStatus -- ^ @Returns@ - 'GrabSuccess' if the grab was successful.
+ Graphics/UI/Gtk/Gdk/Keymap.chs view
@@ -0,0 +1,365 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget Keymap+--+-- Author : Andy Stewart+--+-- Created: 30 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Functions for manipulating keyboard codes+--+module Graphics.UI.Gtk.Gdk.Keymap (++-- * Details+--+-- | Key values are the codes which are sent whenever a key is pressed or released. They appear in the+-- keyval field of the 'EventKey' structure, which is passed to signal handlers for the+-- 'keyPressEvent' and 'keyReleaseEvent' signals.+--+-- Key values are regularly updated from the upstream X.org X11 implementation, so new values are added+-- regularly. They will be prefixed with GDK_ rather than XF86XK_ or ' (for older symbols)'.+--+-- Key values can be converted into a string representation using 'keyvalName'. The reverse+-- function, converting a string to a key value, is provided by 'keyvalFromName'.+--+-- The case of key values can be determined using 'keyvalIsUpper'. Key+-- values can be converted to upper or lower case using 'keyvalToUpper' and+-- 'keyvalToLower'.+--+-- When it makes sense, key values can be converted to and from Unicode characters with+-- 'keyvalToUnicode'.+--+-- One 'Keymap' object exists for each user display. 'keymapGetDefault' returns the 'Keymap'+-- for the default display; to obtain keymaps for other displays, use 'keymapGetForDisplay'. A+-- keymap is a mapping from 'KeymapKey' to key values. You can think of a 'KeymapKey' as a+-- representation of a symbol printed on a physical keyboard key. That is, it contains three pieces of+-- information. First, it contains the hardware keycode; this is an identifying number for a physical+-- key. Second, it contains the level of the key. The level indicates which symbol on the key will be+-- used, in a vertical direction. So on a standard US keyboard, the key with the number \"1\" on it also+-- has the exclamation point \"!\" character on it. The level indicates whether to use the \"1\" or the+-- \"!\" symbol. The letter keys are considered to have a lowercase letter at level 0, and an uppercase+-- letter at level 1, though only the uppercase letter is printed. Third, the 'KeymapKey' contains a+-- group; groups are not used on standard US keyboards, but are used in many other countries. On a+-- keyboard with groups, there can be 3 or 4 symbols printed on a single key. The group indicates+-- movement in a horizontal direction. Usually groups are used for two different languages. In group 0,+-- a key might have two English characters, and in group 1 it might have two Hebrew characters. The+-- Hebrew characters will be printed on the key next to the English characters.+--+-- In order to use a keymap to interpret a key event, it's necessary to first convert the keyboard+-- state into an effective group and level. This is done via a set of rules that varies widely+-- according to type of keyboard and user configuration. The function+-- 'keymapTranslateKeyboardState' accepts a keyboard state -- consisting of hardware keycode+-- pressed, active modifiers, and active group -- applies the appropriate rules, and returns the+-- group/level to be used to index the keymap, along with the modifiers which did not affect the group+-- and level. i.e. it returns "unconsumed modifiers." The keyboard group may differ from the effective+-- group used for keymap lookups because some keys don't have multiple groups - e.g. the Enter key is+-- always in group 0 regardless of keyboard state.+--+-- Note that 'keymapTranslateKeyboardState' also returns the keyval, i.e. it goes ahead and+-- performs the keymap lookup in addition to telling you which effective group/level values were used+-- for the lookup. 'EventKey' already contains this keyval, however, so you don't normally need to+-- call 'keymapTranslateKeyboardState' just to get the keyval.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----Keymap+-- @++-- * Types+ Keymap,+ KeymapClass,+ castToKeymap,+ toKeymap,+ KeymapKey,++-- * Methods+ keymapGetDefault,+#if GTK_CHECK_VERSION(2,2,0)+ keymapGetForDisplay,+#endif+ keymapLookupKey,+ keymapTranslateKeyboardState,+ keymapGetEntriesForKeyval,+ keymapGetEntriesForKeycode,+ keymapGetDirection,+#if GTK_CHECK_VERSION(2,12,0)+ keymapHaveBidiLayouts,+#endif+#if GTK_CHECK_VERSION(2,16,0)+ keymapGetCapsLockState,+#endif++-- * Signals+#if GTK_CHECK_VERSION(2,0,0)+ keymapDirectionChanged,+#if GTK_CHECK_VERSION(2,2,0)+ keymapKeysChanged,+#if GTK_CHECK_VERSION(2,16,0)+ keymapStateChanged,+#endif+#endif+#endif+ ) where++import Control.Monad (liftM)+import System.Glib.FFI+import Graphics.UI.Gtk.Gdk.Enums (Modifier(..))+import Graphics.UI.Gtk.Gdk.Keys (KeyVal (..))+{#import Graphics.Rendering.Pango.Enums#}+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}+import Graphics.UI.Gtk.General.Structs (KeymapKey (..))++{# context lib="gdk" prefix="gdk" #}++--------------------+-- Methods++-- | Returns the 'Keymap' attached to the default display.+--+keymapGetDefault ::+ IO Keymap -- ^ returns the 'Keymap' attached to the default display.+keymapGetDefault =+ makeNewGObject mkKeymap $+ {# call gdk_keymap_get_default #}++#if GTK_CHECK_VERSION(2,2,0)+-- | Returns the 'Keymap' attached to @display@.+--+-- * Available since Gdk version 2.2+--+keymapGetForDisplay ::+ Display -- ^ @display@ - the 'Display'.+ -> IO Keymap -- ^ returns the 'Keymap' attached to @display@.+keymapGetForDisplay display =+ makeNewGObject mkKeymap $+ {# call gdk_keymap_get_for_display #}+ display+#endif++-- | Looks up the keyval mapped to a keycode\/group\/level triplet. If no+-- keyval is bound to @key@, returns 0. For normal user input, you want to use+-- 'keymapTranslateKeyboardState' instead of this function, since the effective+-- group\/level may not be the same as the current keyboard state.+--+keymapLookupKey :: KeymapClass self+ => (Maybe self) -- ^ @keymap@ a 'Keymap' or 'Nothing' to use the default keymap+ -> KeymapKey -- ^ @key@ - a 'KeymapKey'+ -- with keycode, group, and level initialized+ -> IO Int -- ^ returns a keyval, or 0 if none was mapped to+ -- the given @key@+keymapLookupKey Nothing key =+ liftM fromIntegral $+ allocaBytes {# sizeof GdkKeymapKey #} $ \ keyPtr -> do+ poke keyPtr key+ {# call gdk_keymap_lookup_key #}+ (Keymap nullForeignPtr)+ (castPtr keyPtr)+keymapLookupKey (Just self) key =+ liftM fromIntegral $+ allocaBytes {# sizeof GdkKeymapKey #} $ \ keyPtr -> do+ poke keyPtr key+ {# call gdk_keymap_lookup_key #}+ (toKeymap self)+ (castPtr keyPtr)++-- | Translates the contents of a 'EventKey' into a+-- keyval, effective group, and level. Modifiers that affected the translation+-- and are thus unavailable for application use are returned in+-- @consumedModifiers@. See 'keyvalGetKeys' for an explanation of groups and+-- levels. The @effectiveGroup@ is the group that was actually used for the+-- translation; some keys such as Enter are not affected by the active keyboard+-- group. The @level@ is derived from @state@. For convenience, 'EventKey'+-- already contains the translated keyval, so this function+-- isn't as useful as you might think.+--+keymapTranslateKeyboardState :: KeymapClass self => self+ -> Int -- ^ @hardwareKeycode@ - a keycode+ -> Modifier -- ^ @state@ - a modifier state+ -> Int -- ^ @group@ - active keyboard group+ -> IO (Maybe (Int, Int, Int, Modifier))+keymapTranslateKeyboardState self hardwareKeycode state group =+ alloca $ \keyvalPtr ->+ alloca $ \effectiveGroupPtr ->+ alloca $ \levelPtr ->+ alloca $ \modifierPtr -> do+ success <- liftM toBool $+ {# call gdk_keymap_translate_keyboard_state #}+ (toKeymap self)+ (fromIntegral hardwareKeycode)+ ((fromIntegral . fromEnum) state)+ (fromIntegral group)+ keyvalPtr+ effectiveGroupPtr+ levelPtr+ modifierPtr+ if success+ then do+ keyval <- peek keyvalPtr+ effectiveGroup <- peek effectiveGroupPtr+ level <- peek levelPtr+ modifier <- peek modifierPtr+ return (Just (fromIntegral keyval+ ,fromIntegral effectiveGroup+ ,fromIntegral level+ ,toEnum $ fromIntegral modifier))+ else return Nothing++-- | Obtains a list of keycode\/group\/level combinations that will generate+-- @keyval@. Groups and levels are two kinds of keyboard mode; in general, the+-- level determines whether the top or bottom symbol on a key is used, and the+-- group determines whether the left or right symbol is used. On US keyboards,+-- the shift key changes the keyboard level, and there are no groups. A group+-- switch key might convert a keyboard between Hebrew to English modes, for+-- example. 'EventKey' contains a @group@ field that+-- indicates the active keyboard group. The level is computed from the modifier+-- mask.+--+keymapGetEntriesForKeyval :: KeymapClass self => self+ -> KeyVal -- ^ @keyval@ - a keyval, such as @GDK_a@, @GDK_Up@,+ -- @GDK_Return@, etc.+ -> IO (Maybe [KeymapKey])+keymapGetEntriesForKeyval self keyval =+ alloca $ \nKeysPtr ->+ allocaArray 0 $ \ keysPtr -> do+ success <- liftM toBool $+ {# call gdk_keymap_get_entries_for_keyval #}+ (toKeymap self)+ (fromIntegral keyval)+ (castPtr keysPtr)+ nKeysPtr+ if success+ then do+ nKeys <- liftM fromIntegral $ peek nKeysPtr+ keys <- peekArray nKeys keysPtr+ keyList <- mapM peek keys+ {#call unsafe g_free#} (castPtr keysPtr)+ return (Just keyList)+ else return Nothing++-- | Returns the keyvals bound to @hardwareKeycode@. The Nth 'KeymapKey'+-- in @keys@ is bound to the Nth keyval in @keyvals@.+-- When a keycode is pressed by the user, the+-- keyval from this list of entries is selected by considering the effective+-- keyboard group and level. See 'keymapTranslateKeyboardState'.+--+keymapGetEntriesForKeycode :: KeymapClass self => self+ -> Int -- ^ @hardwareKeycode@ - a keycode+ -> IO (Maybe ([KeymapKey], [KeyVal]))+keymapGetEntriesForKeycode self hardwareKeycode =+ alloca $ \nEntriesPtr ->+ allocaArray 0 $ \ keysPtr ->+ allocaArray 0 $ \ keyvalsPtr -> do+ success <- liftM toBool $+ {# call gdk_keymap_get_entries_for_keycode #}+ (toKeymap self)+ (fromIntegral hardwareKeycode)+ (castPtr keysPtr)+ keyvalsPtr+ nEntriesPtr+ if success+ then do+ nEntries <- liftM fromIntegral $ peek nEntriesPtr+ keys <- peekArray nEntries keysPtr+ keyvals <- peekArray nEntries keyvalsPtr+ keyvalsList <- mapM (\x -> liftM fromIntegral $ peek x) keyvals+ keysList <- mapM peek keys+ {#call unsafe g_free#} (castPtr keysPtr)+ {#call unsafe g_free#} (castPtr keyvalsPtr)+ return (Just (keysList, keyvalsList))+ else return Nothing++-- | Returns the direction of effective layout of the keymap.+--+-- Returns the direction of the keymap.+--+keymapGetDirection :: KeymapClass self => self+ -> IO PangoDirection -- ^ returns 'DirectionLtr' or 'DirectionRtl' if it can+ -- determine the direction. 'DirectionNeutral' otherwise.+keymapGetDirection self =+ liftM (toEnum . fromIntegral) $+ {# call gdk_keymap_get_direction #}+ (toKeymap self)++#if GTK_CHECK_VERSION(2,12,0)+-- | Determines if keyboard layouts for both right-to-left and left-to-right+-- languages are in use.+--+-- * Available since Gdk version 2.12+--+keymapHaveBidiLayouts :: KeymapClass self => self+ -> IO Bool -- ^ returns @True@ if there are layouts in both directions,+ -- @False@ otherwise+keymapHaveBidiLayouts self =+ liftM toBool $+ {# call gdk_keymap_have_bidi_layouts #}+ (toKeymap self)+#endif++#if GTK_CHECK_VERSION(2,16,0)+-- | Returns whether the Caps Lock modifier is locked.+--+-- * Available since Gdk version 2.16+--+keymapGetCapsLockState :: KeymapClass self => self+ -> IO Bool -- ^ returns @True@ if Caps Lock is on+keymapGetCapsLockState self =+ liftM toBool $+ {# call gdk_keymap_get_caps_lock_state #}+ (toKeymap self)+#endif++--------------------+-- Signals++#if GTK_CHECK_VERSION(2,0,0)+-- | The 'keymapDirectionChanged' signal gets emitted when the direction of the+-- keymap changes.+--+-- * Available since Gdk version 2.0+--+keymapDirectionChanged :: KeymapClass self => Signal self (IO ())+keymapDirectionChanged = Signal (connect_NONE__NONE "direction_changed")++#if GTK_CHECK_VERSION(2,2,0)+-- | The 'keymapKeysChanged' signal is emitted when the mapping represented by+-- @keymap@ changes.+--+-- * Available since Gdk version 2.2+--+keymapKeysChanged :: KeymapClass self => Signal self (IO ())+keymapKeysChanged = Signal (connect_NONE__NONE "keys_changed")++#if GTK_CHECK_VERSION(2,16,0)+-- | The 'keymapStateChanged' signal is emitted when the state of the keyboard+-- changes, e.g when Caps Lock is turned on or off. See+-- 'keymapGetCapsLockState'.+--+-- * Available since Gdk version 2.16+--+keymapStateChanged :: KeymapClass self => Signal self (IO ())+keymapStateChanged = Signal (connect_NONE__NONE "state_changed")+#endif+#endif+#endif+
Graphics/UI/Gtk/Gdk/Keys.chs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Keys --@@ -29,6 +31,7 @@ -- module Graphics.UI.Gtk.Gdk.Keys ( KeyVal,+ KeyCode, keyName, keyFromName, keyToChar,@@ -36,6 +39,11 @@ keyvalName, keyvalFromName, keyvalToChar,+ keyvalConvertCase,+ keyvalToUpper,+ keyvalToLower,+ keyvalIsUpper,+ keyvalIsLower, ) where import Control.Monad (liftM)@@ -49,34 +57,35 @@ -- released. -- type KeyVal = Word32+type KeyCode = Word16 -- | Converts a key value into a symbolic name. ---keyName :: KeyVal -> String+keyName :: KeyVal -> DefaultGlibString keyName k = unsafePerformIO $ keyvalName k -- | Converts a key name to a key value. ---keyFromName :: String -> KeyVal+keyFromName :: DefaultGlibString -> KeyVal keyFromName k = unsafePerformIO $ keyvalFromName k -- | Convert from a Gdk key symbol to the corresponding Unicode character. ---keyToChar :: +keyToChar :: KeyVal -- ^ @keyval@ - a Gdk key symbol -> Maybe Char -- ^ returns the corresponding unicode character, or -- Nothing if there is no corresponding character. keyToChar k = unsafePerformIO $ keyvalToChar k -keyvalName :: KeyVal -> IO String+keyvalName :: KeyVal -> IO DefaultGlibString keyvalName keyval = do strPtr <- {# call gdk_keyval_name #} (fromIntegral keyval) if strPtr==nullPtr then return "" else peekUTFString strPtr -keyvalFromName :: String -> IO KeyVal+keyvalFromName :: DefaultGlibString -> IO KeyVal keyvalFromName keyvalName = liftM fromIntegral $- withCString keyvalName $ \keyvalNamePtr ->+ withUTFString keyvalName $ \keyvalNamePtr -> {# call gdk_keyval_from_name #} keyvalNamePtr @@ -85,3 +94,60 @@ {# call gdk_keyval_to_unicode #} (fromIntegral keyval) >>= \code -> if code == 0 then return Nothing else return $ Just $ toEnum $ fromIntegral code++-- | Obtains the upper- and lower-case versions of the keyval symbol. Examples of keyvals are GDK_a,+-- 'Enter', 'F1', etc.+keyvalConvertCase :: KeyVal -- ^ @symbol@ a keyval+ -> (KeyVal, KeyVal) -- ^ @(lower, upper)@+ -- ^ lower is the lowercase version of symbol.+ -- ^ upper is uppercase version of symbol.+keyvalConvertCase keyval =+ unsafePerformIO $+ alloca $ \ lowerPtr ->+ alloca $ \ upperPtr -> do+ {#call gdk_keyval_convert_case #}+ (fromIntegral keyval)+ lowerPtr+ upperPtr+ lower <- peek lowerPtr+ upper <- peek upperPtr+ return (fromIntegral lower, fromIntegral upper)++-- | Converts a key value to upper case, if applicable.+keyvalToUpper :: KeyVal -- ^ @keyval@ a key value.+ -> KeyVal -- ^ returns the upper case form of keyval,+ -- or keyval itself if it is already in upper case or it is not subject to case+keyvalToUpper keyval =+ unsafePerformIO $+ liftM fromIntegral $+ {#call gdk_keyval_to_upper #}+ (fromIntegral keyval)++-- | Converts a key value to lower case, if applicable.+keyvalToLower :: KeyVal -- ^ @keyval@ a key value.+ -> KeyVal -- ^ returns the lower case form of keyval,+ -- or keyval itself if it is already in lower case or it is not subject to case+keyvalToLower keyval =+ unsafePerformIO $+ liftM fromIntegral $+ {#call gdk_keyval_to_lower #}+ (fromIntegral keyval)++-- | Returns 'True' if the given key value is in upper case.+keyvalIsLower :: KeyVal+ -> Bool -- ^ returns 'True' if keyval is in upper case, or if keyval is not subject to case conversion.+keyvalIsLower keyval =+ unsafePerformIO $+ liftM toBool $+ {#call gdk_keyval_is_lower #}+ (fromIntegral keyval)++-- | Returns 'True' if the given key value is in upper case.+keyvalIsUpper :: KeyVal+ -> Bool -- ^ returns 'True' if keyval is in upper case, or if keyval is not subject to case conversion.+keyvalIsUpper keyval =+ unsafePerformIO $+ liftM toBool $+ {#call gdk_keyval_is_upper #}+ (fromIntegral keyval)+
Graphics/UI/Gtk/Gdk/Pixbuf.chs view
@@ -1,4 +1,6 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE EmptyDataDecls #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Pixbuf --@@ -69,6 +71,7 @@ -- * Constructors pixbufNew,+ pixbufNewFromData, pixbufNewFromFile, #if GTK_CHECK_VERSION(2,4,0) pixbufNewFromFileAtSize,@@ -76,6 +79,10 @@ #if GTK_CHECK_VERSION(2,6,0) pixbufNewFromFileAtScale, #endif+#if GTK_CHECK_VERSION(3,0,0)+ pixbufNewFromSurface,+ pixbufNewFromWindow,+#endif pixbufNewFromInline, InlineImage, pixbufNewSubpixbuf,@@ -110,24 +117,31 @@ pixbufAddAlpha, pixbufCopyArea, pixbufFill,+#if GTK_MAJOR_VERSION < 3 pixbufGetFromDrawable, pixbufRenderThresholdAlpha, pixbufRenderPixmapAndMaskForColormap+#endif ) where import Control.Monad (liftM)-import Data.Ix import System.Glib.FFI import System.Glib.UTFString-import System.Glib.GDateTime import System.Glib.GObject {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Structs (Rectangle(..))-import System.Glib.GError (GError(..), GErrorClass(..), GErrorDomain,- propagateGError)+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.General.Structs (Rectangle(..))+#endif+import System.Glib.GError (GError(..), GErrorClass(..), GErrorDomain,+ propagateGError) import Graphics.UI.Gtk.Gdk.PixbufData ( PixbufData, mkPixbufData )-import Graphics.UI.Gtk.Gdk.Pixmap (Bitmap, Pixmap)+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.Gdk.Pixmap (Bitmap)+#else+import Graphics.Rendering.Cairo+import Graphics.Rendering.Cairo.Types+#endif {# context prefix="gdk" #} @@ -182,7 +196,7 @@ -- 'pixbufGetRowstride', indicates the number of bytes between rows. -- -- * The returned array is a flat representation of a three dimensional--- array: x-coordiante, y-coordinate and several channels for each color.+-- array: x-coordinate, y-coordinate and several channels for each color. -- The number of channels is usually 3 for plain RGB data or 4 for -- RGB data with an alpha channel. To read or write a specific pixel -- use the formula: @p = y * rowstride + x * nChannels@ for the pixel.@@ -231,18 +245,18 @@ -- | Queries the rowstride of this image. -- -- * Queries the rowstride of a pixbuf, which is the number of bytes between--- rows. Use this value to caculate the offset to a certain row.+-- rows. Use this value to calculate the offset to a certain row. -- pixbufGetRowstride :: Pixbuf -> IO Int pixbufGetRowstride pb = liftM fromIntegral $ {#call unsafe pixbuf_get_rowstride#} pb --- | Returns an attribut of an image.+-- | Returns an attribute of an image. -- -- * Looks up if some information was stored under the @key@ when -- this image was saved. ---pixbufGetOption :: Pixbuf -> String -> IO (Maybe String)+pixbufGetOption :: (GlibString string) => Pixbuf -> string -> IO (Maybe string) pixbufGetOption pb key = withUTFString key $ \strPtr -> do resPtr <- {#call unsafe pixbuf_get_option#} pb strPtr if (resPtr==nullPtr) then return Nothing else@@ -264,11 +278,11 @@ -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the -- error codes in 'PixbufError'. ---pixbufNewFromFile :: FilePath -> IO Pixbuf+pixbufNewFromFile :: GlibFilePath fp => fp -> IO Pixbuf pixbufNewFromFile fname =- constructNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ propagateGError $ \errPtrPtr ->- withUTFString fname $ \strPtr ->+ withUTFFilePath fname $ \strPtr -> #if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) {#call unsafe pixbuf_new_from_file_utf8#} #else@@ -287,9 +301,9 @@ -- -- * Available since Gtk+ version 2.4 ---pixbufNewFromFileAtSize :: String -> Int -> Int -> IO Pixbuf+pixbufNewFromFileAtSize :: GlibString string => string -> Int -> Int -> IO Pixbuf pixbufNewFromFileAtSize filename width height =- constructNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ propagateGError $ \errPtrPtr -> withUTFString filename $ \filenamePtr -> #if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)@@ -320,14 +334,14 @@ -- -- * Available since Gtk+ version 2.6 ---pixbufNewFromFileAtScale ::- String -- ^ the name of the file+pixbufNewFromFileAtScale :: GlibString string+ => string -- ^ the name of the file -> Int -- ^ target width -> Int -- ^ target height -> Bool -- ^ whether to preserve the aspect ratio -> IO Pixbuf pixbufNewFromFileAtScale filename width height preserveAspectRatio =- constructNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ propagateGError $ \errPtrPtr -> withUTFString filename $ \filenamePtr -> #if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)@@ -342,16 +356,54 @@ errPtrPtr #endif +#if GTK_CHECK_VERSION(3,0,0)+-- | Creates a new pixbuf from a cairo Surface.+--+-- Transfers image data from a cairo Surface and converts it to an RGB(A) representation inside a Pixbuf. This allows you to efficiently read individual pixels from cairo surfaces. For GdkWindows, use gdk_pixbuf_get_from_window() instead.+--+-- This function will create an RGB pixbuf with 8 bits per channel. The pixbuf will contain an alpha channel if the surface contains one.+pixbufNewFromSurface :: Surface -> Int -> Int -> Int -> Int -> IO Pixbuf+pixbufNewFromSurface surface srcX srcY width height =+ withSurface surface $ \ss -> wrapNewGObject mkPixbuf $+ {# call gdk_pixbuf_get_from_surface #}+ (castPtr ss)+ (fromIntegral srcX)+ (fromIntegral srcY)+ (fromIntegral width)+ (fromIntegral height)++-- | Creates a new pixbuf from a GDK window.+--+-- Transfers image data from a GdkWindow and converts it to an RGB(A) representation inside a GdkPixbuf. In other words, copies image data from a server-side drawable to a client-side RGB(A) buffer. This allows you to efficiently read individual pixels on the client side.+--+-- This function will create an RGB pixbuf with 8 bits per channel with the size specified by the width and height arguments scaled by the scale factor of window. The pixbuf will contain an alpha channel if the window contains one.+pixbufNewFromWindow :: DrawWindowClass self + => self -- ^ @window@ - The source window.+ -> Int -- ^ @srcX@ - Source X coordinate within window.+ -> Int -- ^ @srcY@ - Source Y coordinate within window.+ -> Int -- ^ @width@ - Width in pixels of region to get.+ -> Int -- ^ @height@ - Height in pixels of region to get.+ -> IO Pixbuf+pixbufNewFromWindow window srcX srcY width height =+ wrapNewGObject mkPixbuf $+ {# call gdk_pixbuf_get_from_window #}+ (toDrawWindow window)+ (fromIntegral srcX)+ (fromIntegral srcY)+ (fromIntegral width)+ (fromIntegral height)+#endif+ -- | A string representing an image file format. ---type ImageFormat = String+type ImageFormat = DefaultGlibString -- constant pixbufGetFormats A list of valid image file formats. -- pixbufGetFormats :: [ImageFormat] pixbufGetFormats = ["png","bmp","wbmp", "gif","ico","ani","jpeg","pnm",- "ras","tiff","xpm","xbm","tga"]+ "ras","tiff","xpm","xbm","tga"] -- | Save an image to disk. --@@ -367,13 +419,12 @@ -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the -- error codes in 'PixbufError'. ---pixbufSave :: Pixbuf -> FilePath -> ImageFormat -> [(String, String)] ->- IO ()+pixbufSave :: (GlibString string, GlibFilePath fp) => Pixbuf -> fp -> ImageFormat -> [(string, string)] ->+ IO () pixbufSave pb fname iType options = let (keys, values) = unzip options in- let optLen = length keys in propagateGError $ \errPtrPtr ->- withUTFString fname $ \fnPtr ->+ withUTFFilePath fname $ \fnPtr -> withUTFString iType $ \tyPtr -> withUTFStringArray0 keys $ \keysPtr -> withUTFStringArray values $ \valuesPtr -> do@@ -397,19 +448,32 @@ -- pixbufNew :: Colorspace -> Bool -> Int -> Int -> Int -> IO Pixbuf pixbufNew colorspace hasAlpha bitsPerSample width height =- constructNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ {#call pixbuf_new#} ((fromIntegral . fromEnum) colorspace) (fromBool hasAlpha) (fromIntegral bitsPerSample) (fromIntegral width) (fromIntegral height) --- | Create a new image from a String.+pixbufNewFromData :: Ptr CUChar -> Colorspace -> Bool -> Int -> Int -> Int -> Int -> IO Pixbuf+pixbufNewFromData imData cSpace hasAlpha bitsPerSample width height rowStride+ = wrapNewGObject mkPixbuf $+ {#call pixbuf_new_from_data #}+ imData+ (fromIntegral . fromEnum $ cSpace)+ (fromBool hasAlpha)+ (fromIntegral bitsPerSample)+ (fromIntegral width)+ (fromIntegral height)+ (fromIntegral rowStride)+ nullFunPtr nullPtr++-- | Create a new image from a string. -- -- * Creates a new pixbuf from a string description. ---pixbufNewFromXPMData :: [String] -> IO Pixbuf+pixbufNewFromXPMData :: GlibString string => [string] -> IO Pixbuf pixbufNewFromXPMData s = withUTFStringArray0 s $ \strsPtr ->- constructNewGObject mkPixbuf $ {#call pixbuf_new_from_xpm_data#} strsPtr+ wrapNewGObject mkPixbuf $ {#call pixbuf_new_from_xpm_data#} strsPtr -- | A dymmy type for inline picture data. --@@ -417,7 +481,7 @@ -- that is embedded in the executable. See -- 'pixbufNewFromInline' for an example. ---data InlineImage = InlineImage+data InlineImage -- | Create a new image from a static pointer. --@@ -436,14 +500,14 @@ -- > extern guint8 my_image[]; -- -- and save it in the current directory.--- The created file can be compiled with: +-- The created file can be compiled with: -- -- > cc -c my_image.c `pkg-config --cflags gdk-2.0` -- -- into an object file which must be linked into your Haskell program by -- specifying @my_image.o@ and @\"-#include my_image.h\"@ on -- the command line of GHC.--- Within you application you delcare a pointer to this image:+-- Within you application you declare a pointer to this image: -- -- > foreign label "my_image" myImage :: Ptr InlineImage --@@ -458,11 +522,11 @@ pixbufNewFromInline iPtr = alloca $ \errPtrPtr -> do pbPtr <- {#call unsafe pixbuf_new_from_inline#} (-1) (castPtr iPtr) (fromBool False) (castPtr errPtrPtr)- if pbPtr/=nullPtr then constructNewGObject mkPixbuf (return pbPtr)+ if pbPtr/=nullPtr then wrapNewGObject mkPixbuf (return pbPtr) else do errPtr <- peek errPtrPtr (GError dom code msg) <- peek errPtr- error msg+ error $ glibToString msg -- | Create a restricted view of an image. --@@ -474,7 +538,7 @@ -- pixbufNewSubpixbuf :: Pixbuf -> Int -> Int -> Int -> Int -> IO Pixbuf pixbufNewSubpixbuf pb srcX srcY height width =- constructNewGObject mkPixbuf $ do+ wrapNewGObject mkPixbuf $ do pbPtr <- {#call unsafe pixbuf_new_subpixbuf#} pb (fromIntegral srcX) (fromIntegral srcY) (fromIntegral height) (fromIntegral width)@@ -484,7 +548,7 @@ -- | Create a deep copy of an image. -- pixbufCopy :: Pixbuf -> IO Pixbuf-pixbufCopy pb = constructNewGObject mkPixbuf $ {#call unsafe pixbuf_copy#} pb+pixbufCopy pb = wrapNewGObject mkPixbuf $ {#call unsafe pixbuf_copy#} pb -- | How an image is scaled.@@ -515,26 +579,26 @@ -- | Scale an image. ----- * Creates a new 'Pixbuf' containing a copy of +-- * Creates a new 'Pixbuf' containing a copy of -- @src@ scaled to the given measures. Leaves @src@--- unaffected. +-- unaffected. -- -- * @interp@ affects the quality and speed of the scaling function. -- 'InterpNearest' is the fastest option but yields very poor quality -- when scaling down. 'InterpBilinear' is a good trade-off between -- speed and quality and should thus be used as a default. ---pixbufScaleSimple :: +pixbufScaleSimple :: Pixbuf -- ^ @src@ - the source image -> Int -- ^ @width@ - the target width -> Int -- ^ @height@ the target height -> InterpType -- ^ interpolation type -> IO Pixbuf pixbufScaleSimple pb width height interp =- constructNewGObject mkPixbuf $ liftM castPtr $- {#call pixbuf_scale_simple#} (toPixbuf pb)- (fromIntegral width) (fromIntegral height)- (fromIntegral $ fromEnum interp)+ wrapNewGObject mkPixbuf $ liftM castPtr $+ {#call pixbuf_scale_simple#} (toPixbuf pb)+ (fromIntegral width) (fromIntegral height)+ (fromIntegral $ fromEnum interp) -- | Copy a scaled image part to another image. --@@ -547,16 +611,16 @@ -- 'pixbufComposite' if you need to blend the source image onto the -- destination. ---pixbufScale :: +pixbufScale :: 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 -- ^ @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 + -> 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@@ -584,17 +648,17 @@ 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 -- ^ @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 + -> 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+ -> Word8 -- ^ @alpha@ - the transparency -> IO () pixbufComposite src dest destX destY destWidth destHeight offsetX offsetY scaleX scaleY interp alpha =@@ -609,7 +673,7 @@ -- pixbufFlipHorizontally :: Pixbuf -> IO Pixbuf pixbufFlipHorizontally self =- constructNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ {# call pixbuf_flip #} self (fromBool True)@@ -619,7 +683,7 @@ -- pixbufFlipVertically :: Pixbuf -> IO Pixbuf pixbufFlipVertically self =- constructNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ {# call pixbuf_flip #} self (fromBool False)@@ -629,7 +693,7 @@ -- pixbufRotateSimple :: Pixbuf -> PixbufRotation -> IO Pixbuf pixbufRotateSimple self angle =- constructNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ {# call pixbuf_rotate_simple #} self ((fromIntegral . fromEnum) angle)@@ -655,15 +719,15 @@ -- during this substitution. -- pixbufAddAlpha :: Pixbuf -> Maybe (Word8, Word8, Word8) -> IO Pixbuf-pixbufAddAlpha pb Nothing = constructNewGObject mkPixbuf $+pixbufAddAlpha pb Nothing = wrapNewGObject mkPixbuf $ {#call unsafe pixbuf_add_alpha#} pb (fromBool False) 0 0 0-pixbufAddAlpha pb (Just (r,g,b)) = constructNewGObject mkPixbuf $+pixbufAddAlpha pb (Just (r,g,b)) = wrapNewGObject mkPixbuf $ {#call unsafe pixbuf_add_alpha#} pb (fromBool True) (fromIntegral r) (fromIntegral g) (fromIntegral b) -- | Copy a rectangular portion into another 'Pixbuf'. ----- The source 'Pixbuf' remains unchanged. Converion between+-- The source 'Pixbuf' remains unchanged. Conversion between -- different formats is done automatically. -- pixbufCopyArea ::@@ -695,6 +759,7 @@ (fromIntegral blue) `shiftL` 8 .|. (fromIntegral alpha)) +#if GTK_MAJOR_VERSION < 3 -- | Take a screenshot of a 'Drawable'. -- -- * This function creates a 'Pixbuf' and fills it with the image@@ -707,19 +772,21 @@ -- rectangle. The function will return @Nothing@ if the window -- is not currently visible. --+-- Removed in Gtk3. pixbufGetFromDrawable :: DrawableClass d => d -> Rectangle -> IO (Maybe Pixbuf) pixbufGetFromDrawable d (Rectangle x y width height) =- maybeNull (constructNewGObject mkPixbuf) $+ maybeNull (wrapNewGObject mkPixbuf) $ {#call unsafe pixbuf_get_from_drawable#} (Pixbuf nullForeignPtr) (toDrawable d) (Colormap nullForeignPtr) (fromIntegral x) (fromIntegral y) 0 0 (fromIntegral width) (fromIntegral height) - -- | Takes the opacity values in a rectangular portion of a pixbuf and -- thresholds them to produce a bi-level alpha mask that can be used -- as a clipping mask for a drawable.+--+-- Removed in Gtk3. pixbufRenderThresholdAlpha :: Pixbuf -- ^ A pixbuf. -> Bitmap -- ^ Bitmap where the bilevel mask will be painted to.@@ -761,6 +828,7 @@ -- If the pixbuf does not have an alpha channel, then the returned -- mask will be @Nothing@. --+-- Removed in Gtk3. pixbufRenderPixmapAndMaskForColormap :: Pixbuf -- ^ A pixbuf. -> Colormap -- ^ A Colormap@@ -774,8 +842,7 @@ (castPtr pmRetPtr) -- seems to reject Pixmap**, so cast (castPtr bmRetPtr) (fromIntegral threshold)- pm <- constructNewGObject mkPixmap (peek pmRetPtr :: IO (Ptr Pixmap))- bm <- maybeNull (constructNewGObject mkPixmap) (peek bmRetPtr :: IO (Ptr Bitmap))+ pm <- wrapNewGObject mkPixmap (peek pmRetPtr :: IO (Ptr Pixmap))+ bm <- maybeNull (wrapNewGObject mkPixmap) (peek bmRetPtr :: IO (Ptr Bitmap)) return (pm, bm)--+#endif
Graphics/UI/Gtk/Gdk/PixbufAnimation.chs view
@@ -80,9 +80,7 @@ import System.Glib.GDateTime import System.Glib.GObject {#import Graphics.UI.Gtk.Types#}-import System.Glib.GError (GError(..), GErrorClass(..), GErrorDomain,- propagateGError)-{# import Graphics.UI.Gtk.Gdk.Pixbuf #}+import System.Glib.GError (propagateGError) {# context prefix="gdk" #} @@ -103,12 +101,13 @@ -- be caught using e.g. 'System.Glib.GError.catchGErrorJust' and one of the -- error codes in 'PixbufError' or 'GFileError' ---pixbufAnimationNewFromFile :: FilePath -- ^ Name of file to load, in the GLib file name encoding- -> IO PixbufAnimation -- ^ A newly-created animation+pixbufAnimationNewFromFile :: GlibFilePath fp+ => fp -- ^ Name of file to load, in the GLib file name encoding+ -> IO PixbufAnimation -- ^ A newly-created animation pixbufAnimationNewFromFile fname =- constructNewGObject mkPixbufAnimation $+ wrapNewGObject mkPixbufAnimation $ propagateGError $ \errPtrPtr ->- withUTFString fname $ \strPtr ->+ withUTFFilePath fname $ \strPtr -> #if defined (WIN32) && GTK_CHECK_VERSION(2,6,5) {#call unsafe pixbuf_animation_new_from_file_utf8#} strPtr errPtrPtr #else@@ -162,7 +161,7 @@ -> Maybe GTimeVal -- ^ time when the animation starts playing -> IO PixbufAnimationIter -- ^ an iterator to move over the animation pixbufAnimationGetIter self tv = maybeWith with tv $ \stPtr ->- constructNewGObject mkPixbufAnimationIter $+ wrapNewGObject mkPixbufAnimationIter $ {#call unsafe pixbuf_animation_get_iter#} self (castPtr stPtr) @@ -187,7 +186,7 @@ pixbufAnimationGetStaticImage :: PixbufAnimation -> IO (Maybe Pixbuf) -- ^ unanimated image representing the animation pixbufAnimationGetStaticImage self =- maybeNull (constructNewGObject mkPixbuf) $ {#call unsafe pixbuf_animation_get_static_image#} self+ maybeNull (makeNewGObject mkPixbuf) $ {#call unsafe pixbuf_animation_get_static_image#} self @@ -254,7 +253,7 @@ -- pixbufAnimationIterGetPixbuf :: PixbufAnimationIter -- ^ an animation iterator -> IO Pixbuf -- ^ the pixbuf to be displayed-pixbufAnimationIterGetPixbuf iter = constructNewGObject mkPixbuf $+pixbufAnimationIterGetPixbuf iter = makeNewGObject mkPixbuf $ {# call unsafe pixbuf_animation_iter_get_pixbuf #} iter @@ -267,7 +266,7 @@ -> Int -- ^ the height of the animation -> Float -- ^ the speed of the animation, in frames per second -> IO PixbufSimpleAnim -- ^ a newly allocated 'PixbufSimpleAnim'-pixbufSimpleAnimNew width height rate = constructNewGObject mkPixbufSimpleAnim $+pixbufSimpleAnimNew width height rate = wrapNewGObject mkPixbufSimpleAnim $ {#call unsafe pixbuf_simple_anim_new#} (fromIntegral width) (fromIntegral height) (realToFrac rate)
Graphics/UI/Gtk/Gdk/PixbufData.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP, ScopedTypeVariables, FlexibleInstances, MultiParamTypeClasses #-}+{-# LANGUAGE ScopedTypeVariables, FlexibleInstances, MultiParamTypeClasses #-} {-# OPTIONS_HADDOCK hide #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Pixbuf as Array@@ -35,38 +35,24 @@ import System.Glib.FFI import Graphics.UI.Gtk.Types-import Data.Ix -- internal module of GHC-import Data.Array.Base ( MArray, newArray, newArray_, unsafeRead, unsafeWrite,-#if __GLASGOW_HASKELL__ < 605- HasBounds, bounds-#else- getBounds-#endif-#if __GLASGOW_HASKELL__ >= 608- ,getNumElements-#endif- )+import Data.Array.Base ( MArray(..), newArray_, unsafeRead, unsafeWrite,+ getBounds, getNumElements ) -- | An array that stored the raw pixel data of a 'Pixbuf'. -- -- * See 'Graphics.UI.Gtk.Gdk.Pixbuf.pixbufGetPixels'. ---data Ix i => PixbufData i e = PixbufData !Pixbuf- {-# UNPACK #-} !(Ptr e)- !(i,i)- {-# UNPACK #-} !Int+data PixbufData i e = PixbufData !Pixbuf+ {-# UNPACK #-} !(Ptr e)+ !(i,i)+ {-# UNPACK #-} !Int mkPixbufData :: Storable e => Pixbuf -> Ptr e -> Int -> PixbufData Int e mkPixbufData pb (ptr :: Ptr e) size = PixbufData pb ptr (0, count) count where count = fromIntegral (size `div` sizeOf (undefined :: e)) -#if __GLASGOW_HASKELL__ < 605-instance HasBounds PixbufData where- bounds (PixbufData pb ptr bd cnt) = bd-#endif- -- | 'PixbufData' is a mutable array. instance Storable e => MArray PixbufData e IO where newArray (l,u) e = error "Gtk.Gdk.Pixbuf.newArray: not implemented"@@ -80,11 +66,7 @@ unsafeWrite (PixbufData (Pixbuf pb) pixPtr _ _) idx elem = do pokeElemOff pixPtr idx elem touchForeignPtr pb-#if __GLASGOW_HASKELL__ >= 605 {-# INLINE getBounds #-} getBounds (PixbufData _ _ bd _) = return bd-#endif-#if __GLASGOW_HASKELL__ >= 608 {-# INLINE getNumElements #-} getNumElements (PixbufData _ _ _ count) = return count-#endif
Graphics/UI/Gtk/Gdk/Pixmap.chs view
@@ -27,12 +27,14 @@ -- Stability : provisional -- Portability : portable (depends on GHC) ----- Pixmaps -- Offscreen drawables +-- Pixmaps -- Offscreen drawables --+-- This module is empty when built with Gtk3 because Pixmap has been+-- removed. module Graphics.UI.Gtk.Gdk.Pixmap ( -- * Detail -- Pixmaps are offscreen drawables. They can be drawn upon with the--- standard drawing primitives, then copied to another drawable +-- standard drawing primitives, then copied to another drawable -- with 'drawDrawable'. -- * Class Hierarchy@@ -42,20 +44,21 @@ -- | +----'Drawable' -- | +----Pixmap -- @-+#if GTK_MAJOR_VERSION < 3 -- * Types- Pixmap, PixmapClass, + Pixmap, PixmapClass, Bitmap, -- * Constructors pixmapNew+#endif ) where +#if GTK_MAJOR_VERSION < 3+ import Data.Maybe import System.Glib.FFI-import System.Glib.GObject (constructNewGObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.Gdk.Drawable (Drawable, DrawableClass(..)) {# context lib="gdk" prefix="gdk" #} @@ -72,7 +75,7 @@ -- and @depth@ must not be @Nothing@. -- -- * Note that in Gtk+ 2.0 the @drawable@ can only be a 'DrawWindow', not an--- arbitary 'Drawable'.+-- arbitrary 'Drawable'. -- #if GTK_CHECK_VERSION(2,2,0) pixmapNew :: DrawableClass drawable@@ -83,7 +86,7 @@ -> Maybe Int -- ^ @depth@ - depth of the pixmap -> IO Pixmap pixmapNew mbDrawable width height depth =- constructNewGObject mkPixmap $+ wrapNewGObject mkPixmap $ {# call unsafe pixmap_new #} (maybe (Drawable nullForeignPtr) toDrawable mbDrawable) (fromIntegral width) (fromIntegral height)@@ -97,9 +100,11 @@ -> Maybe Int -- ^ @depth@ - depth of the pixmap -> IO Pixmap pixmapNew mbDrawWindow width height depth =- constructNewGObject mkPixmap $+ wrapNewGObject mkPixmap $ {# call unsafe pixmap_new #} (maybe (DrawWindow nullForeignPtr) toDrawWindow mbDrawWindow) (fromIntegral width) (fromIntegral height) (fromIntegral $ fromMaybe (negate 1) depth) #endif++#endif /* GTK_MAJOR_VERSION < 3 */
Graphics/UI/Gtk/Gdk/Region.chs view
@@ -33,7 +33,10 @@ -- * Regions consist of a set of non-overlapping rectangles. They are used to -- specify the area of a window which needs updating. --+-- This module is empty when built with Gtk3 because Pixmap has been+-- removed. module Graphics.UI.Gtk.Gdk.Region (+#if GTK_MAJOR_VERSION < 3 makeNewRegion, Region(Region), regionNew,@@ -54,12 +57,16 @@ regionIntersect, regionUnion, regionSubtract,- regionXor) where+ regionXor+#endif+ ) where -import Control.Monad (liftM)+#if GTK_MAJOR_VERSION < 3 +import Control.Monad (liftM)+ import System.Glib.FFI-import Graphics.UI.Gtk.General.Structs (Point, Rectangle(..))+import Graphics.UI.Gtk.General.Structs (Point, Rectangle(..)) {# context lib="gdk" prefix="gdk" #} @@ -67,7 +74,7 @@ instance Show Region where show r = show (unsafePerformIO (regionGetRectangles r))- + -- Construct a region from a pointer. -- makeNewRegion :: Ptr Region -> IO Region@@ -101,8 +108,8 @@ regionPolygon points rule = withArray (concatMap (\(x,y) -> [fromIntegral x, fromIntegral y]) points) $ \(aPtr :: Ptr {#type gint#}) -> do- rPtr <- {#call unsafe region_polygon#} (castPtr aPtr) - (fromIntegral (length points)) ((fromIntegral.fromEnum) rule)+ rPtr <- {#call unsafe region_polygon#} (castPtr aPtr)+ (fromIntegral (length points)) ((fromIntegral.fromEnum) rule) makeNewRegion rPtr -- | Copy a 'Region'.@@ -119,7 +126,7 @@ regPtr <- {#call unsafe region_rectangle#} (castPtr rectPtr) makeNewRegion regPtr --- | Smallest rectangle including the +-- | Smallest rectangle including the -- 'Region'. -- regionGetClipbox :: Region -> IO Rectangle@@ -133,8 +140,8 @@ -- rectangles of the same height. No rectangles in a band touch. -- regionGetRectangles :: Region -> IO [Rectangle]-regionGetRectangles region = - alloca $ \(rectPtrPtr :: Ptr (Ptr Rectangle)) -> +regionGetRectangles region =+ alloca $ \(rectPtrPtr :: Ptr (Ptr Rectangle)) -> alloca $ \(iPtr :: Ptr {#type gint#}) -> do {#call unsafe region_get_rectangles#} region (castPtr rectPtrPtr) iPtr size <- peek iPtr@@ -156,7 +163,7 @@ -- | Checks if a point it is within a region. -- regionPointIn :: Region -> Point -> IO Bool-regionPointIn r (x,y) = liftM toBool $ +regionPointIn r (x,y) = liftM toBool $ {#call unsafe region_point_in#} r (fromIntegral x) (fromIntegral y) -- | Check if a rectangle is within a region.@@ -168,7 +175,7 @@ -- | Move a region. -- regionOffset :: Region -> Int -> Int -> IO ()-regionOffset r dx dy = +regionOffset r dx dy = {#call unsafe region_offset#} r (fromIntegral dx) (fromIntegral dy) -- | Move a region.@@ -176,7 +183,7 @@ -- * Positive values shrink the region, negative values expand it. -- regionShrink :: Region -> Int -> Int -> IO ()-regionShrink r dx dy = +regionShrink r dx dy = {#call unsafe region_shrink#} r (fromIntegral dx) (fromIntegral dy) -- | Updates the region to include the rectangle.@@ -217,4 +224,4 @@ regionXor :: Region -> Region -> IO () regionXor reg1 reg2 = {#call unsafe region_xor#} reg1 reg2 -+#endif
Graphics/UI/Gtk/Gdk/Screen.chs view
@@ -57,6 +57,7 @@ -- * Methods screenGetDefault,+#if GTK_MAJOR_VERSION <3 screenGetSystemColormap, #if GTK_CHECK_VERSION(2,8,0) screenGetRGBAColormap,@@ -65,8 +66,9 @@ screenGetDefaultColormap, screenSetDefaultColormap, #endif+#endif --- screenGetSystemVisual,+ screenGetSystemVisual, #if GTK_CHECK_VERSION(2,10,0) screenIsComposited, #endif@@ -100,7 +102,9 @@ -- * Attributes screenFontOptions, screenResolution,+#if GTK_MAJOR_VERSION < 3 screenDefaultColormap,+#endif -- * Signals screenSizeChanged,@@ -114,7 +118,7 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString@@ -124,7 +128,7 @@ import System.Glib.GList {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.Signals-import Graphics.Rendering.Cairo.Types ( FontOptions(..), mkFontOptions, +import Graphics.Rendering.Cairo.Types ( FontOptions(..), mkFontOptions, withFontOptions) import Graphics.UI.Gtk.General.Structs ( Rectangle(..) ) @@ -144,6 +148,7 @@ maybeNull (makeNewGObject mkScreen) $ {# call gdk_screen_get_default #} +#if GTK_MAJOR_VERSION < 3 screenGetDefaultColormap :: Screen -> IO Colormap -- ^ returns the default 'Colormap'. screenGetDefaultColormap self =@@ -163,6 +168,7 @@ -- | Gets the system default colormap for @screen@ --+-- Removed in Gtk3. screenGetSystemColormap :: Screen -> IO Colormap -- ^ returns the default colormap for @screen@. screenGetSystemColormap self =@@ -181,6 +187,7 @@ -- -- * Available since Gdk version 2.8 --+-- Removed in Gtk3. screenGetRGBAColormap :: Screen -> IO (Maybe Colormap) -- ^ returns a colormap to use for windows with an -- alpha channel or @Nothing@ if the capability is not@@ -190,6 +197,7 @@ {# call gdk_screen_get_rgba_colormap #} self #endif+#endif -- | Get the system's default visual for @screen@. This is the visual for the -- root window of the display.@@ -282,7 +290,7 @@ -- servers this value will not be correct. -- screenGetHeightMM :: Screen- -> IO Int -- ^ returns the heigth of @screen@ in millimeters.+ -> IO Int -- ^ returns the height of @screen@ in millimeters. screenGetHeightMM self = liftM fromIntegral $ {# call gdk_screen_get_height_mm #}@@ -320,8 +328,8 @@ -- | Determines the name to pass to 'displayOpen' to get a 'Display' with this -- screen as the default screen. ---screenMakeDisplayName :: Screen- -> IO String -- ^ returns a newly allocated string+screenMakeDisplayName :: GlibString string => Screen+ -> IO string -- ^ returns a newly allocated string screenMakeDisplayName self = {# call gdk_screen_make_display_name #} self@@ -414,9 +422,9 @@ -- -- * Available since Gdk version 2.14 ---screenGetMonitorPlugName :: Screen+screenGetMonitorPlugName :: GlibString string => Screen -> Int -- ^ @monitorNum@ - number of the monitor- -> IO (Maybe String) -- ^ returns a newly-allocated string containing the name of the+ -> IO (Maybe string) -- ^ returns a newly-allocated string containing the name of the -- monitor, or @Nothing@ if the name cannot be determined screenGetMonitorPlugName self monitorNum = do sPtr <-@@ -432,8 +440,8 @@ -- -- FIXME needs a list of valid settings here, or a link to more information. ---screenGetSetting :: Screen- -> String -- ^ @name@ - the name of the setting+screenGetSetting :: GlibString string => Screen+ -> string -- ^ @name@ - the name of the setting -> {-GValue*-} -- ^ @value@ - location to store the value of the setting -> IO Bool -- ^ returns @True@ if the setting existed and a value was -- stored in @value@, @False@ otherwise.@@ -479,7 +487,7 @@ -> IO (Maybe DrawWindow) -- ^ returns the currently active window, or -- @Nothing@. screenGetActiveWindow self =- maybeNull (makeNewGObject mkDrawWindow) $+ maybeNull (wrapNewGObject mkDrawWindow) $ {# call gdk_screen_get_active_window #} self #endif@@ -503,7 +511,7 @@ screenGetWindowStack self = do lPtr <- {# call gdk_screen_get_window_stack #} self if lPtr==nullPtr then return Nothing else liftM Just $ do- fromGList lPtr >>= mapM (constructNewGObject mkDrawWindow . return)+ fromGList lPtr >>= mapM (wrapNewGObject mkDrawWindow . return) #endif --------------------@@ -523,14 +531,17 @@ screenResolution :: Attr Screen Double screenResolution = newAttrFromDoubleProperty "resolution" +#if GTK_MAJOR_VERSION < 3 -- | Sets the default @colormap@ for @screen@. -- -- Gets the default colormap for @screen@. --+-- Removed in Gtk3. screenDefaultColormap :: Attr Screen Colormap screenDefaultColormap = newAttr screenGetDefaultColormap screenSetDefaultColormap+#endif -------------------- -- Signals@@ -539,7 +550,7 @@ -- screen changes. -- screenSizeChanged :: ScreenClass self => Signal self (IO ())-screenSizeChanged = Signal (connect_NONE__NONE "size_changed")+screenSizeChanged = Signal (connect_NONE__NONE "size-changed") #if GTK_CHECK_VERSION(2,10,0) -- | The 'screenCompositedChanged' signal is emitted when the composited status of@@ -548,7 +559,7 @@ -- * Available since Gdk version 2.10 -- screenCompositedChanged :: ScreenClass self => Signal self (IO ())-screenCompositedChanged = Signal (connect_NONE__NONE "composited_changed")+screenCompositedChanged = Signal (connect_NONE__NONE "composited-changed") #if GTK_CHECK_VERSION(2,14,0) -- | The 'screenMonitorsChanged' signal is emitted when the number, size or
Graphics/UI/Gtk/General/Clipboard.chs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Clipboard --@@ -139,7 +140,7 @@ import System.Glib.UTFString {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.General.DNDTypes#} (SelectionTag, TargetTag,- atomNew, Atom(..))+ Atom(..)) {#import Graphics.UI.Gtk.General.Selection#} (InfoId, SelectionDataM) import Graphics.UI.Gtk.General.Structs ( selectionPrimary,@@ -147,8 +148,7 @@ selectionClipboard, withTargetEntries) import Control.Monad ( liftM )-import Control.Monad.Trans ( liftIO )-import Control.Monad.Reader (runReaderT, ask)+import Control.Monad.Reader (runReaderT) import Data.IORef ( newIORef, readIORef, writeIORef ) {# context lib="gtk" prefix="gtk" #}@@ -232,13 +232,13 @@ -- destructors and thereby free them. Thus, by setting these attributes each time we -- install new data functions, we cuningly finalized the previous closures. Hooray. -{-# NOINLINE getFuncQuark #-} +{-# NOINLINE getFuncQuark #-} getFuncQuark :: Quark-getFuncQuark = unsafePerformIO $ quarkFromString "hsClipboardGetFuncClosure"+getFuncQuark = unsafePerformIO $ quarkFromString ("hsClipboardGetFuncClosure"::DefaultGlibString) -{-# NOINLINE clearFuncQuark #-} +{-# NOINLINE clearFuncQuark #-} clearFuncQuark :: Quark-clearFuncQuark = unsafePerformIO $ quarkFromString "hsClipboardClearFuncClosure"+clearFuncQuark = unsafePerformIO $ quarkFromString ("hsClipboardClearFuncClosure"::DefaultGlibString) -- %hash c:c65a d:b402 -- | Virtually sets the contents of the specified clipboard by providing a@@ -260,7 +260,7 @@ -- data succeeded. clipboardSetWithData self targets getFunc clearFunc = do gFunPtr <- mkClipboardGetFunc- (\_ sPtr info -> runReaderT (getFunc info) sPtr >> return ())+ (\_ sPtr info _ -> runReaderT (getFunc info) sPtr >> return ()) cFunPtr <- mkClipboardClearFunc (\_ _ -> clearFunc) res <- withTargetEntries targets $ \nTargets targets ->@@ -282,7 +282,7 @@ {#pointer ClipboardClearFunc#} foreign import ccall "wrapper" mkClipboardGetFunc ::- (Ptr Clipboard -> Ptr () -> {#type guint#} -> IO ()) -> IO ClipboardGetFunc+ (Ptr Clipboard -> Ptr () -> {#type guint#} -> Ptr () -> IO ()) -> IO ClipboardGetFunc foreign import ccall "wrapper" mkClipboardClearFunc :: (Ptr Clipboard -> Ptr () -> IO ()) -> IO ClipboardClearFunc@@ -295,7 +295,7 @@ -- The difference between this function and 'clipboardSetWithData' is that -- a 'GObject' is passed in. ---clipboardSetWithOwner :: (ClipboardClass self, GObjectClass owner) => self+_clipboardSetWithOwner :: (ClipboardClass self, GObjectClass owner) => self -> [(TargetTag, InfoId)] -- ^ @targets@ - a list containing information -- about the available forms for the clipboard -- data@@ -311,9 +311,9 @@ -- data succeeded. If setting the clipboard data -- failed the provided callback functions will be -- ignored.-clipboardSetWithOwner self targets getFunc clearFunc owner = do+_clipboardSetWithOwner self targets getFunc clearFunc owner = do gFunPtr <- mkClipboardGetFunc- (\_ sPtr info -> runReaderT (getFunc info) sPtr >> return ())+ (\_ sPtr info _ -> runReaderT (getFunc info) sPtr >> return ()) cFunPtr <- mkClipboardClearFunc (\_ _ -> clearFunc) res <- withTargetEntries targets $ \nTargets targets ->@@ -337,10 +337,10 @@ -- has not subsequently called, returns the owner set by -- 'clipboardSetWithOwner'. ---clipboardGetOwner :: ClipboardClass self => self+_clipboardGetOwner :: ClipboardClass self => self -> IO (Maybe GObject) -- ^ returns the owner of the clipboard, if any; otherwise -- @Nothing@.-clipboardGetOwner self =+_clipboardGetOwner self = maybeNull (makeNewGObject mkGObject) $ {# call gtk_clipboard_get_owner #} (toClipboard self)@@ -351,8 +351,8 @@ -- 'clipboardSetWithData', and when the @clearFunc@ you supplied is called. -- Otherwise, the clipboard may be owned by someone else. ---clipboardClear :: ClipboardClass self => self -> IO ()-clipboardClear self =+_clipboardClear :: ClipboardClass self => self -> IO ()+_clipboardClear self = {# call gtk_clipboard_clear #} (toClipboard self) @@ -361,8 +361,8 @@ -- make a copy of the text and take responsibility for responding for requests -- for the text, and for converting the text into the requested format. ---clipboardSetText :: ClipboardClass self => self- -> String -- ^ @text@ - the text to be set as clipboard content+clipboardSetText :: (ClipboardClass self, GlibString string) => self+ -> string -- ^ @text@ - the text to be set as clipboard content -> IO () clipboardSetText self text = withUTFStringLen text $ \(textPtr,len) ->@@ -404,7 +404,7 @@ clipboardRequestContents self (Atom target) callback = do cbRef <- newIORef nullFunPtr cbPtr <- mkClipboardReceivedFunc- (\_ sPtr -> do+ (\_ sPtr _ -> do freeHaskellFunPtr =<< readIORef cbRef runReaderT callback sPtr return ())@@ -418,7 +418,7 @@ {#pointer ClipboardReceivedFunc#} foreign import ccall "wrapper" mkClipboardReceivedFunc ::- (Ptr Clipboard -> Ptr () -> IO ()) -> IO ClipboardReceivedFunc+ (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()) -> IO ClipboardReceivedFunc -- %hash c:7bb1 d:4ef1 -- | Requests the contents of the clipboard as text. When the text is later@@ -430,8 +430,8 @@ -- particular if the clipboard was empty or if the contents of the clipboard -- could not be converted into text form. ---clipboardRequestText :: ClipboardClass self => self- -> (Maybe String -> IO ()) -- ^ @callback@ - a function to call when+clipboardRequestText :: (ClipboardClass self, GlibString string) => self+ -> (Maybe string -> IO ()) -- ^ @callback@ - a function to call when -- the text is received, or the retrieval -- fails. (It will always be called one -- way or the other.)@@ -439,7 +439,7 @@ clipboardRequestText self callback = do cbRef <- newIORef nullFunPtr cbPtr <- mkClipboardTextReceivedFunc- (\_ sPtr -> do+ (\_ sPtr _ -> do freeHaskellFunPtr =<< readIORef cbRef mStr <- if sPtr==nullPtr then return Nothing else liftM Just $ peekUTFString sPtr@@ -453,7 +453,7 @@ {#pointer ClipboardTextReceivedFunc#} foreign import ccall "wrapper" mkClipboardTextReceivedFunc ::- (Ptr Clipboard -> CString -> IO ()) -> IO ClipboardTextReceivedFunc+ (Ptr Clipboard -> CString -> Ptr () -> IO ()) -> IO ClipboardTextReceivedFunc #if GTK_CHECK_VERSION(2,6,0)@@ -477,7 +477,7 @@ clipboardRequestImage self callback = do cbRef <- newIORef nullFunPtr cbPtr <- mkClipboardImageReceivedFunc- (\_ sPtr -> do+ (\_ sPtr _ -> do freeHaskellFunPtr =<< readIORef cbRef mPixbuf <- maybeNull (makeNewGObject mkPixbuf) (return sPtr) callback mPixbuf)@@ -490,7 +490,7 @@ {#pointer ClipboardImageReceivedFunc#} foreign import ccall "wrapper" mkClipboardImageReceivedFunc ::- (Ptr Clipboard -> Ptr Pixbuf -> IO ()) -> IO ClipboardImageReceivedFunc+ (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()) -> IO ClipboardImageReceivedFunc #endif @@ -513,7 +513,7 @@ clipboardRequestTargets self callback = do cbRef <- newIORef nullFunPtr cbPtr <- mkClipboardTargetsReceivedFunc- (\_ tPtr len -> do+ (\_ tPtr len _ -> do -- We must free Haskell pointer *in* the callback to avoid segfault. freeHaskellFunPtr =<< readIORef cbRef mTargets <- if tPtr==nullPtr then return Nothing else@@ -528,7 +528,7 @@ {#pointer ClipboardTargetsReceivedFunc#} foreign import ccall "wrapper" mkClipboardTargetsReceivedFunc ::- (Ptr Clipboard -> Ptr (Ptr ()) -> {#type gint#} -> IO ()) -> IO ClipboardTargetsReceivedFunc+ (Ptr Clipboard -> Ptr (Ptr ()) -> {#type gint#} -> Ptr () -> IO ()) -> IO ClipboardTargetsReceivedFunc #if GTK_CHECK_VERSION(2,10,0) -- %hash c:5601 d:d6a6@@ -542,9 +542,9 @@ -- -- * Available since Gtk+ version 2.10 ---clipboardRequestRichText :: (ClipboardClass self, TextBufferClass buffer) => self+clipboardRequestRichText :: (ClipboardClass self, TextBufferClass buffer, GlibString string) => self -> buffer -- ^ @buffer@ - a 'TextBuffer' that determines the supported rich text formats- -> (Maybe (TargetTag,String) -> IO ()) -- ^ @callback@ - a function to call+ -> (Maybe (TargetTag,string) -> IO ()) -- ^ @callback@ - a function to call -- when the text is received, or the -- retrieval fails. (It will always be -- called one way or the other.)@@ -552,10 +552,10 @@ clipboardRequestRichText self buffer callback = do cbRef <- newIORef nullFunPtr cbPtr <- mkClipboardRichTextReceivedFunc- (\_ tPtr sPtr len -> do+ (\_ tPtr sPtr len _ -> do freeHaskellFunPtr =<< readIORef cbRef mRes <- if sPtr==nullPtr then return Nothing else liftM Just $ do- str <- peekUTFStringLen (sPtr,fromIntegral len)+ str <- peekUTFStringLen (castPtr sPtr,fromIntegral len) return (Atom tPtr, str) callback mRes) writeIORef cbRef cbPtr@@ -568,7 +568,7 @@ {#pointer ClipboardRichTextReceivedFunc#} foreign import ccall "wrapper" mkClipboardRichTextReceivedFunc ::- (Ptr Clipboard -> Ptr () -> CString -> {#type gsize#} -> IO ()) ->+ (Ptr Clipboard -> Ptr () -> Ptr CUChar -> {#type gsize#} -> Ptr () -> IO ()) -> IO ClipboardRichTextReceivedFunc #endif #endif
Graphics/UI/Gtk/General/DNDTypes.chs view
@@ -36,16 +36,16 @@ TargetList(TargetList), SelectionData, SelectionDataM,- + -- * Constructors atomNew, targetListNew,- mkTargetList + mkTargetList ) where import System.Glib.FFI+import System.Glib.UTFString {#import Graphics.UI.Gtk.Types#} ()-import System.Glib.UTFString ( readUTFString, withUTFString ) import Control.Monad ( liftM ) import Control.Monad.Reader ( ReaderT ) @@ -89,11 +89,11 @@ newtype Atom = Atom (Ptr ()) deriving Eq instance Show Atom where- show (Atom ptr) = atomToString ptr+ show (Atom ptr) = show (atomToString ptr :: DefaultGlibString) atomToString ptr = unsafePerformIO $ do- strPtr <- {#call unsafe gdk_atom_name#} ptr- readUTFString strPtr+ strPtr <- {#call unsafe gdk_atom_name#} ptr+ readUTFString strPtr -- | A 'TargetList' contains information about all possible formats -- (represented as 'TargetTag') that a widget can create or receive in form of@@ -111,7 +111,7 @@ -- different applications. Note that the name of an 'Atom' can be printed -- by 'show' though comparing the atom is merely an integer comparison. ---atomNew :: String -> IO Atom+atomNew :: GlibString string => string -> IO Atom atomNew name = withUTFString name $ \strPtr -> liftM Atom $ {#call unsafe gdk_atom_intern#} strPtr 0
Graphics/UI/Gtk/General/Drag.chs view
@@ -27,7 +27,7 @@ -- eventModifier :: [Modifier], -- eventIsHint (this needs to be True in order to avoid gdk_event_get_screen to be called (which causes havoc)) -- eventXRoot,--- eventYRoot :: Double } +-- eventYRoot :: Double } -- Button { -- eventClick :: Click, -- eventTime :: TimeStamp,@@ -39,7 +39,7 @@ -- eventTime :: TimeStamp, -- eventModifier :: [Modifier]} ----- drag_set_icon_pixmap : colormaps are a pain, they migth be useful here+-- drag_set_icon_pixmap : colormaps are a pain, they might be useful here -- drag_set_default_icon : obsolete drag_source_set_icon : colormap problem -- -- |@@ -68,12 +68,14 @@ #endif castToDragContext, gTypeDragContext, toDragContext,- + -- * Methods+#if GTK_MAJOR_VERSION < 3 dragContextActions, dragContextSuggestedAction, dragContextAction,- +#endif+ dragDestSet, dragDestSetProxy, dragDestUnset,@@ -130,17 +132,14 @@ dragMotion ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Flags-import System.Glib.UTFString ( withUTFString )-import System.Glib.GObject (makeNewGObject)-import System.Glib.Attributes ( Attr, newAttr ) import Graphics.UI.Gtk.General.StockItems ( StockId ) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.General.DNDTypes#}-{#import Graphics.UI.Gtk.General.Selection#} ( TargetList ) import Graphics.UI.Gtk.Gdk.Enums ( DragAction(..) ) import Graphics.UI.Gtk.General.Enums ( DestDefaults(..), DragProtocol(..) #if GTK_CHECK_VERSION(2,12,0)@@ -149,22 +148,30 @@ #endif ) import Graphics.UI.Gtk.Gdk.Events ( TimeStamp, Modifier )-import Graphics.UI.Gtk.General.Structs ( Point, +import Graphics.UI.Gtk.General.Structs ( Point,+#if GTK_MAJOR_VERSION < 3 dragContextGetActions, dragContextSetActions, dragContextGetSuggestedAction, dragContextSetSuggestedAction,- dragContextGetAction, dragContextSetAction )+ dragContextGetAction, dragContextSetAction+#endif+ ) import Graphics.UI.Gtk.Signals import Control.Monad.Reader (runReaderT)+#if GTK_MAJOR_VERSION < 3+import System.Glib.Attributes ( Attr, newAttr )+#endif {# context lib="gtk" prefix="gtk" #} - + -------------------- -- Methods +#if GTK_MAJOR_VERSION < 3 -- | A set of actions that the source recommends to be taken. Only valid if -- 'dragContextSuggestedAction' is set to 'ActionAsk'. --+-- Removed in Gtk3. dragContextActions :: Attr DragContext [DragAction] dragContextActions = newAttr (liftM toFlags . dragContextGetActions) (\o -> dragContextSetActions o . fromFlags)@@ -178,6 +185,7 @@ dragContextAction :: Attr DragContext DragAction dragContextAction = newAttr (liftM toEnum . dragContextGetAction) (\o -> dragContextSetAction o . fromEnum)+#endif -- %hash c:4ff5 d:af3f @@ -256,7 +264,7 @@ (toDragContext context) (TargetList nullForeignPtr) if ttPtr==nullPtr then return Nothing else return (Just (Atom ttPtr))- + -- %hash c:41c7 d:af3f -- | Returns the list of targets this widget can accept for drag-and-drop. --@@ -264,7 +272,7 @@ dragDestGetTargetList widget = do tlPtr <- {# call gtk_drag_dest_get_target_list #} (toWidget widget) if tlPtr==nullPtr then return Nothing else liftM Just (mkTargetList tlPtr)- + -- %hash c:5c89 d:af3f -- | Sets the target types that this widget can accept from drag-and-drop. The -- widget must first be made into a drag destination with 'dragDestSet'.@@ -335,12 +343,12 @@ -- retrieval fails, GTK+ will emit a 'dragDataReceived' signal. Failure of -- the retrieval is indicated by passing @Nothing@ in the 'selectionData' signal. -- However, when 'dragGetData' is called--- implicitely because the 'DestDefaultDrop' was set, then the widget will+-- implicitly because the 'DestDefaultDrop' was set, then the widget will -- not receive notification of failed drops. ---dragGetData :: (WidgetClass widget, DragContextClass context) +dragGetData :: (WidgetClass widget, DragContextClass context) => widget -- ^ The widget that will receive the 'dragDataReceived' signal.- -> context + -> context -> TargetTag -- ^ The target (form of the data) to retrieve. -> TimeStamp -- ^ A timestamp for retrieving the data. This will generally be -- the time received in a 'dragMotion' or 'dragDrop' signal.@@ -418,7 +426,7 @@ -- %hash c:f73f d:af3f -- | Sets the icon for a given drag from a stock ID. ---dragSetIconStock :: DragContextClass context => context -> StockId +dragSetIconStock :: DragContextClass context => context -> StockId -> Int -- ^ x hot-spot -> Int -- ^ y hot-spot -> IO ()@@ -437,8 +445,8 @@ -- icon theme (the icon is loaded at the DND size), thus x and y hot-spots -- have to be used with care. Since Gtk 2.8. ---dragSetIconName :: DragContextClass context => context - -> String+dragSetIconName :: (DragContextClass context, GlibString string) => context+ -> string -> Int -- ^ x hot-spot -> Int -- ^ y hot-spot -> IO ()@@ -462,7 +470,7 @@ -- %hash c:5785 d:af3f -- | Checks to see if a mouse drag starting at @(startX, startY)@ and ending--- at @(currentX, currenty)@ has passed the GTK+ drag threshold, and thus+-- at @(currentX, currentY)@ has passed the GTK+ drag threshold, and thus -- should trigger the beginning of a drag-and-drop operation. -- dragCheckThreshold :: WidgetClass widget => widget@@ -496,7 +504,7 @@ -- %hash c:63f5 d:af3f -- | Sets the icon that will be used for drags from a particular widget from a--- 'Pixbuf'. +-- 'Pixbuf'. -- dragSourceSetIconPixbuf :: WidgetClass widget => widget -> Pixbuf -> IO () dragSourceSetIconPixbuf widget pixbuf =@@ -520,7 +528,7 @@ -- | Sets the icon that will be used for drags from a particular source to a -- themed icon. See the docs for 'IconTheme' for more details. ---dragSourceSetIconName :: WidgetClass widget => widget -> String -> IO ()+dragSourceSetIconName :: (WidgetClass widget, GlibString string) => widget -> string -> IO () dragSourceSetIconName widget iconName = withUTFString iconName $ \iconNamePtr -> {# call gtk_drag_source_set_icon_name #}@@ -612,14 +620,14 @@ dragStatus ctxt mAction ts = {# call gdk_drag_status #} ctxt (maybe 0 (fromIntegral . fromEnum) mAction) (fromIntegral ts)- + -- %hash c:fcf8 d:b945 -- | The 'dragBegin' signal is emitted on the drag source when a drag is -- started. A typical reason to connect to this signal is to set up a custom -- drag icon with 'dragSourceSetIcon'. -- dragBegin :: WidgetClass self => Signal self (DragContext -> IO ())-dragBegin = Signal (connect_OBJECT__NONE "drag_begin")+dragBegin = Signal (connect_OBJECT__NONE "drag-begin") -- %hash c:bfef d:a2ff -- | The 'dragDataDelete' signal is emitted on the drag source when a drag@@ -628,10 +636,10 @@ -- means, depends on the context of the drag operation. -- dragDataDelete :: WidgetClass self => Signal self (DragContext -> IO ())-dragDataDelete = Signal (connect_OBJECT__NONE "drag_data_delete")+dragDataDelete = Signal (connect_OBJECT__NONE "drag-data-delete") -- %hash c:eb9c d:844c--- | The ::drag-data-get signal is emitted on the drag source when the+-- | The 'dragDataGet' 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@@ -641,9 +649,9 @@ dragDataGet :: WidgetClass self => Signal self (DragContext -> InfoId -> TimeStamp -> SelectionDataM ()) dragDataGet = Signal (\after object handler -> do- connect_OBJECT_PTR_WORD_WORD__NONE "drag_data_get" after object $+ connect_OBJECT_PTR_WORD_WORD__NONE "drag-data-get" after object $ \ctxt dataPtr info time -> do- runReaderT (handler ctxt (fromIntegral info) (fromIntegral time)) dataPtr >> + runReaderT (handler ctxt (fromIntegral info) (fromIntegral time)) dataPtr >> return ()) -- %hash c:9251 d:a6d8@@ -663,7 +671,7 @@ dragDataReceived :: WidgetClass self => Signal self (DragContext -> Point -> InfoId -> TimeStamp -> SelectionDataM ()) dragDataReceived = Signal (\after object handler -> do- connect_OBJECT_INT_INT_PTR_WORD_WORD__NONE "drag_data_received" after object $+ connect_OBJECT_INT_INT_PTR_WORD_WORD__NONE "drag-data-received" after object $ \ctxt x y dataPtr info time -> do runReaderT (handler ctxt (fromIntegral x, fromIntegral y) (fromIntegral info) (fromIntegral time)) dataPtr >> return ())@@ -682,7 +690,7 @@ dragDrop :: WidgetClass self => Signal self (DragContext -> Point -> TimeStamp -> IO Bool) dragDrop = Signal (\after object handler ->- connect_OBJECT_INT_INT_WORD__BOOL "drag_drop" after object $ \ctxt x y time ->+ connect_OBJECT_INT_INT_WORD__BOOL "drag-drop" after object $ \ctxt x y time -> handler ctxt (fromIntegral x, fromIntegral y) (fromIntegral time)) -- %hash c:9d4e d:a5ac@@ -691,7 +699,7 @@ -- in 'dragBegin'. -- dragEnd :: WidgetClass self => Signal self (DragContext -> IO ())-dragEnd = Signal (connect_OBJECT__NONE "drag_end")+dragEnd = Signal (connect_OBJECT__NONE "drag-end") #if GTK_CHECK_VERSION(2,12,0) -- | The 'dragFailed' signal is emitted on the drag source when a drag has@@ -703,7 +711,7 @@ -- * Available since Gtk+ 2.12.0. -- dragFailed :: WidgetClass self => Signal self (DragContext -> DragResult -> IO Bool)-dragFailed = Signal (connect_OBJECT_ENUM__BOOL "drag_failed")+dragFailed = Signal (connect_OBJECT_ENUM__BOOL "drag-failed") #endif -- %hash c:4a85 d:6122@@ -713,7 +721,7 @@ -- dragLeave :: WidgetClass self => Signal self (DragContext -> TimeStamp -> IO ()) dragLeave = Signal (\after object handler ->- connect_OBJECT_WORD__NONE "drag_leave" after object $ \ctxt time ->+ connect_OBJECT_WORD__NONE "drag-leave" after object $ \ctxt time -> handler ctxt (fromIntegral time)) -- %hash c:53f7 d:176d@@ -737,6 +745,6 @@ dragMotion :: WidgetClass self => Signal self (DragContext -> Point -> TimeStamp -> IO Bool) dragMotion = Signal (\after object handler -> do- connect_OBJECT_INT_INT_WORD__BOOL "drag_motion" after object $ \ctxt x y time ->+ connect_OBJECT_INT_INT_WORD__BOOL "drag-motion" after object $ \ctxt x y time -> handler ctxt (fromIntegral x, fromIntegral y) (fromIntegral time))
Graphics/UI/Gtk/General/Enums.chs view
@@ -27,8 +27,14 @@ -- module Graphics.UI.Gtk.General.Enums ( AccelFlags(..),+#if GTK_CHECK_VERSION(3,0,0)+ Align(..),+#endif ArrowType(..), AttachOptions(..),+#if GTK_CHECK_VERSION(3,10,0)+ BaselinePosition(..),+#endif MouseButton(..), ButtonBoxStyle(..), CalendarDisplayOptions(..),@@ -41,11 +47,20 @@ #endif DirectionType(..), Justification(..),+#if GTK_CHECK_VERSION(3,6,0)+ LevelBarMode(..),+#endif+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED MatchType(..), #endif+#endif MenuDirectionType(..),+#if GTK_MAJOR_VERSION < 3+#if GTK_CHECK_VERSION(2,8,0) MetricType(..),+#endif+#endif MovementStep(..), Orientation(..), Packing(..), toPacking, fromPacking,@@ -54,19 +69,26 @@ PathType(..), PolicyType(..), PositionType(..),+#if GTK_MAJOR_VERSION < 3 ProgressBarOrientation(..),+#endif ReliefStyle(..), ResizeMode(..), ScrollType(..), ScrollStep (..), SelectionMode(..), ShadowType(..),+#if GTK_CHECK_VERSION(3,0,0)+ StateFlags(..),+#endif SortType(..), StateType(..),+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED SubmenuDirection(..), SubmenuPlacement(..), #endif+#endif SpinButtonUpdatePolicy(..), SpinType(..), TargetFlags(..),@@ -76,15 +98,27 @@ ToolbarStyle(..), TreeViewColumnSizing(..), --TroughType(..),+#if GTK_MAJOR_VERSION < 3 UpdateType(..), Visibility(..),+#endif WindowPosition(..), WindowType(..),- WrapMode(..), - module Graphics.UI.Gtk.Gdk.Enums+ WrapMode(..),+#if GTK_CHECK_VERSION(2,16,0)+ EntryIconPosition(..),+#endif+#if GTK_MAJOR_VERSION < 3+ AnchorType (..),+#endif+#if GTK_CHECK_VERSION(3,10,0)+ StackTransitionType (..),+#endif++module Graphics.UI.Gtk.Gdk.Enums ) where -import System.Glib.Flags (Flags)+import System.Glib.Flags (Flags) import Graphics.UI.Gtk.Gdk.Enums {#context lib="gtk" prefix ="gtk"#}@@ -96,6 +130,12 @@ instance Flags AccelFlags +#if GTK_CHECK_VERSION(3,0,0)+-- | State of an accelerator+--+{#enum Align {underscoreToCase} deriving(Bounded,Eq,Show)#}+#endif+ -- | Arrow directions for the arrow widget -- {#enum ArrowType {underscoreToCase} deriving (Eq,Show)#}@@ -106,13 +146,23 @@ instance Flags AttachOptions +#if GTK_CHECK_VERSION(3,10,0)+-- | Whenever a container has some form of natural row it may align children in +-- that row along a common typographical baseline. If the amount of vertical space+-- in the row is taller than the total requested height of the baseline-aligned+-- children then it can use a BaselinePosition to select where to put the+-- baseline inside the extra available space.+--+{#enum BaselinePosition {underscoreToCase} deriving (Eq,Show)#}+#endif+ -- | Mouse buttons. -- data MouseButton = LeftButton- | MiddleButton- | RightButton- | OtherButton Int- deriving (Eq,Show)+ | MiddleButton+ | RightButton+ | OtherButton Int+ deriving (Eq,Show) instance Enum MouseButton where toEnum 1 = LeftButton@@ -137,9 +187,9 @@ -- | Type of mouse click -- data Click = SingleClick- | DoubleClick- | TripleClick- | ReleaseClick+ | DoubleClick+ | TripleClick+ | ReleaseClick deriving (Eq,Show,Enum) -- | Specifies in which corner a child widget should be placed@@ -205,19 +255,29 @@ -- {#enum Justification {underscoreToCase} deriving (Eq,Show)#} +#if GTK_CHECK_VERSION(3,6,0)+{#enum LevelBarMode {underscoreToCase} deriving (Eq,Show)#}+#endif++#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- | Some kind of string search options --+-- Removed in Gtk3. {#enum MatchType {underscoreToCase} deriving (Eq,Show)#} #endif+#endif -- | From where was a menu item entered? -- {#enum MenuDirectionType {underscoreToCase} deriving (Eq,Show)#} +#if GTK_MAJOR_VERSION < 3 -- | Units of measure --+-- Removed in Gtk3. {#enum MetricType {underscoreToCase} deriving (Eq,Show)#}+#endif -- | Movement in text widget --@@ -232,7 +292,7 @@ -- * The 'Packing' parameter determines how the child behaves in the horizontal -- or vertical way in an 'Graphics.UI.Gtk.Layout.HBox' or -- 'Graphics.UI.Gtk.Layout.VBox', respectively. 'PackNatural'--- means the child is as big as it reqests. It will stay at the start of the+-- means the child is as big as it requests. It will stay at the start or -- end of a 'Graphics.UI.Gtk.Layout.Box' if there is more space available. -- All children packed with 'PackRepel' will be padded on both sides with -- additional space. 'PackGrow' will increase the size of a widget so that it@@ -246,12 +306,12 @@ -- it is irrelevant whether the main area is inserted at the start or -- the end of a box. Finally 'PackRepel' is most useful in a window -- where no widget can make use of excess space. Examples include a--- dialog box without list boxes or text fields. +-- dialog box without list boxes or text fields. -- data Packing = PackRepel- | PackGrow- | PackNatural- deriving (Enum,Eq,Show)+ | PackGrow+ | PackNatural+ deriving (Enum,Eq,Show) -- The conversions between our Packing type and Gtk's expand and fill -- properties.@@ -283,14 +343,17 @@ {#enum PolicyType {underscoreToCase} deriving (Eq,Show)#} -- | Position a scale's value is drawn relative to the--- trough+-- through -- {#enum PositionType {underscoreToCase} deriving (Eq,Show)#} +#if GTK_MAJOR_VERSION < 3 -- | Is the ProgressBar horizontally or vertically -- directed? --+-- Removed in Gtk3. {#enum ProgressBarOrientation {underscoreToCase} deriving (Eq,Show)#}+#endif -- | I don't have a clue. --@@ -330,7 +393,17 @@ -- {#enum ShadowType {underscoreToCase} deriving (Eq,Show)#} --- Sort a 'Graphics.UI.Gtk.TreeList.TreeViewColumn' in ascending or descending+#if GTK_CHECK_VERSION(3,0,0)+-- | Describes a widget state. Widget states are used to match the widget against+-- CSS pseudo-classes. Note that GTK extends the regular CSS classes and+-- sometimes uses different names.+--+{#enum StateFlags {underscoreToCase} deriving (Bounded,Eq,Show)#}++instance Flags StateFlags+#endif++-- Sort a 'Graphics.UI.Gtk.ModelView.TreeViewColumn' in ascending or descending -- order. -- {#enum SortType {underscoreToCase} deriving (Eq,Show)#}@@ -339,15 +412,19 @@ -- {#enum StateType {underscoreToCase} deriving (Eq,Show)#} +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- | Submenu direction policies --+-- Removed in Gtk3. {#enum SubmenuDirection {underscoreToCase} deriving (Eq,Show)#} -- | Submenu placement policies --+-- Removed in Gtk3. {#enum SubmenuPlacement {underscoreToCase} deriving (Eq,Show)#} #endif+#endif -- | Whether to clamp or ignore illegal values. --@@ -358,14 +435,14 @@ {#enum SpinType {underscoreToCase} deriving (Eq,Show)#} -- | The 'TargetFlags' enumeration is used to specify constraints on an entry--- in a 'Graphics.UI.Gtk.Gdk.Selection.TargetList'. These flags are only--- used for drag and drop.+-- in a 'Graphics.UI.Gtk.Gdk.Selection.TargetList'. These flags are only+-- used for drag and drop. -- -- * If the 'TargetSameApp' flag is set, the target will only be selected for--- drags within a single application.+-- drags within a single application. -- -- * If the 'TargetSameWidget' flag is set, the target will only be selected--- for drags within a single widget.+-- for drags within a single widget. -- {#enum TargetFlags {underscoreToCase} deriving(Bounded,Eq,Show) #} @@ -390,22 +467,25 @@ -- {#enum ToolbarStyle {underscoreToCase} deriving (Eq,Show)#} --- | Wether columns of a tree or list widget can be resized.+-- | Whether columns of a tree or list widget can be resized. -- {#enum TreeViewColumnSizing {underscoreToCase} deriving (Eq,Show)#} -- hm... text editing? --{#enum TroughType {underscoreToCase} deriving (Eq,Show)#} -+#if GTK_MAJOR_VERSION < 3 -- | Updating types for range widgets (determines when the -- @\"connectToValueChanged\"@ signal is emitted by the widget) --+-- Removed in Gtk3. {#enum UpdateType {underscoreToCase} deriving (Eq,Show)#} -- | Visibility --+-- Removed in Gtk3. {#enum Visibility {underscoreToCase} deriving (Eq,Show)#}+#endif -- | Window position types --@@ -419,4 +499,19 @@ -- {#enum WrapMode {underscoreToCase} deriving (Eq,Show)#} +#if GTK_CHECK_VERSION(2,16,0)+-- | Specifies the side of the entry at which an icon is placed.+--+{#enum EntryIconPosition {underscoreToCase} deriving (Eq,Show)#}+#endif +#if GTK_MAJOR_VERSION < 3+-- |+--+-- Removed in Gtk3.+{#enum AnchorType {underscoreToCase} deriving (Eq,Show)#}+#endif++#if GTK_CHECK_VERSION(3,10,0)+{#enum StackTransitionType {underscoreToCase} deriving (Eq,Show)#}+#endif
Graphics/UI/Gtk/General/General.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) General --@@ -17,10 +18,6 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. ----- TODO------ quitAddDestroy, quitAdd, quitRemove--- -- | -- Maintainer : gtk2hs-users@lists.sourceforge.net -- Stability : provisional@@ -39,7 +36,7 @@ postGUIAsync, threadsEnter, threadsLeave,- + -- * Main event loop mainGUI, mainQuit,@@ -50,12 +47,19 @@ mainIteration, mainIterationDo, mainDoEvent,- ++ -- ** Call when mainloop is left+#if GTK_MAJOR_VERSION < 3+ quitAddDestroy,+ quitAdd,+ quitRemove,+#endif+ -- * Grab widgets grabAdd, grabGetCurrent, grabRemove,- + -- * Timeout and idle callbacks Priority, priorityLow,@@ -75,11 +79,12 @@ FD ) where +import Control.Applicative+import Prelude import System.Environment (getProgName, getArgs)-import Control.Monad (liftM, mapM, when)+import Control.Monad (liftM, when) import Control.Concurrent (rtsSupportsBoundThreads, newEmptyMVar, putMVar, takeMVar)-import Data.IORef (IORef, newIORef, readIORef, writeIORef) import System.Glib.FFI import System.Glib.UTFString@@ -87,7 +92,7 @@ import System.Glib.MainLoop ( Priority, priorityLow, priorityDefaultIdle, priorityHighIdle, priorityDefault, priorityHigh, timeoutRemove, idleRemove, inputRemove, IOCondition(..), HandlerId )-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) import Graphics.UI.Gtk.Gdk.EventM (EventM) import Control.Monad.Reader (ask) import Control.Monad.Trans (liftIO)@@ -96,11 +101,11 @@ {#context lib="gtk" prefix ="gtk"#} {---- | Retreive the current language.+-- | Retrieve the current language. -- * This function returns a String which's pointer can be used later on for -- comarisions. -----getDefaultLanguage :: IO String+--getDefaultLanguage :: GlibString string => IO string --getDefaultLanguage = do -- strPtr <- {#call unsafe get_default_language#} -- str <- peekUTFString strPtr@@ -110,7 +115,7 @@ unsafeInitGUIForThreadedRTS = initGUI --- We compile this module using -#includ"gtk/wingtk.h" to bypass the win32 abi+-- We compile this module using -#include"gtk/wingtk.h" to bypass the win32 abi -- check however we do not compile users programs with this header so if -- initGUI was ever inlined in a users program, then that program would not -- bypass the abi check and would fail on startup. So to stop that we must@@ -137,21 +142,22 @@ -- initGUI :: IO [String] initGUI = do+ initialise when rtsSupportsBoundThreads initialiseGThreads -- note: initizliseGThreads calls 'threadsEnter' prog <- getProgName args <- getArgs let allArgs = (prog:args)- withMany withUTFString allArgs $ \addrs ->+ withMany withUTFString (map stringToGlib allArgs) $ \addrs -> withArrayLen addrs $ \argc argv ->- with argv $ \argvp ->- with argc $ \argcp -> do + with argv $ \argvp ->+ with argc $ \argcp -> do res <- {#call unsafe init_check#} (castPtr argcp) (castPtr argvp) if (toBool res) then do argc' <- peek argcp argv' <- peek argvp _:addrs' <- peekArray argc' argv' -- drop the program name- mapM peekUTFString addrs'+ mapM ((glibToString <$>) . peekUTFString) addrs' else error "Cannot initialize GUI." -- g_thread_init aborts the whole program if it's called more than once so@@ -160,6 +166,9 @@ foreign import ccall "hsgthread.h gtk2hs_threads_initialise" initialiseGThreads :: IO () +foreign import ccall "hsgthread.h gtk2hs_initialise"+ initialise :: IO ()+ -- | Post an action to be run in the main GUI thread. -- -- The current thread blocks until the action completes and the result is@@ -200,7 +209,7 @@ -- their arguments from the main loop, that is, from the OS thread of Gtk, -- thereby ensuring that any Gtk and OS function can be called. ---{#fun unsafe gdk_threads_enter as threadsEnter {} -> `()' #}+{#fun gdk_threads_enter as threadsEnter {} -> `()' #} -- | Release the global Gtk lock. --@@ -211,7 +220,7 @@ -- | Inquire the number of events pending on the event queue -- eventsPending :: IO Int-eventsPending = liftM fromIntegral {#call unsafe events_pending#}+eventsPending = liftM fromIntegral {#call events_pending#} -- | Run the Gtk+ main event loop. --@@ -248,48 +257,90 @@ -- * Returns @True@ if the 'mainQuit' was called while processing the event. -- mainIterationDo :: Bool -> IO Bool-mainIterationDo blocking = +mainIterationDo blocking = liftM toBool $ {#call main_iteration_do#} (fromBool blocking) -- | Processes a single GDK event. This is public only to allow filtering of events between GDK and -- GTK+. You will not usually need to call this function directly.--- +-- -- While you should not call this function directly, you might want to know how exactly events are -- handled. So here is what this function does with the event:--- --- 1. Compress enter/leave notify events. If the event passed build an enter/leave pair together with+--+-- 1. Compress enter\/leave notify events. If the event passed build an enter\/leave pair together with -- the next event (peeked from GDK) both events are thrown away. This is to avoid a backlog of -- (de-)highlighting widgets crossed by the pointer.--- +-- -- 2. Find the widget which got the event. If the widget can't be determined the event is thrown away -- unless it belongs to a INCR transaction. In that case it is passed to -- 'selectionIncrEvent'.--- +-- -- 3. Then the event is passed on a stack so you can query the currently handled event with -- 'getCurrentEvent'.--- +-- -- 4. The event is sent to a widget. If a grab is active all events for widgets that are not in the -- contained in the grab widget are sent to the latter with a few exceptions:--- +-- -- * Deletion and destruction events are still sent to the event widget for obvious reasons.--- +-- -- * Events which directly relate to the visual representation of the event widget.--- +-- -- * Leave events are delivered to the event widget if there was an enter event delivered to it -- before without the paired leave event.--- +-- -- * Drag events are not redirected because it is unclear what the semantics of that would be.--- +-- -- Another point of interest might be that all key events are first passed through the key snooper -- functions if there are any. Read the description of 'keySnooperInstall' if you need this -- feature.--- +-- -- 5. After finishing the delivery the event is popped from the event stack. mainDoEvent :: EventM t () mainDoEvent = do ptr <- ask liftIO $ {#call main_do_event #} (castPtr ptr) +#if GTK_MAJOR_VERSION < 3+-- | Trigger destruction of object in case the mainloop at level @mainLevel@ is quit.+--+-- Removed in Gtk3.+quitAddDestroy :: ObjectClass obj+ => Int -- ^ @mainLevel@ Level of the mainloop which shall trigger the destruction.+ -> obj -- ^ @object@ Object to be destroyed.+ -> IO ()+quitAddDestroy mainLevel obj =+ {#call quit_add_destroy #}+ (fromIntegral mainLevel)+ (toObject obj)++-- | Registers a function to be called when an instance of the mainloop is left.+--+-- Removed in Gtk3.+quitAdd :: Int -- ^ @mainLevel@ Level at which termination the function shall be called. You can pass 0 here to have the function run at the current mainloop.+ -> (IO Bool) -- ^ @function@ The function to call. This should return 'False' to be removed from the list of quit handlers. Otherwise the function might be called again.+ -> IO Int -- ^ returns A handle for this quit handler (you need this for 'quitRemove')+quitAdd mainLevel func = do+ funcPtr <- mkGtkFunction $ \ _ ->+ liftM fromBool func+ liftM fromIntegral $+ {#call quit_add #}+ (fromIntegral mainLevel)+ funcPtr+ nullPtr++{#pointer GtkFunction#}++foreign import ccall "wrapper" mkGtkFunction ::+ (Ptr () -> IO {#type gboolean#}) -> IO GtkFunction++-- | Removes a quit handler by its identifier.+--+-- Removed in Gtk3.+quitRemove :: Int -- ^ @quitHandlerId@ Identifier for the handler returned when installing it.+ -> IO ()+quitRemove quitHandlerId =+ {#call quit_remove #} (fromIntegral quitHandlerId)+#endif+ -- | add a grab widget -- grabAdd :: WidgetClass wd => wd -> IO ()@@ -300,7 +351,7 @@ grabGetCurrent :: IO (Maybe Widget) grabGetCurrent = do wPtr <- {#call grab_get_current#}- if (wPtr==nullPtr) then return Nothing else + if (wPtr==nullPtr) then return Nothing else liftM Just $ makeNewObject mkWidget (return wPtr) -- | remove a grab widget
Graphics/UI/Gtk/General/IconFactory.chs view
@@ -18,14 +18,6 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. ----- TODO------ The following functions are not bound:--- iconFactoryLookup, iconFactoryLookupDefault--- It is not a good idea to lookup an IconSet directly. If an Icon needs to--- be displayed it happends always in the context of a widget. The best--- practice is to get the widgets Style and call styleLookupIconSet.--- -- | -- Maintainer : gtk2hs-users@lists.sourceforge.net -- Stability : provisional@@ -35,7 +27,7 @@ -- module Graphics.UI.Gtk.General.IconFactory ( -- * Detail--- +-- -- | Browse the available stock icons in the list of stock IDs found here. You -- can also use the gtk-demo application for this purpose. --@@ -111,15 +103,16 @@ iconSizeGetName ) where -import Control.Monad (liftM)+import Control.Applicative+import Prelude+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString-import System.Glib.GObject (constructNewGObject, makeNewGObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (TextDirection(..), StateType(..))+import Graphics.UI.Gtk.General.Enums (TextDirection(..), StateType(..)) import Graphics.UI.Gtk.General.StockItems-import Graphics.UI.Gtk.General.Structs (IconSize(..))+import Graphics.UI.Gtk.General.Structs (IconSize(..)) {# context lib="gtk" prefix="gtk" #} @@ -133,7 +126,7 @@ where lookupSizeString n = do ptr <- {#call unsafe icon_size_get_name#} (fromIntegral n)- if ptr==nullPtr then return "" else peekUTFString ptr+ if ptr==nullPtr then return "" else glibToString <$> peekUTFString ptr -------------------- -- Constructors@@ -149,7 +142,7 @@ -- iconFactoryNew :: IO IconFactory iconFactoryNew =- constructNewGObject mkIconFactory {#call unsafe icon_factory_new#}+ wrapNewGObject mkIconFactory {#call unsafe icon_factory_new#} -------------------- -- Methods@@ -222,7 +215,7 @@ -> IconSize -> widget -> IO Pixbuf-iconSetRenderIcon set dir state size widget = makeNewGObject mkPixbuf $+iconSetRenderIcon set dir state size widget = wrapNewGObject mkPixbuf $ {#call icon_set_render_icon#} set (Style nullForeignPtr) ((fromIntegral.fromEnum) dir) ((fromIntegral.fromEnum) state) ((fromIntegral.fromEnum) size) (toWidget widget) nullPtr@@ -231,7 +224,7 @@ -- -- * Each icon in an application is contained in an 'IconSet'. The -- 'IconSet' contains several variants ('IconSource's) to--- accomodate for different sizes and states.+-- accommodate for different sizes and states. -- iconSetNew :: IO IconSet iconSetNew = do@@ -267,7 +260,7 @@ -- | Check if a given IconSize is registered. -- -- * Useful if your application expects a theme to install a set with a--- specific size. You can test if this actually happend and use another size+-- specific size. You can test if this actually happens and use another size -- if not. -- iconSizeCheck :: IconSize -> IO Bool@@ -276,18 +269,18 @@ -- | Register a new IconSize. ---iconSizeRegister ::- String -- ^ the new name of the size+iconSizeRegister :: GlibString string+ => string -- ^ the new name of the size -> Int -- ^ the width of the icon -> Int -- ^ the height of the icon -> IO IconSize -- ^ the new icon size iconSizeRegister name width height = liftM (toEnum . fromIntegral) $- withUTFString name $ \strPtr -> {#call unsafe icon_size_register#} + withUTFString name $ \strPtr -> {#call unsafe icon_size_register#} strPtr (fromIntegral width) (fromIntegral height) -- | Register an additional alias for a name. ---iconSizeRegisterAlias :: IconSize -> String -> IO ()+iconSizeRegisterAlias :: GlibString string => IconSize -> string -> IO () iconSizeRegisterAlias target alias = withUTFString alias $ \strPtr -> {#call unsafe icon_size_register_alias#} strPtr ((fromIntegral . fromEnum) target) @@ -296,7 +289,7 @@ -- * This fixed value 'iconSizeInvalid' is returned if the name was -- not found. ---iconSizeFromName :: String -> IO IconSize+iconSizeFromName :: GlibString string => string -> IO IconSize iconSizeFromName name = liftM (toEnum . fromIntegral) $ withUTFString name {#call unsafe icon_size_from_name#} @@ -304,7 +297,7 @@ -- -- * Returns @Nothing@ if the name was not found. ---iconSizeGetName :: IconSize -> IO (Maybe String)+iconSizeGetName :: GlibString string => IconSize -> IO (Maybe string) iconSizeGetName size = do strPtr <- {#call unsafe icon_size_get_name#} ((fromIntegral . fromEnum) size) if strPtr==nullPtr then return Nothing else liftM Just $ peekUTFString strPtr@@ -325,9 +318,9 @@ -- -- * Returns @Nothing@ if the IconSource was generated by a Pixbuf. ---iconSourceGetFilename :: IconSource -> IO (Maybe String)+iconSourceGetFilename :: GlibString string => IconSource -> IO (Maybe string) iconSourceGetFilename is = do-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) +#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 strPtr <- {#call unsafe icon_source_get_filename_utf8#} is #else strPtr <- {#call unsafe icon_source_get_filename#} is@@ -349,7 +342,7 @@ -- | Retrieve the 'StateType' of this -- 'IconSource'. ----- * @Nothing@ is returned if the 'IconSource' matches all +-- * @Nothing@ is returned if the 'IconSource' matches all -- states. -- iconSourceGetState :: IconSource -> IO (Maybe StateType)@@ -389,12 +382,12 @@ -- | Load an icon picture from this filename. ---iconSourceSetFilename :: IconSource -> FilePath -> IO ()-iconSourceSetFilename is name = -#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) - withUTFString name $ {# call unsafe icon_source_set_filename_utf8 #} is+iconSourceSetFilename :: GlibFilePath fp => IconSource -> fp -> IO ()+iconSourceSetFilename is name =+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3+ withUTFFilePath name $ {# call unsafe icon_source_set_filename_utf8 #} is #else- withUTFString name $ {# call unsafe icon_source_set_filename #} is+ withUTFFilePath name $ {# call unsafe icon_source_set_filename #} is #endif -- | Retrieves the source pixbuf, or Nothing if none is set.@@ -422,7 +415,7 @@ -- 'IconSource' so that is matches anything. -- iconSourceResetSize :: IconSource -> IO ()-iconSourceResetSize is = +iconSourceResetSize is = {#call unsafe icon_source_set_size_wildcarded#} is (fromBool True) -- | Mark this icon to be used only with this@@ -437,5 +430,5 @@ -- 'IconSource' so that is matches anything. -- iconSourceResetState :: IconSource -> IO ()-iconSourceResetState is = +iconSourceResetState is = {#call unsafe icon_source_set_state_wildcarded#} is (fromBool True)
Graphics/UI/Gtk/General/IconTheme.chs view
@@ -33,31 +33,31 @@ -- -- | 'IconTheme' provides a facility for looking up icons by name and size. The main reason for using a -- name rather than simply providing a filename is to allow different icons to be used depending on--- what icon theme is selecetd by the user. The operation of icon themes on Linux and Unix follows the+-- what icon theme is selected by the user. The operation of icon themes on Linux and Unix follows the -- Icon Theme Specification. There is a default icon theme, named hicolor where applications should -- install their icons, but more additional application themes can be installed as operating system -- vendors and users choose.--- +-- -- Named icons are similar to the Themeable Stock Images facility, and the distinction between the -- two may be a bit confusing. A few things to keep in mind:--- +-- -- * Stock images usually are used in conjunction with Stock Items, such as ''StockOk'' or -- ''StockOpen''. Named icons are easier to set up and therefore are more useful for new icons -- that an application wants to add, such as application icons or window icons.--- +-- -- * Stock images can only be loaded at the symbolic sizes defined by the 'IconSize' enumeration, or -- by custom sizes defined by 'iconSizeRegister', while named icons are more flexible and any -- pixel size can be specified.--- +-- -- * Because stock images are closely tied to stock items, and thus to actions in the user interface, -- stock images may come in multiple variants for different widget states or writing directions.--- +-- -- A good rule of thumb is that if there is a stock image for what you want to use, use it, otherwise -- use a named icon. It turns out that internally stock images are generally defined in terms of one or -- more named icons. (An example of the more than one case is icons that depend on writing direction; -- ''StockGoForward'' uses the two themed icons 'gtkStockGoForwardLtr' and -- 'gtkStockGoForwardRtl'.)--- +-- -- In many cases, named themes are used indirectly, via 'Image' or stock items, rather than directly, -- but looking up icons directly is also simple. The 'IconTheme' object acts as a database of all the -- icons in the current theme. You can create new 'IconTheme' objects, but its much more efficient to@@ -107,7 +107,7 @@ iconThemeChooseIcon, #ifdef HAVE_GIO #if GTK_CHECK_VERSION(2,14,0)- iconThemeLookupByGicon,+ iconThemeLookupByGIcon, #endif #endif #endif@@ -139,16 +139,12 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Attributes-import System.Glib.Properties import System.Glib.UTFString import System.Glib.GList-import System.Glib.Flags-import System.Glib.GObject (constructNewGObject, makeNewGObject, Quark)-import System.Glib.GError (GErrorDomain, GErrorClass(..), propagateGError)+import System.Glib.GError (propagateGError) import Graphics.UI.Gtk.General.Structs (Rectangle, Point) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}@@ -175,7 +171,7 @@ -- iconThemeNew :: IO IconTheme iconThemeNew =- constructNewGObject mkIconTheme $+ wrapNewGObject mkIconTheme $ {# call gtk_icon_theme_new #} --------------------@@ -186,7 +182,7 @@ iconThemeGetDefault :: IO IconTheme -- ^ returns A unique 'IconTheme' associated with the default -- screen. This icon theme is associated with the screen and- -- can be used as long as the screen is open. + -- can be used as long as the screen is open. iconThemeGetDefault = makeNewGObject mkIconTheme $ {# call gtk_icon_theme_get_default #}@@ -201,7 +197,7 @@ iconThemeGetForScreen :: Screen -- ^ @screen@ - a 'Screen' -> IO IconTheme -- ^ returns A unique 'IconTheme' associated with the given- -- screen. + -- screen. iconThemeGetForScreen screen = makeNewGObject mkIconTheme $ {# call gtk_icon_theme_get_for_screen #}@@ -232,13 +228,13 @@ -- default icon theme, which is called DEFAULT_THEME_NAME, rather than directly -- on the icon path.) ---iconThemeSetSearchPath :: IconThemeClass self => self- -> [FilePath] -- ^ @path@ - list of directories that are searched for icon+iconThemeSetSearchPath :: (IconThemeClass self, GlibFilePath fp) => self+ -> [fp] -- ^ @path@ - list of directories that are searched for icon -- themes -> Int -- ^ @nElements@ - number of elements in @path@. -> IO () iconThemeSetSearchPath self path nElements =- withUTFStringArray path $ \pathPtr ->+ withUTFFilePathArray path $ \pathPtr -> {# call gtk_icon_theme_set_search_path #} (toIconTheme self) pathPtr@@ -246,39 +242,39 @@ -- | Gets the current search path. See 'iconThemeSetSearchPath'. ---iconThemeGetSearchPath :: IconThemeClass self => self- -> IO ([FilePath], Int) -- ^ @(path, nElements)@ +iconThemeGetSearchPath :: (IconThemeClass self, GlibFilePath fp) => self+ -> IO ([fp], Int) -- ^ @(path, nElements)@ -- @path@ - location to store a list of icon theme path- -- directories. + -- directories. iconThemeGetSearchPath self =- alloca $ \nElementsPtr -> + alloca $ \nElementsPtr -> allocaArray 0 $ \pathPtr -> do {# call gtk_icon_theme_get_search_path #} (toIconTheme self) (castPtr pathPtr) nElementsPtr- pathStr <- readUTFStringArray0 pathPtr+ pathStr <- readUTFFilePathArray0 pathPtr nElements <- peek nElementsPtr return (pathStr, fromIntegral nElements) -- | Appends a directory to the search path. See 'iconThemeSetSearchPath'. ---iconThemeAppendSearchPath :: IconThemeClass self => self- -> FilePath -- ^ @path@ - directory name to append to the icon path+iconThemeAppendSearchPath :: (IconThemeClass self, GlibFilePath fp) => self+ -> fp -- ^ @path@ - directory name to append to the icon path -> IO () iconThemeAppendSearchPath self path =- withUTFString path $ \pathPtr ->+ withUTFFilePath path $ \pathPtr -> {# call gtk_icon_theme_append_search_path #} (toIconTheme self) pathPtr -- | Prepends a directory to the search path. See 'iconThemeSetSearchPath'. ---iconThemePrependSearchPath :: IconThemeClass self => self- -> FilePath -- ^ @path@ - directory name to prepend to the icon path+iconThemePrependSearchPath :: (IconThemeClass self, GlibFilePath fp) => self+ -> fp -- ^ @path@ - directory name to prepend to the icon path -> IO () iconThemePrependSearchPath self path =- withUTFString path $ \pathPtr ->+ withUTFFilePath path $ \pathPtr -> {# call gtk_icon_theme_prepend_search_path #} (toIconTheme self) pathPtr@@ -288,8 +284,8 @@ -- theme objects returned from 'iconThemeGetDefault' and -- 'iconThemeGetForScreen'. ---iconThemeSetCustomTheme :: IconThemeClass self => self- -> (Maybe String) -- ^ @themeName@ name of icon theme to use instead of configured theme, or 'Nothing' to unset a previously set custom theme+iconThemeSetCustomTheme :: (IconThemeClass self, GlibString string) => self+ -> (Maybe string) -- ^ @themeName@ name of icon theme to use instead of configured theme, or 'Nothing' to unset a previously set custom theme -> IO () iconThemeSetCustomTheme self themeName = maybeWith withUTFString themeName $ \themeNamePtr ->@@ -299,8 +295,8 @@ -- | Checks whether an icon theme includes an icon for a particular name. ---iconThemeHasIcon :: IconThemeClass self => self- -> String -- ^ @iconName@ - the name of an icon+iconThemeHasIcon :: (IconThemeClass self, GlibString string) => self+ -> string -- ^ @iconName@ - the name of an icon -> IO Bool -- ^ returns @True@ if @iconTheme@ includes an icon for -- @iconName@. iconThemeHasIcon self iconName =@@ -315,14 +311,14 @@ -- using 'iconInfoLoadIcon'. ('iconThemeLoadIcon' combines these two steps if -- all you need is the pixbuf.) ---iconThemeLookupIcon :: IconThemeClass self => self- -> String -- ^ @iconName@ - the name of the icon to lookup+iconThemeLookupIcon :: (IconThemeClass self, GlibString string) => self+ -> string -- ^ @iconName@ - the name of the icon to lookup -> Int -- ^ @size@ - desired icon size -> IconLookupFlags -- ^ @flags@ - flags modifying the behavior of the -- icon lookup -> IO (Maybe IconInfo) -- ^ returns a 'IconInfo' -- structure containing information about the icon, or- -- 'Nothing' if the icon wasn't found. + -- 'Nothing' if the icon wasn't found. iconThemeLookupIcon self iconName size flags = withUTFString iconName $ \iconNamePtr -> do iiPtr <- {# call gtk_icon_theme_lookup_icon #}@@ -330,7 +326,7 @@ iconNamePtr (fromIntegral size) ((fromIntegral . fromEnum) flags)- if iiPtr == nullPtr + if iiPtr == nullPtr then return Nothing else liftM Just (mkIconInfo (castPtr iiPtr)) @@ -345,14 +341,14 @@ -- -- * Available since Gtk+ version 2.12 ---iconThemeChooseIcon :: IconThemeClass self => self- -> [String] -- ^ @iconNames@ terminated list of icon names to lookup+iconThemeChooseIcon :: (IconThemeClass self, GlibString string) => self+ -> [string] -- ^ @iconNames@ terminated list of icon names to lookup -> Int -- ^ @size@ - desired icon size -> IconLookupFlags -- ^ @flags@ - flags modifying the behavior of the -- icon lookup -> IO (Maybe IconInfo) -- ^ returns a 'IconInfo' -- structure containing information about the icon, or- -- 'Nothing' if the icon wasn't found. + -- 'Nothing' if the icon wasn't found. iconThemeChooseIcon self iconNames size flags = withUTFStringArray0 iconNames $ \iconNamesPtr -> do iiPtr <- {# call gtk_icon_theme_choose_icon #}@@ -360,7 +356,7 @@ iconNamesPtr (fromIntegral size) ((fromIntegral . fromEnum) flags)- if iiPtr == nullPtr + if iiPtr == nullPtr then return Nothing else liftM Just (mkIconInfo (castPtr iiPtr)) @@ -372,21 +368,21 @@ -- -- * Available since Gtk+ version 2.14 ---iconThemeLookupByGicon :: (IconThemeClass self, IconClass icon) => self+iconThemeLookupByGIcon :: (IconThemeClass self, IconClass icon) => self -> icon -- ^ @icon@ - the 'Icon' to look up -> Int -- ^ @size@ - desired icon size -> IconLookupFlags -- ^ @flags@ - flags modifying the behavior of the -- icon lookup -> IO (Maybe IconInfo) -- ^ returns a 'IconInfo' -- structure containing information about the icon, or- -- 'Nothing' if the icon wasn't found. -iconThemeLookupByGicon self icon size flags = do+ -- 'Nothing' if the icon wasn't found.+iconThemeLookupByGIcon self icon size flags = do iiPtr <- {# call gtk_icon_theme_lookup_by_gicon #} (toIconTheme self) (toIcon icon) (fromIntegral size) ((fromIntegral . fromEnum) flags)- if iiPtr == nullPtr + if iiPtr == nullPtr then return Nothing else liftM Just (mkIconInfo (castPtr iiPtr)) #endif@@ -405,18 +401,18 @@ -- of the pixbuf returned by this function. Otherwise Gtk+ may need to keep the -- old icon theme loaded, which would be a waste of memory. ---iconThemeLoadIcon :: IconThemeClass self => self- -> String -- ^ @iconName@ - the name of the icon to lookup+iconThemeLoadIcon :: (IconThemeClass self, GlibString string) => self+ -> string -- ^ @iconName@ - the name of the icon to lookup -> Int -- ^ @size@ - the desired icon size. The resulting icon -- may not be exactly this size; see 'iconInfoLoadIcon'. -> IconLookupFlags -- ^ @flags@ - flags modifying the behavior of the icon -- lookup -> IO (Maybe Pixbuf) -- ^ returns the rendered icon; this may be a newly -- created icon or a new reference to an internal icon,- -- so you must not modify the icon. + -- so you must not modify the icon. -- `Nothing` if the icon isn't found. iconThemeLoadIcon self iconName size flags =- maybeNull (makeNewGObject mkPixbuf) $+ maybeNull (wrapNewGObject mkPixbuf) $ propagateGError $ \errorPtr -> withUTFString iconName $ \iconNamePtr -> {# call gtk_icon_theme_load_icon #}@@ -432,14 +428,14 @@ -- -- * Available since Gtk+ version 2.12 ---iconThemeListContexts :: IconThemeClass self => self- -> IO [String] -- ^ returns a String list+iconThemeListContexts :: (IconThemeClass self, GlibString string) => self+ -> IO [string] -- ^ returns a String list -- holding the names of all the contexts in the- -- theme. + -- theme. iconThemeListContexts self = do glistPtr <- {# call gtk_icon_theme_list_contexts #} (toIconTheme self) list <- fromGList glistPtr- result <- mapM readUTFString list + result <- mapM readUTFString list {#call unsafe g_list_free #} (castPtr glistPtr) return result #endif@@ -449,9 +445,9 @@ -- string is system dependent, but will typically include such values as -- \"Applications\" and \"MimeTypes\". ---iconThemeListIcons :: IconThemeClass self => self- -> (Maybe String) -- ^ @context@ a string identifying a particular type of icon, or 'Nothing' to list all icons.- -> IO [String] -- ^ returns a String list+iconThemeListIcons :: (IconThemeClass self, GlibString string) => self+ -> (Maybe string) -- ^ @context@ a string identifying a particular type of icon, or 'Nothing' to list all icons.+ -> IO [string] -- ^ returns a String list -- holding the names of all the icons in the theme. iconThemeListIcons self context = maybeWith withUTFString context $ \contextPtr -> do@@ -459,7 +455,7 @@ (toIconTheme self) contextPtr list <- fromGList glistPtr- result <- mapM readUTFString list + result <- mapM readUTFString list {#call unsafe g_list_free#} (castPtr glistPtr) return result @@ -470,10 +466,10 @@ -- -- * Available since Gtk+ version 2.6 ---iconThemeGetIconSizes :: IconThemeClass self => self- -> String -- ^ @iconName@ - the name of an icon+iconThemeGetIconSizes :: (IconThemeClass self, GlibString string) => self+ -> string -- ^ @iconName@ - the name of an icon -> IO [Int] -- ^ returns An newly allocated list describing the sizes at- -- which the icon is available. + -- which the icon is available. iconThemeGetIconSizes self iconName = withUTFString iconName $ \iconNamePtr -> do listPtr <- {# call gtk_icon_theme_get_icon_sizes #}@@ -487,8 +483,8 @@ -- | Gets the name of an icon that is representative of the current theme (for -- instance, to use when presenting a list of themes to the user.) ---iconThemeGetExampleIconName :: IconThemeClass self => self- -> IO (Maybe String) -- ^ returns the name of an example icon or `Nothing'+iconThemeGetExampleIconName :: (IconThemeClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns the name of an example icon or `Nothing' iconThemeGetExampleIconName self = do namePtr <- {# call gtk_icon_theme_get_example_icon_name #} (toIconTheme self) if namePtr == nullPtr@@ -518,8 +514,8 @@ -- This function will generally be used with pixbufs loaded via -- 'pixbufNewFromInline'. ---iconThemeAddBuiltinIcon ::- String -- ^ @iconName@ - the name of the icon to register+iconThemeAddBuiltinIcon :: GlibString string =>+ string -- ^ @iconName@ - the name of the icon to register -> Int -- ^ @size@ - the size at which to register the icon (different -- images can be registered for the same icon name at different -- sizes.)@@ -548,7 +544,7 @@ -- | Helper function for build 'IconInfo' mkIconInfo :: Ptr IconInfo -> IO IconInfo-mkIconInfo infoPtr = +mkIconInfo infoPtr = liftM IconInfo $ newForeignPtr infoPtr icon_info_free --------------------@@ -558,7 +554,7 @@ -- | -- iconInfoNewForPixbuf :: IconThemeClass iconTheme => iconTheme -> Pixbuf -> IO IconInfo-iconInfoNewForPixbuf iconTheme pixbuf = +iconInfoNewForPixbuf iconTheme pixbuf = {# call gtk_icon_info_new_for_pixbuf #} (toIconTheme iconTheme) pixbuf@@ -571,7 +567,7 @@ -- | -- iconInfoCopy :: IconInfo -> IO IconInfo-iconInfoCopy self = +iconInfoCopy self = {# call gtk_icon_info_copy #} self >>= mkIconInfo @@ -579,14 +575,14 @@ -- used as anchor points for attaching emblems or overlays to the icon. iconInfoGetAttachPoints :: IconInfo -> IO (Maybe [Point]) iconInfoGetAttachPoints self =- alloca $ \arrPtrPtr -> + alloca $ \arrPtrPtr -> alloca $ \nPointsPtr -> do- success <- liftM toBool $ + success <- liftM toBool $ {# call gtk_icon_info_get_attach_points #} self (castPtr arrPtrPtr) nPointsPtr- if success + if success then do arrPtr <- peek arrPtrPtr nPoints <- peek nPointsPtr@@ -599,16 +595,16 @@ -- theme creator. This may be different than the actual size of image; an example of this is small -- emblem icons that can be attached to a larger icon. These icons will be given the same base size as -- the larger icons to which they are attached.--- +-- iconInfoGetBaseSize :: IconInfo -> IO Int-iconInfoGetBaseSize self = +iconInfoGetBaseSize self = liftM fromIntegral $ {# call gtk_icon_info_get_base_size #} self -- | Gets the built-in image for this icon, if any. To allow GTK+ to use built in icon images, you must -- pass the ''IconLookupUseBuiltin'' to 'iconThemeLookupIcon'.-iconInfoGetBuiltinPixbuf :: IconInfo - -> IO (Maybe Pixbuf) -- ^ returns the built-in image pixbuf, or 'Nothing'. +iconInfoGetBuiltinPixbuf :: IconInfo+ -> IO (Maybe Pixbuf) -- ^ returns the built-in image pixbuf, or 'Nothing'. iconInfoGetBuiltinPixbuf self = do pixbufPtr <- {# call gtk_icon_info_get_builtin_pixbuf #} self if pixbufPtr == nullPtr@@ -617,19 +613,19 @@ -- | Gets the display name for an icon. A display name is a string to be used in place of the icon name -- in a user visible context like a list of icons.-iconInfoGetDisplayName :: IconInfo - -> IO (Maybe String) -- ^ returns the display name for the icon or 'Nothing', if the icon doesn't have a specified display name. +iconInfoGetDisplayName :: GlibString string => IconInfo+ -> IO (Maybe string) -- ^ returns the display name for the icon or 'Nothing', if the icon doesn't have a specified display name. iconInfoGetDisplayName self = do strPtr <- {# call gtk_icon_info_get_display_name #} self- if strPtr == nullPtr + if strPtr == nullPtr then return Nothing else liftM Just $ peekUTFString strPtr -- | Gets the coordinates of a rectangle within the icon that can be used for display of information such -- as a preview of the contents of a text file. See 'iconInfoSetRawCoordinates' for further -- information about the coordinate system.-iconInfoGetEmbeddedRect :: IconInfo - -> IO (Maybe Rectangle) -- ^ @rectangle@ 'Rectangle' in which to store embedded +iconInfoGetEmbeddedRect :: IconInfo+ -> IO (Maybe Rectangle) -- ^ @rectangle@ 'Rectangle' in which to store embedded -- rectangle coordinates. iconInfoGetEmbeddedRect self = alloca $ \rectPtr -> do@@ -644,19 +640,19 @@ -- | Gets the filename for the icon. If the ''IconLookupUseBuiltin'' flag was passed to -- 'iconThemeLookupIcon', there may be no filename if a builtin icon is returned; in this case, -- you should use 'iconInfoGetBuiltinPixbuf'.-iconInfoGetFilename :: IconInfo - -> IO (Maybe String) -- ^ returns the filename for the icon, - -- or 'Nothing' if 'iconInfoGetBuiltinPixbuf' should be used instead. +iconInfoGetFilename :: GlibString string => IconInfo+ -> IO (Maybe string) -- ^ returns the filename for the icon,+ -- or 'Nothing' if 'iconInfoGetBuiltinPixbuf' should be used instead. iconInfoGetFilename self = do namePtr <- {# call gtk_icon_info_get_filename #} self if namePtr == nullPtr- then return Nothing + then return Nothing else liftM Just $ peekUTFString namePtr -- | Looks up an icon in an icon theme, scales it to the given size and renders it into a pixbuf. This is -- a convenience function; if more details about the icon are needed, use 'iconThemeLookupIcon' -- followed by 'iconInfoLoadIcon'.--- +-- -- Note that you probably want to listen for icon theme changes and update the icon. This is usually -- done by connecting to the 'styleSet' signal. If for some reason you do not want to update -- the icon when the icon theme changes, you should consider using 'pixbufCopy' to make a private@@ -664,7 +660,7 @@ -- loaded, which would be a waste of memory. iconInfoLoadIcon :: IconInfo -> IO Pixbuf iconInfoLoadIcon self =- makeNewGObject mkPixbuf $+ wrapNewGObject mkPixbuf $ propagateGError $ \errorPtr -> {# call gtk_icon_info_load_icon #} self@@ -673,17 +669,17 @@ -- | Sets whether the coordinates returned by 'iconInfoGetEmbeddedRect' and -- 'iconInfoGetAttachPoints' should be returned in their original form as specified in the icon -- theme, instead of scaled appropriately for the pixbuf returned by 'iconInfoLoadIcon'.--- +-- -- Raw coordinates are somewhat strange; they are specified to be with respect to the unscaled pixmap -- for PNG and XPM icons, but for SVG icons, they are in a 1000x1000 coordinate space that is scaled to -- the final size of the icon. You can determine if the icon is an SVG icon by using -- 'iconInfoGetFilename', and seeing if it is non-'Nothing' and ends in '.svg'.--- +-- -- This function is provided primarily to allow compatibility wrappers for older API's, and is not -- expected to be useful for applications.-iconInfoSetRawCoordinates :: IconInfo - -> Bool -- ^ @rawCoordinates@ whether the coordinates of - -- embedded rectangles and attached points should be returned in their original +iconInfoSetRawCoordinates :: IconInfo+ -> Bool -- ^ @rawCoordinates@ whether the coordinates of+ -- embedded rectangles and attached points should be returned in their original -> IO () iconInfoSetRawCoordinates self rawCoordinates = {# call gtk_icon_info_set_raw_coordinates #}
Graphics/UI/Gtk/General/RcStyle.chs view
@@ -120,7 +120,7 @@ -- ** Optimizing RC Style Matches ----- | Everytime a widget is created and added to the layout hierarchy of a+-- | Every time a widget is created and added to the layout hierarchy of a -- 'Window' (\"anchored\" to be exact), a list of matching RC styles out of all -- RC styles read in so far is composed. For this, every RC style is matched -- against the widgets class path, the widgets name path and widgets@@ -276,7 +276,7 @@ -- [@NORMAL@] A color used for a widget in its normal state. -- -- [@ACTIVE@] A variant of the @NORMAL@ color used when the widget is in the--- 'StateActive' state, and also for the trough of a ScrollBar, tabs of a+-- 'StateActive' state, and also for the through of a ScrollBar, tabs of a -- NoteBook other than the current tab and similar areas. Frequently, this -- should be a darker variant of the @NORMAL@ color. --@@ -298,7 +298,7 @@ -- g, b}@, where @r@, @g@ and @b@ are either integers in the range 0-65535 or -- floats in the range 0.0-1.0. ----- Since 2.10, colors can also be specified by refering to a symbolic color,+-- Since 2.10, colors can also be specified by referring to a symbolic color, -- as follows: @\@color-name@, or by using expressions to combine colors. The -- following expressions are currently supported: --@@ -455,12 +455,11 @@ rcSetDefaultFiles, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.GType (GType)-import System.Glib.GTypeConstants (none) {#import Graphics.UI.Gtk.Types#} @@ -476,7 +475,7 @@ -- rcStyleNew :: IO RcStyle rcStyleNew =- constructNewGObject mkRcStyle $+ wrapNewGObject mkRcStyle $ {# call gtk_rc_style_new #} --------------------@@ -488,13 +487,13 @@ rcStyleCopy :: RcStyleClass self => self -> IO RcStyle -- ^ returns the resulting 'RcStyle' rcStyleCopy self =- constructNewGObject mkRcStyle $+ wrapNewGObject mkRcStyle $ {# call gtk_rc_style_copy #} (toRcStyle self) -- | Adds a file to the list of files to be parsed at the end of 'initGUI'. ---rcAddDefaultFile :: String -> IO ()+rcAddDefaultFile :: GlibString string => string -> IO () rcAddDefaultFile filename = withUTFString filename $ \filenamePtr -> {# call gtk_rc_add_default_file #}@@ -503,7 +502,7 @@ -- | etrieves the current list of RC files that will be parsed at the end of -- 'initGUI'. ---rcGetDefaultFiles :: IO [String]+rcGetDefaultFiles :: GlibString string => IO [string] rcGetDefaultFiles = do aPtr <- {# call gtk_rc_get_default_files #} sPtrs <- peekArray0 nullPtr (castPtr aPtr)@@ -512,14 +511,14 @@ -- | Obtains the path to the IM modules file. See the documentation of the -- @GTK_IM_MODULE_FILE@ environment variable for more details. ---rcGetImModuleFile :: IO String+rcGetImModuleFile :: GlibString string => IO string rcGetImModuleFile = {# call gtk_rc_get_im_module_file #} >>= readUTFString -- | Returns a directory in which GTK+ looks for theme engines. ---rcGetModuleDir :: IO String+rcGetModuleDir :: GlibString string => IO string rcGetModuleDir = {# call gtk_rc_get_module_dir #} >>= readUTFString@@ -540,11 +539,11 @@ -- pseudo-widgets that should be themed like widgets but don't actually have -- corresponding GTK+ widgets. ---rcGetStyleByPaths :: Settings- -> Maybe String+rcGetStyleByPaths :: GlibString string => Settings+ -> Maybe string -- ^ @widgetPath@ : the widget path to use when looking up the style, or -- @Nothing@ if no matching against the widget path should be done- -> Maybe String+ -> Maybe string -- ^ @classPath@ : the class path to use when looking up the style, or -- @Nothing@ if no matching against the class path should be done. -> GType@@ -568,14 +567,14 @@ -- | Returns the standard directory in which themes should be installed. (GTK+ -- does not actually use this directory itself.) ---rcGetThemeDir :: IO String+rcGetThemeDir :: GlibString string => IO string rcGetThemeDir = {# call gtk_rc_get_theme_dir #} >>= readUTFString -- | Parses a given resource file. ---rcParse :: String+rcParse :: GlibString string => string -- ^ @filename@ : the @filename@ of a file to parse. If @filename@ is not -- absolute, it is searched in the current directory. -> IO ()@@ -586,7 +585,7 @@ -- | Parses resource information directly from a string. ---rcParseString :: String -> IO ()+rcParseString :: GlibString string => string -> IO () rcParseString rcString = withUTFString rcString $ \rcStringPtr -> {# call gtk_rc_parse_string #}@@ -621,7 +620,7 @@ -- gets a new style, it will both redraw and recompute any cached information -- about its appearance. As an example, it is used when the default font size -- set by the operating system changes. Note that this function doesn't affect--- widgets that have a style set explicitely on them with 'widgetSetStyle'.+-- widgets that have a style set explicitly on them with 'widgetSetStyle'. -- rcResetStyles :: Settings -> IO () rcResetStyles settings =@@ -630,7 +629,7 @@ -- | Sets the list of files that GTK+ will read at the end of 'initGUI'. ---rcSetDefaultFiles :: [String] -> IO ()+rcSetDefaultFiles :: GlibString string => [string] -> IO () rcSetDefaultFiles files = withUTFStringArray0 files $ \ssPtr -> {# call gtk_rc_set_default_files #} ssPtr
Graphics/UI/Gtk/General/Selection.chs view
@@ -50,7 +50,7 @@ -- * Constructors atomNew, targetListNew,- + -- * Methods targetListAdd, #if GTK_CHECK_VERSION(2,6,0)@@ -70,7 +70,9 @@ selectionRemoveAll, selectionDataSet,+#if GTK_MAJOR_VERSION < 3 selectionDataGet,+#endif selectionDataIsValid, selectionDataSetText, selectionDataGetText,@@ -82,7 +84,9 @@ selectionDataTargetsIncludeImage, #endif selectionDataGetTarget,+#if GTK_MAJOR_VERSION < 3 selectionDataSetTarget,+#endif selectionDataGetTargets, selectionDataTargetsIncludeText, #if GTK_CHECK_VERSION(2,10,0)@@ -97,7 +101,8 @@ ) where import System.Glib.FFI-import System.Glib.Flags (fromFlags)+import System.Glib.UTFString+import System.Glib.Flags (fromFlags) import System.Glib.Signals import System.Glib.GObject {#import Graphics.UI.Gtk.Types#}@@ -109,15 +114,15 @@ selectionTypeAtom, selectionTypeInteger, selectionTypeString,- selectionDataGetType)+#if GTK_MAJOR_VERSION < 3+ selectionDataGetType+#endif+ ) import Graphics.UI.Gtk.Signals-import System.Glib.UTFString ( peekUTFString, withUTFStringLen,- withUTFStringArray0, peekUTFStringArray0 ) import Control.Monad ( liftM ) import Control.Monad.Trans ( liftIO ) import Control.Monad.Reader (runReaderT, ask)-import Data.Word ( Word32 ) {# context lib="gtk" prefix="gtk" #} @@ -258,29 +263,50 @@ {#call unsafe gtk_selection_data_set #} selPtr tagPtr (fromIntegral (8*sizeOf v)) (castPtr arrayPtr) (fromIntegral (arrayLen*sizeOf v)) --- | Retreives the data in the 'SelectionDataM' monad. The returned array+-- The GtkSelectionData struct was made opaque in Gtk3, but the accessor routines+-- where introduced in 2.14.+#if GTK_CHECK_VERSION(2,14,0)+#if GTK_MAJOR_VERSION < 3+selectionDataGet_format selPtr = {#call gtk_selection_data_get_format#} selPtr+#endif+selectionDataGet_length selPtr = {#call gtk_selection_data_get_length#} selPtr+#if GTK_MAJOR_VERSION < 3+selectionDataGet_data selPtr = {#call gtk_selection_data_get_data#} selPtr+#endif+selectionDataGet_target selPtr = {#call gtk_selection_data_get_target#} selPtr+#else+selectionDataGet_format selPtr = {#get SelectionData -> format#} selPtr+selectionDataGet_length selPtr = {#get SelectionData -> length#} selPtr+selectionDataGet_data selPtr = {#get SelectionData -> data#} selPtr+selectionDataGet_target selPtr = {#get SelectionData -> target#} selPtr+#endif++#if GTK_MAJOR_VERSION < 3+-- | Retrieves the data in the 'SelectionDataM' monad. The returned array -- must have elements of the size that were used to set this data. If -- the size or the type tag does not match, @Nothing@ is returned. ---selectionDataGet :: (Integral a, Storable a) => +-- Removed in Gtk3.+selectionDataGet :: (Integral a, Storable a) => SelectionTypeTag -> SelectionDataM (Maybe [a]) selectionDataGet tagPtr = do selPtr <- ask liftIO $ do typeTag <- selectionDataGetType selPtr if typeTag/=tagPtr then return Nothing else do- bitSize <- liftM fromIntegral $ {#get SelectionData -> format#} selPtr- lenBytes <- liftM fromIntegral $ {#get SelectionData -> length#} selPtr- dataPtr <- liftM castPtr $ {#get SelectionData -> data#} selPtr+ bitSize <- liftM fromIntegral $ selectionDataGet_format selPtr+ lenBytes <- liftM fromIntegral $ selectionDataGet_length selPtr+ dataPtr <- liftM castPtr $ selectionDataGet_data selPtr if lenBytes<=0 || bitSize/=sizeOf (unsafePerformIO (peek dataPtr))*8 then return Nothing else liftM Just $ do peekArray (fromIntegral (lenBytes `quot` (bitSize `quot` 8))) dataPtr+#endif selectionDataGetLength :: SelectionDataM Int selectionDataGetLength = do selPtr <- ask- liftIO $ liftM fromIntegral $ {#get SelectionData -> length#} selPtr + liftIO $ liftM fromIntegral $ selectionDataGet_length selPtr -- | Check if the currently stored data is valid. --@@ -292,7 +318,7 @@ selectionDataIsValid = do len <- selectionDataGetLength return (len>=0)- + -- %hash c:9bdf d:af3f -- | Sets the contents of the selection from a string. The -- string is converted to the form determined by the allowed targets of the@@ -300,7 +326,7 @@ -- -- * Returns @True@ if setting the text was successful. ---selectionDataSetText :: String -> SelectionDataM Bool+selectionDataSetText :: GlibString string => string -> SelectionDataM Bool selectionDataSetText str = do selPtr <- ask liftM toBool $ liftIO $ withUTFStringLen str $ \(strPtr,len) ->@@ -309,7 +335,7 @@ -- %hash c:90e0 d:af3f -- | Gets the contents of the selection data as a string. ---selectionDataGetText :: SelectionDataM (Maybe String)+selectionDataGetText :: GlibString string => SelectionDataM (Maybe string) selectionDataGetText = do selPtr <- ask liftIO $ do@@ -340,7 +366,7 @@ selectionDataGetPixbuf :: SelectionDataM (Maybe Pixbuf) selectionDataGetPixbuf = do selPtr <- ask- liftIO $ maybeNull (constructNewGObject mkPixbuf) $+ liftIO $ maybeNull (wrapNewGObject mkPixbuf) $ {#call unsafe gtk_selection_data_get_pixbuf #} selPtr -- %hash c:d222 d:af3f@@ -349,19 +375,19 @@ -- -- * Returns @True@ if setting the URIs was successful. Since Gtk 2.6. ---selectionDataSetURIs :: [String] -> SelectionDataM Bool+selectionDataSetURIs :: GlibString string => [string] -> SelectionDataM Bool selectionDataSetURIs uris = do selPtr <- ask liftIO $ liftM toBool $ withUTFStringArray0 uris $ \strPtrPtr -> {#call unsafe gtk_selection_data_set_uris #} selPtr strPtrPtr- + -- %hash c:472f d:af3f -- | Gets the contents of the selection data as list of URIs. Returns -- @Nothing@ if the selection did not contain any URIs. -- -- * Since Gtk 2.6. ---selectionDataGetURIs :: SelectionDataM (Maybe [String])+selectionDataGetURIs :: GlibString string => SelectionDataM (Maybe [string]) selectionDataGetURIs = do selPtr <- ask liftIO $ do@@ -376,13 +402,17 @@ selectionDataGetTarget :: SelectionDataM TargetTag selectionDataGetTarget = do selPtr <- ask- liftM Atom $ liftIO $ {#get SelectionData -> target#} selPtr+ liftM Atom $ liftIO $ selectionDataGet_target selPtr +#if GTK_MAJOR_VERSION < 3 -- | Set the selection to the given 'TargetTag'.+--+-- Removed in Gtk3. selectionDataSetTarget :: TargetTag -> SelectionDataM () selectionDataSetTarget (Atom targetTag) = do selPtr <- ask liftIO $ {#set SelectionData -> target#} selPtr targetTag+#endif -- %hash c:e659 d:af3f -- | Queries the content type of the selection data as a list of targets.@@ -395,7 +425,7 @@ selectionDataGetTargets = do selPtr <- ask liftIO $ alloca $ \nAtomsPtr -> alloca $ \targetPtrPtr -> do- valid <- liftM toBool $ + valid <- liftM toBool $ {#call unsafe gtk_selection_data_get_targets #} selPtr targetPtrPtr nAtomsPtr if not valid then return [] else do len <- peek nAtomsPtr@@ -403,7 +433,7 @@ targetPtrs <- peekArray (fromIntegral len) targetPtr {#call unsafe g_free#} (castPtr targetPtr) return (map Atom targetPtrs)- + #if GTK_CHECK_VERSION(2,6,0) -- %hash c:5a8 d:af3f -- | Given a 'SelectionDataM' holding a list of targets, determines if any of@@ -421,7 +451,7 @@ {#call unsafe gtk_selection_data_targets_include_image #} selPtr (fromBool writable)-#endif +#endif -- %hash c:abe8 d:af3f -- | Given a 'SelectionDataM' holding a list of targets, determines if any of@@ -471,7 +501,7 @@ -- selectionReceived :: WidgetClass self => Signal self (TimeStamp -> SelectionDataM ()) selectionReceived = Signal (\after object handler -> do- connect_PTR_WORD__NONE "selection_received" after object $ \dataPtr time -> do+ connect_PTR_WORD__NONE "selection-received" after object $ \dataPtr time -> do runReaderT (handler (fromIntegral time)) dataPtr >> return ()) -- %hash c:c3 d:af3f@@ -482,7 +512,7 @@ selectionGet :: WidgetClass self => Signal self (InfoId -> TimeStamp -> SelectionDataM ()) selectionGet = Signal (\after object handler -> do- connect_PTR_WORD_WORD__NONE "selection_get" after object $+ connect_PTR_WORD_WORD__NONE "selection-get" after object $ \dataPtr info time -> do- runReaderT (handler (fromIntegral info) (fromIntegral time)) dataPtr >> + runReaderT (handler (fromIntegral info) (fromIntegral time)) dataPtr >> return ())
+ Graphics/UI/Gtk/General/Settings.chs view
@@ -0,0 +1,122 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Clipboard+--+-- Author : Axel Simon+--+-- Created: 26 March 2007+--+-- Copyright (C) 2007 Axel Simon+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- I removed all definitions for the clipboard by Juergen Nicklisch since+-- the way the clipboards were selected didn't tie in with the Selection+-- module.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Storing data on clipboards+--+module Graphics.UI.Gtk.General.Settings (++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----Settings+-- @++-- * Types+ Settings,+ SettingsClass,+ castToSettings, gTypeSettings,+ toSettings,++-- * Methods+ settingsGetDefault,+#if GTK_CHECK_VERSION(2,2,0)+ settingsGetForScreen,+#endif+ settingsSetLongProperty,+ settingsSetStringProperty+ ) where++import System.Glib.FFI+import System.Glib.UTFString+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}+++--------------------+-- Methods++-- | Gets the Settings object for the default GDK screen, creating+-- it if necessary. See 'settingsGetForScreen'.+--+settingsGetDefault ::+ IO (Maybe Settings) -- ^ returns a Settings. If there is no default+ -- screen, then returns Nothing.+settingsGetDefault =+ maybeNull (makeNewGObject mkSettings)+ {# call gtk_settings_get_default #}++#if GTK_CHECK_VERSION(2,2,0)+-- | Gets the Settings object for screen, creating it if necessary.+--+settingsGetForScreen ::+ ScreenClass screen+ => screen+ -> IO Settings+settingsGetForScreen screen =+ makeNewGObject mkSettings $+ {# call gtk_settings_get_for_screen #}+ (toScreen screen)+#endif++settingsSetLongProperty ::+ (SettingsClass settings, GlibString string)+ => settings+ -> string+ -> Int+ -> string+ -> IO ()+settingsSetLongProperty settings name value origin =+ withUTFString name $ \namePtr ->+ withUTFString origin $ \originPtr ->+ {# call gtk_settings_set_long_property #}+ (toSettings settings)+ namePtr+ (fromIntegral value)+ originPtr++settingsSetStringProperty ::+ (SettingsClass settings, GlibString string)+ => settings+ -> string+ -> string+ -> string+ -> IO ()+settingsSetStringProperty settings name value origin =+ withUTFString name $ \namePtr ->+ withUTFString value $ \valuePtr ->+ withUTFString origin $ \originPtr ->+ {# call gtk_settings_set_string_property #}+ (toSettings settings)+ namePtr+ valuePtr+ originPtr+
Graphics/UI/Gtk/General/StockItems.hsc view
@@ -1,4 +1,5 @@ {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE OverloadedStrings #-} -- -*-haskell-*- #include <gtk/gtk.h>@@ -54,7 +55,7 @@ stockCancel, #if GTK_CHECK_VERSION(2,16,0) stockCapsLockWarning,-#endif +#endif stockCDROM, stockClear, stockClose,@@ -72,7 +73,7 @@ stockDirectory, #if GTK_CHECK_VERSION(2,12,0) stockDiscard,-#endif +#endif stockDisconnect, stockDnd, stockDndMultiple,@@ -123,10 +124,10 @@ stockOrientationReverseLandscape, stockOrientationPortrait, stockOrientationReversePortrait,-#endif +#endif #if GTK_CHECK_VERSION(2,14,0) stockPageSetup,-#endif +#endif stockPaste, stockPreferences, stockPrint,@@ -135,7 +136,7 @@ stockPrintPaused, stockPrintReport, stockPrintWarning,-#endif +#endif stockPrintPreview, stockProperties, stockQuit,@@ -147,7 +148,7 @@ stockSaveAs, #if GTK_CHECK_VERSION(2,10,0) stockSelectAll,-#endif +#endif stockSelectColor, stockSelectFont, stockSortAscending,@@ -166,25 +167,25 @@ stockZoomOut ) where --- The StockItem structure is completely marshaled to Haskell. It is +-- The StockItem structure is completely marshaled to Haskell. It is -- possible to marshal all strings lazily because the string pointers are -- valid throughout the lifetime of the application. The only drawback it -- that a stock item that is replaced by the another item with the same -- name will never be freed. This deficiency is built into Gtk however. -- -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Flags-import System.Glib.GList (GSList, fromGSListRev)-import Graphics.UI.Gtk.Gdk.Events (Modifier)-import Graphics.UI.Gtk.Gdk.Keys (KeyVal)+import System.Glib.GList (GSList, fromGSListRev)+import Graphics.UI.Gtk.Gdk.Events (Modifier)+import Graphics.UI.Gtk.Gdk.Keys (KeyVal) -- | A synonym for a standard button or icon. ---type StockId = String+type StockId = DefaultGlibString -- Although the structure itself is allocated dynamically, its contents@@ -197,33 +198,33 @@ -- data StockItem = StockItem { siStockId :: StockId,- siLabel :: String,+ siLabel :: DefaultGlibString, siModifier:: [Modifier], siKeyval :: KeyVal,- siTransDom:: String }+ siTransDom:: DefaultGlibString } instance Storable StockItem where- sizeOf _ = #const sizeof(GtkStockItem)- alignment _ = alignment (undefined::CString)- peek siPtr = do+ sizeOf _ = #const sizeof(GtkStockItem)+ alignment _ = alignment (undefined::CString)+ peek siPtr = do (stockId :: CString) <- #{peek GtkStockItem, stock_id} siPtr- (label :: CString) <- #{peek GtkStockItem, label} siPtr- (modifier :: #gtk2hs_type GdkModifierType)- <- #{peek GtkStockItem, modifier} siPtr- (keyval :: #gtk2hs_type guint)- <- #{peek GtkStockItem, keyval} siPtr- (transDom :: CString) <- #{peek GtkStockItem, translation_domain} siPtr+ (label :: CString) <- #{peek GtkStockItem, label} siPtr+ (modifier :: #gtk2hs_type GdkModifierType)+ <- #{peek GtkStockItem, modifier} siPtr+ (keyval :: #gtk2hs_type guint)+ <- #{peek GtkStockItem, keyval} siPtr+ (transDom :: CString) <- #{peek GtkStockItem, translation_domain} siPtr return $ StockItem { siStockId = unsafePerformIO $ peekUTFString' stockId,- siLabel = unsafePerformIO $ peekUTFString' label,+ siLabel = unsafePerformIO $ peekUTFString' label, -- &%!?$ c2hs and hsc should agree on types- siModifier = toFlags (fromIntegral modifier), - siKeyval = keyval,+ siModifier = toFlags (fromIntegral modifier),+ siKeyval = keyval, siTransDom = unsafePerformIO $ peekUTFString' transDom } where- peekUTFString' :: CString -> IO String+ peekUTFString' :: CString -> IO DefaultGlibString peekUTFString' strPtr | strPtr==nullPtr = return ""- | otherwise = peekUTFString strPtr+ | otherwise = peekUTFString strPtr poke siPtr (StockItem { siStockId = stockId,@@ -234,8 +235,8 @@ stockIdPtr <- newUTFString stockId #{poke GtkStockItem, stock_id} siPtr stockIdPtr labelPtr <- newUTFString label- #{poke GtkStockItem, label} siPtr labelPtr- #{poke GtkStockItem, modifier} siPtr + #{poke GtkStockItem, label} siPtr labelPtr+ #{poke GtkStockItem, modifier} siPtr ((fromIntegral (fromFlags modifier))::#{gtk2hs_type GdkModifierType}) #{poke GtkStockItem, keyval} siPtr ((fromIntegral keyval)::#{gtk2hs_type guint}) transDomPtr<- newUTFString transDom@@ -258,7 +259,7 @@ -- | Lookup an item in stock. -- stockLookupItem :: StockId -> IO (Maybe StockItem)-stockLookupItem stockId = +stockLookupItem stockId = alloca $ \siPtr -> withUTFString stockId $ \strPtr -> do res <- stock_lookup strPtr siPtr@@ -291,77 +292,77 @@ #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-about.png>>-stockAbout :: StockId-stockAbout = #{const_str GTK_STOCK_ABOUT}+stockAbout :: StockId+stockAbout = #{const_str GTK_STOCK_ABOUT} #else-stockAbout = stockMissingImage+stockAbout = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-add.png>>-stockAdd :: StockId-stockAdd = #{const_str GTK_STOCK_ADD}+stockAdd :: StockId+stockAdd = #{const_str GTK_STOCK_ADD} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-apply.png>>-stockApply :: StockId-stockApply = #{const_str GTK_STOCK_APPLY}+stockApply :: StockId+stockApply = #{const_str GTK_STOCK_APPLY} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-bold.png>>-stockBold :: StockId-stockBold = #{const_str GTK_STOCK_BOLD}+stockBold :: StockId+stockBold = #{const_str GTK_STOCK_BOLD} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-cancel.png>>-stockCancel :: StockId-stockCancel = #{const_str GTK_STOCK_CANCEL}- +stockCancel :: StockId+stockCancel = #{const_str GTK_STOCK_CANCEL}+ #if GTK_CHECK_VERSION(2,16,0)--- | <<http://library.gnome.org/devel/gtk/stable/gtk-caps-lock-warning.png>> +-- | <<http://library.gnome.org/devel/gtk/stable/gtk-caps-lock-warning.png>> stockCapsLockWarning :: StockId stockCapsLockWarning = #{const_str GTK_STOCK_CAPS_LOCK_WARNING}-#endif +#endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-cdrom.png>>-stockCDROM :: StockId-stockCDROM = #{const_str GTK_STOCK_CDROM}+stockCDROM :: StockId+stockCDROM = #{const_str GTK_STOCK_CDROM} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-clear.png>>-stockClear :: StockId-stockClear = #{const_str GTK_STOCK_CLEAR}+stockClear :: StockId+stockClear = #{const_str GTK_STOCK_CLEAR} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-close.png>>-stockClose :: StockId-stockClose = #{const_str GTK_STOCK_CLOSE}+stockClose :: StockId+stockClose = #{const_str GTK_STOCK_CLOSE} #if GTK_CHECK_VERSION(2,2,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-color-picker.png>>-stockColorPicker :: StockId-stockColorPicker = #{const_str GTK_STOCK_COLOR_PICKER}+stockColorPicker :: StockId+stockColorPicker = #{const_str GTK_STOCK_COLOR_PICKER} #else stockColorPicker = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-convert.png>>-stockConvert :: StockId-stockConvert = #{const_str GTK_STOCK_CONVERT}+stockConvert :: StockId+stockConvert = #{const_str GTK_STOCK_CONVERT} #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-connect.png>>-stockConnect :: StockId-stockConnect = #{const_str GTK_STOCK_CONNECT}+stockConnect :: StockId+stockConnect = #{const_str GTK_STOCK_CONNECT} #else-stockConnect = stockMissingImage+stockConnect = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-copy.png>>-stockCopy :: StockId-stockCopy = #{const_str GTK_STOCK_COPY}+stockCopy :: StockId+stockCopy = #{const_str GTK_STOCK_COPY} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-cut.png>>-stockCut :: StockId-stockCut = #{const_str GTK_STOCK_CUT}+stockCut :: StockId+stockCut = #{const_str GTK_STOCK_CUT} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-delete.png>>-stockDelete :: StockId-stockDelete = #{const_str GTK_STOCK_DELETE}+stockDelete :: StockId+stockDelete = #{const_str GTK_STOCK_DELETE} #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-dialog-authentication.png>>@@ -372,269 +373,269 @@ #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-dialog-error.png>>-stockDialogError :: StockId-stockDialogError = #{const_str GTK_STOCK_DIALOG_ERROR}+stockDialogError :: StockId+stockDialogError = #{const_str GTK_STOCK_DIALOG_ERROR} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-dialog-info.png>>-stockDialogInfo :: StockId-stockDialogInfo = #{const_str GTK_STOCK_DIALOG_INFO}+stockDialogInfo :: StockId+stockDialogInfo = #{const_str GTK_STOCK_DIALOG_INFO} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-dialog-question.png>>-stockDialogQuestion :: StockId-stockDialogQuestion = #{const_str GTK_STOCK_DIALOG_QUESTION}+stockDialogQuestion :: StockId+stockDialogQuestion = #{const_str GTK_STOCK_DIALOG_QUESTION} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-dialog-warning.png>>-stockDialogWarning :: StockId-stockDialogWarning = #{const_str GTK_STOCK_DIALOG_WARNING}+stockDialogWarning :: StockId+stockDialogWarning = #{const_str GTK_STOCK_DIALOG_WARNING} #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-directory.png>>-stockDirectory :: StockId-stockDirectory = #{const_str GTK_STOCK_DIRECTORY}+stockDirectory :: StockId+stockDirectory = #{const_str GTK_STOCK_DIRECTORY} #else-stockDirectory = stockMissingImage+stockDirectory = stockMissingImage #endif #if GTK_CHECK_VERSION(2,12,0)--- | +-- | stockDiscard :: StockId stockDiscard = #{const_str GTK_STOCK_DISCARD}-#endif +#endif #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-disconnect.png>>-stockDisconnect :: StockId-stockDisconnect = #{const_str GTK_STOCK_DISCONNECT}+stockDisconnect :: StockId+stockDisconnect = #{const_str GTK_STOCK_DISCONNECT} #else-stockDisconnect = stockMissingImage+stockDisconnect = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-dnd.png>>-stockDnd :: StockId-stockDnd = #{const_str GTK_STOCK_DND}+stockDnd :: StockId+stockDnd = #{const_str GTK_STOCK_DND} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-dnd-multiple.png>>-stockDndMultiple :: StockId-stockDndMultiple = #{const_str GTK_STOCK_DND_MULTIPLE}+stockDndMultiple :: StockId+stockDndMultiple = #{const_str GTK_STOCK_DND_MULTIPLE} #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-edit.png>>-stockEdit :: StockId-stockEdit = #{const_str GTK_STOCK_EDIT}+stockEdit :: StockId+stockEdit = #{const_str GTK_STOCK_EDIT} #else-stockEdit = stockMissingImage+stockEdit = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-execute.png>>-stockExecute :: StockId-stockExecute = #{const_str GTK_STOCK_EXECUTE}+stockExecute :: StockId+stockExecute = #{const_str GTK_STOCK_EXECUTE} #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-file.png>>-stockFile :: StockId-stockFile = #{const_str GTK_STOCK_FILE}+stockFile :: StockId+stockFile = #{const_str GTK_STOCK_FILE} #else-stockFile = stockMissingImage+stockFile = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-find.png>>-stockFind :: StockId-stockFind = #{const_str GTK_STOCK_FIND}+stockFind :: StockId+stockFind = #{const_str GTK_STOCK_FIND} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-find-and-replace.png>>-stockFindAndRelpace :: StockId-stockFindAndRelpace = #{const_str GTK_STOCK_FIND_AND_REPLACE}+stockFindAndRelpace :: StockId+stockFindAndRelpace = #{const_str GTK_STOCK_FIND_AND_REPLACE} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-floppy.png>>-stockFloppy :: StockId-stockFloppy = #{const_str GTK_STOCK_FLOPPY}+stockFloppy :: StockId+stockFloppy = #{const_str GTK_STOCK_FLOPPY} #if GTK_CHECK_VERSION(2,8,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-fullscreen.png>>-stockFullscreen :: StockId-stockFullscreen = #{const_str GTK_STOCK_FULLSCREEN}+stockFullscreen :: StockId+stockFullscreen = #{const_str GTK_STOCK_FULLSCREEN} #else-stockFullscreen = stockMissingImage+stockFullscreen = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-goto-bottom.png>>-stockGotoBottom :: StockId-stockGotoBottom = #{const_str GTK_STOCK_GOTO_BOTTOM}+stockGotoBottom :: StockId+stockGotoBottom = #{const_str GTK_STOCK_GOTO_BOTTOM} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-goto-first-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-goto-first-rtl.png>>-stockGotoFirst :: StockId-stockGotoFirst = #{const_str GTK_STOCK_GOTO_FIRST}+stockGotoFirst :: StockId+stockGotoFirst = #{const_str GTK_STOCK_GOTO_FIRST} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-goto-last-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-goto-last-rtl.png>>-stockGotoLast :: StockId-stockGotoLast = #{const_str GTK_STOCK_GOTO_LAST}+stockGotoLast :: StockId+stockGotoLast = #{const_str GTK_STOCK_GOTO_LAST} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-goto-top.png>>-stockGotoTop :: StockId-stockGotoTop = #{const_str GTK_STOCK_GOTO_TOP}+stockGotoTop :: StockId+stockGotoTop = #{const_str GTK_STOCK_GOTO_TOP} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-go-back-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-go-back-rtl.png>>-stockGoBack :: StockId-stockGoBack = #{const_str GTK_STOCK_GO_BACK}+stockGoBack :: StockId+stockGoBack = #{const_str GTK_STOCK_GO_BACK} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-go-down.png>>-stockGoDown :: StockId-stockGoDown = #{const_str GTK_STOCK_GO_DOWN}+stockGoDown :: StockId+stockGoDown = #{const_str GTK_STOCK_GO_DOWN} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-go-forward-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-go-forward-rtl.png>>-stockGoForward :: StockId-stockGoForward = #{const_str GTK_STOCK_GO_FORWARD}+stockGoForward :: StockId+stockGoForward = #{const_str GTK_STOCK_GO_FORWARD} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-go-up.png>>-stockGoUp :: StockId-stockGoUp = #{const_str GTK_STOCK_GO_UP}+stockGoUp :: StockId+stockGoUp = #{const_str GTK_STOCK_GO_UP} #if GTK_CHECK_VERSION(2,4,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-harddisk.png>>-stockHarddisk :: StockId-stockHarddisk = #{const_str GTK_STOCK_HARDDISK}+stockHarddisk :: StockId+stockHarddisk = #{const_str GTK_STOCK_HARDDISK} #else-stockHarddisk = stockMissingImage+stockHarddisk = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-help.png>>-stockHelp :: StockId-stockHelp = #{const_str GTK_STOCK_HELP}+stockHelp :: StockId+stockHelp = #{const_str GTK_STOCK_HELP} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-home.png>>-stockHome :: StockId-stockHome = #{const_str GTK_STOCK_HOME}+stockHome :: StockId+stockHome = #{const_str GTK_STOCK_HOME} #if GTK_CHECK_VERSION(2,4,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-indent-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-indent-rtl.png>>-stockIndent :: StockId-stockIndent = #{const_str GTK_STOCK_INDENT}+stockIndent :: StockId+stockIndent = #{const_str GTK_STOCK_INDENT} #else-stockIndent = stockMissingImage+stockIndent = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-index.png>>-stockIndex :: StockId-stockIndex = #{const_str GTK_STOCK_INDEX}+stockIndex :: StockId+stockIndex = #{const_str GTK_STOCK_INDEX} #if GTK_CHECK_VERSION(2,8,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-info.png>>-stockInfo :: StockId-stockInfo = #{const_str GTK_STOCK_INFO}+stockInfo :: StockId+stockInfo = #{const_str GTK_STOCK_INFO} #else-stockInfo = stockMissingImage+stockInfo = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-italic.png>>-stockItalic :: StockId-stockItalic = #{const_str GTK_STOCK_ITALIC}+stockItalic :: StockId+stockItalic = #{const_str GTK_STOCK_ITALIC} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-jump-to-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-jump-to-rtl.png>>-stockJumpTo :: StockId-stockJumpTo = #{const_str GTK_STOCK_JUMP_TO}+stockJumpTo :: StockId+stockJumpTo = #{const_str GTK_STOCK_JUMP_TO} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-justify-center.png>>-stockJustifyCenter :: StockId-stockJustifyCenter = #{const_str GTK_STOCK_JUSTIFY_CENTER}+stockJustifyCenter :: StockId+stockJustifyCenter = #{const_str GTK_STOCK_JUSTIFY_CENTER} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-justify-fill.png>>-stockJustifyFill :: StockId-stockJustifyFill = #{const_str GTK_STOCK_JUSTIFY_FILL}+stockJustifyFill :: StockId+stockJustifyFill = #{const_str GTK_STOCK_JUSTIFY_FILL} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-justify-left.png>>-stockJustifyLeft :: StockId-stockJustifyLeft = #{const_str GTK_STOCK_JUSTIFY_LEFT}+stockJustifyLeft :: StockId+stockJustifyLeft = #{const_str GTK_STOCK_JUSTIFY_LEFT} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-justify-right.png>>-stockJustifyRight :: StockId-stockJustifyRight = #{const_str GTK_STOCK_JUSTIFY_RIGHT}- --- | <<http://library.gnome.org/devel/gtk/stable/gtk-leave-fullscreen.png>> +stockJustifyRight :: StockId+stockJustifyRight = #{const_str GTK_STOCK_JUSTIFY_RIGHT}++-- | <<http://library.gnome.org/devel/gtk/stable/gtk-leave-fullscreen.png>> stockLeaveFullscreen :: StockId stockLeaveFullscreen = #{const_str GTK_STOCK_LEAVE_FULLSCREEN} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-missing-image.png>>-stockMissingImage :: StockId-stockMissingImage = #{const_str GTK_STOCK_MISSING_IMAGE}+stockMissingImage :: StockId+stockMissingImage = #{const_str GTK_STOCK_MISSING_IMAGE} #if GTK_CHECK_VERSION(2,6,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-forward-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-media-forward-rtl.png>>-stockMediaForward :: StockId-stockMediaForward = #{const_str GTK_STOCK_MEDIA_FORWARD}+stockMediaForward :: StockId+stockMediaForward = #{const_str GTK_STOCK_MEDIA_FORWARD} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-next-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-media-next-rtl.png>>-stockMediaNext :: StockId-stockMediaNext = #{const_str GTK_STOCK_MEDIA_NEXT}+stockMediaNext :: StockId+stockMediaNext = #{const_str GTK_STOCK_MEDIA_NEXT} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-pause.png>>-stockMediaPause :: StockId-stockMediaPause = #{const_str GTK_STOCK_MEDIA_PAUSE}+stockMediaPause :: StockId+stockMediaPause = #{const_str GTK_STOCK_MEDIA_PAUSE} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-play-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-media-play-rtl.png>>-stockMediaPlay :: StockId-stockMediaPlay = #{const_str GTK_STOCK_MEDIA_PLAY}+stockMediaPlay :: StockId+stockMediaPlay = #{const_str GTK_STOCK_MEDIA_PLAY} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-previous-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-media-previous-rtl.png>>-stockMediaPrevious :: StockId-stockMediaPrevious = #{const_str GTK_STOCK_MEDIA_PREVIOUS}+stockMediaPrevious :: StockId+stockMediaPrevious = #{const_str GTK_STOCK_MEDIA_PREVIOUS} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-record.png>>-stockMediaRecord :: StockId-stockMediaRecord = #{const_str GTK_STOCK_MEDIA_RECORD}+stockMediaRecord :: StockId+stockMediaRecord = #{const_str GTK_STOCK_MEDIA_RECORD} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-rewind-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-media-rewind-rtl.png>>-stockMediaRewind :: StockId-stockMediaRewind = #{const_str GTK_STOCK_MEDIA_REWIND}+stockMediaRewind :: StockId+stockMediaRewind = #{const_str GTK_STOCK_MEDIA_REWIND} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-media-stop.png>>-stockMediaStop :: StockId-stockMediaStop = #{const_str GTK_STOCK_MEDIA_STOP}+stockMediaStop :: StockId+stockMediaStop = #{const_str GTK_STOCK_MEDIA_STOP} #else-stockMediaForward = stockMissingImage-stockMediaNext = stockMissingImage-stockMediaPause = stockMissingImage-stockMediaPlay = stockMissingImage-stockMediaPrevious = stockMissingImage-stockMediaRecord = stockMissingImage-stockMediaRewind = stockMissingImage-stockMediaStop = stockMissingImage+stockMediaForward = stockMissingImage+stockMediaNext = stockMissingImage+stockMediaPause = stockMissingImage+stockMediaPlay = stockMissingImage+stockMediaPrevious = stockMissingImage+stockMediaRecord = stockMissingImage+stockMediaRewind = stockMissingImage+stockMediaStop = stockMissingImage #endif #if GTK_CHECK_VERSION(2,4,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-network.png>>-stockNetwork :: StockId-stockNetwork = #{const_str GTK_STOCK_NETWORK}+stockNetwork :: StockId+stockNetwork = #{const_str GTK_STOCK_NETWORK} #else-stockNetwork = stockMissingImage+stockNetwork = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-new.png>>-stockNew :: StockId-stockNew = #{const_str GTK_STOCK_NEW}+stockNew :: StockId+stockNew = #{const_str GTK_STOCK_NEW} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-no.png>>-stockNo :: StockId-stockNo = #{const_str GTK_STOCK_NO}+stockNo :: StockId+stockNo = #{const_str GTK_STOCK_NO} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-ok.png>>-stockOk :: StockId-stockOk = #{const_str GTK_STOCK_OK}+stockOk :: StockId+stockOk = #{const_str GTK_STOCK_OK} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-open.png>>-stockOpen :: StockId-stockOpen = #{const_str GTK_STOCK_OPEN}+stockOpen :: StockId+stockOpen = #{const_str GTK_STOCK_OPEN} #if GTK_CHECK_VERSION(2,10,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-orientation-landscape.png>>@@ -666,151 +667,151 @@ #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-paste.png>>-stockPaste :: StockId-stockPaste = #{const_str GTK_STOCK_PASTE}+stockPaste :: StockId+stockPaste = #{const_str GTK_STOCK_PASTE} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-preferences.png>>-stockPreferences :: StockId-stockPreferences = #{const_str GTK_STOCK_PREFERENCES}+stockPreferences :: StockId+stockPreferences = #{const_str GTK_STOCK_PREFERENCES} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-print.png>>-stockPrint :: StockId-stockPrint = #{const_str GTK_STOCK_PRINT}+stockPrint :: StockId+stockPrint = #{const_str GTK_STOCK_PRINT} #if GTK_CHECK_VERSION(2,14,0)--- | <<http://library.gnome.org/devel/gtk/stable/gtk-print-error.png>> +-- | <<http://library.gnome.org/devel/gtk/stable/gtk-print-error.png>> stockPrintError :: StockId stockPrintError = #{const_str GTK_STOCK_PRINT_ERROR}- + -- | <<http://library.gnome.org/devel/gtk/stable/gtk-print-paused.png>> stockPrintPaused :: StockId stockPrintPaused = #{const_str GTK_STOCK_PRINT_PAUSED}- + -- | <<http://library.gnome.org/devel/gtk/stable/gtk-print-report.png>> stockPrintReport :: StockId stockPrintReport = #{const_str GTK_STOCK_PRINT_REPORT}- + -- | <<http://library.gnome.org/devel/gtk/stable/gtk-print-warning.png>> stockPrintWarning :: StockId stockPrintWarning = #{const_str GTK_STOCK_PRINT_WARNING}-#endif +#endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-print-preview.png>>-stockPrintPreview :: StockId-stockPrintPreview = #{const_str GTK_STOCK_PRINT_PREVIEW}+stockPrintPreview :: StockId+stockPrintPreview = #{const_str GTK_STOCK_PRINT_PREVIEW} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-properties.png>>-stockProperties :: StockId-stockProperties = #{const_str GTK_STOCK_PROPERTIES}+stockProperties :: StockId+stockProperties = #{const_str GTK_STOCK_PROPERTIES} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-quit.png>>-stockQuit :: StockId-stockQuit = #{const_str GTK_STOCK_QUIT}+stockQuit :: StockId+stockQuit = #{const_str GTK_STOCK_QUIT} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-redo-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-redo-rtl.png>>-stockRedo :: StockId-stockRedo = #{const_str GTK_STOCK_REDO}+stockRedo :: StockId+stockRedo = #{const_str GTK_STOCK_REDO} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-refresh.png>>-stockRefresh :: StockId-stockRefresh = #{const_str GTK_STOCK_REFRESH}+stockRefresh :: StockId+stockRefresh = #{const_str GTK_STOCK_REFRESH} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-remove.png>>-stockRemove :: StockId-stockRemove = #{const_str GTK_STOCK_REMOVE}+stockRemove :: StockId+stockRemove = #{const_str GTK_STOCK_REMOVE} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-revert-to-saved-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-revert-to-saved-rtl.png>>-stockRevertToSaved :: StockId-stockRevertToSaved = #{const_str GTK_STOCK_REVERT_TO_SAVED}+stockRevertToSaved :: StockId+stockRevertToSaved = #{const_str GTK_STOCK_REVERT_TO_SAVED} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-save.png>>-stockSave :: StockId-stockSave = #{const_str GTK_STOCK_SAVE}+stockSave :: StockId+stockSave = #{const_str GTK_STOCK_SAVE} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-save-as.png>>-stockSaveAs :: StockId-stockSaveAs = #{const_str GTK_STOCK_SAVE_AS}+stockSaveAs :: StockId+stockSaveAs = #{const_str GTK_STOCK_SAVE_AS} #if GTK_CHECK_VERSION(2,10,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-select-all.png>>-stockSelectAll :: StockId-stockSelectAll = #{const_str GTK_STOCK_SELECT_ALL}+stockSelectAll :: StockId+stockSelectAll = #{const_str GTK_STOCK_SELECT_ALL} #else-stockSelectAll = stockMissingImage+stockSelectAll = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-select-color.png>>-stockSelectColor :: StockId-stockSelectColor = #{const_str GTK_STOCK_SELECT_COLOR}+stockSelectColor :: StockId+stockSelectColor = #{const_str GTK_STOCK_SELECT_COLOR} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-font.png>>-stockSelectFont :: StockId-stockSelectFont = #{const_str GTK_STOCK_SELECT_FONT}+stockSelectFont :: StockId+stockSelectFont = #{const_str GTK_STOCK_SELECT_FONT} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-sort-ascending.png>>-stockSortAscending :: StockId-stockSortAscending = #{const_str GTK_STOCK_SORT_ASCENDING}+stockSortAscending :: StockId+stockSortAscending = #{const_str GTK_STOCK_SORT_ASCENDING} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-sort-descending.png>>-stockSortDescending :: StockId-stockSortDescending = #{const_str GTK_STOCK_SORT_DESCENDING}+stockSortDescending :: StockId+stockSortDescending = #{const_str GTK_STOCK_SORT_DESCENDING} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-spell-check.png>>-stockSpellCheck :: StockId-stockSpellCheck = #{const_str GTK_STOCK_SPELL_CHECK}+stockSpellCheck :: StockId+stockSpellCheck = #{const_str GTK_STOCK_SPELL_CHECK} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-stop.png>>-stockStop :: StockId-stockStop = #{const_str GTK_STOCK_STOP}+stockStop :: StockId+stockStop = #{const_str GTK_STOCK_STOP} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-strikethrough.png>>-stockStrikethrough :: StockId-stockStrikethrough = #{const_str GTK_STOCK_STRIKETHROUGH}+stockStrikethrough :: StockId+stockStrikethrough = #{const_str GTK_STOCK_STRIKETHROUGH} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-undelete-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-undelete-rtl.png>>-stockUndelete :: StockId-stockUndelete = #{const_str GTK_STOCK_UNDELETE}+stockUndelete :: StockId+stockUndelete = #{const_str GTK_STOCK_UNDELETE} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-underline.png>>-stockUnderline :: StockId-stockUnderline = #{const_str GTK_STOCK_UNDERLINE}+stockUnderline :: StockId+stockUnderline = #{const_str GTK_STOCK_UNDERLINE} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-undo-ltr.png>> -- <<http://library.gnome.org/devel/gtk/stable/gtk-undo-rtl.png>>-stockUndo :: StockId-stockUndo = #{const_str GTK_STOCK_UNDO}+stockUndo :: StockId+stockUndo = #{const_str GTK_STOCK_UNDO} #if GTK_CHECK_VERSION(2,4,0) -- | <<http://library.gnome.org/devel/gtk/stable/gtk-unindent-ltr.png>>--- <<http://library.gnome.org/devel/gtk/stable/gtk-unindent-rtl.png>> -stockUnindent :: StockId-stockUnindent = #{const_str GTK_STOCK_UNINDENT}+-- <<http://library.gnome.org/devel/gtk/stable/gtk-unindent-rtl.png>>+stockUnindent :: StockId+stockUnindent = #{const_str GTK_STOCK_UNINDENT} #else-stockUnindent = stockMissingImage+stockUnindent = stockMissingImage #endif -- | <<http://library.gnome.org/devel/gtk/stable/gtk-yes.png>>-stockYes :: StockId-stockYes = #{const_str GTK_STOCK_YES}+stockYes :: StockId+stockYes = #{const_str GTK_STOCK_YES} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-zoom-100.png>>-stockZoom100 :: StockId-stockZoom100 = #{const_str GTK_STOCK_ZOOM_100}+stockZoom100 :: StockId+stockZoom100 = #{const_str GTK_STOCK_ZOOM_100} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-zoom-fit.png>>-stockZoomFit :: StockId-stockZoomFit = #{const_str GTK_STOCK_ZOOM_FIT}+stockZoomFit :: StockId+stockZoomFit = #{const_str GTK_STOCK_ZOOM_FIT} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-zoom-in.png>>-stockZoomIn :: StockId-stockZoomIn = #{const_str GTK_STOCK_ZOOM_IN}+stockZoomIn :: StockId+stockZoomIn = #{const_str GTK_STOCK_ZOOM_IN} -- | <<http://library.gnome.org/devel/gtk/stable/gtk-zoom-out.png>>-stockZoomOut :: StockId-stockZoomOut = #{const_str GTK_STOCK_ZOOM_OUT}+stockZoomOut :: StockId+stockZoomOut = #{const_str GTK_STOCK_ZOOM_OUT}
Graphics/UI/Gtk/General/Structs.hsc view
@@ -1,11 +1,14 @@-{-# LANGUAGE ScopedTypeVariables, TypeSynonymInstances #-}+{-# LANGUAGE ScopedTypeVariables, TypeSynonymInstances, FlexibleInstances #-} {-# OPTIONS_HADDOCK hide #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} -- -*-haskell-*- #include <gtk/gtk.h>-#include <gdk/gdk.h> +#include <gdk/gdk.h> #include "template-hsc-gtk2hs.h"-+#if GTK_MAJOR_VERSION >= 3+#include <gtk/gtkx.h>+#endif -- GIMP Toolkit (GTK) Structures -- -- Author : Axel Simon@@ -35,19 +38,26 @@ Point, Rectangle(..), Color(..),+#if GTK_MAJOR_VERSION >= 3+ RGBA(..),+#endif+#if GTK_MAJOR_VERSION < 3 GCValues(..), pokeGCValues, newGCValues, widgetGetState, widgetGetSavedState,+#endif Allocation, Requisition(..), treeIterSize, textIterSize, inputError,+#if GTK_MAJOR_VERSION < 3 dialogGetUpper, dialogGetActionArea, fileSelectionGetButtons,+#endif ResponseId(..), fromResponse, toResponse,@@ -58,19 +68,22 @@ nativeWindowIdNone, #endif drawableGetID,+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED toolbarChildButton, toolbarChildToggleButton, toolbarChildRadioButton, #endif+#endif IconSize(..),+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED comboGetList, #endif widgetGetDrawWindow, widgetGetSize,- layoutGetDrawWindow, windowGetFrame,+#endif styleGetForeground, styleGetBackground, styleGetLight,@@ -79,6 +92,7 @@ styleGetText, styleGetBase, styleGetAntiAliasing,+#if GTK_MAJOR_VERSION < 3 colorSelectionDialogGetColor, colorSelectionDialogGetOkButton, colorSelectionDialogGetCancelButton,@@ -89,6 +103,7 @@ dragContextSetSuggestedAction, dragContextGetAction, dragContextSetAction,+#endif SortColumnId, treeSortableDefaultSortColumnId, tagInvalid,@@ -99,40 +114,45 @@ selectionTypeAtom, selectionTypeInteger, selectionTypeString,+#if GTK_MAJOR_VERSION < 3 selectionDataGetType,- withTargetEntries+#endif+ withTargetEntries,+ KeymapKey (..) ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import Data.IORef-#ifdef HAVE_NEW_CONTROL_EXCEPTION-import Control.OldException-#else-import Control.Exception-#endif+import Control.Exception (handle, ErrorCall(..)) import System.Glib.FFI import System.Glib.UTFString ( UTFCorrection, ofsToUTF )-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import System.Glib.GObject (makeNewGObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import System.Glib.GObject (makeNewGObject) import Graphics.UI.Gtk.Types-import Graphics.UI.Gtk.Gdk.Enums (Function, Fill, SubwindowMode,- LineStyle, CapStyle, JoinStyle)-import Graphics.UI.Gtk.General.Enums (StateType)+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.Gdk.Enums (Function, Fill, SubwindowMode,+ LineStyle, CapStyle, JoinStyle)+#endif+import Graphics.UI.Gtk.General.Enums (StateType) import Graphics.UI.Gtk.General.DNDTypes (InfoId, Atom(Atom) , SelectionTag, TargetTag, SelectionTypeTag) import Graphics.Rendering.Pango.Structs ( Color(..), Rectangle(..) )+#if !defined(WIN32) || GTK_CHECK_VERSION(2,14,0)+#else+import Unsafe.Coerce+#endif -- | Represents the x and y coordinate of a point. -- type Point = (Int, Int)- -instance Storable Point where ++instance Storable Point where sizeOf _ = #{const sizeof(GdkPoint)} alignment _ = alignment (undefined:: #gtk2hs_type gint) peek ptr = do- (x_ ::#gtk2hs_type gint) <- #{peek GdkPoint, x} ptr- (y_ ::#gtk2hs_type gint) <- #{peek GdkPoint, y} ptr- return $ (fromIntegral x_, fromIntegral y_) + (x_ ::#gtk2hs_type gint) <- #{peek GdkPoint, x} ptr+ (y_ ::#gtk2hs_type gint) <- #{peek GdkPoint, y} ptr+ return $ (fromIntegral x_, fromIntegral y_) poke ptr (x, y) = do #{poke GdkPoint, x} ptr ((fromIntegral x)::#gtk2hs_type gint) #{poke GdkPoint, y} ptr ((fromIntegral y)::#gtk2hs_type gint)@@ -141,12 +161,12 @@ sizeOf _ = #{const sizeof(GdkRectangle)} alignment _ = alignment (undefined:: #gtk2hs_type gint) peek ptr = do- (x_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, x} ptr- (y_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, y} ptr- (width_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, width} ptr- (height_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, height} ptr- return $ Rectangle (fromIntegral x_) (fromIntegral y_) - (fromIntegral width_) (fromIntegral height_)+ (x_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, x} ptr+ (y_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, y} ptr+ (width_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, width} ptr+ (height_ ::#gtk2hs_type gint) <- #{peek GdkRectangle, height} ptr+ return $ Rectangle (fromIntegral x_) (fromIntegral y_)+ (fromIntegral width_) (fromIntegral height_) poke ptr (Rectangle x y width height) = do #{poke GdkRectangle, x} ptr ((fromIntegral x)::#gtk2hs_type gint) #{poke GdkRectangle, y} ptr ((fromIntegral y)::#gtk2hs_type gint)@@ -157,7 +177,7 @@ sizeOf _ = #{const sizeof(GdkColor)} alignment _ = alignment (undefined::#gtk2hs_type guint32) peek ptr = do- red <- #{peek GdkColor, red} ptr+ red <- #{peek GdkColor, red} ptr green <- #{peek GdkColor, green} ptr blue <- #{peek GdkColor, blue} ptr return $ Color red green blue@@ -166,10 +186,33 @@ #{poke GdkColor, red} ptr red #{poke GdkColor, green} ptr green #{poke GdkColor, blue} ptr blue+#if GTK_MAJOR_VERSION < 3 cPtr <- gdkColormapGetSystem gdkColormapAllocColor cPtr ptr 0 1+#endif return () +#if GTK_MAJOR_VERSION >= 3+data RGBA = RGBA Double Double Double Double++instance Storable RGBA where+ sizeOf _ = #{const sizeof(GdkRGBA)}+ alignment _ = alignment (undefined::#gtk2hs_type guint32)+ peek ptr = do+ red <- #{peek GdkRGBA, red} ptr+ green <- #{peek GdkRGBA, green} ptr+ blue <- #{peek GdkRGBA, blue} ptr+ alpha <- #{peek GdkRGBA, alpha} ptr+ return $ RGBA red green blue alpha+ poke ptr (RGBA red green blue alpha) = do+ #{poke GdkRGBA, red} ptr red+ #{poke GdkRGBA, green} ptr green+ #{poke GdkRGBA, blue} ptr blue+ #{poke GdkRGBA, alpha} ptr alpha+ return ()+#endif++#if GTK_MAJOR_VERSION < 3 type ColorMap = () foreign import ccall unsafe "gdk_colormap_get_system"@@ -182,13 +225,13 @@ gdkColormapQueryColor :: Ptr ColorMap -> CULong -> Ptr Color -> IO () -- entry GC- -- | Intermediate data structure for 'GC's. -- -- * If @graphicsExposure@ is set then copying portions into a -- drawable will generate an @\"exposure\"@ event, even if the -- destination area is not currently visible. --+-- Removed in Gtk3. data GCValues = GCValues { foreground :: Color, background :: Color,@@ -221,46 +264,46 @@ backgroundPtr = #{ptr GdkGCValues, background} ptr (foregroundPixelPtr :: CULong) <- #{peek GdkColor, pixel} foregroundPtr (backgroundPixelPtr :: CULong) <- #{peek GdkColor, pixel} backgroundPtr- colormapPtr <- gdkColormapGetSystem + colormapPtr <- gdkColormapGetSystem gdkColormapQueryColor colormapPtr foregroundPixelPtr foregroundPtr gdkColormapQueryColor colormapPtr backgroundPixelPtr backgroundPtr foreground_ <- peek (#{ptr GdkGCValues, foreground} ptr) background_ <- peek (#{ptr GdkGCValues, background} ptr)- (function_ :: #{gtk2hs_type GdkFunction}) <- #{peek GdkGCValues, function} ptr- (fill_ :: #{gtk2hs_type GdkFill}) <- #{peek GdkGCValues, fill} ptr- tile_ <- do- pPtr <- #{peek GdkGCValues, tile} ptr- if (pPtr==nullPtr) then return Nothing else- liftM Just $ makeNewGObject mkPixmap $ return pPtr- stipple_ <- do- pPtr <- #{peek GdkGCValues, stipple} ptr- if (pPtr==nullPtr) then return Nothing else- liftM Just $ makeNewGObject mkPixmap $ return pPtr- clipMask_ <- do- pPtr <- #{peek GdkGCValues, clip_mask} ptr- if (pPtr==nullPtr) then return Nothing else- liftM Just $ makeNewGObject mkPixmap $ return pPtr- (subwindow_ :: #{gtk2hs_type GdkSubwindowMode}) - <- #{peek GdkGCValues, subwindow_mode} ptr- (tsXOrigin_ :: #{gtk2hs_type gint}) - <- #{peek GdkGCValues, ts_x_origin} ptr- (tsYOrigin_ :: #{gtk2hs_type gint}) - <- #{peek GdkGCValues, ts_y_origin} ptr- (clipXOrigin_:: #{gtk2hs_type gint}) - <- #{peek GdkGCValues, clip_x_origin} ptr- (clipYOrigin_:: #{gtk2hs_type gint}) - <- #{peek GdkGCValues, clip_y_origin} ptr- (graphics_ :: #{gtk2hs_type gint})- <- #{peek GdkGCValues, graphics_exposures} ptr- (lineWidth_ :: #{gtk2hs_type gint})- <- #{peek GdkGCValues, line_width} ptr- (lineStyle_ :: #{gtk2hs_type GdkLineStyle}) - <- #{peek GdkGCValues, line_style} ptr- (capStyle_ :: #{gtk2hs_type GdkCapStyle}) - <- #{peek GdkGCValues, cap_style} ptr- (joinStyle_ :: #{gtk2hs_type GdkJoinStyle}) - <- #{peek GdkGCValues, join_style} ptr+ (function_ :: #{gtk2hs_type GdkFunction}) <- #{peek GdkGCValues, function} ptr+ (fill_ :: #{gtk2hs_type GdkFill}) <- #{peek GdkGCValues, fill} ptr+ tile_ <- do+ pPtr <- #{peek GdkGCValues, tile} ptr+ if (pPtr==nullPtr) then return Nothing else+ liftM Just $ makeNewGObject mkPixmap $ return pPtr+ stipple_ <- do+ pPtr <- #{peek GdkGCValues, stipple} ptr+ if (pPtr==nullPtr) then return Nothing else+ liftM Just $ makeNewGObject mkPixmap $ return pPtr+ clipMask_ <- do+ pPtr <- #{peek GdkGCValues, clip_mask} ptr+ if (pPtr==nullPtr) then return Nothing else+ liftM Just $ makeNewGObject mkPixmap $ return pPtr+ (subwindow_ :: #{gtk2hs_type GdkSubwindowMode})+ <- #{peek GdkGCValues, subwindow_mode} ptr+ (tsXOrigin_ :: #{gtk2hs_type gint})+ <- #{peek GdkGCValues, ts_x_origin} ptr+ (tsYOrigin_ :: #{gtk2hs_type gint})+ <- #{peek GdkGCValues, ts_y_origin} ptr+ (clipXOrigin_:: #{gtk2hs_type gint})+ <- #{peek GdkGCValues, clip_x_origin} ptr+ (clipYOrigin_:: #{gtk2hs_type gint})+ <- #{peek GdkGCValues, clip_y_origin} ptr+ (graphics_ :: #{gtk2hs_type gint})+ <- #{peek GdkGCValues, graphics_exposures} ptr+ (lineWidth_ :: #{gtk2hs_type gint})+ <- #{peek GdkGCValues, line_width} ptr+ (lineStyle_ :: #{gtk2hs_type GdkLineStyle})+ <- #{peek GdkGCValues, line_style} ptr+ (capStyle_ :: #{gtk2hs_type GdkCapStyle})+ <- #{peek GdkGCValues, cap_style} ptr+ (joinStyle_ :: #{gtk2hs_type GdkJoinStyle})+ <- #{peek GdkGCValues, join_style} ptr return $ GCValues { foreground = foreground_, background = background_,@@ -280,6 +323,7 @@ capStyle = (toEnum.fromIntegral) capStyle_, joinStyle = (toEnum.fromIntegral) joinStyle_ }+ poke = error "GCValues poke undefined (not sure why)" pokeGCValues :: Ptr GCValues -> GCValues -> IO CInt pokeGCValues ptr (GCValues {@@ -302,17 +346,17 @@ joinStyle = joinStyle_ }) = do r <- newIORef 0- add r #{const GDK_GC_FOREGROUND } $ + add r #{const GDK_GC_FOREGROUND } $ poke (#{ptr GdkGCValues, foreground} ptr) foreground_- add r #{const GDK_GC_BACKGROUND } $ + add r #{const GDK_GC_BACKGROUND } $ poke (#{ptr GdkGCValues, background} ptr) background_- add r #{const GDK_GC_FUNCTION } $ - #{poke GdkGCValues, function} ptr + add r #{const GDK_GC_FUNCTION } $+ #{poke GdkGCValues, function} ptr (fromIntegral (fromEnum function_):: #{gtk2hs_type GdkFunction}) add r #{const GDK_GC_FILL } $- #{poke GdkGCValues, fill} ptr + #{poke GdkGCValues, fill} ptr (fromIntegral (fromEnum fill_):: #{gtk2hs_type GdkFill})- case tile_ of + case tile_ of Nothing -> return () Just tile_ -> add r #{const GDK_GC_TILE} $ withForeignPtr (unPixmap tile_) $@@ -336,7 +380,7 @@ add r #{const GDK_GC_TS_Y_ORIGIN } $ #{poke GdkGCValues, ts_y_origin } ptr (fromIntegral tsYOrigin_:: #{gtk2hs_type gint})- add r #{const GDK_GC_CLIP_X_ORIGIN } $ + add r #{const GDK_GC_CLIP_X_ORIGIN } $ #{poke GdkGCValues, clip_x_origin } ptr (fromIntegral clipXOrigin_:: #{gtk2hs_type gint}) add r #{const GDK_GC_CLIP_Y_ORIGIN } $@@ -351,10 +395,10 @@ add r #{const GDK_GC_LINE_STYLE } $ #{poke GdkGCValues, line_style } ptr (fromIntegral (fromEnum lineStyle_):: #{gtk2hs_type GdkLineStyle})- add r #{const GDK_GC_CAP_STYLE } $ + add r #{const GDK_GC_CAP_STYLE } $ #{poke GdkGCValues, cap_style } ptr (fromIntegral (fromEnum capStyle_):: #{gtk2hs_type GdkCapStyle})- add r #{const GDK_GC_JOIN_STYLE } $ + add r #{const GDK_GC_JOIN_STYLE } $ #{poke GdkGCValues, join_style } ptr (fromIntegral (fromEnum joinStyle_):: #{gtk2hs_type GdkJoinStyle}) readIORef r@@ -369,6 +413,7 @@ -- * Use this value instead of the constructor to avoid compiler wanings -- about uninitialized fields. --+-- Removed in Gtk3. newGCValues :: GCValues newGCValues = GCValues { foreground = undefined,@@ -389,14 +434,16 @@ capStyle = undefined, joinStyle = undefined }+#endif -- Widget related methods-+#if GTK_MAJOR_VERSION < 3 -- | Retrieve the current state of the widget. -- -- * The state refers to different modes of user interaction, see -- 'StateType' for more information. --+-- Removed in Gtk3. widgetGetState :: WidgetClass w => w -> IO StateType widgetGetState w = liftM (\x -> toEnum (fromIntegral (x :: #gtk2hs_type guint8))) $@@ -407,11 +454,12 @@ -- * If a widget is turned insensitive, the previous state is stored in -- a specific location. This function retrieves this previous state. --+-- Removed in Gtk3. widgetGetSavedState :: WidgetClass w => w -> IO StateType widgetGetSavedState w = liftM (\x -> toEnum (fromIntegral (x :: #gtk2hs_type guint8))) $ withForeignPtr ((unWidget . toWidget) w) $ #{peek GtkWidget,saved_state}-+#endif -- | Allocation --@@ -433,8 +481,8 @@ sizeOf _ = #{const sizeof(GtkRequisition)} alignment _ = alignment (undefined::#gtk2hs_type gint) peek ptr = do- (width_ ::#gtk2hs_type gint) <- #{peek GtkRequisition, width} ptr- (height_ ::#gtk2hs_type gint) <- #{peek GtkRequisition, height} ptr+ (width_ ::#gtk2hs_type gint) <- #{peek GtkRequisition, width} ptr+ (height_ ::#gtk2hs_type gint) <- #{peek GtkRequisition, height} ptr return $ Requisition (fromIntegral width_) (fromIntegral height_) poke ptr (Requisition width height) = do #{poke GtkRequisition, width} ptr ((fromIntegral width)::#gtk2hs_type gint)@@ -462,7 +510,7 @@ textIterSize = #{const sizeof(GtkTextIter)} -- Dialog related methods-+#if GTK_MAJOR_VERSION < 3 -- | Get the upper part of a dialog. -- -- * The upper part of a dialog window consists of a 'VBox'.@@ -480,7 +528,8 @@ -- dialogGetActionArea :: DialogClass dc => dc -> IO HBox dialogGetActionArea dc = makeNewObject mkHBox $ liftM castPtr $- withForeignPtr ((unDialog.toDialog) dc) #{peek GtkDialog, action_area} + withForeignPtr ((unDialog.toDialog) dc) #{peek GtkDialog, action_area}+#endif -- | Some constructors that can be used as response -- numbers for dialogs.@@ -512,7 +561,7 @@ -- | \"Close\" was pressed. -- -- * This value is returned from the \"Close\" stock dialog button.- | ResponseClose+ | ResponseClose -- | \"Yes\" was pressed. --@@ -527,7 +576,7 @@ -- | \"Apply\" was pressed. -- -- * This value is returned from the \"Apply\" stock dialog button.- | ResponseApply+ | ResponseApply -- | \"Help\" was pressed. --@@ -569,9 +618,10 @@ toResponse i = ResponseUser $ fromIntegral i #if !defined(WIN32) || GTK_CHECK_VERSION(2,8,0)--- | The identifer of a window of the underlying windowing system.+-- | The identifier of a window of the underlying windowing system. ---#ifdef GDK_NATIVE_WINDOW_POINTER+#if defined(GDK_NATIVE_WINDOW_POINTER) && !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ)+--GDK Quartz also defined GDK_NATIVE_WINDOW_POINTER newtype NativeWindowId = NativeWindowId (Ptr ()) deriving (Eq, Show) unNativeWindowId :: NativeWindowId -> Ptr a unNativeWindowId (NativeWindowId id) = castPtr id@@ -581,8 +631,22 @@ fromNativeWindowId = castPtr . unNativeWindowId nativeWindowIdNone :: NativeWindowId nativeWindowIdNone = NativeWindowId nullPtr+#elif defined(HAVE_QUARTZ_GTK) || defined(GDK_WINDOWING_QUARTZ) || (defined(WIN32) && GTK_MAJOR_VERSION >= 3)+newtype NativeWindowId = NativeWindowId (Maybe DrawWindow) deriving (Eq)+unNativeWindowId :: NativeWindowId -> Maybe DrawWindow+unNativeWindowId (NativeWindowId id) = id+toNativeWindowId :: Maybe DrawWindow -> NativeWindowId+toNativeWindowId = NativeWindowId+fromNativeWindowId :: NativeWindowId -> Maybe DrawWindow+fromNativeWindowId = unNativeWindowId+nativeWindowIdNone :: NativeWindowId+nativeWindowIdNone = NativeWindowId Nothing #else+#if GTK_MAJOR_VERSION < 3 newtype NativeWindowId = NativeWindowId #{gtk2hs_type GdkNativeWindow} deriving (Eq, Show)+#else+newtype NativeWindowId = NativeWindowId #{gtk2hs_type Window} deriving (Eq, Show)+#endif unNativeWindowId :: Integral a => NativeWindowId -> a unNativeWindowId (NativeWindowId id) = fromIntegral id toNativeWindowId :: Integral a => a -> NativeWindowId@@ -594,37 +658,68 @@ #endif #endif -#if !defined(WIN32)-foreign import ccall unsafe "gdk_x11_drawable_get_xid" - gdk_x11_drawable_get_xid :: (Ptr Drawable) -> IO CInt-#else -foreign import ccall unsafe "gdk_win32_drawable_get_handle" +#if GTK_MAJOR_VERSION < 3+#if defined(WIN32)+foreign import ccall unsafe "gdk_win32_drawable_get_handle" gdk_win32_drawable_get_handle :: (Ptr Drawable) -> IO (Ptr a)-#endif +#elif !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ)+foreign import ccall unsafe "gdk_x11_drawable_get_xid"+ gdk_x11_drawable_get_xid :: (Ptr Drawable) -> IO CInt+#endif+#else+#if !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ) && !defined(WIN32)+foreign import ccall unsafe "gdk_x11_window_get_xid"+ gdk_x11_drawable_get_xid :: (Ptr DrawWindow) -> IO CInt+#endif+#endif --- | Get 'NativeWindowId' of 'Drawable'. +-- | Get 'NativeWindowId' of 'Drawable'.+#if GTK_MAJOR_VERSION < 3 && !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ) drawableGetID :: DrawableClass d => d -> IO NativeWindowId+#else+drawableGetID :: DrawWindowClass d => d -> IO NativeWindowId+#endif drawableGetID d = liftM toNativeWindowId $+#if GTK_MAJOR_VERSION < 3 && !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ) (\(Drawable drawable) ->-#if !defined(WIN32)- withForeignPtr drawable gdk_x11_drawable_get_xid-#else +#else+ (\(DrawWindow drawable) ->+#endif+#if defined(WIN32) && GTK_MAJOR_VERSION < 3+#if GTK_CHECK_VERSION(2,14,0)+#else+ -- GTK-2.12 is a bit sloppy about the distinction between pointers and+ -- 32-bit ints, so we have to mimic that sloppiness here+ liftM unsafeCoerce $+#endif withForeignPtr drawable gdk_win32_drawable_get_handle+#elif !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ) && !defined(WIN32)+ withForeignPtr drawable gdk_x11_drawable_get_xid+#else+ return $ Just (DrawWindow drawable) #endif+#if GTK_MAJOR_VERSION < 3 && !defined(HAVE_QUARTZ_GTK) && !defined(GDK_WINDOWING_QUARTZ) ) (toDrawable d)+#else+ ) (toDrawWindow d)+#endif ++#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- Static values for different Toolbar widgets. -- -- * c2hs and hsc should agree on types! --+-- Removed in Gtk3. toolbarChildButton, toolbarChildToggleButton, toolbarChildRadioButton :: CInt -- \#gtk2hs_type GtkToolbarChildType toolbarChildButton = #const GTK_TOOLBAR_CHILD_BUTTON toolbarChildToggleButton = #const GTK_TOOLBAR_CHILD_TOGGLEBUTTON toolbarChildRadioButton = #const GTK_TOOLBAR_CHILD_RADIOBUTTON #endif+#endif -- | The size of an icon in pixels. --@@ -656,7 +751,7 @@ -- | Icon size for icons next to dialog text. | IconSizeDialog- + | IconSizeUser Int deriving (Eq) @@ -670,30 +765,32 @@ toEnum #{const GTK_ICON_SIZE_DIALOG} = IconSizeDialog toEnum n = IconSizeUser n fromEnum IconSizeInvalid = #{const GTK_ICON_SIZE_INVALID}- fromEnum IconSizeMenu = #{const GTK_ICON_SIZE_MENU} + fromEnum IconSizeMenu = #{const GTK_ICON_SIZE_MENU} fromEnum IconSizeSmallToolbar = #{const GTK_ICON_SIZE_SMALL_TOOLBAR} fromEnum IconSizeLargeToolbar = #{const GTK_ICON_SIZE_LARGE_TOOLBAR} fromEnum IconSizeButton = #{const GTK_ICON_SIZE_BUTTON} fromEnum IconSizeDnd = #{const GTK_ICON_SIZE_DND} fromEnum IconSizeDialog = #{const GTK_ICON_SIZE_DIALOG} fromEnum (IconSizeUser n) = n- --- entry Widget Combo +-- entry Widget Combo+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- | Extract the List container from a 'Combo' box. --+-- Removed in Gtk3. comboGetList :: Combo -> IO List comboGetList c = withForeignPtr (unCombo c) $ \cPtr -> makeNewObject mkList $ #{peek GtkCombo, list} cPtr #endif+#endif -- FileSelection related methods-+#if GTK_MAJOR_VERSION < 3 -- | Extract the buttons of a fileselection. ---fileSelectionGetButtons :: FileSelectionClass fsel => fsel -> - IO (Button, Button)+fileSelectionGetButtons :: FileSelectionClass fsel => fsel ->+ IO (Button, Button) fileSelectionGetButtons fsel = do ok <- butPtrToButton #{peek GtkFileSelection, ok_button}@@ -702,18 +799,21 @@ where butPtrToButton bp = makeNewObject mkButton $ liftM castPtr $ withForeignPtr ((unFileSelection . toFileSelection) fsel) bp+#endif +#if GTK_MAJOR_VERSION < 3 -- DrawingArea related methods -- | Retrieves the 'DrawWindow' that the widget draws onto. ----- This function thows an error if the widget has not yet been realized, since+-- This function throws an error if the widget has not yet been realized, since -- a widget does not allocate its window resources until just before it is -- displayed on the screen. You can use the -- 'Graphics.UI.Gtk.Abstract.Widget.onRealize' signal to give you the -- opportunity to use a widget's 'DrawWindow' as soon as it has been created -- but before the widget is displayed. --+-- Removed in Gtk3. widgetGetDrawWindow :: WidgetClass widget => widget -> IO DrawWindow widgetGetDrawWindow da = withForeignPtr (unWidget.toWidget $ da) $ \da' -> do@@ -726,27 +826,20 @@ -- -- * This information may be out of date if the user is resizing the window. --+-- Removed in Gtk3. widgetGetSize :: WidgetClass widget => widget -> IO (Int, Int) widgetGetSize da = withForeignPtr (unWidget.toWidget $ da) $ \wPtr -> do- (width :: #{gtk2hs_type gint}) <- #{peek GtkAllocation, width} - (#{ptr GtkWidget, allocation} wPtr)+ (width :: #{gtk2hs_type gint}) <- #{peek GtkAllocation, width}+ (#{ptr GtkWidget, allocation} wPtr) (height :: #{gtk2hs_type gint}) <- #{peek GtkAllocation, height}- (#{ptr GtkWidget, allocation} wPtr)+ (#{ptr GtkWidget, allocation} wPtr) return (fromIntegral width, fromIntegral height) --- Layout related methods---- | Retrieves the 'Drawable' part.----layoutGetDrawWindow :: Layout -> IO DrawWindow-layoutGetDrawWindow lay = makeNewGObject mkDrawWindow $- withForeignPtr (unLayout lay) $- \lay' -> liftM castPtr $ #{peek GtkLayout, bin_window} lay'- -- Window related methods -- | Retrieves the frame 'DrawWindow' that contains a 'Window'. --+-- Removed in Gtk3. windowGetFrame :: WindowClass widget => widget -> IO (Maybe DrawWindow) windowGetFrame da = withForeignPtr (unWidget.toWidget $ da) $ \da' -> do@@ -754,7 +847,7 @@ if drawWindowPtr == nullPtr then return Nothing else liftM Just $ makeNewGObject mkDrawWindow (return $ castPtr drawWindowPtr)-+#endif -- Styles related methods -- | Retrieve the the foreground color.@@ -846,7 +939,7 @@ -- | Retrieve the color for drawing anti-aliased text. -- -- * The anti-aliasing color is the color which is used when the rendering--- of a character does not make it clear if a certain pixel shoud be set+-- of a character does not make it clear if a certain pixel should be set -- or not. This color is between the text and the base color. -- -- * The parameter @state@ determines for which widget@@ -859,7 +952,10 @@ withForeignPtr (unStyle st) $ \stPtr -> peekElemOff (#{ptr GtkStyle, text_aa} stPtr) (fromEnum ty) +#if GTK_MAJOR_VERSION < 3 -- | Retrieve the ColorSelection object contained within the dialog.+--+-- Removed in Gtk3. colorSelectionDialogGetColor :: ColorSelectionDialog -> IO ColorSelection colorSelectionDialogGetColor cd = makeNewObject mkColorSelection $ liftM castPtr $@@ -867,6 +963,8 @@ #{peek GtkColorSelectionDialog, colorsel} -- | Retrieve the OK button widget contained within the dialog.+--+-- Removed in Gtk3. colorSelectionDialogGetOkButton :: ColorSelectionDialog -> IO Button colorSelectionDialogGetOkButton cd = makeNewObject mkButton $ liftM castPtr $@@ -874,6 +972,8 @@ #{peek GtkColorSelectionDialog, ok_button} -- | Retrieve the Cancel button widget contained within the dialog.+--+-- Removed in Gtk3. colorSelectionDialogGetCancelButton :: ColorSelectionDialog -> IO Button colorSelectionDialogGetCancelButton cd = makeNewObject mkButton $ liftM castPtr $@@ -881,6 +981,8 @@ #{peek GtkColorSelectionDialog, cancel_button} -- | Retrieve the Help button widget contained within the dialog.+--+-- Removed in Gtk3. colorSelectionDialogGetHelpButton :: ColorSelectionDialog -> IO Button colorSelectionDialogGetHelpButton cd = makeNewObject mkButton $ liftM castPtr $@@ -910,6 +1012,7 @@ dragContextSetSuggestedAction :: DragContext -> Int -> IO () dragContextSetSuggestedAction dc val = withForeignPtr (unDragContext dc) $ \ptr -> #{poke GdkDragContext, suggested_action} ptr (fromIntegral val :: #{gtk2hs_type int})+#endif -- | ID number of a sort column. --@@ -962,11 +1065,13 @@ selectionTypeString :: SelectionTypeTag selectionTypeString = intToAtom #{const GDK_SELECTION_TYPE_STRING} +#if GTK_MAJOR_VERSION < 3 -- | Extract the type field of SelectionData*. This should be in the -- Selection modules but c2hs chokes on the 'type' field. selectionDataGetType :: Ptr () -> IO SelectionTypeTag selectionDataGetType selPtr = liftM intToAtom $ #{peek GtkSelectionData, type} selPtr+#endif -- A type that identifies a target. This is needed to marshal arrays of -- GtkTargetEntries.@@ -982,7 +1087,6 @@ withTargetEntries tags fun = do ptrsInfo <- mapM (\(Atom tag, info) -> gdk_atom_name tag >>= \strPtr -> return (TargetEntry strPtr info)) tags- let len = length tags res <- withArrayLen ptrsInfo (\len ptr -> fun len (castPtr ptr)) mapM_ (\(TargetEntry ptr _) -> g_free ptr) ptrsInfo return res@@ -1001,3 +1105,35 @@ #{poke GtkTargetEntry, target} ptr cPtr #{poke GtkTargetEntry, flags} ptr (0::#{gtk2hs_type guint}) #{poke GtkTargetEntry, info} ptr info++-- | A 'KeymapKey' is a hardware key that can be mapped to a keyval.+data KeymapKey = KeymapKey {+ keycode :: Int -- ^ @keycode@ the hardware keycode. This is an identifying number for a physical key.+ ,group :: Int -- ^ @group@ indicates movement in a horizontal direction.+ -- Usually groups are used for two different languages.+ -- In group 0, a key might have two English characters,+ -- and in group 1 it might have two Hebrew characters.+ -- The Hebrew characters will be printed on the key next to the English characters.+ -- indicates which symbol on the key will be used,+ -- in a vertical direction. So on a standard US keyboard, the+ ,level :: Int -- ^ @level@ key with the number "1" on it also has the exclamation+ -- point ("!") character on it. The level+ -- indicates whether to use the "1" or the "!" symbol. The letter keys are considered to+ -- have a lowercase letter at level 0, and an uppercase letter at level 1, though only+ -- the uppercase letter is printed.+ } deriving (Eq, Show)++instance Storable KeymapKey where+ sizeOf _ = #{const sizeof(GdkKeymapKey)}+ alignment _ = alignment (undefined::#gtk2hs_type gint)+ peek ptr = do+ (keycode_ ::#gtk2hs_type guint) <- #{peek GdkKeymapKey, keycode} ptr+ (group_ ::#gtk2hs_type gint) <- #{peek GdkKeymapKey, group} ptr+ (level_ ::#gtk2hs_type gint) <- #{peek GdkKeymapKey, level} ptr+ return $ KeymapKey (fromIntegral keycode_) (fromIntegral group_) (fromIntegral level_)+ poke ptr (KeymapKey keycode group level) = do+ #{poke GdkKeymapKey, keycode} ptr ((fromIntegral keycode)::#gtk2hs_type guint)+ #{poke GdkKeymapKey, group} ptr ((fromIntegral group)::#gtk2hs_type gint)+ #{poke GdkKeymapKey, level} ptr ((fromIntegral level)::#gtk2hs_type gint)++
Graphics/UI/Gtk/General/Style.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Styles --@@ -34,7 +35,7 @@ -- module Graphics.UI.Gtk.General.Style ( -- * Description--- +-- -- | Styles are attached to widgets and determine how particular parts are -- drawn and with what color. Thus they are should be seen as mandatory when -- one implements a new custom widgets via 'DrawingArea'. Although the@@ -58,16 +59,84 @@ styleGetDark, styleGetText, styleGetBase,- styleGetAntiAliasing+ styleGetAntiAliasing,++#if GTK_MAJOR_VERSION < 3+ stylePaintFlatBox,+ stylePaintLayout,+#endif+ ) where +{# context prefix ="gtk" #}++#if GTK_MAJOR_VERSION < 3+import System.Glib.FFI+{#import Graphics.Rendering.Pango.Types#}+import Graphics.Rendering.Pango.BasicTypes+import Graphics.UI.Gtk.General.Structs (Rectangle)+import Graphics.UI.Gtk.General.Enums (StateType, ShadowType)+#endif+ {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Structs (styleGetForeground,- styleGetBackground,- styleGetLight,- styleGetMiddle,- styleGetDark,- styleGetText,- styleGetBase,- styleGetAntiAliasing)+import Graphics.UI.Gtk.General.Structs (styleGetForeground,+ styleGetBackground,+ styleGetLight,+ styleGetMiddle,+ styleGetDark,+ styleGetText,+ styleGetBase,+ styleGetAntiAliasing) +#if GTK_MAJOR_VERSION < 3+stylePaintFlatBox :: WidgetClass widget+ => Style+ -> DrawWindow+ -> StateType+ -> ShadowType+ -> Rectangle+ -> widget+ -> String+ -> Int -> Int -> Int -> Int+ -> IO ()+stylePaintFlatBox style window stateType shadowType+ clipRect widget detail x y width height =+ with clipRect $ \rectPtr ->+ withCString detail $ \detailPtr ->+ {# call paint_flat_box #}+ style+ window+ ((fromIntegral.fromEnum) stateType)+ ((fromIntegral.fromEnum) shadowType)+ (castPtr rectPtr)+ (toWidget widget)+ detailPtr+ (fromIntegral x) (fromIntegral y)+ (fromIntegral width) (fromIntegral height)++stylePaintLayout :: WidgetClass widget+ => Style+ -> DrawWindow+ -> StateType+ -> Bool+ -> Rectangle+ -> widget+ -> String+ -> Int -> Int+ -> PangoLayout+ -> IO ()+stylePaintLayout style window stateType useText+ clipRect widget detail x y (PangoLayout _ layout) =+ with clipRect $ \rectPtr ->+ withCString detail $ \detailPtr ->+ {# call gtk_paint_layout #}+ style+ window+ ((fromIntegral.fromEnum) stateType)+ (fromBool useText)+ (castPtr rectPtr)+ (toWidget widget)+ detailPtr+ (fromIntegral x) (fromIntegral y)+ layout+#endif
Graphics/UI/Gtk/General/hsgthread.c view
@@ -25,13 +25,20 @@ * instead. */ +#define DEFINED_LPTYPELIB+#define DEFINDE_LPTYPEINFO+#define DEFINED_LPTYPECOMP+#define DEFINE_LPCREATETYPEINFO+#define DEFINED_LPDISPATCH+ #include <glib.h>-#include <glib/gthread.h> #include <gdk/gdk.h> #include "hsgthread.h" #if defined( WIN32 ) #include <windows.h>+#include <stdlib.h>+#include <fcntl.h> #endif #undef DEBUG@@ -40,7 +47,7 @@ #if defined( WIN32 ) static CRITICAL_SECTION gtk2hs_finalizer_mutex; #else-static GStaticMutex gtk2hs_finalizer_mutex;+static GMutex gtk2hs_finalizer_mutex; #endif static GSource* gtk2hs_finalizer_source; static guint gtk2hs_finalizer_id;@@ -48,6 +55,40 @@ gboolean gtk2hs_run_finalizers(gpointer data); +#if defined( WIN32 ) && GLIB_CHECK_VERSION(2,32,0)+static GRecMutex recursive_mutex;++void imp_rec_lock() {+ g_rec_mutex_lock(&recursive_mutex);+}++void imp_rec_unlock() {+ g_rec_mutex_unlock(&recursive_mutex);+}+#endif++/* Initialize the default _fmode on WIN32. */+void gtk2hs_initialise (void) {+#if defined( WIN32 ) && defined( GTK2HS_SET_FMODE_BINARY )+ /* Some Windows GTK binaries (current Fedora MinGW ones) do */+ /* not open files in binary mode. This is a work around. */+ HANDLE handle = LoadLibrary("MSVCRT.dll");+ if(!handle) { + fprintf(stderr, "Warning: failed to load MSVCRT.dll, ");+ fprintf(stderr, "binary mode was not set!\n");+ return;+ }+ + int *_fmode_ptr = GetProcAddress(handle, "_fmode");+ if(!_fmode_ptr) {+ fprintf(stderr, "Warning: failed to load address of _fmode from MSVCRT.dll, ");+ fprintf(stderr, "binary mode was not set!\n");+ return;+ }+ *_fmode_ptr = _O_BINARY;+#endif+}+ /* Initialize the threads system of Gdk and Gtk. */ void gtk2hs_threads_initialise (void) { @@ -61,9 +102,14 @@ #if defined( WIN32 ) InitializeCriticalSection(>k2hs_finalizer_mutex); #else- g_static_mutex_init(>k2hs_finalizer_mutex);+ g_mutex_init(>k2hs_finalizer_mutex); #endif- g_thread_init(NULL);++#if defined( WIN32 ) && GLIB_CHECK_VERSION(2,32,0)+ g_rec_mutex_init(&recursive_mutex);+ + gdk_threads_set_lock_functions(imp_rec_lock, imp_rec_unlock);+#endif gdk_threads_init(); /* from here onwards, the Gdk lock is held */@@ -86,7 +132,7 @@ #if defined( WIN32 ) EnterCriticalSection(>k2hs_finalizer_mutex); #else- g_static_mutex_lock(>k2hs_finalizer_mutex);+ g_mutex_lock(>k2hs_finalizer_mutex); #endif mutex_locked = 1; }@@ -131,7 +177,7 @@ #if defined( WIN32 ) LeaveCriticalSection(>k2hs_finalizer_mutex); #else- g_static_mutex_unlock(>k2hs_finalizer_mutex);+ g_mutex_unlock(>k2hs_finalizer_mutex); #endif } }@@ -151,7 +197,7 @@ #if defined( WIN32 ) EnterCriticalSection(>k2hs_finalizer_mutex); #else- g_static_mutex_lock(>k2hs_finalizer_mutex);+ g_mutex_lock(>k2hs_finalizer_mutex); #endif mutex_locked = 1; }@@ -174,7 +220,7 @@ #if defined( WIN32 ) LeaveCriticalSection(>k2hs_finalizer_mutex); #else- g_static_mutex_unlock(>k2hs_finalizer_mutex);+ g_mutex_unlock(>k2hs_finalizer_mutex); #endif }
Graphics/UI/Gtk/General/hsgthread.h view
@@ -3,6 +3,9 @@ #ifndef HSGTHREAD_H #define HSGTHREAD_H +/* Initialize the default _fmode on WIN32 systems. */+void gtk2hs_initialise (void);+ /* Initialize the threads system of Gdk and Gtk. */ void gtk2hs_threads_initialise (void);
Graphics/UI/Gtk/Layout/Alignment.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.Alignment ( -- * Detail--- +-- -- | The 'Alignment' widget controls the alignment and size of its child -- widget. It has four settings: xscale, yscale, xalign, and yalign. --@@ -81,12 +81,12 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -96,7 +96,7 @@ -- | Creates a new 'Alignment'. ---alignmentNew :: +alignmentNew :: Float -- ^ @xalign@ - the horizontal alignment of the child widget, -- from 0 (left) to 1 (right). -> Float -- ^ @yalign@ - the vertical alignment of the child widget,
Graphics/UI/Gtk/Layout/AspectFrame.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget AspectFrame --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.AspectFrame ( -- * Detail--- +-- -- | The 'AspectFrame' is useful when you want pack a widget so that it can -- resize but always retains the same aspect ratio. For instance, one might be -- drawing a small preview of a larger image. 'AspectFrame' derives from@@ -64,13 +65,13 @@ aspectFrameObeyChild, ) where -import Control.Monad (liftM)-import Data.Maybe (isNothing)+import Control.Monad (liftM)+import Data.Maybe (isNothing) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -82,7 +83,7 @@ -- -- The frame may be augmented with a label which can be set by @frameSetLabel@. ---aspectFrameNew :: +aspectFrameNew :: Float -- ^ @xalign@ - Horizontal alignment of the child within -- the allocation of the 'AspectFrame'. This ranges from 0.0 -- (left aligned) to 1.0 (right aligned)
Graphics/UI/Gtk/Layout/Expander.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Layout.Expander ( -- * Detail--- +-- -- | A 'Expander' allows the user to hide or show its child by clicking on an -- expander triangle similar to the triangles used in a 'TreeView'. --@@ -82,6 +82,9 @@ expanderUseMarkup, expanderSpacing, expanderLabelWidget,+#if GTK_CHECK_VERSION(2,22,0)+ expanderLabelFill,+#endif -- * Signals onActivate,@@ -94,6 +97,7 @@ import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes+import System.Glib.Properties import Graphics.UI.Gtk.Abstract.Object {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.Signals@@ -106,7 +110,7 @@ -- | Creates a new expander using the given string as the text of the label. ---expanderNew :: String -> IO Expander+expanderNew :: GlibString string => string -> IO Expander expanderNew label = makeNewObject mkExpander $ liftM (castPtr :: Ptr Widget -> Ptr Expander) $@@ -121,8 +125,8 @@ -- accelerator called a mnemonic. Pressing Alt and that key activates the -- button. ---expanderNewWithMnemonic :: - String -- ^ @label@ - the text of the label with an underscore in+expanderNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - the text of the label with an underscore in -- front of the mnemonic character -> IO Expander expanderNewWithMnemonic label =@@ -178,7 +182,7 @@ -- -- This will also clear any previously set labels. ---expanderSetLabel :: Expander -> String -> IO ()+expanderSetLabel :: GlibString string => Expander -> string -> IO () expanderSetLabel self label = withUTFString label $ \labelPtr -> {# call gtk_expander_set_label #}@@ -188,7 +192,7 @@ -- | Fetches the text from the label of the expander, as set by -- 'expanderSetLabel'. ---expanderGetLabel :: Expander -> IO String+expanderGetLabel :: GlibString string => Expander -> IO string expanderGetLabel self = {# call gtk_expander_get_label #} self@@ -272,7 +276,7 @@ -- | Text of the expander's label. ---expanderLabel :: Attr Expander String+expanderLabel :: GlibString string => Attr Expander string expanderLabel = newAttr expanderGetLabel expanderSetLabel@@ -313,6 +317,15 @@ expanderLabelWidget = newAttr expanderGetLabelWidget expanderSetLabelWidget++#if GTK_CHECK_VERSION(2,22,0)+-- | Whether the label widget should fill all available horizontal space.+--+-- Default value: 'False'+--+expanderLabelFill :: Attr Expander Bool+expanderLabelFill = newAttrFromBoolProperty "label-fill"+#endif -------------------- -- Signals
Graphics/UI/Gtk/Layout/Fixed.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Fixed --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.Fixed ( -- * Detail--- +-- -- | The 'Fixed' widget is a container which can place child widgets at fixed -- positions and with fixed sizes, given in pixels. 'Fixed' performs no -- automatic layout management.@@ -83,22 +84,23 @@ -- * Methods fixedPut, fixedMove,+#if GTK_MAJOR_VERSION < 3 fixedSetHasWindow, fixedGetHasWindow, -- * Attributes fixedHasWindow,-+#endif -- * Child Attributes fixedChildX, fixedChildY, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.Abstract.ContainerChildProperties @@ -146,6 +148,7 @@ (fromIntegral x) (fromIntegral y) +#if GTK_MAJOR_VERSION < 3 -- | Sets whether the 'Fixed' widget is created with a separate 'DrawWindow' for -- its window or not. (By default, it will be created with no separate -- 'DrawWindow'). This function must be called while the 'Fixed' is not@@ -154,6 +157,7 @@ -- This function was added to provide an easy migration path for older -- applications which may expect 'Fixed' to have a separate window. --+-- Removed in Gtk3. Use the Widget version. fixedSetHasWindow :: FixedClass self => self -> Bool -> IO () fixedSetHasWindow self hasWindow = {# call fixed_set_has_window #}@@ -163,6 +167,7 @@ -- | Gets whether the 'Fixed' has its own 'DrawWindow'. See -- 'fixedSetHasWindow'. --+-- Removed in Gtk3. Use the Widget version. fixedGetHasWindow :: FixedClass self => self -> IO Bool fixedGetHasWindow self = liftM toBool $@@ -174,11 +179,12 @@ -- | \'hasWindow\' property. See 'fixedGetHasWindow' and 'fixedSetHasWindow' --+-- Removed in Gtk3. Use the Widget version. fixedHasWindow :: FixedClass self => Attr self Bool fixedHasWindow = newAttr fixedGetHasWindow fixedSetHasWindow-+#endif -------------------- -- Child Attributes
Graphics/UI/Gtk/Layout/HBox.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget HBox --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.HBox ( -- * Detail--- +-- -- | 'HBox' is a container that organizes child widgets into a single row. -- -- Use the 'Box' packing interface to determine the arrangement, spacing,@@ -58,10 +59,10 @@ hBoxNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -71,7 +72,7 @@ -- | Creates a new 'HBox'. ---hBoxNew :: +hBoxNew :: Bool -- ^ @homogeneous@ - @True@ if all children are to be given equal -- space allotments. -> Int -- ^ @spacing@ - the number of pixels to place by default between
Graphics/UI/Gtk/Layout/HButtonBox.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget HButtonBox --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.HButtonBox ( -- * Detail--- +-- -- | A button box should be used to provide a consistent layout of buttons -- throughout your application. The layout\/spacing can be altered by the -- programmer, or if desired, by the user to alter the \'feel\' of a program to
Graphics/UI/Gtk/Layout/HPaned.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget HPaned --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.HPaned ( -- * Detail--- +-- -- | The HPaned widget is a container widget with two children arranged -- horizontally. The division between the two panes is adjustable by the user -- by dragging a handle. See 'Paned' for details.@@ -52,10 +53,10 @@ hPanedNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/Layout/Layout.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Layout --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.Layout ( -- * Detail--- +-- -- | 'Layout' is similar to 'DrawingArea' in that it's a \"blank slate\" and -- doesn't do anything but paint a blank background by default. It's different -- in that it supports scrolling natively (you can add it to a@@ -79,16 +80,15 @@ afterSetScrollAdjustments, ) where -import Data.Maybe (fromMaybe)-import Control.Monad (liftM)+import Data.Maybe (fromMaybe)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Structs (layoutGetDrawWindow) import Graphics.UI.Gtk.Abstract.ContainerChildProperties {# context lib="gtk" prefix="gtk" #}@@ -100,7 +100,7 @@ -- the layout to use for scrolling, pass @Nothing@ for @hadjustment@ and -- @vadjustment@. ---layoutNew :: +layoutNew :: Maybe Adjustment -- ^ @hadjustment@ - horizontal scroll adjustment, or -- @Nothing@ -> Maybe Adjustment -- ^ @vadjustment@ - vertical scroll adjustment, or@@ -224,6 +224,13 @@ {# call layout_set_vadjustment #} (toLayout self) adjustment++-- | Retrieves the 'Drawable' part of the layout used for drawing operations.+--+layoutGetDrawWindow :: Layout -> IO DrawWindow+layoutGetDrawWindow lay = makeNewGObject mkDrawWindow $+ {# call layout_get_bin_window #}+ (toLayout lay) -------------------- -- Attributes
Graphics/UI/Gtk/Layout/Notebook.chs view
@@ -43,7 +43,7 @@ -- module Graphics.UI.Gtk.Layout.Notebook ( -- * Detail--- +-- -- | The 'Notebook' widget is a 'Container' whose children are pages that can -- be switched between using tab labels along one edge. --@@ -67,7 +67,9 @@ -- * Types Notebook, NotebookClass,+#if GTK_MAJOR_VERSION < 3 NotebookPage,+#endif castToNotebook, gTypeNotebook, toNotebook, @@ -96,11 +98,13 @@ notebookGetShowBorder, notebookSetScrollable, notebookGetScrollable,+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED notebookSetTabBorder, notebookSetTabHBorder, notebookSetTabVBorder, #endif+#endif notebookSetPopup, notebookGetCurrentPage, notebookSetMenuLabel,@@ -114,11 +118,13 @@ notebookGetTabLabel, notebookGetTabLabelText, Packing(..), PackType(..),+#if GTK_MAJOR_VERSION < 3 notebookQueryTabLabelPacking, notebookSetTabLabelPacking, #ifndef DISABLE_DEPRECATED notebookSetHomogeneousTabs, #endif+#endif notebookSetTabLabel, notebookSetTabLabelText, #if GTK_CHECK_VERSION(2,10,0)@@ -127,6 +133,10 @@ notebookSetTabDetachable, notebookGetTabDetachable, #endif+#if GTK_CHECK_VERSION(2,20,0)+ notebookSetActionWidget,+ notebookGetActionWidget,+#endif -- * Attributes notebookPage,@@ -178,24 +188,26 @@ #endif ) where -import Control.Monad (liftM)-import Data.Maybe (maybe)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.Abstract.ContainerChildProperties-import Graphics.UI.Gtk.Display.Label (labelNew)-import Graphics.UI.Gtk.General.Enums (Packing(..), toPacking, fromPacking,- PackType(..), PositionType(..), DirectionType(..))+import Graphics.UI.Gtk.Display.Label (labelNew)+import Graphics.UI.Gtk.General.Enums (Packing(..), toPacking, fromPacking,+ PackType(..), PositionType(..)) {# context lib="gtk" prefix="gtk" #} +#if GTK_MAJOR_VERSION < 3 {#pointer *GtkNotebookPage as NotebookPage foreign newtype #}+_ignoreNotebookPage = NotebookPage+#endif -------------------- -- Constructors@@ -221,9 +233,9 @@ -- -- * This function returned @()@ in Gtk+ version 2.2.X and earlier ---notebookAppendPage :: (NotebookClass self, WidgetClass child) => self+notebookAppendPage :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the 'Widget' to use as the contents of the page.- -> String -- ^ @tabLabel@ - the label for the page+ -> string -- ^ @tabLabel@ - the label for the page -> IO Int -- ^ returns the index (starting from 0) of the appended page in -- the notebook, or -1 if function fails notebookAppendPage self child tabLabel = do@@ -244,9 +256,9 @@ -- -- * This function returns @Int@ in Gtk+ version 2.4.0 and later. ---notebookAppendPage :: (NotebookClass self, WidgetClass child) => self+notebookAppendPage :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the 'Widget' to use as the contents of the page.- -> String -- ^ @tabLabel@ - the label for the page+ -> string -- ^ @tabLabel@ - the label for the page -> IO () notebookAppendPage self child tabLabel = do tab <- labelNew (Just tabLabel)@@ -319,9 +331,9 @@ -- -- * This function returned @()@ in Gtk version 2.2.X and earlier ---notebookPrependPage :: (NotebookClass self, WidgetClass child) => self+notebookPrependPage :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the 'Widget' to use as the contents of the page.- -> String -- ^ @tabLabel@ - the label for the page+ -> string -- ^ @tabLabel@ - the label for the page -> IO Int -- ^ returns the index (starting from 0) of the prepended page in -- the notebook, or -1 if function fails notebookPrependPage self child tabLabel = do@@ -342,9 +354,9 @@ -- -- * This function returns @Int@ in Gtk version 2.4.0 and later. ---notebookPrependPage :: (NotebookClass self, WidgetClass child) => self+notebookPrependPage :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the 'Widget' to use as the contents of the page.- -> String -- ^ @tabLabel@ - the label for the page+ -> string -- ^ @tabLabel@ - the label for the page -> IO () notebookPrependPage self child tabLabel = do tab <- labelNew (Just tabLabel)@@ -416,9 +428,9 @@ -- -- * This function returned @()@ in Gtk version 2.2.X and earlier ---notebookInsertPage :: (NotebookClass self, WidgetClass child) => self+notebookInsertPage :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the 'Widget' to use as the contents of the page.- -> String -- ^ @tabLabel@ - the label for the page+ -> string -- ^ @tabLabel@ - the label for the page -> Int -- ^ @position@ - the index (starting at 0) at which to insert -- the page, or -1 to append the page after all other pages. -> IO Int -- ^ returns the index (starting from 0) of the inserted page in@@ -442,9 +454,9 @@ -- -- * This function returns @Int@ in Gtk version 2.4.0 and later. ---notebookInsertPage :: (NotebookClass self, WidgetClass child) => self+notebookInsertPage :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the 'Widget' to use as the contents of the page.- -> String -- ^ @tabLabel@ - the label for the page+ -> string -- ^ @tabLabel@ - the label for the page -> Int -- ^ @position@ - the index (starting at 0) at which to insert -- the page, or -1 to append the page after all other pages. -> IO ()@@ -495,7 +507,7 @@ -- -- * This function returns @Int@ in Gtk version 2.4.0 and later ---notebookInsertPageMenu ::(NotebookClass nb, WidgetClass child, +notebookInsertPageMenu ::(NotebookClass nb, WidgetClass child, WidgetClass tab, WidgetClass menu) => nb -> child -- ^ Widget to use as the contents of the page -> tab -- ^ Tab label widget for the page.@@ -540,7 +552,7 @@ -- Use @-1@ to request the last page. -- -- * Note that due to historical reasons, GtkNotebook refuses--- to switch to a page unless the child widget is visible. +-- to switch to a page unless the child widget is visible. -- Therefore, it is recommended to show child widgets before -- adding them to a notebook. --@@ -668,6 +680,7 @@ {# call unsafe notebook_get_scrollable #} (toNotebook self) +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- | Sets the width the border around the tab labels in a notebook. This is -- equivalent to calling @'notebookSetTabHBorder' notebook borderWidth@@@ -676,6 +689,7 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. --+-- Removed in Gtk3. notebookSetTabBorder :: NotebookClass self => self -> Int -- ^ @borderWidth@ - width of the border around the tab labels. -> IO ()@@ -689,6 +703,7 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. --+-- Removed in Gtk3. notebookSetTabHBorder :: NotebookClass self => self -> Int -- ^ @tabHborder@ - width of the horizontal border of tab labels. -> IO ()@@ -702,6 +717,7 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. --+-- Removed in Gtk3. notebookSetTabVBorder :: NotebookClass self => self -> Int -- ^ @tabVborder@ - width of the vertical border of tab labels. -> IO ()@@ -710,6 +726,7 @@ (toNotebook self) (fromIntegral tabVborder) #endif+#endif -- | Enables or disables the popup menu: if the user clicks with the right -- mouse button on the bookmarks, a menu with all the pages will be popped up.@@ -760,9 +777,9 @@ -- | Creates a new label and sets it as the menu label of @child@. ---notebookSetMenuLabelText :: (NotebookClass self, WidgetClass child) => self+notebookSetMenuLabelText :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the child widget- -> String -- ^ @menuText@ - the label text+ -> string -- ^ @menuText@ - the label text -> IO () notebookSetMenuLabelText self child menuText = withUTFString menuText $ \menuTextPtr ->@@ -773,10 +790,10 @@ -- | Retrieves the text of the menu label for the page containing @child@. ---notebookGetMenuLabelText :: (NotebookClass self, WidgetClass child) => self+notebookGetMenuLabelText :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the child widget of a page of the -- notebook.- -> IO (Maybe String) -- ^ returns value: the text of the tab label, or+ -> IO (Maybe string) -- ^ returns value: the text of the tab label, or -- @Nothing@ if the widget does not have a menu label -- other than the default menu label, or the menu label -- widget is not a 'Label'.@@ -826,10 +843,10 @@ -- | Retrieves the text of the tab label for the page containing @child@. ---notebookGetTabLabelText :: (NotebookClass self, WidgetClass child) => self+notebookGetTabLabelText :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - a widget contained in a page of -- @notebook@- -> IO (Maybe String) -- ^ returns value: the text of the tab label, or+ -> IO (Maybe string) -- ^ returns value: the text of the tab label, or -- @Nothing@ if the tab label widget is not a 'Label'. notebookGetTabLabelText self child = {# call unsafe notebook_get_tab_label_text #}@@ -837,9 +854,11 @@ (toWidget child) >>= maybePeek peekUTFString +#if GTK_MAJOR_VERSION < 3 -- | Query the packing attributes for the tab label of the page containing -- @child@. --+-- Removed in Gtk3. notebookQueryTabLabelPacking :: (NotebookClass self, WidgetClass child) => self -> child -- ^ @child@ - the page -> IO (Packing,PackType)@@ -862,6 +881,7 @@ -- @child@. See 'Graphics.UI.Gtk.Abstract.Box.boxPackStart' for the exact -- meaning of the parameters. --+-- Removed in Gtk3. notebookSetTabLabelPacking :: (NotebookClass self, WidgetClass child) => self -> child -- ^ @child@ - the child widget -> Packing@@ -872,7 +892,7 @@ (toNotebook self) (toWidget child) (fromBool expand)- (fromBool fill) + (fromBool fill) ((fromIntegral . fromEnum) packType) where (expand, fill) = fromPacking pack @@ -882,6 +902,7 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. --+-- Removed in Gtk3. notebookSetHomogeneousTabs :: NotebookClass self => self -> Bool -- ^ @homogeneous@ - @True@ if all tabs should be the same size. -> IO ()@@ -890,6 +911,7 @@ (toNotebook self) (fromBool homogeneous) #endif+#endif -- | Changes the tab label for @child@. --@@ -906,9 +928,9 @@ -- | Creates a new label and sets it as the tab label for the page containing -- @child@. ---notebookSetTabLabelText :: (NotebookClass self, WidgetClass child) => self+notebookSetTabLabelText :: (NotebookClass self, WidgetClass child, GlibString string) => self -> child -- ^ @child@ - the page- -> String -- ^ @tabText@ - the label text+ -> string -- ^ @tabText@ - the label text -> IO () notebookSetTabLabelText self child tabText = withUTFString tabText $ \tabTextPtr ->@@ -924,7 +946,7 @@ -- notebookSetTabReorderable :: (NotebookClass self, WidgetClass child) => self -> child -- ^ @child@ - a child page- -> Bool -- ^ @reorderable@ - whether the tab is reorderable or not. + -> Bool -- ^ @reorderable@ - whether the tab is reorderable or not. -> IO () notebookSetTabReorderable self child reorderable = {# call notebook_set_tab_reorderable #}@@ -938,7 +960,7 @@ -- notebookGetTabReorderable :: (NotebookClass self, WidgetClass child) => self -> child -- ^ @child@ - the child page- -> IO Bool -- ^ return @True@ if the tab is reorderable. + -> IO Bool -- ^ return @True@ if the tab is reorderable. notebookGetTabReorderable self child = liftM toBool $ {# call notebook_get_tab_reorderable #} (toNotebook self)@@ -948,7 +970,7 @@ -- -- Note that 2 notebooks must share a common group identificator (see gtk_notebook_set_group_id()) to allow automatic tabs interchange between them. ----- If you want a widget to interact with a notebook through DnD (i.e.: accept dragged tabs from it) it must be set as a drop destination and accept the target "GTK_NOTEBOOK_TAB". +-- If you want a widget to interact with a notebook through DnD (i.e.: accept dragged tabs from it) it must be set as a drop destination and accept the target "GTK_NOTEBOOK_TAB". -- The notebook will fill the selection with a GtkWidget** pointing to the child widget that corresponds to the dropped tab. -- -- If you want a notebook to accept drags from other widgets, you will have to set your own DnD code to do it.@@ -957,7 +979,7 @@ -- notebookSetTabDetachable :: (NotebookClass self, WidgetClass child) => self -> child -- ^ @child@ - the child page- -> Bool -- ^ @detachable@ - whether the tab is detachable or not + -> Bool -- ^ @detachable@ - whether the tab is detachable or not -> IO () notebookSetTabDetachable self child detachable = {# call notebook_set_tab_detachable #}@@ -971,13 +993,47 @@ -- notebookGetTabDetachable :: (NotebookClass self, WidgetClass child) => self -> child -- ^ @child@ - the child page- -> IO Bool -- ^ return @True@ if the tab is detachable. -notebookGetTabDetachable self child = liftM toBool $ + -> IO Bool -- ^ return @True@ if the tab is detachable.+notebookGetTabDetachable self child = liftM toBool $ {# call notebook_get_tab_detachable #} (toNotebook self) (toWidget child) #endif +#if GTK_CHECK_VERSION(2,20,0)+-- | Sets widget as one of the action widgets. Depending on the pack type the widget will be placed+-- before or after the tabs. You can use a 'Box' if you need to pack more than one widget on the same+-- side.+--+-- Note that action widgets are "internal" children of the notebook and thus not included in the list+-- returned from 'containerForeach'.+--+-- * Available since Gtk version 2.20+--+notebookSetActionWidget :: (NotebookClass self, WidgetClass widget) => self+ -> widget+ -> PackType -- ^ @packType@ pack type of the action widget+ -> IO ()+notebookSetActionWidget self widget packType =+ {#call gtk_notebook_set_action_widget #}+ (toNotebook self)+ (toWidget widget)+ ((fromIntegral . fromEnum) packType)++-- | Gets one of the action widgets. See 'notebookSetActionWidget'.+--+-- * Available since Gtk version 2.20+--+notebookGetActionWidget :: NotebookClass self => self+ -> PackType -- ^ @packType@ pack type of the action widget to receive+ -> IO (Maybe Widget)+notebookGetActionWidget self packType =+ maybeNull (makeNewObject mkWidget) $+ {#call gtk_notebook_get_action_widget #}+ (toNotebook self)+ ((fromIntegral . fromEnum) packType)+#endif+ -------------------- -- Attributes @@ -1082,14 +1138,14 @@ -- -- Default value: @Nothing@ ---notebookChildTabLabel :: (NotebookClass self, WidgetClass child) => child -> Attr self String+notebookChildTabLabel :: (NotebookClass self, WidgetClass child, GlibString string) => child -> Attr self string notebookChildTabLabel = newAttrFromContainerChildStringProperty "tab-label" -- | The string displayed in the child's menu entry. -- -- Default value: @Nothing@ ---notebookChildMenuLabel :: (NotebookClass self, WidgetClass child) => child -> Attr self String+notebookChildMenuLabel :: (NotebookClass self, WidgetClass child, GlibString string) => child -> Attr self string notebookChildMenuLabel = newAttrFromContainerChildStringProperty "menu-label" -- | The index of the child in the parent.@@ -1257,7 +1313,7 @@ pageAdded :: NotebookClass self => Signal self (Widget -> Int -> IO ()) pageAdded = Signal (connect_OBJECT_INT__NONE "page-added") #endif- + -- * Deprecated #ifndef DISABLE_DEPRECATED @@ -1266,11 +1322,11 @@ -- onSwitchPage, afterSwitchPage :: NotebookClass nb => nb -> (Int -> IO ()) -> IO (ConnectId nb)-onSwitchPage nb fun = connect_BOXED_WORD__NONE "switch-page" - (const $ return ()) False nb - (\_ page -> fun (fromIntegral page))-afterSwitchPage nb fun = connect_BOXED_WORD__NONE "switch-page" - (const $ return ()) True nb - (\_ page -> fun (fromIntegral page))+onSwitchPage nb fun = connect_BOXED_WORD__NONE "switch-page"+ (const $ return ()) False nb+ (\_ page -> fun (fromIntegral page))+afterSwitchPage nb fun = connect_BOXED_WORD__NONE "switch-page"+ (const $ return ()) True nb+ (\_ page -> fun (fromIntegral page)) #endif
Graphics/UI/Gtk/Layout/Table.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Table --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.Table ( -- * Detail--- +-- -- | The 'Table' functions allow the programmer to arrange widgets in rows and -- columns, making it easy to align many widgets next to each other, -- horizontally and vertically.@@ -80,6 +81,9 @@ tableGetDefaultColSpacing, tableSetHomogeneous, tableGetHomogeneous,+#if GTK_CHECK_VERSION(2,22,0)+ tableGetSize,+#endif -- * Attributes tableNRows,@@ -99,15 +103,15 @@ tableChildYPadding, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Flags (fromFlags)+import System.Glib.Flags (fromFlags) import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (AttachOptions(..))+import Graphics.UI.Gtk.General.Enums (AttachOptions(..)) import Graphics.UI.Gtk.Abstract.ContainerChildProperties {# context lib="gtk" prefix="gtk" #}@@ -120,7 +124,7 @@ -- can be changed later with 'tableResize'. @rows@ and @columns@ must both be -- in the range 0 .. 65535. ---tableNew :: +tableNew :: Int -- ^ @rows@ - The number of rows the new table should have. -> Int -- ^ @columns@ - The number of columns the new table should have. -> Bool -- ^ @homogeneous@ - If set to @True@, all table cells are@@ -305,7 +309,7 @@ {# call unsafe table_get_default_col_spacing #} (toTable self) --- | Changes the homogenous property of table cells, ie. whether all cells are+-- | Changes the homogeneous property of table cells, ie. whether all cells are -- an equal size or not. -- tableSetHomogeneous :: TableClass self => self@@ -327,6 +331,26 @@ liftM toBool $ {# call unsafe table_get_homogeneous #} (toTable self)++#if GTK_CHECK_VERSION(2,22,0)+-- | Returns the size of 'Table'.+--+-- * Available since Gtk+ version 2.22+--+tableGetSize :: TableClass self => self+ -> IO (Int, Int) -- ^ returns (rows, columns) of table+tableGetSize self =+ alloca $ \ rowsPtr ->+ alloca $ \ columnsPtr -> do+ {# call unsafe gtk_table_get_size #}+ (toTable self)+ rowsPtr+ columnsPtr+ rows <- peek rowsPtr+ columns <- peek columnsPtr+ return (fromIntegral rows, fromIntegral columns)++#endif -------------------- -- Attributes
Graphics/UI/Gtk/Layout/VBox.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VBox --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.VBox ( -- * Detail--- +-- -- | 'VBox' is a container that organizes child widgets into a single column. -- -- Use the 'Box' packing interface to determine the arrangement, spacing,@@ -58,10 +59,10 @@ vBoxNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -71,7 +72,7 @@ -- | Creates a new 'VBox'. ---vBoxNew :: +vBoxNew :: Bool -- ^ @homogeneous@ - @True@ if all children are to be given equal -- space allotments. -> Int -- ^ @spacing@ - the number of pixels to place by default between
Graphics/UI/Gtk/Layout/VButtonBox.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VButtonBox --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.VButtonBox ( -- * Detail--- +-- -- | A button box should be used to provide a consistent layout of buttons -- throughout your application. The layout\/spacing can be altered by the -- programmer, or if desired, by the user to alter the \'feel\' of a program to
Graphics/UI/Gtk/Layout/VPaned.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VPaned --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Layout.VPaned ( -- * Detail--- +-- -- | The VPaned widget is a container widget with two children arranged -- vertically. The division between the two panes is adjustable by the user by -- dragging a handle. See 'Paned' for details.@@ -52,10 +53,10 @@ vPanedNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/MenuComboToolbar/CheckMenuItem.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.CheckMenuItem ( -- * Detail--- +-- -- | A 'CheckMenuItem' is a menu item that maintains the state of a boolean -- value in addition to a 'MenuItem's usual role in activating application -- code.@@ -63,7 +63,7 @@ -- * Methods checkMenuItemSetActive, checkMenuItemGetActive,- checkMenuItemToggled,+ checkMenuItemEmitToggled, checkMenuItemSetInconsistent, checkMenuItemGetInconsistent, #if GTK_CHECK_VERSION(2,4,0)@@ -77,14 +77,18 @@ #if GTK_CHECK_VERSION(2,4,0) checkMenuItemDrawAsRadio, #endif++-- * Signals+ checkMenuItemToggled ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -102,8 +106,8 @@ -- | Creates a new 'CheckMenuItem' with a label. ---checkMenuItemNewWithLabel :: - String -- ^ @label@ - the string to use for the label.+checkMenuItemNewWithLabel :: GlibString string+ => string -- ^ @label@ - the string to use for the label. -> IO CheckMenuItem checkMenuItemNewWithLabel label = makeNewObject mkCheckMenuItem $@@ -116,8 +120,8 @@ -- created using 'Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic', so -- underscores in @label@ indicate the mnemonic for the menu item. ---checkMenuItemNewWithMnemonic :: - String -- ^ @label@ - The text of the button, with an underscore+checkMenuItemNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - The text of the button, with an underscore -- in front of the mnemonic character -> IO CheckMenuItem checkMenuItemNewWithMnemonic label =@@ -149,8 +153,8 @@ -- | Emits the toggled signal. ---checkMenuItemToggled :: CheckMenuItemClass self => self -> IO ()-checkMenuItemToggled self =+checkMenuItemEmitToggled :: CheckMenuItemClass self => self -> IO ()+checkMenuItemEmitToggled self = {# call check_menu_item_toggled #} (toCheckMenuItem self) @@ -169,7 +173,7 @@ (toCheckMenuItem self) (fromBool setting) --- | Query if the menu check is drawn as inconsistent (inbetween). See+-- | Query if the menu check is drawn as inconsistent (in between). See -- 'checkMenuItemSetInconsistent'. -- checkMenuItemGetInconsistent :: CheckMenuItemClass self => self -> IO Bool@@ -232,3 +236,7 @@ checkMenuItemSetDrawAsRadio #endif +-- | This signal is emitted when the state of the check box is changed.+--+checkMenuItemToggled :: CheckMenuItemClass self => Signal self (IO ())+checkMenuItemToggled = Signal (connect_NONE__NONE "toggled")
Graphics/UI/Gtk/MenuComboToolbar/Combo.chs view
@@ -33,9 +33,10 @@ -- * Warning: this module is deprecated and should not be used in -- newly-written code. --+-- This module is empty in Gtk3 as Combo has been removed. module Graphics.UI.Gtk.MenuComboToolbar.Combo ( -- * Detail--- +-- -- | The 'Combo' widget consists of a single-line text entry field and a -- drop-down list. The drop-down list is displayed when the user clicks on a -- small arrow button to the right of the entry field.@@ -63,6 +64,7 @@ -- | +----Combo -- @ +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- * Types Combo,@@ -88,21 +90,23 @@ comboAllowEmpty, comboValueInList, #endif+#endif ) where -import Control.Monad (liftM, mapM_)+#if GTK_MAJOR_VERSION < 3+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import Graphics.UI.Gtk.Abstract.Widget (widgetShow)-import Graphics.UI.Gtk.Abstract.Container (containerAdd)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Widget (widgetShow)+import Graphics.UI.Gtk.Abstract.Container (containerAdd) {#import Graphics.UI.Gtk.Types#} #ifndef DISABLE_DEPRECATED-import Graphics.UI.Gtk.General.Structs (comboGetList)+import Graphics.UI.Gtk.General.Structs (comboGetList) #endif {# context lib="gtk" prefix="gtk" #}@@ -125,12 +129,12 @@ -- | Insert a set of Strings into the -- 'Combo' drop down list. ---comboSetPopdownStrings :: ComboClass self => self -> [String] -> IO ()+comboSetPopdownStrings :: (ComboClass self, GlibString string) => self -> [string] -> IO () comboSetPopdownStrings self strs = do list <- comboGetList (toCombo self) {#call list_clear_items#} list 0 (-1) mapM_ (\str -> do- li <- makeNewObject mkWidget $ liftM castPtr $ + li <- makeNewObject mkWidget $ liftM castPtr $ withUTFString str {#call unsafe list_item_new_with_label#} widgetShow li containerAdd list li)@@ -231,4 +235,5 @@ -- comboValueInList :: ComboClass self => Attr self Bool comboValueInList = newAttrFromBoolProperty "value-in-list"+#endif #endif
Graphics/UI/Gtk/MenuComboToolbar/ComboBox.chs view
@@ -68,11 +68,18 @@ ComboBoxClass, castToComboBox, gTypeComboBox, toComboBox,+ ComboBoxText, -- * Constructors comboBoxNew,+#if GTK_CHECK_VERSION(2,24,0)+ comboBoxNewWithEntry,+#endif comboBoxNewText, comboBoxNewWithModel,+#if GTK_CHECK_VERSION(2,24,0)+ comboBoxNewWithModelAndEntry,+#endif -- * Methods @@ -137,10 +144,15 @@ #endif #endif +#if GTK_CHECK_VERSION(2,24,0)+ comboBoxGetHasEntry,+ comboBoxSetEntryTextColumn,+ comboBoxGetEntryTextColumn,+#endif+ -- * Signals changed,- popupShownNotify,- + -- * Deprecated #ifndef DISABLE_DEPRECATED onChanged,@@ -150,29 +162,25 @@ ) where import Control.Monad (liftM)+import Data.Text (Text) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import System.Glib.GObject (makeNewGObject,- destroyFunPtr,- Quark, objectSetAttribute, objectGetAttributeUnsafe ) {#import Graphics.UI.Gtk.Types#} hiding (ListStore)-{#import Graphics.UI.Gtk.ModelView.Types#} (TypedTreeModelClass,- TreeIter,- receiveTreeIter,+{#import Graphics.UI.Gtk.ModelView.Types#} (receiveTreeIter, comboQuark) {#import Graphics.UI.Gtk.Signals#}-{#import Graphics.UI.Gtk.ModelView.CustomStore#} -{#import Graphics.UI.Gtk.ModelView.TreeModel#} +{#import Graphics.UI.Gtk.ModelView.CustomStore#}+{#import Graphics.UI.Gtk.ModelView.TreeModel#} import Graphics.UI.Gtk.ModelView.ListStore ( ListStore, listStoreNew, listStoreInsert, listStorePrepend, listStoreAppend, listStoreRemove,- listStoreGetValue )+ listStoreSafeGetValue ) import Graphics.UI.Gtk.ModelView.CellLayout ( cellLayoutSetAttributes, cellLayoutPackStart, cellLayoutClear )-import Graphics.UI.Gtk.ModelView.CellRendererText ( cellRendererTextNew, +import Graphics.UI.Gtk.ModelView.CellRendererText ( cellRendererTextNew, cellText) {# context lib="gtk" prefix="gtk" #} @@ -188,6 +196,18 @@ liftM (castPtr :: Ptr Widget -> Ptr ComboBox) $ {# call gtk_combo_box_new #} +#if GTK_CHECK_VERSION(2,24,0)+-- | Creates a new empty 'ComboBox' with an entry.+--+-- * Available since Gtk+ version 2.24+--+comboBoxNewWithEntry :: IO ComboBox+comboBoxNewWithEntry =+ makeNewObject mkComboBox $+ liftM (castPtr :: Ptr Widget -> Ptr ComboBox) $+ {# call gtk_combo_box_new_with_entry #}+#endif+ -- | Convenience function which constructs a new text combo box that is a -- 'ComboBox' just displaying strings. This function internally calls -- 'comboBoxSetModelText' after creating a new combo box.@@ -210,6 +230,21 @@ {# call gtk_combo_box_new_with_model #} (toTreeModel model) +#if GTK_CHECK_VERSION(2,24,0)+-- | Creates a new empty 'ComboBox' with an entry and with the model initialized to @model@.+--+-- * Available since Gtk+ version 2.24+--+comboBoxNewWithModelAndEntry :: TreeModelClass model =>+ model -- ^ @model@ - A 'TreeModel'.+ -> IO ComboBox+comboBoxNewWithModelAndEntry model =+ makeNewObject mkComboBox $+ liftM (castPtr :: Ptr Widget -> Ptr ComboBox) $+ {# call gtk_combo_box_new_with_model_and_entry #}+ (toTreeModel model)+#endif+ -------------------- -- Methods @@ -221,17 +256,24 @@ -- widget and sets the model to the list store. The widget can contain only -- strings. The model can be retrieved with 'comboBoxGetModel'. The list -- store can be retrieved with 'comboBoxGetModelText'.--- Any exisiting model or renderers are removed before setting the new text+-- Any existing model or renderers are removed before setting the new text -- model. -- Note that the functions 'comboBoxAppendText', 'comboBoxInsertText', -- 'comboBoxPrependText', 'comboBoxRemoveText' and 'comboBoxGetActiveText' -- can be called on a combo box only once 'comboBoxSetModelText' is called. ---comboBoxSetModelText :: ComboBoxClass self => self -> IO (ListStore String)+type ComboBoxText = Text++comboBoxSetModelText :: ComboBoxClass self => self -> IO (ListStore ComboBoxText) comboBoxSetModelText combo = do cellLayoutClear (toComboBox combo)- store <- listStoreNew ([] :: [String])+ store <- listStoreNew ([] :: [ComboBoxText]) comboBoxSetModel combo (Just store)+#if GTK_CHECK_VERSION(2,24,0)+ let colId = makeColumnIdString 0+ customStoreSetColumn store colId id+ comboBoxSetEntryTextColumn (toComboBox combo) colId+#endif ren <- cellRendererTextNew cellLayoutPackStart (toComboBox combo) ren True cellLayoutSetAttributes (toComboBox combo) ren store (\a -> [cellText := a])@@ -240,7 +282,7 @@ -- | Retrieve the model that was created with 'comboBoxSetModelText'. ---comboBoxGetModelText :: ComboBoxClass self => self -> IO (ListStore String)+comboBoxGetModelText :: ComboBoxClass self => self -> IO (ListStore ComboBoxText) comboBoxGetModelText self = do (Just store) <- objectGetAttributeUnsafe comboQuark (toComboBox self) return store@@ -250,11 +292,11 @@ -- you can only use this function with combo boxes constructed with -- 'comboBoxNewText'. Returns the index of the appended text. ---comboBoxAppendText :: ComboBoxClass self => self -> String -> IO Int+comboBoxAppendText :: ComboBoxClass self => self -> ComboBoxText -> IO Int comboBoxAppendText self text = do store <- comboBoxGetModelText self listStoreAppend store text- + -- %hash c:41de d:8ab0 -- | Inserts @string@ at @position@ in the list of strings stored in -- @comboBox@. Note that you can only use this function with combo boxes@@ -262,18 +304,18 @@ -- comboBoxInsertText :: ComboBoxClass self => self -> Int -- ^ @position@ - An index to insert @text@.- -> String -- ^ @text@ - A string.+ -> ComboBoxText -- ^ @text@ - A string. -> IO () comboBoxInsertText self position text = do store <- comboBoxGetModelText self listStoreInsert store position text- + -- %hash c:98ea d:9fab -- | Prepends @string@ to the list of strings stored in @comboBox@. Note that -- you can only use this function with combo boxes constructed with -- 'comboBoxNewText'. ---comboBoxPrependText :: ComboBoxClass self => self -> String -> IO ()+comboBoxPrependText :: ComboBoxClass self => self -> ComboBoxText -> IO () comboBoxPrependText self text = do store <- comboBoxGetModelText self listStorePrepend store text@@ -293,15 +335,14 @@ -- selected. Note that you can only use this function with combo boxes -- constructed with 'comboBoxNewText'. ---comboBoxGetActiveText :: ComboBoxClass self => self -> IO (Maybe String)+comboBoxGetActiveText :: ComboBoxClass self => self -> IO (Maybe ComboBoxText) comboBoxGetActiveText self = do activeId <- comboBoxGetActive self if activeId < 0 then return Nothing else do listStore <- comboBoxGetModelText self- value <- listStoreGetValue listStore activeId- return $ Just value+ listStoreSafeGetValue listStore activeId #if GTK_CHECK_VERSION(2,6,0) -- %hash d:566e@@ -494,17 +535,17 @@ {# call gtk_combo_box_set_row_separator_func #} (toComboBox self) nullFunPtr nullPtr nullFunPtr comboBoxSetRowSeparatorSource self (Just (model, extract)) = do- funPtr <- mkRowSeparatorFunc $ \_ iterPtr -> do+ funPtr <- mkRowSeparatorFunc $ \_ iterPtr _ -> do iter <- peek iterPtr value <- customStoreGetRow model iter- return (extract value)+ return (fromBool $ extract value) {# call gtk_combo_box_set_row_separator_func #} (toComboBox self) funPtr (castFunPtrToPtr funPtr) destroyFunPtr {#pointer TreeViewRowSeparatorFunc#} foreign import ccall "wrapper" mkRowSeparatorFunc ::- (Ptr TreeModel -> Ptr TreeIter -> IO Bool) -> IO TreeViewRowSeparatorFunc+ (Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO {#type gboolean #}) -> IO TreeViewRowSeparatorFunc -- %hash c:5bf8 -- | Sets whether the popup menu should have a tearoff menu item.@@ -533,8 +574,8 @@ -- -- * Available since Gtk+ version 2.10 ---comboBoxSetTitle :: ComboBoxClass self => self- -> String -- ^ @title@ - a title for the menu in tearoff mode.+comboBoxSetTitle :: (ComboBoxClass self, GlibString string) => self+ -> string -- ^ @title@ - a title for the menu in tearoff mode. -> IO () comboBoxSetTitle self title = withUTFString title $ \titlePtr ->@@ -548,14 +589,56 @@ -- -- * Available since Gtk+ version 2.10 ---comboBoxGetTitle :: ComboBoxClass self => self- -> IO String -- ^ returns the menu's title in tearoff mode.+comboBoxGetTitle :: (ComboBoxClass self, GlibString string) => self+ -> IO string -- ^ returns the menu's title in tearoff mode. comboBoxGetTitle self = {# call gtk_combo_box_get_title #} (toComboBox self) >>= peekUTFString #endif +#if GTK_CHECK_VERSION(2,24,0)+-- | Returns whether the combo box has an entry.+--+-- * Available since Gtk+ version 2.24+--+comboBoxGetHasEntry :: ComboBoxClass self => self+ -> IO Bool -- ^ returns whether there is an entry in @self@.+comboBoxGetHasEntry self =+ liftM toBool $+ {# call gtk_combo_box_get_has_entry #}+ (toComboBox self)++-- | Sets the model column which combo_box should use to get strings from+-- to be @textColumn@. The column text_column in the model of @comboBox@+-- must be of type ComboBoxText.+--+-- This is only relevant if @comboBox@ has been created with "has-entry"+-- as True.+--+-- * Available since Gtk+ version 2.24+--+comboBoxSetEntryTextColumn :: ComboBoxClass comboBox => comboBox+ -> ColumnId row ComboBoxText -- ^ @textColumn@ - A column in model to get the strings from for the internal entry.+ -> IO ()+comboBoxSetEntryTextColumn comboBox textColumn =+ {# call gtk_combo_box_set_entry_text_column #}+ (toComboBox comboBox)+ ((fromIntegral . columnIdToNumber) textColumn)++-- | Returns the column which @comboBox@ is using to get the strings from to+-- display in the internal entry.+--+-- * Available since Gtk+ version 2.24+--+comboBoxGetEntryTextColumn :: ComboBoxClass comboBox => comboBox+ -> IO (ColumnId row ComboBoxText) -- ^ returns a column in the data source model of @comboBox@.+comboBoxGetEntryTextColumn comboBox =+ liftM (makeColumnIdString . fromIntegral) $+ {# call gtk_combo_box_get_entry_text_column #}+ (toComboBox comboBox)+#endif+ -- %hash c:fe18 -- | Sets whether the combo box will grab focus when it is clicked with the -- mouse. Making mouse clicks not grab focus is useful in places like toolbars@@ -690,7 +773,7 @@ -- -- * Available since Gtk+ version 2.10 ---comboBoxTearoffTitle :: ComboBoxClass self => Attr self String+comboBoxTearoffTitle :: (ComboBoxClass self, GlibString string) => Attr self string comboBoxTearoffTitle = newAttrFromStringProperty "tearoff-title" -- %hash c:efa9 d:89e5@@ -709,7 +792,7 @@ -- -- * Available since Gtk+ version 2.10 ---comboBoxTitle :: ComboBoxClass self => Attr self String+comboBoxTitle :: (ComboBoxClass self, GlibString string) => Attr self string comboBoxTitle = newAttr comboBoxGetTitle comboBoxSetTitle@@ -727,11 +810,6 @@ -- changed :: ComboBoxClass self => Signal self (IO ()) changed = Signal (connect_NONE__NONE "changed")---- | The combo box was dropped down or collapsed.----popupShownNotify :: ComboBoxClass self => Signal self (IO ())-popupShownNotify = Signal (connect_NONE__NONE "notify::popup-shown") -------------------- -- Deprecated Signals
Graphics/UI/Gtk/MenuComboToolbar/ComboBoxEntry.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry ( -- * Detail--- +-- -- | A 'ComboBoxEntry' is a widget that allows the user to choose from a list -- of valid choices or enter a different value. It is very similar to a -- 'ComboBox', but it displays the selected value in an entry to allow@@ -49,6 +49,8 @@ -- Connect to the activate signal of the 'Entry' (use 'binGetChild') to detect -- when the user actually finishes entering text. --+-- * This module is deprecated and the functionality removed in Gtk3. It is+-- therefore empty in Gtk3. -- * Class Hierarchy -- |@@ -62,6 +64,7 @@ -- | +----ComboBoxEntry -- @ +#if GTK_MAJOR_VERSION < 3 #if GTK_CHECK_VERSION(2,4,0) -- * Types ComboBoxEntry,@@ -82,25 +85,25 @@ #if GTK_CHECK_VERSION(2,6,0) comboBoxEntryGetActiveText, #endif- + -- * Attributes comboBoxEntryTextColumn, #endif+#endif ) where -import Control.Monad (liftM)+#if GTK_MAJOR_VERSION < 3+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} hiding ( ListStore ) import Graphics.UI.Gtk.ModelView.Types import Graphics.UI.Gtk.MenuComboToolbar.ComboBox-import Graphics.UI.Gtk.ModelView.CellRendererText-import Graphics.UI.Gtk.ModelView.CellLayout {#import Graphics.UI.Gtk.ModelView.CustomStore#}-{#import Graphics.UI.Gtk.ModelView.TreeModel#} +{#import Graphics.UI.Gtk.ModelView.TreeModel#} import Graphics.UI.Gtk.ModelView.ListStore ( ListStore, listStoreNew ) {# context lib="gtk" prefix="gtk" #}@@ -127,13 +130,13 @@ combo <- comboBoxEntryNew comboBoxEntrySetModelText combo return combo- + -- | 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. ---comboBoxEntryNewWithModel :: TreeModelClass model => +comboBoxEntryNewWithModel :: TreeModelClass model => model -- ^ @model@ - A 'CustomStore'. -> IO ComboBoxEntry comboBoxEntryNewWithModel model = do@@ -144,17 +147,17 @@ -------------------- -- Methods --- | Set a model box that holds strings.+-- | Set a model that holds strings. -- -- This function stores a 'Graphics.UI.Gtk.ModelView.ListStore' with the -- widget and sets the model to the list store. The widget can contain only -- strings. The model can be retrieved with 'comboBoxGetModel'. The list -- store can be retrieved with 'comboBoxGetModelText'.--- Any exisiting model or renderers are removed before setting the new text+-- Any existing model or renderers are removed before setting the new text -- model. -- In order to respond to new texts that the user enters, it is necessary to--- connect to the 'Graphics.UI.Gtk.Entry.Entry.entryActivate' signal of the--- contained 'Graphics.UI.Gtk.Entry.Entry.Entry' an insert the text into the+-- connect to the 'Graphics.UI.Gtk.Entry.Entry.entryActivated' signal of the+-- contained 'Graphics.UI.Gtk.Entry.Entry.Entry' and insert the text into the -- text model which can be retrieved with -- 'Graphics.UI.Gtk.MenuComboToolbar.ComboBox.comboBoxGetModelText'. -- Note that the functions 'comboBoxAppendText', 'comboBoxInsertText',@@ -177,8 +180,8 @@ -- | Sets the model column should be use to get strings from to -- be @textColumn@. ---comboBoxEntrySetTextColumn :: ComboBoxEntryClass self => self- -> ColumnId row String -- ^ @textColumn@ - A column in @model@ to get the strings from.+comboBoxEntrySetTextColumn :: (ComboBoxEntryClass self, GlibString string) => self+ -> ColumnId row string -- ^ @textColumn@ - A column in @model@ to get the strings from. -> IO () comboBoxEntrySetTextColumn self textColumn = {# call gtk_combo_box_entry_set_text_column #}@@ -188,8 +191,8 @@ -- %hash c:a3e3 d:6441 -- | Returns the column which is used to get the strings from. ---comboBoxEntryGetTextColumn :: ComboBoxEntryClass self => self- -> IO (ColumnId row String) -- ^ returns A column in the data source model of @entryBox@.+comboBoxEntryGetTextColumn :: (ComboBoxEntryClass self, GlibString string) => self+ -> IO (ColumnId row string) -- ^ returns A column in the data source model of @entryBox@. comboBoxEntryGetTextColumn self = liftM (makeColumnIdString . fromIntegral) $ {# call gtk_combo_box_entry_get_text_column #}@@ -200,10 +203,10 @@ -- -- * Returns @Nothing@ if no text is selected or entered. ----- * Availabe in Gtk 2.6 or higher.+-- * Available in Gtk 2.6 or higher. ---comboBoxEntryGetActiveText :: ComboBoxEntryClass self => self- -> IO (Maybe String)+comboBoxEntryGetActiveText :: (ComboBoxEntryClass self, GlibString string) => self+ -> IO (Maybe string) comboBoxEntryGetActiveText self = do strPtr <- {# call gtk_combo_box_get_active_text #} (toComboBox self) if strPtr == nullPtr then return Nothing else liftM Just $@@ -220,9 +223,10 @@ -- -- Default value: 'Graphics.UI.Gtk.ModelView.CustomStore.invalidColumnId' ---comboBoxEntryTextColumn :: ComboBoxEntryClass self => Attr self (ColumnId row String)+comboBoxEntryTextColumn :: (ComboBoxEntryClass self, GlibString string) => Attr self (ColumnId row string) comboBoxEntryTextColumn = newAttr comboBoxEntryGetTextColumn comboBoxEntrySetTextColumn +#endif #endif
Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget ImageMenuItem --@@ -30,7 +31,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.ImageMenuItem ( -- * Detail--- +-- -- | A 'ImageMenuItem' is a menu item which has an icon next to the text -- label. --@@ -70,12 +71,12 @@ imageMenuItemImage, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.General.StockItems @@ -95,7 +96,7 @@ -- | Creates a new 'ImageMenuItem' containing the image and text from a stock -- item. ---imageMenuItemNewFromStock :: +imageMenuItemNewFromStock :: StockId -- ^ @stockId@ - the name of the stock item. -> IO ImageMenuItem imageMenuItemNewFromStock stockId =@@ -108,8 +109,8 @@ -- | Creates a new 'ImageMenuItem' containing a label. ---imageMenuItemNewWithLabel :: - String -- ^ @label@ - the text of the menu item.+imageMenuItemNewWithLabel :: GlibString string+ => string -- ^ @label@ - the text of the menu item. -> IO ImageMenuItem imageMenuItemNewWithLabel label = makeNewObject mkImageMenuItem $@@ -122,8 +123,8 @@ -- created using 'Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic', so -- underscores in @label@ indicate the mnemonic for the menu item. ---imageMenuItemNewWithMnemonic :: - String -- ^ @label@ - the text of the menu item, with an+imageMenuItemNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - the text of the menu item, with an -- underscore in front of the mnemonic character -> IO ImageMenuItem imageMenuItemNewWithMnemonic label =
Graphics/UI/Gtk/MenuComboToolbar/Menu.chs view
@@ -25,8 +25,8 @@ -- -- The function menuPopup at a specific position is difficult to bind: -- The callback function that determines at which position the menu is--- to be shown is keept after the call returns. Maybe we could destroy--- this function pointer with a destory event?+-- to be shown is kept after the call returns. Maybe we could destroy+-- this function pointer with a destroy event? -- -- | -- Maintainer : gtk2hs-users@lists.sourceforge.net@@ -37,7 +37,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.Menu ( -- * Detail--- +-- -- | A 'Menu' is a 'MenuShell' that implements a drop down menu consisting of -- a list of 'MenuItem' objects which can be navigated and activated by the -- user to perform application functions.@@ -114,7 +114,7 @@ menuChildBottomAttach, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import Data.Maybe (fromMaybe) import System.Glib.FFI@@ -122,8 +122,7 @@ import System.Glib.GList import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (makeNewGObject)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.Abstract.ContainerChildProperties import Graphics.UI.Gtk.Gdk.Events (MouseButton, TimeStamp)@@ -157,7 +156,7 @@ (toWidget child) (fromIntegral position) --- | Popup a context menu where a button press occurred. +-- | Popup a context menu where a button press occurred. -- -- * This function must be called in response to a button click. It opens -- the given menu at a place determined by the last emitted event (hence@@ -216,7 +215,7 @@ -- its immediate children, its menu items, can be constructed. The main purpose -- of this function is to spare the programmer the inconvenience of having to -- call 'menuItemSetAccelPath' on each menu item that should support runtime--- user changable accelerators. Instead, by just calling 'menuSetAccelPath' on+-- user changeable accelerators. Instead, by just calling 'menuSetAccelPath' on -- their parent, each menu item of this menu, that contains a label describing -- its purpose, automatically gets an accel path assigned. --@@ -232,8 +231,8 @@ -- accelerators at runtime. More details about accelerator paths and their -- default setups can be found at 'accelMapAddEntry'. ---menuSetAccelPath :: MenuClass self => self- -> String -- ^ @accelPath@ - a valid accelerator path+menuSetAccelPath :: (MenuClass self, GlibString string) => self+ -> string -- ^ @accelPath@ - a valid accelerator path -> IO () menuSetAccelPath self accelPath = withUTFString accelPath $ \accelPathPtr ->@@ -244,7 +243,7 @@ -- | Sets the title string for the menu. The title is displayed when the menu -- is shown as a tearoff menu. ---menuSetTitle :: MenuClass self => self -> String -> IO ()+menuSetTitle :: (MenuClass self, GlibString string) => self -> string -> IO () menuSetTitle self title = withUTFString title $ \titlePtr -> {# call unsafe menu_set_title #}@@ -253,8 +252,8 @@ -- | Returns the title of the menu. See 'menuSetTitle'. ---menuGetTitle :: MenuClass self => self- -> IO (Maybe String) -- ^ returns the title of the menu, or @Nothing@ if the+menuGetTitle :: (MenuClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns the title of the menu, or @Nothing@ if the -- menu has no title set on it. menuGetTitle self = {# call unsafe menu_get_title #}@@ -344,7 +343,7 @@ menuGetAttachWidget :: MenuClass self => self -> IO (Maybe Widget) menuGetAttachWidget self = do wPtr <- {#call unsafe menu_get_attach_widget#} (toMenu self)- if wPtr==nullPtr then return Nothing else liftM Just $ + if wPtr==nullPtr then return Nothing else liftM Just $ makeNewObject mkWidget (return wPtr) #if GTK_CHECK_VERSION(2,2,0)@@ -412,7 +411,7 @@ -- -- * Available since Gtk+ version 2.6 ---menuGetForAttachWidget :: WidgetClass widget => +menuGetForAttachWidget :: WidgetClass widget => widget -- ^ @widget@ - a 'Widget' -> IO [Menu] menuGetForAttachWidget widget =@@ -430,7 +429,7 @@ -- -- Default value: \"\" ---menuTitle :: MenuClass self => Attr self String+menuTitle :: (MenuClass self, GlibString string) => Attr self string menuTitle = newAttrFromStringProperty "tearoff-title" #if GTK_CHECK_VERSION(2,6,0)
Graphics/UI/Gtk/MenuComboToolbar/MenuBar.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.MenuBar ( -- * Detail--- +-- -- | The 'MenuBar' is a subclass of 'MenuShell' which contains one to many -- 'MenuItem'. The result is a standard menu bar which can hold many menu -- items.@@ -70,11 +70,11 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/MenuComboToolbar/MenuItem.chs view
@@ -1,3 +1,5 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget MenuItem --@@ -25,7 +27,7 @@ -- -- TODO ----- figure out what the signals \"toggle-size-allocate\" and +-- figure out what the signals \"toggle-size-allocate\" and -- \"toggle-size-request\" are good for and bind them if useful -- -- figure out if the connectToToggle signal is useful at all@@ -39,12 +41,12 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.MenuItem ( -- * Detail--- --- | The 'MenuItem' widget and the derived widgets are the only valid childs+--+-- | The 'MenuItem' widget and the derived widgets are the only valid children -- for menus. Their function is to correctly handle highlighting, alignment, -- events and submenus. ----- As it derives from 'Bin' it can hold any valid child widget, altough only+-- As it derives from 'Bin' it can hold any valid child widget, although only -- a few are really useful. -- * Class Hierarchy@@ -75,12 +77,18 @@ menuItemNewWithMnemonic, -- * Methods+#if GTK_CHECK_VERSION(2,16,0)+ menuItemSetLabel,+ menuItemGetLabel,+ menuItemSetUseUnderline,+ menuItemGetUseUnderline,+#endif menuItemSetSubmenu, menuItemGetSubmenu, menuItemRemoveSubmenu,- menuItemSelect,- menuItemDeselect,- menuItemActivate,+ menuItemEmitSelect,+ menuItemEmitDeselect,+ menuItemEmitActivate, menuItemSetRightJustified, menuItemGetRightJustified, menuItemSetAccelPath,@@ -88,8 +96,23 @@ -- * Attributes menuItemSubmenu, menuItemRightJustified,+#if GTK_CHECK_VERSION(2,16,0)+ menuItemLabel,+ menuItemUseUnderline,+#endif -- * Signals+ menuItemActivatedItem,+ menuItemActivated,+ menuItemActivateItem,+ menuItemActivate,+ menuItemSelect,+ menuItemDeselect,+ menuItemToggle,++#if GTK_MAJOR_VERSION < 3+#ifndef DISABLE_DEPRECATED+-- * Deprecated onActivateItem, afterActivateItem, onActivateLeaf,@@ -100,14 +123,16 @@ afterDeselect, onToggle, afterToggle+#endif+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -126,8 +151,8 @@ -- | Creates a new 'MenuItem' whose child is a 'Label'. ---menuItemNewWithLabel :: - String -- ^ @label@ - the text for the label+menuItemNewWithLabel :: GlibString string+ => string -- ^ @label@ - the text for the label -> IO MenuItem menuItemNewWithLabel label = makeNewObject mkMenuItem $@@ -140,8 +165,8 @@ -- using 'labelNewWithMnemonic', so underscores in @label@ indicate the -- mnemonic for the menu item. ---menuItemNewWithMnemonic :: - String -- ^ @label@ - The text of the label, with an underscore in+menuItemNewWithMnemonic :: GlibString string+ => string -- ^ @label@ - The text of the label, with an underscore in -- front of the mnemonic character -> IO MenuItem menuItemNewWithMnemonic label =@@ -153,7 +178,36 @@ -------------------- -- Methods+#if GTK_CHECK_VERSION(2,16,0)+-- | Sets text on the MenuItem label +menuItemSetLabel :: (MenuItemClass self, GlibString string) => self -> string -> IO ()+menuItemSetLabel self label =+ withUTFString label $ {# call gtk_menu_item_set_label #} (toMenuItem self)++-- | Gets text on the MenuItem label+menuItemGetLabel :: (MenuItemClass self, GlibString string) => self -> IO string+menuItemGetLabel self =+ {# call gtk_menu_item_get_label #}+ (toMenuItem self)+ >>= \strPtr -> if strPtr == nullPtr+ then return ""+ else peekUTFString strPtr++-- | If True, an underline in the text indicates the next character should be used for the mnemonic accelerator key.+--+menuItemSetUseUnderline :: (MenuItemClass self) => self -> Bool -> IO ()+menuItemSetUseUnderline self =+ {# call gtk_menu_item_set_use_underline #} (toMenuItem self) . fromBool++-- | Checks if an underline in the text indicates the next character should be used for the mnemonic accelerator key.+--+menuItemGetUseUnderline :: (MenuItemClass self) => self -> IO Bool+menuItemGetUseUnderline self =+ liftM toBool $ {# call gtk_menu_item_get_use_underline #}+ (toMenuItem self)++#endif -- | Sets the item's submenu, or changes it. -- menuItemSetSubmenu :: (MenuItemClass self, MenuClass submenu) => self -> submenu -> IO ()@@ -177,27 +231,28 @@ -- menuItemRemoveSubmenu :: MenuItemClass self => self -> IO () menuItemRemoveSubmenu self =- {# call menu_item_remove_submenu #}+ {# call menu_item_set_submenu #} (toMenuItem self)+ (Widget $ unsafePerformIO $ newForeignPtr_ nullPtr) -- | Select the menu item. Emits the \"select\" signal on the item. ---menuItemSelect :: MenuItemClass self => self -> IO ()-menuItemSelect self =+menuItemEmitSelect :: MenuItemClass self => self -> IO ()+menuItemEmitSelect self = {# call menu_item_select #} (toMenuItem self) -- | Deselect the menu item. Emits the \"deselect\" signal on the item. ---menuItemDeselect :: MenuItemClass self => self -> IO ()-menuItemDeselect self =+menuItemEmitDeselect :: MenuItemClass self => self -> IO ()+menuItemEmitDeselect self = {# call menu_item_deselect #} (toMenuItem self) -- | Simulate a click on the menu item. Emits the \"activate\" signal on the item. ---menuItemActivate :: MenuItemClass self => self -> IO ()-menuItemActivate self =+menuItemEmitActivate :: MenuItemClass self => self -> IO ()+menuItemEmitActivate self = {# call menu_item_activate #} (toMenuItem self) @@ -227,7 +282,7 @@ -- | Set the accelerator path on the menu item, through which runtime changes of -- the menu item's accelerator caused by the user can be identified and saved--- to persistant storage (see 'accelMapSave' on this). To setup a default+-- to persistent storage (see 'accelMapSave' on this). To setup a default -- accelerator for this menu item, call 'accelMapAddEntry' with the same accel -- path. See also 'accelMapAddEntry' on the specifics of accelerator paths, and -- 'menuSetAccelPath' for a more convenient variant of this function.@@ -239,8 +294,8 @@ -- Note that you do need to set an accelerator on the parent menu with -- 'menuSetAccelGroup' for this to work. ---menuItemSetAccelPath :: MenuItemClass self => self- -> Maybe String -- ^ @accelPath@ - accelerator path, corresponding to this+menuItemSetAccelPath :: (MenuItemClass self, GlibString string) => self+ -> Maybe string -- ^ @accelPath@ - accelerator path, corresponding to this -- menu item's functionality, or @Nothing@ to unset the -- current path. -> IO ()@@ -268,6 +323,22 @@ menuItemGetRightJustified menuItemSetRightJustified +#if GTK_CHECK_VERSION(2,16,0)+-- | \'label\' property. See 'menuItemSetLabel' and 'menuItemGetLabel'+--+menuItemLabel :: (MenuItemClass self, GlibString string) => Attr self string+menuItemLabel = newAttr+ menuItemGetLabel+ menuItemSetLabel++-- | \'useUnderline\' property. See 'menuItemSetUseUnderline' and+-- 'menuItemGetUseEUnderline'+--+menuItemUseUnderline :: MenuItemClass self => Attr self Bool+menuItemUseUnderline = newAttr+ menuItemGetUseUnderline+ menuItemSetUseUnderline+#endif -------------------- -- Signals @@ -276,43 +347,73 @@ -- * This is the only function applications normally connect to. -- It is not emitted if the item has a submenu. ---onActivateLeaf, afterActivateLeaf :: MenuItemClass self => self- -> IO ()- -> IO (ConnectId self)-onActivateLeaf = connect_NONE__NONE "activate" False-afterActivateLeaf = connect_NONE__NONE "activate" True+menuItemActivated :: MenuItemClass self => Signal self (IO ())+menuItemActivated = Signal (connect_NONE__NONE "activate") +-- | Deprecated. See 'menuItemActivated'.+menuItemActivate :: MenuItemClass self => Signal self (IO ())+menuItemActivate = menuItemActivated+ -- | Emitted when the user chooses a menu item that has a submenu. -- -- * This signal is not emitted if the menu item does not have a -- submenu. --+menuItemActivatedItem :: MenuItemClass self => Signal self (IO ())+menuItemActivatedItem = Signal (connect_NONE__NONE "activate-item")++-- | Deprecated. See 'menuItemActivatedItem'.+menuItemActivateItem :: MenuItemClass self => Signal self (IO ())+menuItemActivateItem = menuItemActivatedItem++-- | This signal is emitted when the item is selected.+--+menuItemSelect :: MenuItemClass i => Signal i (IO ())+menuItemSelect = Signal (connect_NONE__NONE "select")++-- | This signal is emitted when the item is deselected.+--+menuItemDeselect :: MenuItemClass i => Signal i (IO ())+menuItemDeselect = Signal (connect_NONE__NONE "deselect")++-- | This signal is emitted when the item is toggled.+--+menuItemToggle :: MenuItemClass i => Signal i (IO ())+menuItemToggle = Signal (connect_NONE__NONE "toggle")++#if GTK_MAJOR_VERSION < 3+#ifndef DISABLE_DEPRECATED+--------------------+-- Deprecated Signals++onActivateLeaf, afterActivateLeaf :: MenuItemClass self => self+ -> IO ()+ -> IO (ConnectId self)+onActivateLeaf = connect_NONE__NONE "activate" False+afterActivateLeaf = connect_NONE__NONE "activate" True+ onActivateItem, afterActivateItem :: MenuItemClass self => self -> IO () -> IO (ConnectId self) onActivateItem = connect_NONE__NONE "activate-item" False afterActivateItem = connect_NONE__NONE "activate-item" True --- | This signal is emitted when the item is selected.--- onSelect, afterSelect :: ItemClass i => i -> IO () -> IO (ConnectId i) onSelect = connect_NONE__NONE "select" False afterSelect = connect_NONE__NONE "select" True --- | This signal is emitted when the item is deselected.--- onDeselect, afterDeselect :: ItemClass i => i -> IO () -> IO (ConnectId i) onDeselect = connect_NONE__NONE "deselect" False afterDeselect = connect_NONE__NONE "deselect" True --- | This signal is emitted when the item is toggled.--- onToggle, afterToggle :: ItemClass i => i -> IO () -> IO (ConnectId i)-onToggle = connect_NONE__NONE "toggled" False-afterToggle = connect_NONE__NONE "toggled" True+onToggle = connect_NONE__NONE "toggle" False+afterToggle = connect_NONE__NONE "toggle" True+#endif+#endif
Graphics/UI/Gtk/MenuComboToolbar/MenuShell.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.MenuShell ( -- * Detail--- +-- -- | A 'MenuShell' is the abstract base class used to derive the 'Menu' and -- 'MenuBar' subclasses. --@@ -92,13 +92,13 @@ afterSelectionDone ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Enums (MenuDirectionType(..))+import Graphics.UI.Gtk.General.Enums (MenuDirectionType(..)) {# context lib="gtk" prefix="gtk" #} @@ -219,7 +219,7 @@ -- to submenus whenever a submenu is popped up, so you don't have to worry -- about recursively setting it for your entire menu hierarchy. Only when -- programmatically picking a submenu and popping it up manually, the--- @takeFocus@ property of the submenu needs to be set explicitely.+-- @takeFocus@ property of the submenu needs to be set explicitly. -- -- Note that setting it to @False@ has side-effects: --
Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.MenuToolButton ( -- * Detail--- +-- -- | A 'MenuToolButton' is a 'ToolItem' that contains a button and a small -- additional button with an arrow. When clicked, the arrow button pops up a -- dropdown menu.@@ -65,7 +65,9 @@ -- * Methods menuToolButtonSetMenu, menuToolButtonGetMenu,+#if GTK_MAJOR_VERSION < 3 menuToolButtonSetArrowTooltip,+#endif #if GTK_CHECK_VERSION(2,12,0) menuToolButtonSetArrowTooltipText, menuToolButtonSetArrowTooltipMarkup,@@ -80,16 +82,15 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.StockItems-import Graphics.Rendering.Pango.Markup {# context lib="gtk" prefix="gtk" #} @@ -100,10 +101,10 @@ -- | Creates a new 'MenuToolButton' using @iconWidget@ as icon and @label@ as -- label. ---menuToolButtonNew :: WidgetClass iconWidget => +menuToolButtonNew :: (WidgetClass iconWidget, GlibString string) => Maybe iconWidget -- ^ @iconWidget@ - a widget that will be used as icon -- widget, or @Nothing@- -> Maybe String -- ^ @label@ - a string that will be used as label, or+ -> Maybe string -- ^ @label@ - a string that will be used as label, or -- @Nothing@ -> IO MenuToolButton menuToolButtonNew iconWidget label =@@ -117,7 +118,7 @@ -- | Creates a new 'MenuToolButton'. The new 'MenuToolButton' will contain an -- icon and label from the stock item indicated by @stockId@. ---menuToolButtonNewFromStock :: +menuToolButtonNewFromStock :: StockId -- ^ @stockId@ - the name of a stock item -> IO MenuToolButton menuToolButtonNewFromStock stockId =@@ -150,14 +151,15 @@ {# call gtk_menu_tool_button_get_menu #} (toMenuToolButton self) +#if GTK_MAJOR_VERSION < 3 -- | Sets the 'Tooltips' object to be used for arrow button which pops up the -- menu. See 'Graphics.UI.Gtk.MenuComboToolbar.ToolItem.toolItemSetTooltip' -- for setting a tooltip on the whole 'MenuToolButton'. ---menuToolButtonSetArrowTooltip :: MenuToolButtonClass self => self+menuToolButtonSetArrowTooltip :: (MenuToolButtonClass self, GlibString string) => self -> Tooltips -- ^ @tooltips@ - the 'Tooltips' object to be used- -> String -- ^ @tipText@ - text to be used as tooltip text for tool item- -> String -- ^ @tipPrivate@ - text to be used as private tooltip text+ -> string -- ^ @tipText@ - text to be used as tooltip text for tool item+ -> string -- ^ @tipPrivate@ - text to be used as private tooltip text -> IO () menuToolButtonSetArrowTooltip self tooltips tipText tipPrivate = withUTFString tipPrivate $ \tipPrivatePtr ->@@ -167,6 +169,7 @@ tooltips tipTextPtr tipPrivatePtr+#endif #if GTK_CHECK_VERSION(2,12,0) -- | Sets the tooltip text to be used as tooltip for the arrow button which@@ -175,8 +178,8 @@ -- -- * Available since Gtk+ version 2.12 ---menuToolButtonSetArrowTooltipText :: MenuToolButtonClass self => self- -> String -- ^ @text@ - text to be used as tooltip text for button's arrow+menuToolButtonSetArrowTooltipText :: (MenuToolButtonClass self, GlibString string) => self+ -> string -- ^ @text@ - text to be used as tooltip text for button's arrow -- button -> IO () menuToolButtonSetArrowTooltipText self text =@@ -191,8 +194,8 @@ -- -- * Available since Gtk+ version 2.12 ---menuToolButtonSetArrowTooltipMarkup :: MenuToolButtonClass self => self- -> Markup -- ^ @markup@ - markup text to be used as tooltip text for button's+menuToolButtonSetArrowTooltipMarkup :: (MenuToolButtonClass self, GlibString markup) => self+ -> markup -- ^ @markup@ - markup text to be used as tooltip text for button's -- arrow button -> IO () menuToolButtonSetArrowTooltipMarkup self markup =@@ -215,7 +218,7 @@ -------------------- -- Signals --- | +-- | -- onShowMenu, afterShowMenu :: MenuToolButtonClass self => self -> IO ()
Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs view
@@ -26,11 +26,11 @@ -- A widget used to choose from a list of valid choices -- -- * Warning: this module is deprecated and should not be used in--- newly-written code.+-- newly-written code. It is empty in Gtk3. -- module Graphics.UI.Gtk.MenuComboToolbar.OptionMenu ( -- * Detail--- +-- -- | A 'OptionMenu' is a widget that allows the user to choose from a list of -- valid choices. The 'OptionMenu' displays the selected choice. When activated -- the 'OptionMenu' displays a popup 'Menu' which allows the user to make a new@@ -58,6 +58,7 @@ -- | +----OptionMenu -- @ +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- * Types OptionMenu,@@ -82,19 +83,21 @@ onOMChanged, afterOMChanged #endif+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {# context lib="gtk" prefix="gtk" #} +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -------------------- -- Constructors@@ -179,4 +182,5 @@ -> IO (ConnectId self) onOMChanged = connect_NONE__NONE "changed" False afterOMChanged = connect_NONE__NONE "changed" True+#endif #endif
Graphics/UI/Gtk/MenuComboToolbar/RadioMenuItem.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget RadioMenuItem --@@ -30,7 +31,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.RadioMenuItem ( -- * Detail--- +-- -- | A radio menu item is a check menu item that belongs to a group. At each -- instant exactly one of the radio menu items from a group is selected. @@ -62,17 +63,17 @@ radioMenuItemNewWithLabelFromWidget, radioMenuItemNewWithMnemonicFromWidget, - -- * Compatibilty aliases+ -- * Compatibility aliases radioMenuItemNewJoinGroup, radioMenuItemNewJoinGroupWithLabel, radioMenuItemNewJoinGroupWithMnemonic, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -91,7 +92,7 @@ -- | Creates a new 'RadioMenuItem' whose child is a simple 'Label'. ---radioMenuItemNewWithLabel :: String -> IO RadioMenuItem+radioMenuItemNewWithLabel :: GlibString string => string -> IO RadioMenuItem radioMenuItemNewWithLabel label = makeNewObject mkRadioMenuItem $ liftM (castPtr :: Ptr Widget -> Ptr RadioMenuItem) $@@ -104,7 +105,7 @@ -- created using 'labelNewWithMnemonic', so underscores in @label@ indicate the -- mnemonic for the menu item. ---radioMenuItemNewWithMnemonic :: String -> IO RadioMenuItem+radioMenuItemNewWithMnemonic :: GlibString string => string -> IO RadioMenuItem radioMenuItemNewWithMnemonic label = makeNewObject mkRadioMenuItem $ liftM (castPtr :: Ptr Widget -> Ptr RadioMenuItem) $@@ -116,7 +117,7 @@ -- | Create a new radio button, adding it to the same group as the group to -- which @groupMember@ belongs. ---radioMenuItemNewFromWidget :: +radioMenuItemNewFromWidget :: RadioMenuItem -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added. -> IO RadioMenuItem@@ -130,10 +131,10 @@ -- | Create a new radio button with a label, adding it to the same group as the -- group to which @groupMember@ belongs. ---radioMenuItemNewWithLabelFromWidget :: - RadioMenuItem -- ^ @groupMember@ - a member of an existing radio button+radioMenuItemNewWithLabelFromWidget :: GlibString string+ => RadioMenuItem -- ^ @groupMember@ - a member of an existing radio button -- group, to which the new radio button will be added.- -> String+ -> string -> IO RadioMenuItem radioMenuItemNewWithLabelFromWidget groupMember label = {# call unsafe radio_menu_item_get_group #} groupMember >>= \groupPtr ->@@ -148,12 +149,12 @@ -- another radio button. Underscores in the label string indicate the mnemonic -- for the menu item. ---radioMenuItemNewWithMnemonicFromWidget :: RadioMenuItem- -> String+radioMenuItemNewWithMnemonicFromWidget :: GlibString string => RadioMenuItem+ -> string -> IO RadioMenuItem radioMenuItemNewWithMnemonicFromWidget groupMember label = {# call unsafe radio_menu_item_get_group #} groupMember >>= \groupPtr ->- withUTFString label $ \strPtr -> + withUTFString label $ \strPtr -> makeNewObject mkRadioMenuItem $ liftM (castPtr :: Ptr Widget -> Ptr RadioMenuItem) $ {# call unsafe radio_menu_item_new_with_mnemonic #}@@ -167,7 +168,9 @@ radioMenuItemNewJoinGroup = radioMenuItemNewFromWidget -- | Alias for 'radioMenuItemNewWithLabelFromWidget'.+radioMenuItemNewJoinGroupWithLabel :: GlibString string => RadioMenuItem -> string -> IO RadioMenuItem radioMenuItemNewJoinGroupWithLabel = radioMenuItemNewWithLabelFromWidget -- | Alias for 'radioMenuItemNewWithMnemonicFromWidget'.+radioMenuItemNewJoinGroupWithMnemonic :: GlibString string => RadioMenuItem -> string -> IO RadioMenuItem radioMenuItemNewJoinGroupWithMnemonic = radioMenuItemNewWithMnemonicFromWidget
Graphics/UI/Gtk/MenuComboToolbar/RadioToolButton.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.RadioToolButton ( -- * Detail--- +-- -- | A 'RadioToolButton' is a 'ToolItem' that contains a radio button, that -- is, a button that is part of a group of toggle buttons where only one button -- can be active at a time.@@ -76,13 +76,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.GList import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.General.StockItems @@ -105,7 +105,7 @@ -- 'RadioToolButton' will contain an icon and label from the stock item -- indicated by @stockId@. ---radioToolButtonNewFromStock :: +radioToolButtonNewFromStock :: StockId -- ^ @stockId@ - the name of a stock item -> IO RadioToolButton radioToolButtonNewFromStock stockId =@@ -116,10 +116,10 @@ nullPtr stockIdPtr --- | Creates a new 'RadioToolButton' adding it to the same group as +-- | Creates a new 'RadioToolButton' adding it to the same group as -- the group to which @groupMember@ belongs. ---radioToolButtonNewFromWidget :: RadioToolButtonClass groupMember => +radioToolButtonNewFromWidget :: RadioToolButtonClass groupMember => groupMember -- ^ @groupMember@ - a member of an existing radio group, -- to which the new radio tool button will be added. -> IO RadioToolButton@@ -133,7 +133,7 @@ -- to which @groupMember@ belongs. The new 'RadioToolButton' will contain an -- icon and label from the stock item indicated by @stockId@. ---radioToolButtonNewWithStockFromWidget :: RadioToolButtonClass groupMember => +radioToolButtonNewWithStockFromWidget :: RadioToolButtonClass groupMember => groupMember -- ^ @groupMember@ - a member of an existing radio group, -- to which the new radio tool button will be added. -> StockId -- ^ @stockId@ - the name of a stock item
Graphics/UI/Gtk/MenuComboToolbar/SeparatorMenuItem.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.SeparatorMenuItem ( -- * Detail--- +-- -- | The 'SeparatorMenuItem' is a separator used to group items within a menu. -- It displays a horizontal line with a shadow to make it appear sunken into -- the interface.@@ -55,10 +55,10 @@ separatorMenuItemNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/MenuComboToolbar/SeparatorToolItem.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.SeparatorToolItem ( -- * Detail--- +-- -- | A 'SeparatorToolItem' is a 'ToolItem' that separates groups of other -- 'ToolItem's. Depending on the theme, a 'SeparatorToolItem' will often look -- like a vertical line on horizontally docked toolbars.@@ -71,11 +71,11 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/MenuComboToolbar/TearoffMenuItem.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget TearoffMenuItem --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.TearoffMenuItem ( -- * Detail--- +-- -- | A 'TearoffMenuItem' is a special 'MenuItem' which is used to tear off and -- reattach its menu. --@@ -62,10 +63,10 @@ tearoffMenuItemNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.ToggleToolButton ( -- * Detail--- +-- -- | A 'ToggleToolButton' is a 'ToolItem' that contains a toggle button. -- -- Use 'toggleToolButtonNew' to create a new 'ToggleToolButton'. Use@@ -76,12 +76,12 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.StockItems@@ -105,7 +105,7 @@ -- -- It is an error if @stockId@ is not a name of a stock item. ---toggleToolButtonNewFromStock :: +toggleToolButtonNewFromStock :: StockId -- ^ @stockId@ - the name of the stock item -> IO ToggleToolButton toggleToolButtonNewFromStock stockId =
Graphics/UI/Gtk/MenuComboToolbar/ToolButton.chs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget ToolButton --@@ -29,7 +30,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.ToolButton ( -- * Detail--- +-- -- | 'ToolButton's are 'ToolItems' containing buttons. -- -- Use 'toolButtonNew' to create a new 'ToolButton'. Use@@ -107,12 +108,12 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.StockItems@@ -126,10 +127,10 @@ -- | Creates a new 'ToolButton' using @iconWidget@ as icon and @label@ as -- label. ---toolButtonNew :: WidgetClass iconWidget => +toolButtonNew :: (WidgetClass iconWidget, GlibString string) => Maybe iconWidget -- ^ @iconWidget@ - a widget that will be used as icon -- widget, or @Nothing@- -> Maybe String -- ^ @label@ - a string that will be used as label, or+ -> Maybe string -- ^ @label@ - a string that will be used as label, or -- @Nothing@ -> IO ToolButton toolButtonNew iconWidget label =@@ -145,7 +146,7 @@ -- -- It is an error if @stockId@ is not a name of a stock item. ---toolButtonNewFromStock :: +toolButtonNewFromStock :: StockId -- ^ @stockId@ - the name of the stock item -> IO ToolButton toolButtonNewFromStock stockId =@@ -165,8 +166,8 @@ -- property. If the \"stock_id\" property is also @Nothing@, @button@ will not -- have a label. ---toolButtonSetLabel :: ToolButtonClass self => self- -> Maybe String -- ^ @label@ - a string that will be used as label, or+toolButtonSetLabel :: (ToolButtonClass self, GlibString string) => self+ -> Maybe string -- ^ @label@ - a string that will be used as label, or -- @Nothing@. -> IO () toolButtonSetLabel self label =@@ -178,7 +179,7 @@ -- | Returns the label used by the tool button, or @Nothing@ if the tool -- button doesn't have a label. or uses a the label from a stock item. ---toolButtonGetLabel :: ToolButtonClass self => self -> IO (Maybe String)+toolButtonGetLabel :: (ToolButtonClass self, GlibString string) => self -> IO (Maybe string) toolButtonGetLabel self = {# call gtk_tool_button_get_label #} (toToolButton self)@@ -223,7 +224,7 @@ -- | Returns the name of the stock item. See 'toolButtonSetStockId'. ---toolButtonGetStockId :: ToolButtonClass self => self -> IO (Maybe String)+toolButtonGetStockId :: ToolButtonClass self => self -> IO (Maybe StockId) toolButtonGetStockId self = {# call gtk_tool_button_get_stock_id #} (toToolButton self)@@ -286,8 +287,8 @@ -- -- * Available since Gtk+ version 2.8 ---toolButtonSetIconName :: ToolButtonClass self => self- -> String -- ^ @iconName@ - the name of the themed icon+toolButtonSetIconName :: (ToolButtonClass self, GlibString string) => self+ -> string -- ^ @iconName@ - the name of the themed icon -> IO () toolButtonSetIconName self iconName = withUTFString iconName $ \iconNamePtr ->@@ -300,8 +301,8 @@ -- -- * Available since Gtk+ version 2.8 ---toolButtonGetIconName :: ToolButtonClass self => self- -> IO String -- ^ returns the icon name or @\"\"@ if the tool button has no+toolButtonGetIconName :: (ToolButtonClass self, GlibString string) => self+ -> IO string -- ^ returns the icon name or @\"\"@ if the tool button has no -- themed icon. toolButtonGetIconName self = {# call gtk_tool_button_get_icon_name #}@@ -318,7 +319,7 @@ -- -- Default value: @Nothing@ ---toolButtonLabel :: ToolButtonClass self => Attr self (Maybe String)+toolButtonLabel :: (ToolButtonClass self, GlibString string) => Attr self (Maybe string) toolButtonLabel = newAttr toolButtonGetLabel toolButtonSetLabel@@ -345,7 +346,7 @@ -- -- Default value: @Nothing@ ---toolButtonStockId :: ToolButtonClass self => ReadWriteAttr self (Maybe String) (Maybe String)+toolButtonStockId :: ToolButtonClass self => ReadWriteAttr self (Maybe StockId) (Maybe StockId) toolButtonStockId = newAttr toolButtonGetStockId toolButtonSetStockId@@ -357,7 +358,7 @@ -- -- Default value: \"\" ---toolButtonIconName :: ToolButtonClass self => Attr self String+toolButtonIconName :: (ToolButtonClass self, GlibString string) => Attr self string toolButtonIconName = newAttr toolButtonGetIconName toolButtonSetIconName
Graphics/UI/Gtk/MenuComboToolbar/ToolItem.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.ToolItem ( -- * Detail--- +-- -- | 'ToolItem's are widgets that can appear on a toolbar. To create a toolbar -- item that contain something else than a button, use 'toolItemNew'. Use -- 'containerAdd' to add a child widget to the tool item.@@ -65,7 +65,9 @@ toolItemGetHomogeneous, toolItemSetExpand, toolItemGetExpand,+#if GTK_MAJOR_VERSION < 3 toolItemSetTooltip,+#endif toolItemSetUseDragWindow, toolItemGetUseDragWindow, toolItemSetVisibleHorizontal,@@ -86,6 +88,13 @@ toolItemGetProxyMenuItem, toolItemSetProxyMenuItem, +#if GTK_CHECK_VERSION(2,20,0)+ toolItemGetEllipsizeMode,+ toolItemGetTextAlignment,+ toolItemGetTextOrientation,+ toolItemGetTextSizeGroup,+#endif+ -- * Attributes toolItemVisibleHorizontal, toolItemVisibleVertical,@@ -96,15 +105,17 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.Rendering.Pango.Enums (EllipsizeMode (..))+import Graphics.UI.Gtk.Misc.SizeGroup {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Structs (IconSize)-import Graphics.UI.Gtk.General.Enums (Orientation(..), ToolbarStyle(..), ReliefStyle(..))+import Graphics.UI.Gtk.General.Structs (IconSize)+import Graphics.UI.Gtk.General.Enums (Orientation(..), ToolbarStyle(..), ReliefStyle(..)) {# context lib="gtk" prefix="gtk" #} @@ -164,14 +175,16 @@ {# call unsafe tool_item_get_expand #} (toToolItem self) +#if GTK_MAJOR_VERSION < 3 -- | Sets the 'Tooltips' object to be used for the tool item, the text to be -- displayed as tooltip on the item and the private text to be used. See -- 'tooltipsSetTip'. ---toolItemSetTooltip :: ToolItemClass self => self+-- Removed in Gtk3.+toolItemSetTooltip :: (ToolItemClass self, GlibString string) => self -> Tooltips -- ^ @tooltips@ - The 'Tooltips' object to be used- -> String -- ^ @tipText@ - text to be used as tooltip text for @toolItem@- -> String -- ^ @tipPrivate@ - text to be used as private tooltip text+ -> string -- ^ @tipText@ - text to be used as tooltip text for @toolItem@+ -> string -- ^ @tipPrivate@ - text to be used as private tooltip text -> IO () toolItemSetTooltip self tooltips tipText tipPrivate = withUTFString tipPrivate $ \tipPrivatePtr ->@@ -181,6 +194,7 @@ tooltips tipTextPtr tipPrivatePtr+#endif -- | Sets whether toolitem has a drag window. When @True@ the tool item can be -- used as a drag source through 'dragSourceSet'. When the tool item has a drag@@ -313,15 +327,15 @@ -- | If @menuItemId@ matches the string passed to 'toolItemSetProxyMenuItem' -- return the corresponding 'MenuItem'. ---toolItemGetProxyMenuItem :: ToolItemClass self => self- -> String -- ^ @menuItemId@ - a string used to identify the menu+toolItemGetProxyMenuItem :: (ToolItemClass self, GlibString string) => self+ -> string -- ^ @menuItemId@ - a string used to identify the menu -- item -> IO (Maybe Widget) -- ^ returns The 'MenuItem' passed to -- 'toolItemSetProxyMenuItem', if the @menuItemId@s -- match. toolItemGetProxyMenuItem self menuItemId = maybeNull (makeNewObject mkWidget) $- withCString menuItemId $ \menuItemIdPtr ->+ withUTFString menuItemId $ \menuItemIdPtr -> {# call unsafe tool_item_get_proxy_menu_item #} (toToolItem self) menuItemIdPtr@@ -330,16 +344,57 @@ -- is used to identify the caller of this function and should also be used with -- 'toolItemGetProxyMenuItem'. ---toolItemSetProxyMenuItem :: (ToolItemClass self, MenuItemClass menuItem) => self- -> String -- ^ @menuItemId@ - a string used to identify @menuItem@+toolItemSetProxyMenuItem :: (ToolItemClass self, MenuItemClass menuItem, GlibString string) => self+ -> string -- ^ @menuItemId@ - a string used to identify @menuItem@ -> menuItem -- ^ @menuItem@ - a 'MenuItem' to be used in the overflow menu -> IO () toolItemSetProxyMenuItem self menuItemId menuItem =- withCString menuItemId $ \menuItemIdPtr ->+ withUTFString menuItemId $ \menuItemIdPtr -> {# call tool_item_set_proxy_menu_item #} (toToolItem self) menuItemIdPtr (toWidget menuItem)++#if GTK_CHECK_VERSION(2,20,0)+-- | Returns the ellipsize mode used for @toolItem@. Custom subclasses of 'ToolItem' should call this+-- function to find out how text should be ellipsized.+--+-- * Available since Gtk+ version 2.20+--+toolItemGetEllipsizeMode :: ToolItemClass item => item+ -> IO EllipsizeMode -- ^ returns a PangoEllipsizeMode indicating how text in @toolItem@ should be ellipsized.+toolItemGetEllipsizeMode item =+ liftM (toEnum . fromIntegral) $+ {#call gtk_tool_item_get_ellipsize_mode #}+ (toToolItem item)++-- | Returns the text alignment used for @toolItem@. Custom subclasses of 'ToolItem' should call this+-- function to find out how text should be aligned.+toolItemGetTextAlignment :: ToolItemClass item => item+ -> IO Double -- ^ returns a gfloat indicating the horizontal text alignment used for @toolItem@+toolItemGetTextAlignment item =+ liftM realToFrac $+ {#call gtk_tool_item_get_text_alignment #}+ (toToolItem item)++-- | Returns the text orientation used for @toolItem@. Custom subclasses of 'ToolItem' should call this+-- function to find out how text should be orientated.+toolItemGetTextOrientation :: ToolItemClass item => item+ -> IO Orientation -- ^ returns a 'Orientation' indicating the orientation used for @toolItem@+toolItemGetTextOrientation item =+ liftM (toEnum . fromIntegral) $+ {#call gtk_tool_item_get_text_orientation #}+ (toToolItem item)++-- | Returns the size group used for labels in @toolItem@. Custom subclasses of 'ToolItem' should call+-- this function and use the size group for labels.+toolItemGetTextSizeGroup :: ToolItemClass item => item+ -> IO SizeGroup+toolItemGetTextSizeGroup item =+ makeNewGObject mkSizeGroup $+ {#call gtk_tool_item_get_text_size_group #}+ (toToolItem item)+#endif -------------------- -- Attributes
+ Graphics/UI/Gtk/MenuComboToolbar/ToolItemGroup.chs view
@@ -0,0 +1,293 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget ToolItemGroup+--+-- Author : Andy Stewart+--+-- Created: 08 Sep 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A sub container used in a tool palette+--+-- * Module available since Gtk+ version 2.20+--+module Graphics.UI.Gtk.MenuComboToolbar.ToolItemGroup (++-- * Detail+-- | A 'ToolItemGroup' is used together with 'ToolPalette' to add 'ToolItems' to a palette like+-- container with different categories and drag and drop support.++-- * Class Hierarchy+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'ToolItemGroup'+-- @++#if GTK_CHECK_VERSION(2,20,0)+-- * Types+ ToolItemGroup,+ ToolItemGroupClass,+ castToToolItemGroup,+ toToolItemGroup,++-- * Constructors+ toolItemGroupNew,++-- * Methods+ toolItemGroupGetDropItem,+ toolItemGroupGetItemPosition,+ toolItemGroupGetNItems,+ toolItemGroupGetNthItem,+ toolItemGroupInsert,+ toolItemGroupSetItemPosition,++-- * Attributes+ toolItemGroupCollapsed,+ toolItemGroupEllipsize,+ toolItemGroupHeaderRelief,+ toolItemGroupLabel,+ toolItemGroupLabelWidget,++-- * Child Attributes+ toolItemGroupChildExpand,+ toolItemGroupChildFill,+ toolItemGroupChildHomogeneous,+ toolItemGroupChildNewRow,+ toolItemGroupChildPosition,+#endif+) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import System.Glib.UTFString+import Graphics.Rendering.Pango.Enums (EllipsizeMode (..))+import Graphics.UI.Gtk.General.Enums (ReliefStyle(..))+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,20,0)+-- | Creates a new tool item group with label label.+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupNew :: GlibString string => string -- ^ @label@ the label of the new group+ -> IO ToolItemGroup -- ^ returns a new 'ToolItemGroup'.+toolItemGroupNew label =+ makeNewObject mkToolItemGroup $+ liftM (castPtr :: Ptr Widget -> Ptr ToolItemGroup) $+ withUTFString label $ \ labelPtr ->+ {#call gtk_tool_item_group_new #}+ labelPtr++-- | Gets the tool item at position (x, y).+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupGetDropItem :: ToolItemGroupClass self => self+ -> (Int, Int)+ -> IO ToolItem+toolItemGroupGetDropItem group (x, y) =+ makeNewObject mkToolItem $+ {#call gtk_tool_item_group_get_drop_item #}+ (toToolItemGroup group)+ (fromIntegral x)+ (fromIntegral y)++-- | Gets the position of item in group as index.+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupGetItemPosition :: (ToolItemGroupClass group, ToolItemClass item)+ => group -- ^ @group@ a 'ToolItemGroup'+ -> item -- ^ @item@ a 'ToolItem'+ -> IO Int -- ^ returns the index of item in group or -1 if item is no child of group+toolItemGroupGetItemPosition group item =+ liftM fromIntegral $+ {#call gtk_tool_item_group_get_item_position #}+ (toToolItemGroup group)+ (toToolItem item)++-- | Gets the number of tool items in group.+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupGetNItems :: ToolItemGroupClass group => group+ -> IO Int -- ^ returns the number of tool items in group+toolItemGroupGetNItems group =+ liftM fromIntegral $+ {#call gtk_tool_item_group_get_n_items #}+ (toToolItemGroup group)++-- | Gets the tool item at index in group.+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupGetNthItem :: ToolItemGroupClass group => group+ -> Int -- ^ @index@ the index+ -> IO ToolItem -- ^ returns the 'ToolItem' at index+toolItemGroupGetNthItem group index =+ makeNewObject mkToolItem $+ {#call gtk_tool_item_group_get_nth_item #}+ (toToolItemGroup group)+ (fromIntegral index)++-- | Inserts item at position in the list of children of group.+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupInsert :: (ToolItemGroupClass group, ToolItemClass item)+ => group -- ^ @group@ a 'ToolItemGroup'+ -> item -- ^ @item@ the 'ToolItem' to insert into group+ -> Int -- ^ @position@ the position of item in group, starting with 0.+ -- The position -1 means end of list.+ -> IO ()+toolItemGroupInsert group item position =+ {#call gtk_tool_item_group_insert #}+ (toToolItemGroup group)+ (toToolItem item)+ (fromIntegral position)++-- | Sets the position of item in the list of children of group.+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupSetItemPosition :: (ToolItemGroupClass group, ToolItemClass item)+ => group -- ^ @group@ a 'ToolItemGroup'+ -> item -- ^ @item@ the 'ToolItem' to move to a new position, should be a child of group.+ -> Int -- ^ @position@ the new position of item in group, starting with 0. The position -1 means end of list.+ -> IO ()+toolItemGroupSetItemPosition group item position =+ {#call gtk_tool_item_group_set_item_position #}+ (toToolItemGroup group)+ (toToolItem item)+ (fromIntegral position)++-- | Whether the group has been collapsed and items are hidden.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupCollapsed :: ToolItemGroupClass group => Attr group Bool+toolItemGroupCollapsed =+ newAttrFromBoolProperty "collapsed"++-- | Ellipsize for item group headers.+--+-- Default value: EllipsizeNone+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupEllipsize :: ToolItemGroupClass group => Attr group EllipsizeMode+toolItemGroupEllipsize =+ newAttrFromEnumProperty "ellipsize"+ {# call pure unsafe pango_ellipsize_mode_get_type #}++-- | Relief of the group header button.+--+-- Default value: 'ReliefNormal'+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupHeaderRelief :: ToolItemGroupClass group => Attr group ReliefStyle+toolItemGroupHeaderRelief =+ newAttrFromEnumProperty "header-relief"+ {# call pure unsafe gtk_relief_style_get_type #}++-- | The human-readable title of this item group.+--+-- Default value: \"\"+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupLabel :: GlibString string => ToolItemGroupClass group => Attr group string+toolItemGroupLabel =+ newAttrFromStringProperty "label"++-- | A widget to display in place of the usual label.+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupLabelWidget :: ToolItemGroupClass group => Attr group Widget+toolItemGroupLabelWidget =+ newAttrFromObjectProperty "label-widget"+ {# call pure unsafe gtk_widget_get_type #}++-- | Whether the item should receive extra space when the group grows.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupChildExpand :: ToolItemGroupClass group => Attr group Bool+toolItemGroupChildExpand =+ newAttrFromBoolProperty "expand"++-- | Whether the item should fill the available space.+--+-- Default value: 'True'+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupChildFill :: ToolItemGroupClass group => Attr group Bool+toolItemGroupChildFill =+ newAttrFromBoolProperty "fill"++-- | Whether the item should be the same size as other homogeneous items.+--+-- Default value: 'True'+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupChildHomogeneous :: ToolItemGroupClass group => Attr group Bool+toolItemGroupChildHomogeneous =+ newAttrFromBoolProperty "homogeneous"++-- | Whether the item should start a new row.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupChildNewRow :: ToolItemGroupClass group => Attr group Bool+toolItemGroupChildNewRow =+ newAttrFromBoolProperty "new-row"++-- | Position of the item within this group.+--+-- Allowed values: >= 0+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.20+--+toolItemGroupChildPosition :: ToolItemGroupClass group => Attr group Int+toolItemGroupChildPosition =+ newAttrFromIntProperty "position"+#endif+
+ Graphics/UI/Gtk/MenuComboToolbar/ToolPalette.chs view
@@ -0,0 +1,265 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget ToolPalette+--+-- Author : Andy Stewart+--+-- Created: 08 Sep 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A tool palette with categories+--+-- * Module available since Gtk+ version 2.20+--+-- TODO:+--+-- gtk_tool_palette_add_drag_dest+-- gtk_tool_palette_get_drag_item+-- gtk_tool_palette_get_drag_target_group+-- gtk_tool_palette_get_drag_target_item+-- gtk_tool_palette_get_drop_group+-- gtk_tool_palette_get_drop_item+--+module Graphics.UI.Gtk.MenuComboToolbar.ToolPalette (++-- * Detail+-- | A 'ToolPalette' allows you to add 'ToolItems' to a palette-like container with different+-- categories and drag and drop support.+--+-- A 'ToolPalette' is created with a call to 'toolPaletteNew'.+--+-- 'ToolItems' cannot be added directly to a 'ToolPalette' - instead they are added to a+-- 'ToolItemGroup' which can than be added to a 'ToolPalette'. To add a 'ToolItemGroup' to a+-- 'ToolPalette', use 'containerAdd'.+--+-- The easiest way to use drag and drop with 'ToolPalette' is to call 'toolPaletteAddDragDest'+-- with the desired drag source palette and the desired drag target widget. Then+-- 'toolPaletteGetDragItem' can be used to get the dragged item in the 'dragDataReceived'+-- signal handler of the drag target.++-- * Class Hierarchy+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'ToolPalette'+-- @++#if GTK_CHECK_VERSION(2,20,0)+-- * Types+ ToolPalette,+ ToolPaletteClass,+ castToToolPalette,+ toToolPalette,++-- * Enums+ ToolPaletteDragTargets (..),++-- * Constructors+ toolPaletteNew,++-- * Methods+ toolPaletteUnsetIconSize,+ toolPaletteUnsetStyle,+ toolPaletteGetHAdjustment,+ toolPaletteGetVAdjustment,++-- * Attributes+ toolPaletteSetGroupPosition,+ toolPaletteGetGroupPosition,+ toolPaletteIconSize,+ toolPaletteIconSizeSet,+ toolPaletteToolbarStyle,++-- * Child Attributes+ toolPaletteChildExclusive,+ toolPaletteChildExpand,++-- * Signals+ toolPaletteSetScrollAdjustments,+#endif+) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.General.Structs (IconSize (..))+import Graphics.UI.Gtk.General.Enums (ToolbarStyle (..))+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,20,0)++-- | Flags used to specify the supported drag targets.+{# enum ToolPaletteDragTargets {underscoreToCase} deriving (Eq) #}++-- | Creates a new tool palette.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteNew :: IO ToolPalette+toolPaletteNew =+ makeNewObject mkToolPalette $+ liftM (castPtr :: Ptr Widget -> Ptr ToolPalette) $+ {#call gtk_tool_palette_new #}++-- | Unsets the tool palette icon size set with 'toolPaletteSetIconSize', so that user+-- preferences will be used to determine the icon size.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteUnsetIconSize :: ToolPaletteClass self => self -> IO ()+toolPaletteUnsetIconSize palette =+ {#call gtk_tool_palette_unset_icon_size #}+ (toToolPalette palette)++-- | Unsets a toolbar style set with 'toolPaletteSetStyle', so that user preferences will be used+-- to determine the toolbar style.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteUnsetStyle :: ToolPaletteClass self => self -> IO ()+toolPaletteUnsetStyle palette =+ {#call gtk_tool_palette_unset_style #}+ (toToolPalette palette)++-- | Gets the horizontal adjustment of the tool palette.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteGetHAdjustment :: ToolPaletteClass self => self+ -> IO Adjustment+toolPaletteGetHAdjustment palette =+ makeNewObject mkAdjustment $+ {# call gtk_tool_palette_get_hadjustment #}+ (toToolPalette palette)++-- | Gets the vertical adjustment of the tool palette.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteGetVAdjustment :: ToolPaletteClass self => self+ -> IO Adjustment+toolPaletteGetVAdjustment palette =+ makeNewObject mkAdjustment $+ {# call gtk_tool_palette_get_vadjustment #}+ (toToolPalette palette)++-- | Gets the position of group in palette as index. See 'toolPaletteSetGroupPosition'.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteGetGroupPosition :: (ToolPaletteClass palette, ToolItemGroupClass group)+ => palette+ -> group+ -> IO Int -- ^ returns the index of group or -1 if group is not a child of palette+toolPaletteGetGroupPosition palette group =+ liftM fromIntegral $+ {#call gtk_tool_palette_get_group_position #}+ (toToolPalette palette)+ (toToolItemGroup group)++-- | Sets the position of the group as an index of the tool palette. If position is 0 the group will+-- become the first child, if position is -1 it will become the last child.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteSetGroupPosition :: (ToolPaletteClass palette, ToolItemGroupClass group)+ => palette+ -> group+ -> Int+ -> IO ()+toolPaletteSetGroupPosition palette group position =+ {#call gtk_tool_palette_set_group_position #}+ (toToolPalette palette)+ (toToolItemGroup group)+ (fromIntegral position)++-- | The size of the icons in a tool palette is normally determined by the 'toolbarIconSize'+-- setting. When this property is set, it overrides the setting.+--+-- This should only be used for special-purpose tool palettes, normal application tool palettes should+-- respect the user preferences for the size of icons.+--+-- Default value: 'IconSizeSmallToolbar'+--+-- * Available since Gtk+ version 2.20+--+toolPaletteIconSize :: ToolPaletteClass self => Attr self IconSize+toolPaletteIconSize =+ newAttrFromEnumProperty "icon-size"+ {# call pure unsafe gtk_icon_size_get_type #}++-- | Is 'True' if the 'iconSize' property has been set.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+toolPaletteIconSizeSet :: ToolPaletteClass self => Attr self Bool+toolPaletteIconSizeSet =+ newAttrFromBoolProperty "icon-size-set"++-- | The style of items in the tool palette.+--+-- Default value: 'ToolbarIcons'+--+-- * Available since Gtk+ version 2.20+--+toolPaletteToolbarStyle :: ToolPaletteClass self => Attr self ToolbarStyle+toolPaletteToolbarStyle =+ newAttrFromEnumProperty "toolbar-style"+ {# call pure unsafe gtk_toolbar_style_get_type #}++-- | Whether the item group should be the only one that is expanded at a given time.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+toolPaletteChildExclusive :: ToolPaletteClass self => Attr self Bool+toolPaletteChildExclusive =+ newAttrFromBoolProperty "exclusive"++-- | Whether the item group should receive extra space when the palette grows. at a given time.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+toolPaletteChildExpand :: ToolPaletteClass self => Attr self Bool+toolPaletteChildExpand =+ newAttrFromBoolProperty "expand"++-- | Set the scroll adjustments for the viewport. Usually scrolled containers like 'ScrolledWindow' will+-- emit this signal to connect two instances of 'Scrollbar' to the scroll directions of the+-- 'Toolpalette'.+--+-- * Available since Gtk+ version 2.20+--+toolPaletteSetScrollAdjustments :: ToolPaletteClass self => Signal self (Adjustment -> Adjustment -> IO ())+toolPaletteSetScrollAdjustments = Signal (connect_OBJECT_OBJECT__NONE "set-scroll-adjustments")+#endif
Graphics/UI/Gtk/MenuComboToolbar/Toolbar.chs view
@@ -27,8 +27,8 @@ -- module Graphics.UI.Gtk.MenuComboToolbar.Toolbar ( -- * Detail--- --- | This widget underwent a signficant overhaul in gtk 2.4 and the+--+-- | This widget underwent a significant overhaul in gtk 2.4 and the -- recommended api changed substantially. The old interface is still supported -- but it is not recommended. --@@ -52,7 +52,7 @@ #ifndef DISABLE_DEPRECATED -- | * The following information applies to the old interface only. ----- 'Button's, 'RadioButton's and 'ToggleButton's can be added by refering to+-- 'Button's, 'RadioButton's and 'ToggleButton's can be added by referring to -- stock images. Their size can be changed by calling 'toolbarSetIconSize'. In -- contrast, normal widget cannot be added. Due to the bad interface of -- "Toolbar" mnemonics of 'RadioButton's and 'ToggleButton's are not honored.@@ -91,6 +91,7 @@ toolbarNew, -- * Methods+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED toolbarInsertNewButton, toolbarAppendNewButton,@@ -107,11 +108,14 @@ #endif toolbarSetOrientation, toolbarGetOrientation,+#endif toolbarSetStyle, toolbarGetStyle, toolbarUnsetStyle,+#if GTK_MAJOR_VERSION < 3 toolbarSetTooltips, toolbarGetTooltips,+#endif IconSize(..), #ifndef DISABLE_DEPRECATED toolbarSetIconSize,@@ -131,13 +135,17 @@ #endif -- * Attributes+#if GTK_MAJOR_VERSION < 3 toolbarOrientation,+#endif #if GTK_CHECK_VERSION(2,4,0) toolbarShowArrow, #endif #if GTK_CHECK_VERSION(2,8,0)+#if GTK_MAJOR_VERSION < 3 toolbarTooltips, #endif+#endif toolbarStyle, -- * Child Attributes@@ -153,28 +161,33 @@ afterPopupContextMenu, ) where -import Control.Monad (liftM)-import Data.Maybe (fromJust)--import System.Glib.FFI+import Control.Monad (liftM)+#if GTK_MAJOR_VERSION < 3+#ifndef DISABLE_DEPRECATED+import Data.Maybe (fromJust)+import qualified Data.Text as T (filter)+import Graphics.UI.Gtk.General.StockItems+import Graphics.UI.Gtk.Display.Image (imageNewFromStock) import System.Glib.UTFString+#endif+#endif+import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.Abstract.ContainerChildProperties-import Graphics.UI.Gtk.General.Enums (Orientation(..), ToolbarStyle(..),- ReliefStyle(..))-import Graphics.UI.Gtk.General.StockItems-import Graphics.UI.Gtk.General.Structs (+import Graphics.UI.Gtk.General.Enums (Orientation(..), ToolbarStyle(..),+ ReliefStyle(..))+import Graphics.UI.Gtk.General.Structs (+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED- toolbarChildToggleButton,- toolbarChildRadioButton,+ toolbarChildToggleButton,+ toolbarChildRadioButton, #endif- IconSize(..))-import Graphics.UI.Gtk.General.StockItems (stockLookupItem, siLabel, stockMissingImage)-import Graphics.UI.Gtk.Display.Image (imageNewFromStock)+#endif+ IconSize(..)) {# context lib="gtk" prefix="gtk" #} @@ -189,17 +202,17 @@ liftM (castPtr :: Ptr Widget -> Ptr Toolbar) $ {# call unsafe toolbar_new #} --- Make tooltips or not? +--------------------+-- Methods+#if GTK_MAJOR_VERSION < 3+#ifndef DISABLE_DEPRECATED+-- Make tooltips or not? ---mkToolText :: Maybe (String,String) -> (CString -> CString -> IO a) -> IO a+mkToolText :: GlibString string => Maybe (string,string) -> (CString -> CString -> IO a) -> IO a mkToolText Nothing fun = fun nullPtr nullPtr-mkToolText (Just (text,private)) fun = withUTFString text $ \txtPtr -> +mkToolText (Just (text,private)) fun = withUTFString text $ \txtPtr -> withUTFString private $ \prvPtr -> fun txtPtr prvPtr ------------------------ Methods--#ifndef DISABLE_DEPRECATED -- | Insert a new 'Button' into the 'Toolbar'. -- -- The new 'Button' is created at position @pos@, counting from 0.@@ -208,24 +221,25 @@ -- which must be a valid entry in the 'Toolbar's Style or the -- default 'IconFactory'. ----- If you whish to have 'Tooltips' added to this button you can+-- If you wish to have 'Tooltips' added to this button you can -- specify @Just (tipText, tipPrivate)@ , otherwise specify @Nothing@. ----- The newly created 'Button' is returned. Use this button to +-- The newly created 'Button' is returned. Use this button to -- add an action function with @\"connectToClicked\"@. -- -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarInsertNewButton :: ToolbarClass self => self+-- Removed in Gtk3.+toolbarInsertNewButton :: (ToolbarClass self, GlibString string) => self -> Int -> StockId- -> Maybe (String,String)+ -> Maybe (string,string) -> IO Button-toolbarInsertNewButton self pos stockId tooltips = +toolbarInsertNewButton self pos stockId tooltips = withUTFString stockId $ \stockPtr -> mkToolText tooltips $ \textPtr privPtr ->- makeNewObject mkButton $ liftM castPtr $ + makeNewObject mkButton $ liftM castPtr $ {# call unsafe toolbar_insert_stock #} (toToolbar self) stockPtr@@ -242,9 +256,10 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarAppendNewButton :: ToolbarClass self => self- -> String- -> Maybe (String, String)+-- Removed in Gtk3.+toolbarAppendNewButton :: (ToolbarClass self, GlibString string) => self+ -> StockId+ -> Maybe (string, string) -> IO Button toolbarAppendNewButton self = toolbarInsertNewButton self (-1) @@ -255,9 +270,10 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarPrependNewButton :: ToolbarClass self => self- -> String- -> Maybe (String, String)+-- Removed in Gtk3.+toolbarPrependNewButton :: (ToolbarClass self, GlibString string) => self+ -> StockId+ -> Maybe (string, string) -> IO Button toolbarPrependNewButton self = toolbarInsertNewButton self 0 @@ -268,23 +284,24 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarInsertNewToggleButton :: ToolbarClass self => self+-- Removed in Gtk3.+toolbarInsertNewToggleButton :: (ToolbarClass self, GlibString string) => self -> Int -> StockId- -> Maybe (String, String)+ -> Maybe (string, string) -> IO ToggleButton toolbarInsertNewToggleButton self pos stockId tooltips = do mItem <- stockLookupItem stockId item <- case mItem of (Just item) -> return item- Nothing -> liftM fromJust $ stockLookupItem stockMissingImage- let label = (filter (/= '_')) $ siLabel item+ Nothing -> liftM fromJust $ stockLookupItem stockMissingImage+ let label = (T.filter (/= '_')) $ siLabel item size <- toolbarGetIconSize (toToolbar self) image <- imageNewFromStock stockId size makeNewObject mkToggleButton $ liftM castPtr $ withUTFString label $ \lblPtr -> mkToolText tooltips $ \textPtr privPtr ->- {#call unsafe toolbar_insert_element#} (toToolbar self) - toolbarChildToggleButton (Widget nullForeignPtr) lblPtr + {#call unsafe toolbar_insert_element#} (toToolbar self)+ toolbarChildToggleButton (Widget nullForeignPtr) lblPtr textPtr privPtr (toWidget image) nullFunPtr nullPtr (fromIntegral pos) -- | Append a new 'ToggleButton' to the 'Toolbar'.@@ -294,9 +311,10 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarAppendNewToggleButton :: ToolbarClass self => self- -> String- -> Maybe (String, String)+-- Removed in Gtk3.+toolbarAppendNewToggleButton :: (ToolbarClass self, GlibString string) => self+ -> StockId+ -> Maybe (string, string) -> IO ToggleButton toolbarAppendNewToggleButton self = toolbarInsertNewToggleButton self (-1) @@ -307,9 +325,10 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarPrependNewToggleButton :: ToolbarClass self => self- -> String- -> Maybe (String, String)+-- Removed in Gtk3.+toolbarPrependNewToggleButton :: (ToolbarClass self, GlibString string) => self+ -> StockId+ -> Maybe (string, string) -> IO ToggleButton toolbarPrependNewToggleButton self = toolbarInsertNewToggleButton self 0 @@ -321,31 +340,32 @@ -- newly-written code. -- -- The @parent@ argument must be set to another--- 'RadioButton' in the group. If @Nothing@ is given, --- a new group is generated (which is the desired behavious for the+-- 'RadioButton' in the group. If @Nothing@ is given,+-- a new group is generated (which is the desired behaviour for the -- first button of a group). -- -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarInsertNewRadioButton :: (ToolbarClass self, RadioButtonClass rb) => self+-- Removed in Gtk3.+toolbarInsertNewRadioButton :: (ToolbarClass self, RadioButtonClass rb, GlibString string) => self -> Int -> StockId- -> Maybe (String,String)+ -> Maybe (string,string) -> Maybe rb -> IO RadioButton toolbarInsertNewRadioButton self pos stockId tooltips rb = do mItem <- stockLookupItem stockId item <- case mItem of (Just item) -> return item- Nothing -> liftM fromJust $ stockLookupItem stockMissingImage- let label = (filter (/= '_')) $ siLabel item+ Nothing -> liftM fromJust $ stockLookupItem stockMissingImage+ let label = (T.filter (/= '_')) $ siLabel item size <- toolbarGetIconSize (toToolbar self) image <- imageNewFromStock stockId size makeNewObject mkRadioButton $ liftM castPtr $ withUTFString label $ \lblPtr -> mkToolText tooltips $ \textPtr privPtr ->- {#call unsafe toolbar_insert_element#} (toToolbar self) - toolbarChildRadioButton (maybe (Widget nullForeignPtr) toWidget rb) + {#call unsafe toolbar_insert_element#} (toToolbar self)+ toolbarChildRadioButton (maybe (Widget nullForeignPtr) toWidget rb) lblPtr textPtr privPtr (toWidget image) nullFunPtr nullPtr (fromIntegral pos) @@ -356,9 +376,10 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarAppendNewRadioButton :: (ToolbarClass self, RadioButtonClass rb) => self- -> String- -> Maybe (String, String)+-- Removed in Gtk3.+toolbarAppendNewRadioButton :: (ToolbarClass self, RadioButtonClass rb, GlibString string) => self+ -> StockId+ -> Maybe (string, string) -> Maybe rb -> IO RadioButton toolbarAppendNewRadioButton self = toolbarInsertNewRadioButton self (-1)@@ -370,9 +391,10 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarPrependNewRadioButton :: (ToolbarClass self, RadioButtonClass rb) => self- -> String- -> Maybe (String, String)+-- Removed in Gtk3.+toolbarPrependNewRadioButton :: (ToolbarClass self, RadioButtonClass rb, GlibString string) => self+ -> StockId+ -> Maybe (string, string) -> Maybe rb -> IO RadioButton toolbarPrependNewRadioButton self = toolbarInsertNewRadioButton self 0@@ -386,12 +408,13 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarInsertNewWidget :: (ToolbarClass self, WidgetClass w) => self+-- Removed in Gtk3.+toolbarInsertNewWidget :: (ToolbarClass self, WidgetClass w, GlibString string) => self -> Int -> w- -> Maybe (String,String)+ -> Maybe (string,string) -> IO ()-toolbarInsertNewWidget self pos w tooltips = +toolbarInsertNewWidget self pos w tooltips = mkToolText tooltips $ \textPtr privPtr -> {# call unsafe toolbar_insert_widget #} (toToolbar self)@@ -407,9 +430,10 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarAppendNewWidget :: (ToolbarClass self, WidgetClass w) => self+-- Removed in Gtk3.+toolbarAppendNewWidget :: (ToolbarClass self, WidgetClass w, GlibString string) => self -> w- -> Maybe (String, String)+ -> Maybe (string, string) -> IO () toolbarAppendNewWidget self = toolbarInsertNewWidget self (-1) @@ -420,15 +444,17 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. ---toolbarPrependNewWidget :: (ToolbarClass self, WidgetClass w) => self- -> w - -> Maybe (String, String)+-- Removed in Gtk3.+toolbarPrependNewWidget :: (ToolbarClass self, WidgetClass w, GlibString string) => self+ -> w+ -> Maybe (string, string) -> IO () toolbarPrependNewWidget self = toolbarInsertNewWidget self 0 #endif -- | Sets whether a toolbar should appear horizontally or vertically. --+-- Removed in Gtk3. toolbarSetOrientation :: ToolbarClass self => self -> Orientation -> IO () toolbarSetOrientation self orientation = {# call toolbar_set_orientation #}@@ -438,12 +464,13 @@ -- | Retrieves the current orientation of the toolbar. See -- 'toolbarSetOrientation'. --+-- Removed in Gtk3. toolbarGetOrientation :: ToolbarClass self => self -> IO Orientation toolbarGetOrientation self = liftM (toEnum . fromIntegral) $ {# call unsafe toolbar_get_orientation #} (toToolbar self)-+#endif -- | Alters the view of the toolbar to display either icons only, text only, or -- both. --@@ -470,8 +497,10 @@ {# call toolbar_unset_style #} (toToolbar self) +#if GTK_MAJOR_VERSION < 3 -- | Sets if the tooltips of a toolbar should be active or not. --+-- Removed in Gtk3. toolbarSetTooltips :: ToolbarClass self => self -> Bool -- ^ @enable@ - set to @False@ to disable the tooltips, or @True@ to -- enable them.@@ -483,11 +512,13 @@ -- | Retrieves whether tooltips are enabled. See 'toolbarSetTooltips'. --+-- Removed in Gtk3. toolbarGetTooltips :: ToolbarClass self => self -> IO Bool toolbarGetTooltips self = liftM toBool $ {# call unsafe toolbar_get_tooltips #} (toToolbar self)+#endif #ifndef DISABLE_DEPRECATED -- | This function sets the size of stock icons in the toolbar. You can call@@ -647,14 +678,17 @@ -------------------- -- Attributes +#if GTK_MAJOR_VERSION < 3 -- | The orientation of the toolbar. -- -- Default value: 'OrientationHorizontal' --+-- Removed in Gtk3. toolbarOrientation :: ToolbarClass self => Attr self Orientation toolbarOrientation = newAttr toolbarGetOrientation toolbarSetOrientation+#endif -- | How to draw the toolbar. --@@ -675,14 +709,18 @@ toolbarSetShowArrow #endif ++#if GTK_MAJOR_VERSION < 3 -- | If the tooltips of the toolbar should be active or not. -- -- Default value: @True@ --+-- Removed in Gtk3. toolbarTooltips :: ToolbarClass self => Attr self Bool toolbarTooltips = newAttr toolbarGetTooltips toolbarSetTooltips+#endif -------------------- -- Child Attributes@@ -726,7 +764,7 @@ -- Application developers should handle this signal if they want to display -- a context menu on the toolbar. The context-menu should appear at the -- coordinates given by @x@ and @y@. The mouse button number is given by the--- @button@ parameter. If the menu was popped up using the keybaord, @button@+-- @button@ parameter. If the menu was popped up using the keyboard, @button@ -- is -1. -- onPopupContextMenu, afterPopupContextMenu :: ToolbarClass self => self
+ Graphics/UI/Gtk/Misc/Accessible.chs view
@@ -0,0 +1,89 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget accessible+--+-- Author : Andy Stewart+--+-- Created: 23 Oct 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A 'Object' representing an adjustable bounded value+--+module Graphics.UI.Gtk.Misc.Accessible (+-- * Detail+--+-- | Accessible accessibility support for widgets.+--++-- * Class Hierarchy+-- |+-- @+-- | 'GObject'+-- | +----'AtkObject'+-- | +----Accessible+-- @++#if GTK_CHECK_VERSION(2,22,0)+-- * Types+ Accessible,+ AccessibleClass,+ castToAccessible, gTypeAccessible,+ toAccessible,++-- * Methods+ accessibleGetWidget,+ accessibleSetWidget+#endif+) where++#if GTK_CHECK_VERSION(2,22,0)++import System.Glib.FFI+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Methods++-- | Gets the 'Widget' corresponding to the 'Accessible'.+--+-- * Available since Gtk+ version 2.22+--+accessibleGetWidget :: AccessibleClass self => self+ -> IO (Maybe Widget) -- ^ returns the 'Widget' corresponding to the 'Accessible', or 'Nothing'.+accessibleGetWidget self =+ maybeNull (makeNewObject mkWidget) $+ {# call accessible_get_widget #}+ (toAccessible self)++-- | Sets the 'Widget' corresponding to the 'Accessible'.+--+-- * Available since Gtk+ version 2.22+--+accessibleSetWidget :: (AccessibleClass self, WidgetClass widget)+ => self -- ^ @accessible@ a 'Accessible'+ -> widget -- ^ @widget@ a 'Widget'+ -> IO ()+accessibleSetWidget self widget =+ {#call accessible_set_widget #}+ (toAccessible self)+ (toWidget widget)+#endif
Graphics/UI/Gtk/Misc/Adjustment.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Misc.Adjustment ( -- * Detail--- +-- -- | The 'Adjustment' object represents a value which has an associated lower -- and upper bound, together with step and page increments, and a page size. It -- is used within several Gtk+ widgets, including 'SpinButton', 'Viewport', and@@ -93,12 +93,12 @@ afterValueChanged, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -116,7 +116,7 @@ -- @pageSize@ is needed to determine if the end of the slider is still in the -- range. ---adjustmentNew :: +adjustmentNew :: Double -- ^ @value@ - the initial value. -> Double -- ^ @lower@ - the minimum value. -> Double -- ^ @upper@ - the maximum value.@@ -199,7 +199,7 @@ self -- | Updates the 'Adjustment' @value@ to ensure that the range between @lower@--- and @upper@ is in the current page (i.e. between @value@ and @value + +-- and @upper@ is in the current page (i.e. between @value@ and @value + -- pageSize@). If the range is larger than the page size, then only the start -- of it will be in the current page. A \"changed\" signal will be emitted if -- the value is changed.
Graphics/UI/Gtk/Misc/Arrow.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Arrow --@@ -26,14 +27,14 @@ -- module Graphics.UI.Gtk.Misc.Arrow ( -- * Detail--- +-- -- | 'Arrow' should be used to draw simple arrows that need to point in one of -- the four cardinal directions (up, down, left, or right). The style of the -- arrow can be one of shadow in, shadow out, etched in, or etched out. Note--- that these directions and style types may be ammended in versions of Gtk to+-- that these directions and style types may be amended in versions of Gtk to -- come. ----- 'Arrow' will fill any space alloted to it, but since it is inherited from+-- 'Arrow' will fill any space allotted to it, but since it is inherited from -- 'Misc', it can be padded and\/or aligned, to fill exactly the space the -- programmer desires. --@@ -69,14 +70,14 @@ arrowShadowType, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (ArrowType(..), ShadowType(..))+import Graphics.UI.Gtk.General.Enums (ArrowType(..), ShadowType(..)) {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/Misc/Calendar.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Misc.Calendar ( -- * Detail--- +-- -- | 'Calendar' is a widget that displays a calendar, one month at a time. It -- can be created with 'calendarNew'. --@@ -70,17 +70,21 @@ calendarMarkDay, calendarUnmarkDay, calendarClearMarks,+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED calendarDisplayOptions, #endif+#endif #if GTK_CHECK_VERSION(2,4,0) calendarSetDisplayOptions, calendarGetDisplayOptions, #endif calendarGetDate,+#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED calendarFreeze, #endif+#endif -- * Attributes calendarYear,@@ -111,16 +115,16 @@ afterPrevYear, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Flags (fromFlags, toFlags)+import System.Glib.Flags (fromFlags, toFlags) import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Enums (CalendarDisplayOptions(..))+import Graphics.UI.Gtk.General.Enums (CalendarDisplayOptions(..)) {# context lib="gtk" prefix="gtk" #} @@ -143,9 +147,9 @@ calendarSelectMonth :: CalendarClass self => self -> Int -- ^ @month@ - a month number between 0 and 11. -> Int -- ^ @year@ - the year the month is in.- -> IO Bool -- ^ returns @True@, always+ -> IO () calendarSelectMonth self month year =- liftM toBool $+ liftM (const ()) $ {# call calendar_select_month #} (toCalendar self) (fromIntegral month)@@ -166,9 +170,9 @@ -- calendarMarkDay :: CalendarClass self => self -> Int -- ^ @day@ - the day number to mark between 1 and 31.- -> IO Bool -- ^ returns @True@, always+ -> IO () calendarMarkDay self day =- liftM toBool $+ liftM (const ()) $ {# call calendar_mark_day #} (toCalendar self) (fromIntegral day)@@ -177,9 +181,9 @@ -- calendarUnmarkDay :: CalendarClass self => self -> Int -- ^ @day@ - the day number to unmark between 1 and 31.- -> IO Bool -- ^ returns @True@, always+ -> IO () calendarUnmarkDay self day =- liftM toBool $+ liftM (const ()) $ {# call calendar_unmark_day #} (toCalendar self) (fromIntegral day)@@ -217,6 +221,7 @@ (toCalendar self) #endif +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- | Sets display options (whether to display the heading and the month -- headings).@@ -224,6 +229,7 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. Use 'calendarSetDisplayOptions' instead. --+-- Removed in Gtk3. calendarDisplayOptions :: CalendarClass self => self -> [CalendarDisplayOptions] -> IO () calendarDisplayOptions self flags =@@ -231,6 +237,7 @@ (toCalendar self) ((fromIntegral . fromFlags) flags) #endif+#endif -- | Retrieve the currently selected date. --@@ -250,6 +257,7 @@ day <- liftM fromIntegral $ peek dayPtr return (year,month,day) +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED -- | Does nothing. Previously locked the display of the calendar for several -- update operations.@@ -257,6 +265,7 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. --+-- Removed in Gtk3. calendarFreeze :: CalendarClass self => self -> IO a -- ^ An action that performs several update operations on the -- calendar. After the action finnishes all the changes made by it@@ -268,6 +277,7 @@ {# call calendar_thaw #} (toCalendar self) return res #endif+#endif -------------------- -- Attributes@@ -354,9 +364,9 @@ onDaySelectedDoubleClick, afterDaySelectedDoubleClick :: CalendarClass self => self -> IO () -> IO (ConnectId self)-onDaySelectedDoubleClick = +onDaySelectedDoubleClick = connect_NONE__NONE "day-selected-double-click" False-afterDaySelectedDoubleClick = +afterDaySelectedDoubleClick = connect_NONE__NONE "day-selected-double-click" True -- | The month changed.
Graphics/UI/Gtk/Misc/DrawingArea.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget DrawingArea --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Misc.DrawingArea ( -- * Detail--- +-- -- | The 'DrawingArea' widget is used for creating custom user interface -- elements. It's essentially a blank widget; you can draw on -- the 'Drawable' returned by 'drawingAreaGetDrawWindow'.@@ -79,18 +80,20 @@ drawingAreaNew, -- * Methods+#if GTK_MAJOR_VERSION < 3 drawingAreaGetDrawWindow, drawingAreaGetSize+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Structs (widgetGetDrawWindow, widgetGetSize)--- to make haddock happy:-import Graphics.UI.Gtk.Abstract.Widget+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.General.Structs (widgetGetDrawWindow, widgetGetSize)+#endif {# context lib="gtk" prefix="gtk" #} @@ -105,14 +108,18 @@ liftM (castPtr :: Ptr Widget -> Ptr DrawingArea) $ {# call unsafe drawing_area_new #} +#if GTK_MAJOR_VERSION < 3 -- | See 'widgetGetDrawWindow' --+-- Removed in Gtk3. drawingAreaGetDrawWindow :: DrawingArea -> IO DrawWindow drawingAreaGetDrawWindow = widgetGetDrawWindow {-# DEPRECATED drawingAreaGetDrawWindow "use widgetGetDrawWindow instead" #-} -- | See 'widgetGetSize' --+-- Removed in Gtk3. drawingAreaGetSize :: DrawingArea -> IO (Int, Int) drawingAreaGetSize = widgetGetSize {-# DEPRECATED drawingAreaGetSize "use widgetGetSize instead" #-}+#endif
Graphics/UI/Gtk/Misc/EventBox.chs view
@@ -28,7 +28,7 @@ -- module Graphics.UI.Gtk.Misc.EventBox ( -- * Detail--- +-- -- | The 'EventBox' widget is a subclass of 'Bin' which also has its own -- window. It is useful since it allows you to catch events for widgets which -- do not have their own window.@@ -66,11 +66,11 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/Misc/HandleBox.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget HandleBox --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Misc.HandleBox ( -- * Detail--- +-- -- | The 'HandleBox' widget allows a portion of a window to be \"torn off\". -- It is a bin widget which displays its child and a handle that the user can -- drag to tear off a separate window (the float window) containing the child@@ -36,12 +37,12 @@ -- -- When reattaching, the ghost and float window, must be aligned along one -- of the edges, the snap edge. This either can be specified by the application--- programmer explicitely, or Gtk+ will pick a reasonable default based on the+-- programmer explicitly, or Gtk+ will pick a reasonable default based on the -- handle position. -- -- To make detaching and reattaching the handlebox as minimally confusing as -- possible to the user, it is important to set the snap edge so that the snap--- edge does not move when the handlebox is deattached. For instance, if the+-- edge does not move when the handlebox is detached. For instance, if the -- handlebox is packed at the bottom of a VBox, then when the handlebox is -- detached, the bottom edge of the handlebox's allocation will remain fixed as -- the height of the handlebox shrinks, so the snap edge should be set to@@ -90,15 +91,15 @@ afterChildDetached, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Enums (ShadowType(..), PositionType(..))+import Graphics.UI.Gtk.General.Enums (ShadowType(..), PositionType(..)) {# context lib="gtk" prefix="gtk" #} @@ -226,7 +227,7 @@ -------------------- -- Signals --- Note: for these two signales we ignore the given Widget in the handler.+-- Note: for these two signals we ignore the given Widget in the handler. -- | This signal is emitted when the contents of the handlebox are reattached -- to the main window.
+ Graphics/UI/Gtk/Misc/IMContextSimple.chs view
@@ -0,0 +1,99 @@+{-# LANGUAGE CPP, ScopedTypeVariables #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget IMContextSimple+--+-- Author : Andy Stewart+--+-- Created: 24 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- An input method context supporting table-based input methods+--+module Graphics.UI.Gtk.Misc.IMContextSimple (++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'IMContext'+-- | +----IMContextSimple+-- @++-- * Types+ IMContextSimple,+ IMContextSimpleClass,+ castToIMContextSimple,+ toIMContextSimple,++-- * Constructors+ imContextSimpleNew,++-- * Methods+ imContextSimpleAddTable,+ ) where++import Control.Monad (liftM)+import Data.Map (Map)++import System.Glib.FFI+import System.Glib.UTFString+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++import qualified Data.Map as M++--------------------+-- Constructors++-- | Creates a new 'IMContextSimple'.+--+imContextSimpleNew :: IO IMContextSimple+imContextSimpleNew =+ wrapNewGObject mkIMContextSimple $+ liftM castPtr {# call gtk_im_context_simple_new #}++--------------------+-- Methods++-- | Adds an additional table to search to the input context. Each row of the table consists of+-- @maxSeqLen@ key symbols followed by two 'Int' interpreted as the high and low words of a gunicode+-- value. Tables are searched starting from the last added.+--+-- The table must be sorted in dictionary order on the numeric value of the key symbol fields. (Values+-- beyond the length of the sequence should be zero.)+--+imContextSimpleAddTable :: (IMContextSimpleClass self, GlibString string) => self+ -> Map string string -- ^ @data@ - the table+ -> Int -- ^ @maxSeqLen@ - Maximum length of a sequence in the table+ -- (cannot be greater than 'MaxComposeLen')+ -> Int -- ^ @nSeqs@ - number of sequences in the table+ -> IO ()+imContextSimpleAddTable self table maxSeqLen nSeqs = do+ tableList <- mapM (\(x,y) -> do+ nx <- newUTFString x+ ny <- newUTFString y+ return (nx, ny)) (M.toList table)+ withArray (concatMap (\(x,y) -> [x, y]) tableList) $ \(tablePtr :: Ptr CString) ->+ {# call gtk_im_context_simple_add_table #}+ (toIMContextSimple self)+ (castPtr tablePtr)+ (fromIntegral maxSeqLen)+ (fromIntegral nSeqs)
Graphics/UI/Gtk/Misc/IMMulticontext.chs view
@@ -49,8 +49,6 @@ imMulticontextAppendMenuitems, ) where -import Control.Monad (liftM)- import System.Glib.FFI {#import Graphics.UI.Gtk.Types#} @@ -63,7 +61,7 @@ -- imMulticontextNew :: IO IMContext imMulticontextNew =- constructNewGObject mkIMContext $+ wrapNewGObject mkIMContext $ {# call im_multicontext_new #} --------------------
Graphics/UI/Gtk/Misc/SizeGroup.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Misc.SizeGroup ( -- * Detail--- +-- -- | 'SizeGroup' provides a mechanism for grouping a number of widgets -- together so they all request the same amount of space. This is typically -- useful when you want a column of widgets to have the same size, but you@@ -87,11 +87,10 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes-import System.Glib.GObject (constructNewGObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -103,11 +102,11 @@ -- | Create a new 'SizeGroup'. ---sizeGroupNew :: +sizeGroupNew :: SizeGroupMode -- ^ @mode@ - the mode for the new size group. -> IO SizeGroup sizeGroupNew mode =- constructNewGObject mkSizeGroup $+ wrapNewGObject mkSizeGroup $ {# call unsafe size_group_new #} ((fromIntegral . fromEnum) mode)
Graphics/UI/Gtk/Misc/Tooltip.chs view
@@ -34,8 +34,8 @@ -- | 'Tooltip' belongs to the new tooltips API that was introduced in Gtk+ -- 2.12 and which deprecates the old 'Tooltips' API. ----- Basic tooltips can be realized simply by using 'widgetSetTooltipText' or--- 'widgetSetTooltipMarkup' without any explicit tooltip object.+-- Basic tooltips can be realized simply by using 'widgetTooltipText' or+-- 'widgetTooltipMarkup' without any explicit tooltip object. -- -- When you need a tooltip with a little more fancy contents, like adding an -- image, or you want the tooltip to have different contents per 'TreeView' row@@ -43,24 +43,24 @@ -- -- * Set the 'hasTooltip' property to 'True', this will make GTK+ monitor the widget for motion and -- related events which are needed to determine when and where to show a tooltip.--- +-- -- * Connect to the 'queryTooltip' signal. This signal will be emitted when a tooltip is supposed to -- be shown. One of the arguments passed to the signal handler is a 'Tooltip' object. This is the -- object that we are about to display as a tooltip, and can be manipulated in your callback using -- functions like 'tooltipSetIcon'. There are functions for setting the tooltip's markup, -- setting an image from a stock icon, or even putting in a custom widget.--- +-- -- * Return 'True' from your query-tooltip handler. This causes the tooltip to be show. If you return -- 'False', it will not be shown.--- +-- -- In the probably rare case where you want to have even more control over the tooltip that is about to -- be shown, you can set your own 'Window' which will be used as tooltip window. This works as -- follows:--- +-- -- * Set 'hasTooltip' and connect to 'queryTooltip' as before.--- +-- -- * Use 'widgetSetTooltipWindow' to set a 'Window' created by you as tooltip window.--- +-- -- * In the 'queryTooltip' callback you can access your window using 'widgetGetTooltipWindow' -- and manipulate as you wish. The semantics of the return value are exactly as before, return 'True' -- to show the window, 'False' to not show it.@@ -91,30 +91,36 @@ tooltipSetCustom, tooltipTriggerTooltipQuery, tooltipSetTipArea,+#ifdef HAVE_GIO+#if GTK_CHECK_VERSION(2,20,0)+ tooltipSetIconFromGIcon, #endif+#endif+#endif ) where -import Control.Monad (liftM)+#if GTK_CHECK_VERSION(2,12,0)+ import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.UTFString-import System.Glib.GObject (constructNewGObject,makeNewGObject)-import Graphics.UI.Gtk.General.Structs (IconSize(..), Rectangle)-import Graphics.Rendering.Pango.Markup+import Graphics.UI.Gtk.General.Structs (IconSize(..), Rectangle) {#import Graphics.UI.Gtk.Types#}+#ifdef HAVE_GIO+{#import System.GIO.Types#}+#endif {# context lib="gtk" prefix="gtk" #} -#if GTK_CHECK_VERSION(2,12,0) -------------------- -- Methods -- | Sets the text of the tooltip to be @markup@, which is marked up with the -- Pango text markup language. If @markup@ is 'Nothing', the label will be hidden. ---tooltipSetMarkup :: TooltipClass self => self- -> Maybe Markup -- ^ @markup@ - a markup string (see Pango markup format) or 'Nothing'+tooltipSetMarkup :: (TooltipClass self, GlibString markup) => self+ -> Maybe markup -- ^ @markup@ - a markup string (see Pango markup format) or 'Nothing' -> IO () tooltipSetMarkup self markup = maybeWith withUTFString markup $ \markupPtr ->@@ -125,8 +131,8 @@ -- | Sets the text of the tooltip to be @text@. If @text@ is 'Nothing' -- the label will be hidden. See also 'tooltipSetMarkup'. ---tooltipSetText :: TooltipClass self => self- -> Maybe String -- ^ @text@ - a text string or 'Nothing'+tooltipSetText :: (TooltipClass self, GlibString string) => self+ -> Maybe string -- ^ @text@ - a text string or 'Nothing' -> IO () tooltipSetText self text = maybeWith withUTFString text $ \textPtr ->@@ -149,12 +155,12 @@ -- stock item indicated by @stockId@ with the size indicated by @size@. If -- @stockId@ is 'Nothing' the image will be hidden. ---tooltipSetIconFromStock :: TooltipClass self => self- -> Maybe String -- ^ @id@ a stock id, or 'Nothing' - -> IconSize -- ^ @size@ a stock icon size +tooltipSetIconFromStock :: (TooltipClass self, GlibString string) => self+ -> Maybe string -- ^ @id@ a stock id, or 'Nothing'+ -> IconSize -- ^ @size@ a stock icon size -> IO () tooltipSetIconFromStock self id size =- maybeWith withUTFString id $ \ idPtr -> + maybeWith withUTFString id $ \ idPtr -> {#call tooltip_set_icon_from_stock#} (toTooltip self) idPtr@@ -167,12 +173,12 @@ -- -- * Available since Gtk+ version 2.14 ---tooltipSetIconFromIconName :: TooltipClass self => self- -> Maybe String -- ^ @iconName@ an icon name, or 'Nothing' - -> IconSize -- ^ @size@ a stock icon size +tooltipSetIconFromIconName :: (TooltipClass self, GlibString string) => self+ -> Maybe string -- ^ @iconName@ an icon name, or 'Nothing'+ -> IconSize -- ^ @size@ a stock icon size -> IO () tooltipSetIconFromIconName self iconName size =- maybeWith withUTFString iconName $ \ iconPtr -> + maybeWith withUTFString iconName $ \ iconPtr -> {#call tooltip_set_icon_from_icon_name#} (toTooltip self) iconPtr@@ -184,11 +190,11 @@ -- a box with a 'Image' and 'Label' is embedded in the tooltip, which can be -- configured using 'tooltipSetMarkup' and 'tooltipSetIcon'. ---tooltipSetCustom :: (TooltipClass self, WidgetClass widget) => self - -> Maybe widget -- ^ @customWidget@ a 'Widget', or 'Nothing' to unset the old custom widget. +tooltipSetCustom :: (TooltipClass self, WidgetClass widget) => self+ -> Maybe widget -- ^ @customWidget@ a 'Widget', or 'Nothing' to unset the old custom widget. -> IO () tooltipSetCustom self customWidget =- {#call tooltip_set_custom#} + {#call tooltip_set_custom#} (toTooltip self) (maybe (Widget nullForeignPtr) toWidget customWidget) @@ -213,8 +219,24 @@ -- tooltipSetTipArea :: TooltipClass self => self -> Rectangle -> IO () tooltipSetTipArea self rect =- with rect $ \ rectPtr -> + with rect $ \ rectPtr -> {#call tooltip_set_tip_area#} (toTooltip self) (castPtr rectPtr)+#endif++#ifdef HAVE_GIO+#if GTK_CHECK_VERSION(2,20,0)+-- | Sets the icon of the tooltip (which is in front of the text) to be the icon indicated by gicon with+-- the size indicated by size. If gicon is 'Nothing', the image will be hidden.+tooltipSetIconFromGIcon :: TooltipClass self => self+ -> Maybe Icon -- ^ @gicon@ a GIcon representing the icon, or 'Nothing'. allow-none.+ -> IconSize+ -> IO ()+tooltipSetIconFromGIcon tooltip icon size =+ {#call gtk_tooltip_set_icon_from_gicon #}+ (toTooltip tooltip)+ (fromMaybe (Icon nullForeignPtr) icon)+ ((fromIntegral . fromEnum) size)+#endif #endif
Graphics/UI/Gtk/Misc/Tooltips.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Misc.Tooltips ( -- * Detail--- +-- -- | Tooltips are the messages that appear next to a widget when the mouse -- pointer is held over it for a short amount of time. They are especially -- helpful for adding more verbose descriptions of things such as buttons in a@@ -53,6 +53,8 @@ -- -- Information about the tooltip (if any) associated with an arbitrary -- widget can be retrieved using 'tooltipsDataGet'.+--+-- * This module is deprecated. It is empty in Gtk3. -- * Class Hierarchy -- |@@ -61,7 +63,7 @@ -- | +----'Object' -- | +----Tooltips -- @-+#if GTK_MAJOR_VERSION < 3 -- * Types Tooltips, TooltipsClass,@@ -79,8 +81,10 @@ #endif tooltipsSetTip, tooltipsDataGet+#endif ) where +#if GTK_MAJOR_VERSION < 3 import System.Glib.FFI import System.Glib.UTFString import Graphics.UI.Gtk.Abstract.Object (makeNewObject)@@ -91,7 +95,7 @@ -------------------- -- Constructors --- | Create a new goup of 'Tooltips'.+-- | Create a new group of 'Tooltips'. -- tooltipsNew :: IO Tooltips tooltipsNew =@@ -136,10 +140,10 @@ -- | Adds a tooltip containing the message @tipText@ to the specified -- 'Widget'. ---tooltipsSetTip :: (TooltipsClass self, WidgetClass widget) => self+tooltipsSetTip :: (TooltipsClass self, WidgetClass widget, GlibString string) => self -> widget -- ^ @widget@ - the 'Widget' you wish to associate the tip with.- -> String -- ^ @tipText@ - a string containing the tip itself.- -> String -- ^ @tipPrivate@ - a string of any further information that may be+ -> string -- ^ @tipText@ - a string containing the tip itself.+ -> string -- ^ @tipPrivate@ - a string of any further information that may be -- useful if the user gets stuck. -> IO () tooltipsSetTip self widget tipText tipPrivate =@@ -151,11 +155,9 @@ tipTextPtr tipPrivatePtr -{#pointer * TooltipsData#}- -- | Retrieves any 'Tooltips' previously associated with the given widget. ---tooltipsDataGet :: WidgetClass w => w -> IO (Maybe (Tooltips, String, String))+tooltipsDataGet :: (WidgetClass w, GlibString string) => w -> IO (Maybe (Tooltips, string, string)) tooltipsDataGet w = do tipDataPtr <- {#call unsafe tooltips_data_get#} (toWidget w) if tipDataPtr == nullPtr@@ -167,4 +169,4 @@ tipPrivate <- {#get TooltipsData->tip_private#} tipDataPtr >>= peekUTFString return $ Just $ (tooltips, tipText, tipPrivate)-+#endif
Graphics/UI/Gtk/Misc/Viewport.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Viewport --@@ -53,6 +54,7 @@ -- * Types Viewport, ViewportClass,+ ShadowType(..), castToViewport, gTypeViewport, toViewport, @@ -64,9 +66,14 @@ viewportGetVAdjustment, viewportSetHAdjustment, viewportSetVAdjustment,- ShadowType(..), viewportSetShadowType, viewportGetShadowType,+#if GTK_CHECK_VERSION(2,20,0)+ viewportGetBinWindow,+#endif+#if GTK_CHECK_VERSION(2,22,0)+ viewportGetViewWindow,+#endif -- * Attributes viewportHAdjustment,@@ -74,13 +81,14 @@ viewportShadowType, ) where -import Control.Monad (liftM)+import Control.Monad (liftM)+import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (ShadowType(..))+import Graphics.UI.Gtk.General.Enums (ShadowType(..)) {# context lib="gtk" prefix="gtk" #} @@ -89,16 +97,16 @@ -- | Creates a new 'Viewport' with the given adjustments. ---viewportNew :: - Adjustment -- ^ @hadjustment@ - horizontal adjustment.- -> Adjustment -- ^ @vadjustment@ - vertical adjustment.+viewportNew ::+ Maybe Adjustment -- ^ @hadjustment@ - horizontal adjustment.+ -> Maybe Adjustment -- ^ @vadjustment@ - vertical adjustment. -> IO Viewport viewportNew hadjustment vadjustment = makeNewObject mkViewport $ liftM (castPtr :: Ptr Widget -> Ptr Viewport) $ {# call unsafe viewport_new #}- hadjustment- vadjustment+ (fromMaybe (Adjustment nullForeignPtr) hadjustment)+ (fromMaybe (Adjustment nullForeignPtr) vadjustment) -------------------- -- Methods@@ -153,6 +161,30 @@ liftM (toEnum . fromIntegral) $ {# call unsafe viewport_get_shadow_type #} (toViewport self)++#if GTK_CHECK_VERSION(2,20,0)+-- | Gets the bin window of the 'Viewport'.+--+-- * Available since Gtk version 2.20+--+viewportGetBinWindow :: ViewportClass self => self -> IO DrawWindow+viewportGetBinWindow self =+ makeNewGObject mkDrawWindow $+ {#call gtk_viewport_get_bin_window #}+ (toViewport self)+#endif++#if GTK_CHECK_VERSION(2,22,0)+-- | Gets the view window of the 'Viewport'.+--+-- * Available since Gtk+ version 2.22+--+viewportGetViewWindow :: ViewportClass self => self -> IO DrawWindow+viewportGetViewWindow self =+ makeNewGObject mkDrawWindow $+ {#call gtk_viewport_get_view_window #}+ (toViewport self)+#endif -------------------- -- Attributes
+ Graphics/UI/Gtk/ModelView.chs view
@@ -0,0 +1,85 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) New model-based tree/list widget system+--+-- Author : Duncan Coutts+--+-- Created: 9 December 2006+--+-- Copyright (C) 2006 Duncan Coutts+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- New model-based tree\/list widget system.+--+-- This just re-exports the Graphics.UI.Gtk.ModelView.* modules.+--+-- * Note: From this version of Gtk2Hs this system will be the default+-- so it will not be necessary to explicitly import this module.+--+module Graphics.UI.Gtk.ModelView (+ module Graphics.UI.Gtk.ModelView.CellLayout,+ module Graphics.UI.Gtk.ModelView.CellRenderer,+ module Graphics.UI.Gtk.ModelView.CellRendererCombo,+ module Graphics.UI.Gtk.ModelView.CellRendererPixbuf,+ module Graphics.UI.Gtk.ModelView.CellRendererProgress,+ module Graphics.UI.Gtk.ModelView.CellRendererText,+ module Graphics.UI.Gtk.ModelView.CellRendererToggle,+ module Graphics.UI.Gtk.ModelView.CellView,+ module Graphics.UI.Gtk.MenuComboToolbar.ComboBox,+#if GTK_MAJOR_VERSION < 3+ module Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry,+#endif+ module Graphics.UI.Gtk.ModelView.CustomStore,+ module Graphics.UI.Gtk.Entry.EntryCompletion,+ module Graphics.UI.Gtk.ModelView.IconView,+ module Graphics.UI.Gtk.ModelView.ListStore,+ module Graphics.UI.Gtk.ModelView.TreeDrag,+ module Graphics.UI.Gtk.ModelView.TreeModel,+ module Graphics.UI.Gtk.ModelView.TreeModelSort,+ module Graphics.UI.Gtk.ModelView.TreeSortable,+ module Graphics.UI.Gtk.ModelView.TreeRowReference,+ module Graphics.UI.Gtk.ModelView.TreeSelection,+ module Graphics.UI.Gtk.ModelView.TreeStore,+ module Graphics.UI.Gtk.ModelView.TreeView,+ module Graphics.UI.Gtk.ModelView.TreeViewColumn+ ) where++import Graphics.UI.Gtk.ModelView.CellLayout+import Graphics.UI.Gtk.ModelView.CellRenderer+import Graphics.UI.Gtk.ModelView.CellRendererCombo+import Graphics.UI.Gtk.ModelView.CellRendererPixbuf+import Graphics.UI.Gtk.ModelView.CellRendererProgress+import Graphics.UI.Gtk.ModelView.CellRendererText+import Graphics.UI.Gtk.ModelView.CellRendererToggle+import Graphics.UI.Gtk.ModelView.CellView+import Graphics.UI.Gtk.MenuComboToolbar.ComboBox -- these moved back to MenuComboToolbar+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry+#endif+import Graphics.UI.Gtk.ModelView.CustomStore+import Graphics.UI.Gtk.Entry.EntryCompletion -- this moved back to Entry+import Graphics.UI.Gtk.ModelView.IconView+import Graphics.UI.Gtk.ModelView.ListStore+import Graphics.UI.Gtk.ModelView.TreeDrag+import Graphics.UI.Gtk.ModelView.TreeModel+import Graphics.UI.Gtk.ModelView.TreeModelSort+import Graphics.UI.Gtk.ModelView.TreeSortable+import Graphics.UI.Gtk.ModelView.TreeRowReference+import Graphics.UI.Gtk.ModelView.TreeSelection+import Graphics.UI.Gtk.ModelView.TreeStore+import Graphics.UI.Gtk.ModelView.TreeView+import Graphics.UI.Gtk.ModelView.TreeViewColumn
− Graphics/UI/Gtk/ModelView.hs
@@ -1,80 +0,0 @@--- -*-haskell-*---- GIMP Toolkit (GTK) New model-based tree/list widget system------ Author : Duncan Coutts------ Created: 9 December 2006------ Copyright (C) 2006 Duncan Coutts------ This library is free software; you can redistribute it and/or--- modify it under the terms of the GNU Lesser General Public--- License as published by the Free Software Foundation; either--- version 2.1 of the License, or (at your option) any later version.------ This library is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU--- Lesser General Public License for more details.------ |--- Maintainer : gtk2hs-users@lists.sourceforge.net--- Stability : provisional--- Portability : portable (depends on GHC)------ New model-based tree\/list widget system.--- --- This just re-exports the Graphics.UI.Gtk.ModelView.* modules.------ * Note: From this version of Gtk2Hs this system will be the default--- so it will not be necessary to explicitly import this module.----module Graphics.UI.Gtk.ModelView (- module Graphics.UI.Gtk.ModelView.CellLayout,- module Graphics.UI.Gtk.ModelView.CellRenderer,- module Graphics.UI.Gtk.ModelView.CellRendererCombo,- module Graphics.UI.Gtk.ModelView.CellRendererPixbuf,- module Graphics.UI.Gtk.ModelView.CellRendererProgress,- module Graphics.UI.Gtk.ModelView.CellRendererText,- module Graphics.UI.Gtk.ModelView.CellRendererToggle,- module Graphics.UI.Gtk.ModelView.CellView,- module Graphics.UI.Gtk.MenuComboToolbar.ComboBox,- module Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry,- module Graphics.UI.Gtk.ModelView.CustomStore,- module Graphics.UI.Gtk.Entry.EntryCompletion,- module Graphics.UI.Gtk.ModelView.IconView,- module Graphics.UI.Gtk.ModelView.ListStore,- module Graphics.UI.Gtk.ModelView.TreeDrag,- module Graphics.UI.Gtk.ModelView.TreeModel,- module Graphics.UI.Gtk.ModelView.TreeModelSort,- module Graphics.UI.Gtk.ModelView.TreeSortable,- module Graphics.UI.Gtk.ModelView.TreeRowReference,- module Graphics.UI.Gtk.ModelView.TreeSelection,- module Graphics.UI.Gtk.ModelView.TreeStore,- module Graphics.UI.Gtk.ModelView.TreeView,- module Graphics.UI.Gtk.ModelView.TreeViewColumn- ) where--import Graphics.UI.Gtk.ModelView.CellLayout-import Graphics.UI.Gtk.ModelView.CellRenderer-import Graphics.UI.Gtk.ModelView.CellRendererCombo-import Graphics.UI.Gtk.ModelView.CellRendererPixbuf-import Graphics.UI.Gtk.ModelView.CellRendererProgress-import Graphics.UI.Gtk.ModelView.CellRendererText-import Graphics.UI.Gtk.ModelView.CellRendererToggle-import Graphics.UI.Gtk.ModelView.CellView-import Graphics.UI.Gtk.MenuComboToolbar.ComboBox -- these moved back to MenuComboToolbar-import Graphics.UI.Gtk.MenuComboToolbar.ComboBoxEntry-import Graphics.UI.Gtk.ModelView.CustomStore-import Graphics.UI.Gtk.Entry.EntryCompletion -- this moved back to Entry-import Graphics.UI.Gtk.ModelView.IconView-import Graphics.UI.Gtk.ModelView.ListStore-import Graphics.UI.Gtk.ModelView.TreeDrag-import Graphics.UI.Gtk.ModelView.TreeModel-import Graphics.UI.Gtk.ModelView.TreeModelSort-import Graphics.UI.Gtk.ModelView.TreeSortable-import Graphics.UI.Gtk.ModelView.TreeRowReference-import Graphics.UI.Gtk.ModelView.TreeSelection-import Graphics.UI.Gtk.ModelView.TreeStore-import Graphics.UI.Gtk.ModelView.TreeView-import Graphics.UI.Gtk.ModelView.TreeViewColumn
+ Graphics/UI/Gtk/ModelView/CellEditable.chs view
@@ -0,0 +1,144 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Interface CellEditable+--+-- Author : Andy Stewart+--+-- Created: 26 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Interface for widgets which can are used for editing cells+--+module Graphics.UI.Gtk.ModelView.CellEditable (++-- * Detail+--+-- | The 'CellEditable' interface must be implemented for widgets to be usable+-- when editing the contents of a 'TreeView' cell.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GInterface'+-- | +----CellEditable+-- @++-- * Types+ CellEditable,+ CellEditableClass,+ castToCellEditable,+ toCellEditable,++-- * Methods+ cellEditableStartEditing,+ cellEditableEmitEditingDone,+ cellEditableEmitRemoveWidget,++-- * Attributes+#if GTK_CHECK_VERSION(2,20,0)+ cellEditableEditingCanceled,+#endif++-- * Signals+ cellEditableEditingDone,+ cellEditableRemoveWidget,+ ) where++import Control.Monad.Reader.Class (ask)+import Control.Monad.Trans (liftIO)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}+import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny)++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Methods++-- | Begins editing on a @cellEditable@. @event@ is the 'Event' that began the editing process.+--+cellEditableStartEditing :: CellEditableClass self => self -> EventM EAny ()+cellEditableStartEditing self = do+ eventPtr <- ask+ liftIO $ {# call gtk_cell_editable_start_editing #}+ (toCellEditable self)+ (castPtr eventPtr)++-- | Emits the 'cellEditableEditingDone' signal.+--+cellEditableEmitEditingDone :: CellEditableClass self => self -> IO ()+cellEditableEmitEditingDone self =+ {# call gtk_cell_editable_editing_done #}+ (toCellEditable self)++-- | Emits the 'cellEditableRemoveWidget' signal.+--+cellEditableEmitRemoveWidget :: CellEditableClass self => self -> IO ()+cellEditableEmitRemoveWidget self =+ {# call gtk_cell_editable_remove_widget #}+ (toCellEditable self)++--------------------+-- Attributes+#if GTK_CHECK_VERSION(2,20,0)+-- | Indicates whether editing on the cell has been canceled.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+cellEditableEditingCanceled :: CellEditableClass self => Attr self Bool+cellEditableEditingCanceled =+ newAttrFromBoolProperty "editing-canceled"+#endif++--------------------+-- Signals++-- | This signal is a sign for the cell renderer to update its value from the+-- @cellEditable@.+--+-- Implementations of 'CellEditable' are responsible for emitting this+-- signal when they are done editing, e.g. 'Entry' is emitting it when the user+-- presses Enter.+--+-- 'cellEditableEmitEditingDone' is a convenience method for emitting+-- ::editing-done.+--+cellEditableEditingDone :: CellEditableClass self => Signal self (IO ())+cellEditableEditingDone = Signal (connect_NONE__NONE "editing_done")++-- | This signal is meant to indicate that the cell is finished editing, and+-- the widget may now be destroyed.+--+-- Implementations of 'CellEditable' are responsible for emitting this+-- signal when they are done editing. It must be emitted after the+-- 'cellEditableEditingDone' signal, to give the cell+-- renderer a chance to update the cell's value before the widget is removed.+--+-- 'cellEditableEmitRemoveWidget' is a convenience method for emitting+-- ::remove-widget.+--+cellEditableRemoveWidget :: CellEditableClass self => Signal self (IO ())+cellEditableRemoveWidget = Signal (connect_NONE__NONE "remove_widget")
Graphics/UI/Gtk/ModelView/CellLayout.chs view
@@ -18,9 +18,6 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. ----- TODO: the following varargs functions were not bound--- gtk_cell_layout_set_attributes--- -- | -- Maintainer : gtk2hs-users@lists.sourceforge.net -- Stability : provisional@@ -32,7 +29,7 @@ -- module Graphics.UI.Gtk.ModelView.CellLayout ( -- * Detail--- +-- -- | 'CellLayout' is an interface which is implemented by all objects which -- provide a 'TreeViewColumn' API for packing cells, setting attributes and data funcs. @@ -71,7 +68,6 @@ import System.Glib.FFI import System.Glib.GList import System.Glib.Attributes-import System.Glib.GObject (destroyFunPtr) import System.Glib.GType {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.ModelView.Types#}@@ -90,7 +86,9 @@ instance CellLayoutClass EntryCompletion instance CellLayoutClass TreeViewColumn instance CellLayoutClass ComboBox+#if GTK_MAJOR_VERSION < 3 instance CellLayoutClass ComboBoxEntry+#endif -------------------- -- Methods@@ -172,7 +170,7 @@ cellLayoutAddColumnAttribute :: (CellLayoutClass self, CellRendererClass cell) => self -> cell -- ^ @cell@ - A 'CellRenderer'. -> ReadWriteAttr cell a v -- ^ @attribute@ - An attribute of a renderer.- -> ColumnId row v -- ^ @column@ - The virtual column of the model from which to + -> ColumnId row v -- ^ @column@ - The virtual column of the model from which to -- retrieve the attribute. -> IO () cellLayoutAddColumnAttribute self cell attr column =@@ -201,15 +199,15 @@ -- pass the child model to this function. -- cellLayoutSetAttributes :: (CellLayoutClass self,- CellRendererClass cell,- TreeModelClass (model row),- TypedTreeModelClass model)+ CellRendererClass cell,+ TreeModelClass (model row),+ TypedTreeModelClass model) => self -> cell -- ^ @cell@ - A 'CellRenderer'. -> model row -- ^ @model@ - A model containing rows of type @row@. -> (row -> [AttrOp cell]) -- ^ Function to set attributes on the cell renderer. -> IO ()-cellLayoutSetAttributes self cell model attributes = +cellLayoutSetAttributes self cell model attributes = cellLayoutSetAttributeFunc self cell model $ \iter -> do row <- treeModelGetRow model iter set cell (attributes row)@@ -218,8 +216,8 @@ -- attributes of the 'CellRenderer' @cell@ using the row's content. -- cellLayoutSetAttributeFunc :: (CellLayoutClass self,- CellRendererClass cell,- TreeModelClass model)+ CellRendererClass cell,+ TreeModelClass model) => self -> cell -- ^ @cell@ - A 'CellRenderer'. -> model -- ^ @model@ - A model from which to draw data.@@ -227,12 +225,12 @@ -> IO () cellLayoutSetAttributeFunc self cell model func = do fPtr <- mkSetAttributeFunc $ \_ cellPtr' modelPtr' iterPtr _ -> do- iter <- convertIterFromParentToChildModel iterPtr modelPtr' + iter <- convertIterFromParentToChildModel iterPtr modelPtr' (toTreeModel model) let (CellRenderer cellPtr) = toCellRenderer cell if unsafeForeignPtrToPtr cellPtr /= cellPtr' then error ("cellLayoutSetAttributeFunc: attempt to set attributes of "++- "a different CellRenderer.")+ "a different CellRenderer.") else func iter {#call gtk_cell_layout_set_cell_data_func #} (toCellLayout self) (toCellRenderer cell) fPtr (castFunPtrToPtr fPtr) destroyFunPtr@@ -287,14 +285,14 @@ foreign import ccall safe "gtk_tree_model_filter_convert_iter_to_child_iter" treeModelFilterConvertIterToChildIter :: Ptr TreeModel -> Ptr TreeIter ->- Ptr TreeIter -> IO () + Ptr TreeIter -> IO () foreign import ccall unsafe "gtk_tree_model_sort_get_model" treeModelSortGetModel :: Ptr TreeModel -> IO (Ptr TreeModel)- + foreign import ccall safe "gtk_tree_model_sort_convert_iter_to_child_iter" treeModelSortConvertIterToChildIter :: Ptr TreeModel -> Ptr TreeIter ->- Ptr TreeIter -> IO () + Ptr TreeIter -> IO () -- | Clears all existing attributes previously set with -- 'cellLayoutSetAttributes'.
Graphics/UI/Gtk/ModelView/CellRenderer.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.ModelView.CellRenderer ( -- * Detail--- +-- -- | The 'CellRenderer' is a base class of a set of objects used for rendering -- a cell to a 'Drawable'. These objects are used primarily by the 'TreeView' -- widget, though they aren't tied to them in any specific way. It is worth@@ -65,7 +65,7 @@ CellRendererClass, castToCellRenderer, gTypeCellRenderer, toCellRenderer,- CellRendererMode,+ CellRendererMode(..), -- * Methods #if GTK_CHECK_VERSION(2,6,0)@@ -87,7 +87,9 @@ cellIsExpander, cellIsExpanded, cellBackground,+#if GTK_MAJOR_VERSION < 3 cellBackgroundColor,+#endif cellBackgroundSet, -- * Signals@@ -112,10 +114,13 @@ ) where import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Attributes ( Attr, WriteAttr ) import System.Glib.Properties {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.Gdk.GC (Color)+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.Gdk.GC (Color)+#endif {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.ModelView.Types#} @@ -141,7 +146,7 @@ #endif -- %hash c:6d51 d:dc3e--- | Returns @(width, height)@ denoting the size of the fixed size of+-- | Returns @(width, height)@ denoting the size of the fixed size of -- @cell@. If no fixed size is set, returns @-1@ for that value. -- cellRendererGetFixedSize :: CellRendererClass self => self@@ -263,14 +268,17 @@ -- -- Default value: @\"\"@ ---cellBackground :: CellRendererClass self => WriteAttr self String+cellBackground :: (CellRendererClass self, GlibString string) => WriteAttr self string cellBackground = writeAttrFromStringProperty "cell-background" +#if GTK_MAJOR_VERSION < 3 -- | Cell background color as a 'Color'. --+-- Removed in Gtk3. cellBackgroundColor :: CellRendererClass self => Attr self Color cellBackgroundColor = newAttrFromBoxedStorableProperty "cell-background-gdk" {# call pure unsafe gdk_color_get_type #}+#endif -- | Whether the 'cellBackground' \/ 'cellBackgroundColor' attribute is set. --@@ -298,7 +306,7 @@ #if GTK_CHECK_VERSION(2,6,0) -- %hash c:41f0 d:49f--- | This signal gets emitted when a cell starts to be edited. The indended+-- | This signal gets emitted when a cell starts to be edited. The intended -- use of this signal is to do special setup on @editable@, e.g. adding a -- 'EntryCompletion' or setting up additional columns in a 'ComboBox'. --@@ -317,11 +325,11 @@ -- * Available since Gtk+ version 2.6 -- editingStarted :: CellRendererClass self =>- Signal self (Widget -> TreePath -> IO ())+ Signal self (Widget -> TreePath -> IO ()) editingStarted = Signal editingStartedInternal editingStartedInternal after cr act =- connect_OBJECT_STRING__NONE "editing-started" after cr+ connect_OBJECT_GLIBSTRING__NONE "editing-started" after cr $ \ce path -> act ce (stringToTreePath path) #endif #endif
+ Graphics/UI/Gtk/ModelView/CellRendererAccel.chs view
@@ -0,0 +1,171 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget CellRendererAccel+--+-- Author : Andy Stewart+--+-- Created: 25 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Renders a keyboard accelerator in a cell+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.ModelView.CellRendererAccel (++-- * Detail+--+-- | 'CellRendererAccel' displays a keyboard accelerator (i.e. a key+-- combination like \<Control>-a). If the cell renderer is editable, the+-- accelerator can be changed by simply typing the new combination.+--+-- The 'CellRendererAccel' cell renderer was added in Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'CellRenderer'+-- | +----'CellRendererText'+-- | +----CellRendererAccel+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ CellRendererAccel,+ CellRendererAccelClass,+ castToCellRendererAccel,+ toCellRendererAccel,++-- * Enums+ CellRendererAccelMode(..),++-- * Constructors+ cellRendererAccelNew,++-- * Attributes+ cellRendererAccelAccelKey,+ cellRendererAccelAccelMods,+ cellRendererAccelKeycode,+ cellRendererAccelAccelMode,++-- * Signals+ accelEdited,+ accelCleared,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Gdk.Enums (Modifier)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Gdk.Keys (KeyVal, KeyCode)+{#import Graphics.UI.Gtk.Signals#}+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)+--------------------+-- Enums+{#enum CellRendererAccelMode {underscoreToCase} deriving (Bounded,Eq,Show)#}++--------------------+-- Constructors++-- | Creates a new 'CellRendererAccel'.+--+-- * Available since Gtk+ version 2.10+--+cellRendererAccelNew :: IO CellRendererAccel+cellRendererAccelNew =+ makeNewObject mkCellRendererAccel $ liftM castPtr $+ {# call gtk_cell_renderer_accel_new #}++--------------------+-- Attributes++-- | The keyval of the accelerator.+--+-- Allowed values: <= GMaxint+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.10+--+cellRendererAccelAccelKey :: CellRendererAccelClass self => Attr self Int+cellRendererAccelAccelKey = newAttrFromUIntProperty "accel-key"++-- | The modifier mask of the accelerator.+--+-- * Available since Gtk+ version 2.10+--+cellRendererAccelAccelMods :: CellRendererAccelClass self => Attr self [Modifier]+cellRendererAccelAccelMods = newAttrFromFlagsProperty "accel-mods"+ {# call pure unsafe gdk_modifier_type_get_type #}++-- | The hardware keycode of the accelerator. Note that the hardware keycode is only relevant if the key+-- does not have a keyval. Normally, the keyboard configuration should assign keyvals to all keys.+--+-- Allowed values: <= GMaxint+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.10+--+cellRendererAccelKeycode :: CellRendererAccelClass self => Attr self Int+cellRendererAccelKeycode = newAttrFromUIntProperty "keycode"++-- | Determines if the edited accelerators are GTK+ accelerators. If they are, consumed modifiers are+-- suppressed, only accelerators accepted by GTK+ are allowed, and the accelerators are rendered in the+-- same way as they are in menus.+--+-- Default value: 'CellRendererAccelModeGtk'+--+-- * Available since Gtk+ version 2.10+--+cellRendererAccelAccelMode :: CellRendererAccelClass self => Attr self CellRendererAccelMode+cellRendererAccelAccelMode = newAttrFromEnumProperty "accel-mode"+ {# call pure unsafe gtk_cell_renderer_accel_mode_get_type #}++--------------------+-- Signals++-- | Gets emitted when the user has selected a new accelerator.+--+-- * Available since Gtk+ version 2.10+--+accelEdited :: (CellRendererAccelClass self, GlibString string) => Signal self (string -> KeyVal -> Modifier -> KeyCode -> IO ())+accelEdited = Signal (\after obj user -> connect_GLIBSTRING_INT_ENUM_INT__NONE "accel_edited" after obj+ (\ path keyval modifier keycode ->+ user path (fromIntegral keyval) modifier (fromIntegral keycode)))++-- | Gets emitted when the user has removed the accelerator.+--+-- * Available since Gtk+ version 2.10+--+accelCleared :: (CellRendererAccelClass self, GlibString string) => Signal self (string -> IO ())+accelCleared = Signal (connect_GLIBSTRING__NONE "accel_cleared")+#endif
Graphics/UI/Gtk/ModelView/CellRendererCombo.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.ModelView.CellRendererCombo ( -- * Detail--- +-- -- | 'CellRendererCombo' renders text in a cell like -- 'Graphics.UI.Gtk.ModelView.CellRendererText' from which it is derived. But -- while 'Graphics.UI.Gtk.ModelView.CellRendererText' offers a simple entry to@@ -73,9 +73,9 @@ import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Attributes (Attr, WriteAttr, writeAttr) import System.Glib.Properties-import System.Glib.GObject (constructNewGObject) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.ModelView.Types#}@@ -88,7 +88,7 @@ -- Constructors -- | Creates a new 'CellRendererCombo'. This 'Renderer' allows for displaying--- a fixed set of options the user can choose from. +-- a fixed set of options the user can choose from. -- cellRendererComboNew :: IO CellRendererCombo cellRendererComboNew = do@@ -112,12 +112,13 @@ -- tree model can be a datum in the tree model that is used to populate the -- view in which the 'CellRendererCombo' is part of. In other words, it is -- possible that every 'CellRendererCombo' can show a different set of--- options on each row. +-- options on each row. -- cellComboTextModel :: ( TreeModelClass (model row), TypedTreeModelClass model,- CellRendererComboClass self) =>- WriteAttr self (model row, ColumnId row String)+ CellRendererComboClass self,+ GlibString string) =>+ WriteAttr self (model row, ColumnId row string) cellComboTextModel = writeAttr setter where setter cr (model, col) = do
Graphics/UI/Gtk/ModelView/CellRendererPixbuf.chs view
@@ -72,12 +72,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Attributes (Attr) import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -107,7 +108,7 @@ cellPixbufExpanderOpen :: CellRendererPixbufClass self => Attr self Pixbuf cellPixbufExpanderOpen = newAttrFromObjectProperty "pixbuf-expander-open" {# call pure unsafe gdk_pixbuf_get_type #}- + -- | Pixbuf for closed expander. -- cellPixbufExpanderClosed :: CellRendererPixbufClass self => Attr self Pixbuf@@ -118,7 +119,7 @@ -- -- Default value: @\"\"@ ---cellPixbufStockId :: CellRendererPixbufClass self => Attr self String+cellPixbufStockId :: (CellRendererPixbufClass self, GlibString string) => Attr self string cellPixbufStockId = newAttrFromStringProperty "stock-id" -- | The 'IconSize' value that specifies the size of the rendered icon.@@ -132,7 +133,7 @@ -- -- Default value: @\"\"@ ---cellPixbufStockDetail :: CellRendererPixbufClass self => Attr self String+cellPixbufStockDetail :: (CellRendererPixbufClass self, GlibString string) => Attr self string cellPixbufStockDetail = newAttrFromStringProperty "stock-detail" #if GTK_CHECK_VERSION(2,8,0)@@ -141,7 +142,7 @@ -- -- Default value: @\"\"@ ---cellPixbufIconName :: CellRendererPixbufClass self => Attr self String+cellPixbufIconName :: (CellRendererPixbufClass self, GlibString string) => Attr self string cellPixbufIconName = newAttrFromStringProperty "icon-name" -- | Specifies whether the rendered pixbuf should be colorized according to
Graphics/UI/Gtk/ModelView/CellRendererProgress.chs view
@@ -59,12 +59,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Attributes (Attr)+import System.Glib.UTFString+import System.Glib.Attributes (Attr) import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -101,6 +102,6 @@ -- -- Default value: @Nothing@ ---cellProgressText :: CellRendererProgressClass self => Attr self (Maybe String)+cellProgressText :: (CellRendererProgressClass self, GlibString string) => Attr self (Maybe string) cellProgressText = newAttrFromMaybeStringProperty "text" #endif
+ Graphics/UI/Gtk/ModelView/CellRendererSpin.chs view
@@ -0,0 +1,131 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget CellRendererSpin+--+-- Author : Andy Stewart+--+-- Created: 25 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Renders a spin button in a cell+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.ModelView.CellRendererSpin (++-- * Detail+--+-- | 'CellRendererSpin' renders text in a cell like 'CellRendererText' from+-- which it is derived. But while 'CellRendererText' offers a simple entry to+-- edit the text, 'CellRendererSpin' offers a 'SpinButton' widget. Of course,+-- that means that the text has to be parseable as a floating point number.+--+-- The range of the spinbutton is taken from the adjustment property of the+-- cell renderer, which can be set explicitly or mapped to a column in the tree+-- model, like all properties of cell renders. 'CellRendererSpin' also has+-- properties for the climb rate and the number of digits to display. Other+-- 'SpinButton' properties can be set in a handler for the start-editing+-- signal.+--+-- The 'CellRendererSpin' cell renderer was added in Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'CellRenderer'+-- | +----'CellRendererText'+-- | +----CellRendererSpin+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ CellRendererSpin,+ CellRendererSpinClass,+ castToCellRendererSpin,+ toCellRendererSpin,++-- * Constructors+ cellRendererSpinNew,++-- * Attributes+ cellRendererSpinAdjustment,+ cellRendererSpinClimbRate,+ cellRendererSpinDigits,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)+--------------------+-- Constructors++-- | Creates a new 'CellRendererSpin'.+--+-- * Available since Gtk+ version 2.10+--+cellRendererSpinNew :: IO CellRendererSpin+cellRendererSpinNew =+ makeNewObject mkCellRendererSpin $ liftM castPtr+ {# call gtk_cell_renderer_spin_new #}++--------------------+-- Attributes++-- | The adjustment that holds the value of the spinbutton.+--+-- * Available since Gtk+ version 2.10+--+cellRendererSpinAdjustment :: CellRendererSpinClass self => Attr self Adjustment+cellRendererSpinAdjustment = newAttrFromObjectProperty "adjustment"+ {# call pure unsafe gtk_adjustment_get_type #}++-- | The acceleration rate when you hold down a button.+--+-- Allowed values: >= 0+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.10+--+cellRendererSpinClimbRate :: CellRendererSpinClass self => Attr self Double+cellRendererSpinClimbRate = newAttrFromDoubleProperty "climb-rate"++-- | The number of decimal places to display.+--+-- Allowed values: <= 20+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.10+--+cellRendererSpinDigits :: CellRendererSpinClass self => Attr self Int+cellRendererSpinDigits = newAttrFromUIntProperty "digits"+#endif
+ Graphics/UI/Gtk/ModelView/CellRendererSpinner.chs view
@@ -0,0 +1,123 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget CellRendererSpinner+--+-- Author : Andy Stewart+--+-- Created: 25 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Renders a spinning animation in a cell+--+-- * Module available since Gtk+ version 2.20+--+module Graphics.UI.Gtk.ModelView.CellRendererSpinner (+-- * Detail+-- | 'CellRendererSpinner' renders a spinning animation in a cell, very similar to 'Spinner'. It can+-- often be used as an alternative to a 'CellRendererProgress' for displaying indefinite activity,+-- instead of actual progress.+--+-- To start the animation in a cell, set the "active" property to 'True' and increment the "pulse"+-- property at regular intervals. The usual way to set the cell renderer properties for each cell is+-- to bind them to columns in your tree model using e.g. 'treeViewColumnAddAttribute'.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'CellRenderer'+-- | +----'CellRendererSpinner'+-- @++#if GTK_CHECK_VERSION(2,20,0)+-- * Types+ CellRendererSpinner,+ CellRendererSpinnerClass,+ castToCellRendererSpinner,+ toCellRendererSpinner,++-- * Constructors+ cellRendererSpinnerNew,++-- * Attributes+ cellRendererSpinnerActive,+ cellRendererSpinnerPulse,+ cellRendererSpinnerSize,+#endif+) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.General.Structs (IconSize(..))+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,20,0)+-- | Returns a new cell renderer which will show a spinner to indicate activity.+--+-- * Available since Gtk+ version 2.20+--+cellRendererSpinnerNew :: IO CellRendererSpinner+cellRendererSpinnerNew =+ makeNewObject mkCellRendererSpinner $ liftM castPtr $+ {#call gtk_cell_renderer_spinner_new #}++-- | Whether the spinner is active (ie. shown) in the cell.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.20+--+cellRendererSpinnerActive :: CellRendererSpinnerClass self => Attr self Bool+cellRendererSpinnerActive =+ newAttrFromBoolProperty "active"++-- | Pulse of the spinner. Increment this value to draw the next frame of the spinner animation. Usually,+-- you would update this value in a timeout.+--+-- The 'Spinner' widget draws one full cycle of the animation per second by default. You can learn+-- about the number of frames used by the theme by looking at the 'numSteps' style property and the+-- duration of the cycle by looking at 'cycleDuration'.+--+-- Default value: 0+--+-- * Available since Gtk+ version 2.20+--+cellRendererSpinnerPulse :: CellRendererSpinnerClass self => Attr self Int+cellRendererSpinnerPulse =+ newAttrFromIntProperty "pulse"++-- | The 'IconSize' value that specifies the size of the rendered spinner.+--+-- Default value: 'IconSizeMenu'+--+-- * Available since Gtk+ version 2.20+--+cellRendererSpinnerSize :: CellRendererSpinnerClass self => Attr self IconSize+cellRendererSpinnerSize =+ newAttrFromEnumProperty "size"+ {# call pure unsafe gtk_icon_size_get_type #}+#endif
Graphics/UI/Gtk/ModelView/CellRendererText.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.ModelView.CellRendererText ( -- * Detail--- +-- -- | A 'CellRendererText' renders a given text in its cell, using the font, -- color and style information provided by its attributes. The text will be -- ellipsized if it is too long and the ellipsize property allows it.@@ -118,20 +118,21 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Properties import System.Glib.Attributes (Attr, WriteAttr)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.ModelView.Types#}-import Graphics.UI.Gtk.General.Structs (Color(..))+import Graphics.UI.Gtk.General.Structs () import Graphics.Rendering.Pango.Enums {#import Graphics.Rendering.Pango.BasicTypes#} ( FontDescription(..),- makeNewFontDescription )-{#import Graphics.Rendering.Pango.Layout#} ( LayoutAlignment, LayoutWrapMode )+ makeNewFontDescription )+{#import Graphics.Rendering.Pango.Layout#} ( LayoutAlignment, LayoutWrapMode ) {# context lib="gtk" prefix="gtk" #} @@ -153,7 +154,7 @@ -- 'cellTextFont' and 'Graphics.UI.Gtk.ModelView.CellRenderer.cellYPad' -- attribute set on it. Further changes in these properties do not affect the -- height, so they must be accompanied by a subsequent call to this function.--- Using this function is unflexible, and should really only be used if+-- Using this function is inflexible, and should really only be used if -- calculating the size of a cell is too slow (ie, a massive number of cells -- displayed). If @numberOfRows@ is -1, then the fixed height is unset, and -- the height is determined by the properties again.@@ -175,7 +176,7 @@ -- -- Default value: @\"\"@ ---cellTextBackground :: CellRendererClass self => WriteAttr self String+cellTextBackground :: (CellRendererClass self, GlibString string) => WriteAttr self string cellTextBackground = writeAttrFromStringProperty "background" -- | Text background color as a 'Color'.@@ -212,7 +213,7 @@ -- cellTextEllipsize :: CellRendererTextClass self => Attr self EllipsizeMode cellTextEllipsize = newAttrFromEnumProperty "ellipsize"- {# call pure pango_ellipsize_mode_get_type #}+ {# call pure pango_ellipsize_mode_get_type #} -- | Whether the 'cellTextEllipsize' tag affects the ellipsize mode. --@@ -224,7 +225,7 @@ -- | Name of the font family, e.g. Sans, Helvetica, Times, Monospace. ---cellTextFamily :: CellRendererTextClass self => Attr self String+cellTextFamily :: (CellRendererTextClass self, GlibString string) => Attr self string cellTextFamily = newAttrFromStringProperty "family" -- | Determines if 'cellTextFamily' has an effect.@@ -234,7 +235,7 @@ -- | Font description as a string. ---cellTextFont :: CellRendererTextClass self => Attr self String+cellTextFont :: (CellRendererTextClass self, GlibString string) => Attr self string cellTextFont = newAttrFromStringProperty "font" -- | Font description as a 'Graphics.Rendering.Pango.FontDescription'.@@ -248,7 +249,7 @@ -- -- Default value: @\"\"@ ---cellTextForeground :: CellRendererClass self => WriteAttr self String+cellTextForeground :: (CellRendererClass self, GlibString string) => WriteAttr self string cellTextForeground = writeAttrFromStringProperty "foreground" -- | Text foreground color as a 'Color'.@@ -268,7 +269,7 @@ -- a hint when rendering the text. If you don't understand this parameter, -- you probably don't need it. ---cellTextLanguage :: CellRendererTextClass self => Attr self (Maybe String)+cellTextLanguage :: (CellRendererTextClass self, GlibString string) => Attr self (Maybe string) cellTextLanguage = newAttrFromMaybeStringProperty "language" -- | Whether the 'cellTextLanguage' tag is used, default is @False@.@@ -278,7 +279,7 @@ -- | Define a markup string instead of a text. See 'cellText'. ---cellTextMarkup :: CellRendererTextClass cr => WriteAttr cr (Maybe String)+cellTextMarkup :: (CellRendererTextClass cr, GlibString string) => WriteAttr cr (Maybe string) cellTextMarkup = writeAttrFromMaybeStringProperty "markup" -- %hash c:4e25 d:f7c6@@ -339,7 +340,7 @@ -- cellTextStretch :: CellRendererTextClass self => Attr self Stretch cellTextStretch = newAttrFromEnumProperty "stretch"- {# call pure pango_stretch_get_type #}+ {# call pure pango_stretch_get_type #} -- | Whether the 'cellTextStretch' tag is used, default is @False@. --@@ -360,7 +361,7 @@ -- cellTextStyle :: CellRendererTextClass self => Attr self FontStyle cellTextStyle = newAttrFromEnumProperty "style"- {# call pure pango_style_get_type #}+ {# call pure pango_style_get_type #} -- | Whether the 'cellTextStyle' tag is used, default is @False@. --@@ -370,14 +371,14 @@ -- | Define the attribute that specifies the text to be rendered. See -- also 'cellTextMarkup'. ---cellText :: CellRendererTextClass cr => Attr cr String+cellText :: (CellRendererTextClass cr, GlibString string) => Attr cr string cellText = newAttrFromStringProperty "text" -- | Style of underline for this text. -- cellTextUnderline :: CellRendererTextClass self => Attr self Underline cellTextUnderline = newAttrFromEnumProperty "underline"- {# call pure pango_underline_get_type #}+ {# call pure pango_underline_get_type #} -- | Whether the 'cellTextUnderline' tag is used, default is @False@. --@@ -388,7 +389,7 @@ -- cellTextVariant :: CellRendererTextClass self => Attr self Variant cellTextVariant = newAttrFromEnumProperty "variant"- {# call pure pango_variant_get_type #}+ {# call pure pango_variant_get_type #} -- | Whether the 'cellTextVariant' tag is used, default is @False@. --@@ -429,7 +430,7 @@ -- cellTextWrapMode :: CellRendererTextClass self => Attr self LayoutWrapMode cellTextWrapMode = newAttrFromEnumProperty "wrap-mode"- {# call pure pango_wrap_mode_get_type #}+ {# call pure pango_wrap_mode_get_type #} -- | Specifies the width at which the text is wrapped. The wrap-mode -- property can be used to influence at what character positions the@@ -472,12 +473,12 @@ -- indicates that the model should be updated with the supplied value. -- The value is always a string which matches the 'cellText' attribute of -- 'CellRendererText' (and its derivates like 'CellRendererCombo').--- --- * This signal is not emitted when editing is disabled (see +--+-- * This signal is not emitted when editing is disabled (see -- 'cellTextEditable') or when the user aborts editing. ---edited :: CellRendererTextClass self =>- Signal self (TreePath -> String -> IO ())+edited :: (CellRendererTextClass self, GlibString string) =>+ Signal self (TreePath -> string -> IO ()) edited = Signal internalEdited --------------------@@ -485,24 +486,24 @@ #ifndef DISABLE_DEPRECATED -- %hash c:76ed-onEdited :: CellRendererTextClass self => self- -> (TreePath -> String -> IO ())+onEdited :: (CellRendererTextClass self, GlibString string) => self+ -> (TreePath -> string -> IO ()) -> IO (ConnectId self) onEdited = internalEdited False {-# DEPRECATED onEdited "instead of 'onEdited obj' use 'on obj edited'" #-} -- %hash c:f70c-afterEdited :: CellRendererTextClass self => self- -> (TreePath -> String -> IO ())+afterEdited :: (CellRendererTextClass self, GlibString string) => self+ -> (TreePath -> string -> IO ()) -> IO (ConnectId self) afterEdited = internalEdited True {-# DEPRECATED afterEdited "instead of 'afterEdited obj' use 'after obj edited'" #-} #endif -internalEdited :: CellRendererTextClass cr =>- Bool -> cr ->- (TreePath -> String -> IO ()) ->+internalEdited :: (CellRendererTextClass cr, GlibString string) =>+ Bool -> cr ->+ (TreePath -> string -> IO ()) -> IO (ConnectId cr) internalEdited after cr user =- connect_STRING_STRING__NONE "edited" after cr $ \path string -> do+ connect_GLIBSTRING_GLIBSTRING__NONE "edited" after cr $ \path string -> do user (stringToTreePath path) string
Graphics/UI/Gtk/ModelView/CellRendererToggle.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.ModelView.CellRendererToggle ( -- * Detail--- +-- -- | 'CellRendererToggle' renders a toggle button in a cell. The button is -- drawn as a radio or checkbutton, depending on the radio property. When -- activated, it emits the toggled signal.@@ -73,13 +73,14 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Attributes (Attr)-import System.Glib.Properties (newAttrFromBoolProperty,- newAttrFromIntProperty)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import System.Glib.Properties (newAttrFromBoolProperty,+ newAttrFromIntProperty)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -210,24 +211,24 @@ -- represents a 'TreePath' into the model and can be converted using -- 'stringToTreePath'. ---cellToggled :: CellRendererToggleClass self => Signal self (String -> IO ())-cellToggled = Signal (connect_STRING__NONE "toggled")+cellToggled :: (CellRendererToggleClass self, GlibString string) => Signal self (string -> IO ())+cellToggled = Signal (connect_GLIBSTRING__NONE "toggled") -------------------- -- Deprecated Signals #ifndef DISABLE_DEPRECATED -- %hash c:21f7-onCellToggled :: CellRendererToggleClass self => self- -> (String -> IO ())+onCellToggled :: (CellRendererToggleClass self, GlibString string) => self+ -> (string -> IO ()) -> IO (ConnectId self)-onCellToggled = connect_STRING__NONE "toggled" False+onCellToggled = connect_GLIBSTRING__NONE "toggled" False {-# DEPRECATED onCellToggled "instead of 'onCellToggled obj' use 'on obj cellToggled'" #-} -- %hash c:82f6-afterCellToggled :: CellRendererToggleClass self => self- -> (String -> IO ())+afterCellToggled :: (CellRendererToggleClass self, GlibString string) => self+ -> (string -> IO ()) -> IO (ConnectId self)-afterCellToggled = connect_STRING__NONE "toggled" True+afterCellToggled = connect_GLIBSTRING__NONE "toggled" True {-# DEPRECATED afterCellToggled "instead of 'afterCellToggled obj' use 'after obj cellToggled'" #-} #endif
Graphics/UI/Gtk/ModelView/CellView.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.ModelView.CellView ( -- * Detail--- +-- -- | A 'CellView' displays a single row of a 'TreeModel', using cell renderers -- just like 'TreeView'. 'CellView' doesn't support some of the more complex -- features of 'TreeView', like cell editing and drag and drop.@@ -60,23 +60,27 @@ cellViewSetModel, cellViewGetSizeOfRow, cellViewSetBackgroundColor,+#if GTK_MAJOR_VERSION < 3 cellViewGetCellRenderers,+#endif -- * Attributes cellViewBackground #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import System.Glib.Properties (writeAttrFromStringProperty)+import System.Glib.Properties (writeAttrFromStringProperty)+#if GTK_MAJOR_VERSION < 3 {#import System.Glib.GList#}+#endif {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.ModelView.Types#}-import Graphics.UI.Gtk.General.Structs (Color, Requisition)+import Graphics.UI.Gtk.General.Structs (Color, Requisition) {# context lib="gtk" prefix="gtk" #} @@ -96,8 +100,8 @@ -- makes its show @markup@. The text can be marked up with the Pango -- text markup language. ---cellViewNewWithMarkup :: - String -- ^ @markup@ - the text to display in the cell view+cellViewNewWithMarkup :: GlibString string+ => string -- ^ @markup@ - the text to display in the cell view -> IO CellView cellViewNewWithMarkup markup = makeNewObject mkCellView $@@ -109,7 +113,7 @@ -- | Creates a new 'CellView' widget, adds a 'CellRendererPixbuf' to it, and -- makes its show @pixbuf@. ---cellViewNewWithPixbuf :: +cellViewNewWithPixbuf :: Pixbuf -- ^ @pixbuf@ - the image to display in the cell view -> IO CellView cellViewNewWithPixbuf pixbuf =@@ -121,8 +125,8 @@ -- | Creates a new 'CellView' widget, adds a 'CellRendererText' to it, and -- makes its show @text@. ---cellViewNewWithText :: - String -- ^ @text@ - the text to display in the cell view+cellViewNewWithText :: GlibString string+ => string -- ^ @text@ - the text to display in the cell view -> IO CellView cellViewNewWithText text = makeNewObject mkCellView $@@ -172,14 +176,17 @@ (toCellView self) (castPtr colorPtr) +#if GTK_MAJOR_VERSION < 3 -- | Returns the cell renderers which have been added to @cellView@. --+-- Removed in Gtk3. cellViewGetCellRenderers :: CellViewClass self => self -> IO [CellRenderer] cellViewGetCellRenderers self = {# call gtk_cell_view_get_cell_renderers #} (toCellView self) >>= fromGList >>= mapM (\elemPtr -> makeNewObject mkCellRenderer (return elemPtr))+#endif -------------------- -- Attributes@@ -188,7 +195,7 @@ -- -- Default value: @\"\"@ ---cellViewBackground :: CellViewClass self => WriteAttr self String+cellViewBackground :: (CellViewClass self, GlibString string) => WriteAttr self string cellViewBackground = writeAttrFromStringProperty "background" #endif
Graphics/UI/Gtk/ModelView/CustomStore.chs view
@@ -33,7 +33,7 @@ -- 'customStoreGetRow' functions. -- module Graphics.UI.Gtk.ModelView.CustomStore (- -- * The definition of a row-based store. + -- * The definition of a row-based store. CustomStore, TreeModelFlags(..), TreeModelIface(..),@@ -45,30 +45,26 @@ customStoreGetPrivate, customStoreGetStamp, customStoreInvalidateIters,- -- for backwards compatability, not documented+ -- for backwards compatibility, not documented treeModelGetRow, treeModelSetColumn, ) where -import Control.Monad (liftM, when)+import Control.Monad (liftM) import Control.Monad.Reader (runReaderT) import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.Maybe (fromMaybe)-import System.Glib.FFI hiding (maybeNull)-import System.Glib.Flags (Flags, fromFlags)-{#import System.Glib.GObject#} (GObjectClass(..), GObject(..), unGObject,- makeNewGObject, objectUnref)+import System.Glib.FFI hiding (maybeNull)+import System.Glib.Flags (Flags, fromFlags) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.ModelView.Types#} import Graphics.UI.Gtk.General.DNDTypes (SelectionDataM, SelectionData) -import System.Glib.StoreValue (TMType(..), GenericValue(..), valueSetGenericValue)-{#import System.Glib.GValue#} (GValue(GValue), allocaGValue)-{#import System.Glib.GType#} (GType)-import System.Glib.GValueTypes (valueSetString)+{#import System.Glib.GValue#} (GValue(GValue))+{#import System.Glib.GType#} (GType) import qualified System.Glib.GTypeConstants as GConst {#import System.Glib.GValueTypes#}-{#import System.Glib.GValue#} (valueInit)+{#import System.Glib.GValue#} (valueInit) {# context lib="gtk" prefix="gtk" #} @@ -93,7 +89,7 @@ -- | A 'CustomStore' is an instance of a Gtk+ 'TreeModel' and can thus be used -- for any widget that stores data in a 'TreeModel'. The user may either -- create an instance of a 'CustomStore' or use one of the pre-defined--- models 'Graphics.UI.Gtk.ModelView.ListStore.ListStore' of+-- models 'Graphics.UI.Gtk.ModelView.ListStore.ListStore' or -- 'Graphics.UI.Gtk.ModelView.TreeStore.TreeStore'. newtype CustomStore private row = CustomStore (ForeignPtr (CustomStore private row)) @@ -113,10 +109,10 @@ -- the model is installed into a widget since the number of defined -- columns are only checked once by widgets. customStoreSetColumn :: TypedTreeModelClass model- => model row -- ^ the store in which to allocate a new column- -> (ColumnId row ty) -- ^ the column that should be set- -> (row -> ty) -- ^ the function that sets the property- -> IO ()+ => model row -- ^ the store in which to allocate a new column+ -> (ColumnId row ty) -- ^ the column that should be set+ -> (row -> ty) -- ^ the function that sets the property+ -> IO () customStoreSetColumn model (ColumnId _ setter colId) acc | colId<0 = return () | otherwise = case toTypedTreeModel model of@@ -133,16 +129,16 @@ let (beg,_:end) = splitAt colId cols writeIORef cMap (beg++setter acc:end) --- this is a backwards compatability definition+-- this is a backwards compatibility definition treeModelSetColumn :: TypedTreeModelClass model- => model row -- ^ the store in which to allocate a new column- -> (ColumnId row ty) -- ^ the column that should be set- -> (row -> ty) -- ^ the function that sets the property- -> IO ()+ => model row -- ^ the store in which to allocate a new column+ -> (ColumnId row ty) -- ^ the column that should be set+ -> (row -> ty) -- ^ the function that sets the property+ -> IO () treeModelSetColumn = customStoreSetColumn data CustomStoreImplementation model row = CustomStoreImplementation {- customStoreColumns :: ColumnMap row, -- provide access via columns+ customStoreColumns :: ColumnMap row, -- provide access via columns customStoreIface :: TreeModelIface row, -- functions implementing a tree model customTreeDragSourceIface :: DragSourceIface model row, -- the drag and drop source interface customTreeDragDestIface :: DragDestIface model row -- the drag and drop dest interface@@ -157,7 +153,7 @@ -- Return @Nothing@ if the path does not exit. treeModelIfaceGetIter :: TreePath -> IO (Maybe TreeIter), -- convert a path to an iterator -- | Convert an iterator to a path. The iterator will always be valid.- treeModelIfaceGetPath :: TreeIter -> IO TreePath, -- convert an interator to a path+ treeModelIfaceGetPath :: TreeIter -> IO TreePath, -- convert an iterator to a path -- | Retrieve a row at the given iterator. treeModelIfaceGetRow :: TreeIter -> IO row, -- get the row at an iter -- | Advance the given iterator to the next node at the same level.@@ -212,7 +208,7 @@ -- its information be used to insert a new row at the given path. treeDragDestDragDataReceived:: model row -> TreePath -> SelectionDataM Bool -- insert row from selection object }- + -- | Create a new store that implements the 'TreeModelIface' interface and -- optionally the 'DragSourceIface' and the 'DragDestIface'. If the latter two -- are set to @Nothing@ a dummy interface is substituted that rejects every@@ -239,7 +235,7 @@ customTreeDragSourceIface = fromMaybe dummyDragSource mDragSource, customTreeDragDestIface = fromMaybe dummyDragDest mDragDest } privPtr <- newStablePtr priv- liftM con $ makeNewGObject (CustomStore, objectUnref) $+ liftM con $ wrapNewGObject (CustomStore, objectUnref) $ gtk2hs_store_new implPtr privPtr foreign import ccall unsafe "Gtk2HsStore.h gtk2hs_store_new"@@ -250,13 +246,13 @@ -- | Extract a row of the given model at the given 'TreeIter'. -- customStoreGetRow :: TypedTreeModelClass model => model row -> TreeIter -> IO row-customStoreGetRow model iter = +customStoreGetRow model iter = case toTypedTreeModel model of TypedTreeModel model -> do impl <- withForeignPtr model gtk2hs_store_get_impl >>= deRefStablePtr treeModelIfaceGetRow (customStoreIface impl) iter --- this is a backwards compatability definition+-- this is a backwards compatibility definition treeModelGetRow :: TypedTreeModelClass model => model row -> TreeIter -> IO row treeModelGetRow = customStoreGetRow @@ -375,9 +371,9 @@ (CABool ca) -> valueInit gVal GConst.bool >> valueSetBool gVal (ca row) (CAString ca) -> valueInit gVal GConst.string >> valueSetString gVal (ca row) (CAPixbuf ca) -> valueInit gVal {#call fun unsafe gdk_pixbuf_get_type#} >>- valueSetGObject gVal (ca row)+ valueSetGObject gVal (ca row) CAInvalid -> valueInit gVal GConst.int >> valueSetInt gVal 0- + foreign export ccall "gtk2hs_store_get_value_impl" treeModelIfaceGetValue_static :: StablePtr (CustomStoreImplementation model row) -> Ptr TreeIter -> CInt -> Ptr GValue -> IO () @@ -531,7 +527,3 @@ maybeNull marshal ptr | ptr == nullPtr = return Nothing | otherwise = liftM Just (marshal ptr)--iterSetStamp :: CInt -> TreeIter -> TreeIter-iterSetStamp t (TreeIter _ a b c) = (TreeIter t a b c)-
Graphics/UI/Gtk/ModelView/Gtk2HsStore.c view
@@ -55,6 +55,7 @@ static void gtk2hs_store_set_sort_column_id (GtkTreeSortable *sortable, gint sort_column_id, GtkSortType order);+#if GTK_MAJOR_VERSION < 3 static void gtk2hs_store_set_sort_func (GtkTreeSortable *sortable, gint sort_column_id, GtkTreeIterCompareFunc func,@@ -64,6 +65,7 @@ GtkTreeIterCompareFunc func, gpointer data, GtkDestroyNotify destroy);+#endif static gboolean gtk2hs_store_has_default_sort_func (GtkTreeSortable *sortable); @@ -120,6 +122,7 @@ NULL }; +#if GTK_MAJOR_VERSION < 3 /* The TreeSortable interface is currently not implemented. */ static const GInterfaceInfo tree_sortable_info = {@@ -127,7 +130,7 @@ NULL, NULL };-+#endif static const GInterfaceInfo tree_drag_source_info = { (GInterfaceInitFunc) gtk2hs_store_tree_drag_source_init,@@ -215,6 +218,7 @@ iface->unref_node = gtk2hs_store_unref_node; } +#if GTK_MAJOR_VERSION < 3 /** * * gtk2hs_store_tree_sortable_init: init callback for the interface registration@@ -234,7 +238,7 @@ iface->set_default_sort_func = gtk2hs_store_set_default_sort_func; iface->has_default_sort_func = gtk2hs_store_has_default_sort_func; }-+#endif /** * * gtk2hs_store_tree_drag_source_init: init callback for the interface registration@@ -270,7 +274,7 @@ /** *- * gtk2hs_store_init: this is called everytime a new custom list object+ * gtk2hs_store_init: this is called every time a new custom list object * instance is created (we do that in gtk2hs_store_new). * Initialise the list structure's fields here. *@@ -458,7 +462,6 @@ WHEN_DEBUG(g_debug("calling gtk2hs_store_iter_next\t\t(%p, %p)\n", tree_model, iter)); Gtk2HsStore *store = (Gtk2HsStore *) tree_model; g_return_val_if_fail (GTK2HS_IS_STORE (tree_model), FALSE);- g_return_val_if_fail (iter->stamp == store->stamp, FALSE); gboolean result = gtk2hs_store_iter_next_impl(store->impl, iter); if (result) iter->stamp = store->stamp;@@ -485,7 +488,6 @@ WHEN_DEBUG(g_debug("calling gtk2hs_store_iter_children\t(%p, %p, %p)\n", tree_model, iter, parent)); Gtk2HsStore *store = (Gtk2HsStore *) tree_model; g_return_val_if_fail (GTK2HS_IS_STORE (tree_model), FALSE);- g_return_val_if_fail (parent == NULL || parent->stamp == store->stamp, FALSE); gboolean result = gtk2hs_store_iter_children_impl(store->impl, iter, parent); if (result) iter->stamp = store->stamp;@@ -507,7 +509,8 @@ WHEN_DEBUG(g_debug("calling gtk2hs_store_iter_has_child\t(%p, %p)\n", tree_model, iter)); Gtk2HsStore *store = (Gtk2HsStore *) tree_model; g_return_val_if_fail (GTK2HS_IS_STORE (tree_model), FALSE);- g_return_val_if_fail (iter->stamp == store->stamp, FALSE);+ /* don't check if iter->stamp == store->stamp; see the thread culminating in+ * http://sourceforge.net/p/gtk2hs/mailman/message/31887332/ for details */ gboolean result = gtk2hs_store_iter_has_child_impl(store->impl, iter); WHEN_DEBUG(g_debug("return gtk2hs_store_iter_has_child\t=%s\n", result ? "TRUE" : "FALSE"));@@ -599,7 +602,6 @@ WHEN_DEBUG(g_debug("calling gtk2hs_store_ref_node\t\t(%p, %p)\n", tree_model, iter)); Gtk2HsStore *store = (Gtk2HsStore *) tree_model; g_return_if_fail (GTK2HS_IS_STORE (tree_model));- g_return_if_fail (iter->stamp == store->stamp); gtk2hs_store_ref_node_impl(store->impl, iter); }@@ -634,6 +636,7 @@ return; } +#if GTK_MAJOR_VERSION < 3 static void gtk2hs_store_set_sort_func (GtkTreeSortable *sortable, gint sort_column_id,@@ -654,7 +657,7 @@ WHEN_DEBUG(g_debug("calling gtk2hs_store_set_default_sort_func\t\t(%p)\n", sortable)); return; }-+#endif static gboolean gtk2hs_store_has_default_sort_func (GtkTreeSortable *sortable) {
Graphics/UI/Gtk/ModelView/Gtk2HsStore.h view
@@ -1,9 +1,8 @@ #ifndef __GTK2HS_STORE_H__ #define __GTK2HS_STORE_H__ -#include <gtk/gtktreemodel.h>-#include <gtk/gtktreednd.h>-#include <gtk/gtktreesortable.h>+#include <gtk/gtk.h>+ #include "Graphics/UI/Gtk/ModelView/CustomStore_stub.h" G_BEGIN_DECLS
Graphics/UI/Gtk/ModelView/IconView.chs view
@@ -72,8 +72,10 @@ iconViewSelectedForeach, iconViewSetSelectionMode, iconViewGetSelectionMode,+#if GTK_MAJOR_VERSION < 3 iconViewSetOrientation, iconViewGetOrientation,+#endif iconViewSetColumns, iconViewGetColumns, iconViewSetItemWidth,@@ -108,6 +110,10 @@ iconViewSetReorderable, iconViewGetReorderable, #endif+#if GTK_CHECK_VERSION(2,22,0)+ iconViewGetItemRow,+ iconViewGetItemColumn,+#endif -- * Attributes iconViewSelectionMode,@@ -125,6 +131,9 @@ #if GTK_CHECK_VERSION(2,8,0) iconViewReorderable, #endif+#if GTK_CHECK_VERSION(2,22,0)+ iconViewItemOrientation,+#endif -- * Signals setIconViewScrollAdjustments,@@ -136,11 +145,11 @@ import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties import System.Glib.GList (fromGList) import System.Glib.Flags-import System.Glib.GObject (makeNewGObject, constructNewGObject) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) import Graphics.UI.Gtk.Gdk.Enums (DragAction(..)) import Graphics.UI.Gtk.Gdk.Events (Modifier(..))@@ -148,21 +157,13 @@ {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.General.Enums#} (Orientation, SelectionMode) {#import Graphics.UI.Gtk.ModelView.TreeModel#}-{#import Graphics.UI.Gtk.ModelView.CustomStore#} {#import Graphics.UI.Gtk.ModelView.Types#} {#import Graphics.UI.Gtk.General.DNDTypes#} (TargetList(..))-import Graphics.Rendering.Pango.Markup (Markup) {# context lib="gtk" prefix="gtk" #} #if GTK_CHECK_VERSION(2,6,0) ----------------------- Interfaces---- %hash c:4792-instance CellLayoutClass IconView---------------------- -- Constructors -- | Creates a new 'IconView' widget@@ -219,8 +220,8 @@ -- source is set using 'iconViewSetMarkupSource', then the text source is -- ignored. ---iconViewSetTextColumn :: IconViewClass self => self- -> ColumnId row String -- ^ @column@ - A column in the currently used model.+iconViewSetTextColumn :: (IconViewClass self, GlibString string) => self+ -> ColumnId row string -- ^ @column@ - A column in the currently used model. -> IO () iconViewSetTextColumn self column = {# call gtk_icon_view_set_text_column #}@@ -229,21 +230,21 @@ -- | Returns the column with text for @iconView@. ---iconViewGetTextColumn :: IconViewClass self => self- -> IO (ColumnId row String) -- ^ returns the text column, or 'invalidColumnId' if it's unset.+iconViewGetTextColumn :: (IconViewClass self, GlibString string) => self+ -> IO (ColumnId row string) -- ^ returns the text column, or 'invalidColumnId' if it's unset. iconViewGetTextColumn self = liftM (makeColumnIdString . fromIntegral) $ {# call gtk_icon_view_get_text_column #} (toIconView self)- + -- %hash c:995f d:801c -- | Sets the column of the text for entries in the 'IconView' as a markup -- string (see 'Graphics.Rendering.Pango.Markup'). A text source that is set -- using 'iconViewSetTextSource' is ignored once a markup source is set. ---iconViewSetMarkupColumn :: IconViewClass self => self- -> ColumnId row Markup -- ^ @column@ - A column in the currently used model.+iconViewSetMarkupColumn :: (IconViewClass self, GlibString markup) => self+ -> ColumnId row markup -- ^ @column@ - A column in the currently used model. -> IO () iconViewSetMarkupColumn self column = {# call gtk_icon_view_set_markup_column #}@@ -252,8 +253,8 @@ -- | Returns the column with markup text for @iconView@. ---iconViewGetMarkupColumn :: IconViewClass self => self- -> IO (ColumnId row Markup) -- ^ returns the markup column, or 'invalidColumnId' if it's unset.+iconViewGetMarkupColumn :: (IconViewClass self, GlibString markup) => self+ -> IO (ColumnId row markup) -- ^ returns the markup column, or 'invalidColumnId' if it's unset. iconViewGetMarkupColumn self = liftM (makeColumnIdString . fromIntegral) $ {# call gtk_icon_view_get_markup_column #}@@ -303,7 +304,7 @@ -- cannot be modified from within this function. -- iconViewSelectedForeach :: IconViewClass self => self- -> (TreePath -> IO ()) -- ^ @(\path -> ...)@ - The funcion to call for each+ -> (TreePath -> IO ()) -- ^ @(\path -> ...)@ - The function to call for each -- selected icon. -> IO () iconViewSelectedForeach self func = do@@ -341,6 +342,7 @@ {# call gtk_icon_view_get_selection_mode #} (toIconView self) +#if GTK_MAJOR_VERSION < 3 -- | Sets the ::orientation property which determines whether the labels are -- drawn beside the icons instead of below. --@@ -361,6 +363,7 @@ liftM (toEnum . fromIntegral) $ {# call gtk_icon_view_get_orientation #} (toIconView self)+#endif -- %hash c:7d23 d:d4e7 -- | Sets the ::columns property which determines in how many columns the@@ -587,7 +590,7 @@ iconViewGetItemAtPos :: IconViewClass self => self -> Int -- ^ @x@ - The x position to be identified -> Int -- ^ @y@ - The y position to be identified- -> IO (Maybe (TreePath, CellRenderer)) + -> IO (Maybe (TreePath, CellRenderer)) -- specified position iconViewGetItemAtPos self x y = alloca $ \pathPtrPtr -> alloca $ \crPtrPtr -> do@@ -697,7 +700,7 @@ -- %hash c:8354 d:f7f3 -- | Retrieve the first and last visible path.--- Note that there may be invisible paths inbetween.+-- Note that there may be invisible paths in between. -- -- * Available since Gtk+ version 2.8 --@@ -822,6 +825,37 @@ #endif +#if GTK_CHECK_VERSION(2,22,0)+-- | Gets the row in which the item path is currently displayed. Row numbers start at 0.+--+-- * Available since Gtk+ version 2.22+--+iconViewGetItemRow :: IconViewClass self => self+ -> TreePath -- ^ @path@ the 'TreePath' of the item+ -> IO Int -- ^ returns The row in which the item is displayed+iconViewGetItemRow self path =+ liftM fromIntegral $+ withTreePath path $ \path ->+ {# call gtk_icon_view_get_item_row #}+ (toIconView self)+ path++-- | Gets the column in which the item path is currently displayed. Column numbers start at 0.+--+-- * Available since Gtk+ version 2.22+--+iconViewGetItemColumn :: IconViewClass self => self+ -> TreePath -- ^ @path@ the 'TreePath' of the item+ -> IO Int -- ^ returns The column in which the item is displayed+iconViewGetItemColumn self path =+ liftM fromIntegral $+ withTreePath path $ \path ->+ {# call gtk_icon_view_get_item_column #}+ (toIconView self)+ path++#endif+ -------------------- -- Attributes @@ -856,7 +890,7 @@ -- -- Default value: 'invalidColumnId' ---iconViewTextColumn :: IconViewClass self => Attr self (ColumnId row String)+iconViewTextColumn :: (IconViewClass self, GlibString string) => Attr self (ColumnId row string) iconViewTextColumn = newAttr iconViewGetTextColumn iconViewSetTextColumn@@ -869,7 +903,7 @@ -- -- Default value: 'invalidColumnId' ---iconViewMarkupColumn :: IconViewClass self => Attr self (ColumnId row Markup)+iconViewMarkupColumn :: (IconViewClass self, GlibString markup) => Attr self (ColumnId row markup) iconViewMarkupColumn = newAttr iconViewGetMarkupColumn iconViewSetMarkupColumn@@ -973,6 +1007,19 @@ iconViewReorderable = newAttrFromBoolProperty "reorderable" #endif +#if GTK_CHECK_VERSION(2,22,0)+-- | The item-orientation property specifies how the cells (i.e. the icon and the text) of the item are+-- positioned relative to each other.+--+-- Default value: 'OrientationVertical'+--+-- * Available since Gtk+ version 2.22+--+iconViewItemOrientation :: IconViewClass self => Attr self Orientation+iconViewItemOrientation = newAttrFromEnumProperty "item-orientation"+ {# call pure unsafe gtk_orientation_get_type #}+#endif+ -------------------- -- Signals @@ -980,13 +1027,13 @@ -- | New scroll adjustment have been set for this widget. -- setIconViewScrollAdjustments :: IconViewClass self => Signal self (Adjustment -> Adjustment -> IO ())-setIconViewScrollAdjustments = Signal (connect_OBJECT_OBJECT__NONE "set_scroll_adjustments")+setIconViewScrollAdjustments = Signal (connect_OBJECT_OBJECT__NONE "set-scroll-adjustments") -- %hash c:4090 d:af3f -- | A specific element has been activated (by pressing enter or double clicking). -- itemActivated :: IconViewClass self => Signal self (TreePath -> IO ())-itemActivated = Signal (connect_BOXED__NONE "item_activated" (peekTreePath . castPtr))+itemActivated = Signal (connect_BOXED__NONE "item-activated" (peekTreePath . castPtr)) -- %hash c:6098 d:af3f -- | The selected item changed.
Graphics/UI/Gtk/ModelView/ListStore.hs view
@@ -4,7 +4,7 @@ -- -- Author : Duncan Coutts, Axel Simon ----- Created: 11 Feburary 2006+-- Created: 11 February 2006 -- -- Copyright (C) 2005 Duncan Coutts, Axel Simon --@@ -27,13 +27,13 @@ -- module Graphics.UI.Gtk.ModelView.ListStore ( --- * Types +-- * Types ListStore, -- * Constructors listStoreNew, listStoreNewDND,- + -- * Implementation of Interfaces listStoreDefaultDragSourceIface, listStoreDefaultDragDestIface,@@ -41,6 +41,7 @@ -- * Methods listStoreIterToIndex, listStoreGetValue,+ listStoreSafeGetValue, listStoreSetValue, listStoreToList, listStoreGetSize,@@ -64,8 +65,8 @@ import Graphics.UI.Gtk.ModelView.Sequence (Seq) #endif -import Graphics.UI.Gtk.Types (GObjectClass(..), TreeModelClass)-import Graphics.UI.Gtk.ModelView.Types (TypedTreeModelClass, TreeIter(..))+import Graphics.UI.Gtk.Types (GObjectClass(..))+-- import Graphics.UI.Gtk.ModelView.Types () import Graphics.UI.Gtk.ModelView.CustomStore import Graphics.UI.Gtk.ModelView.TreeModel import Graphics.UI.Gtk.ModelView.TreeDrag@@ -97,11 +98,12 @@ customStoreNew rows ListStore TreeModelIface { treeModelIfaceGetFlags = return [TreeModelListOnly], treeModelIfaceGetIter = \[n] -> readIORef rows >>= \rows ->- return (if Seq.null rows then Nothing else- Just (TreeIter 0 (fromIntegral n) 0 0)),+ return (if inRange (0, Seq.length rows - 1) n+ then Just (TreeIter 0 (fromIntegral n) 0 0)+ else Nothing), treeModelIfaceGetPath = \(TreeIter _ n _ _) -> return [fromIntegral n], treeModelIfaceGetRow = \(TreeIter _ n _ _) ->- readIORef rows >>= \rows -> + readIORef rows >>= \rows -> if inRange (0, Seq.length rows - 1) (fromIntegral n) then return (rows `Seq.index` fromIntegral n) else fail "ListStore.getRow: iter does not refer to a valid entry",@@ -111,7 +113,11 @@ if inRange (0, Seq.length rows - 1) (fromIntegral (n+1)) then return (Just (TreeIter 0 (n+1) 0 0)) else return Nothing,- treeModelIfaceIterChildren = \_ -> return Nothing,+ treeModelIfaceIterChildren = \index -> readIORef rows >>= \rows ->+ case index of+ Nothing | not (Seq.null rows) ->+ return (Just (TreeIter 0 0 0 0))+ _ -> return Nothing, treeModelIfaceIterHasChild = \_ -> return False, treeModelIfaceIterNChildren = \index -> readIORef rows >>= \rows -> case index of@@ -175,12 +181,22 @@ listStoreGetValue (ListStore model) index = readIORef (customStoreGetPrivate model) >>= return . (`Seq.index` index) +-- | Extract the value at the given index.+--+listStoreSafeGetValue :: ListStore a -> Int -> IO (Maybe a)+listStoreSafeGetValue (ListStore model) index = do+ seq <- readIORef (customStoreGetPrivate model)+ return $ if index >=0 && index < Seq.length seq+ then Just $ seq `Seq.index` index+ else Nothing+ -- | Update the value at the given index. The index must exist. -- listStoreSetValue :: ListStore a -> Int -> a -> IO () listStoreSetValue (ListStore model) index value = do modifyIORef (customStoreGetPrivate model) (Seq.update index value)- treeModelRowChanged model [index] (TreeIter 0 (fromIntegral index) 0 0)+ stamp <- customStoreGetStamp model+ treeModelRowChanged model [index] (TreeIter stamp (fromIntegral index) 0 0) -- | Extract all data from the store. --@@ -198,7 +214,7 @@ listStoreGetSize :: ListStore a -> IO Int listStoreGetSize (ListStore model) = liftM Seq.length $ readIORef (customStoreGetPrivate model)- + -- | Insert an element in front of the given element. The element is appended -- if the index is greater or equal to the size of the list. listStoreInsert :: ListStore a -> Int -> a -> IO ()@@ -223,10 +239,10 @@ stamp <- customStoreGetStamp model treeModelRowInserted model [0] (TreeIter stamp 0 0 0) --- | Prepend a list to the store. Not implemented yet.-listStorePrependList :: ListStore a -> [a] -> IO ()-listStorePrependList store list =- mapM_ (listStoreInsert store 0) (reverse list)+---- | Prepend a list to the store. Not implemented yet.+--listStorePrependList :: ListStore a -> [a] -> IO ()+--listStorePrependList store list =+-- mapM_ (listStoreInsert store 0) (reverse list) -- | Append an element to the store. Returns the index of the inserted -- element.@@ -247,7 +263,7 @@ endIndex = startIndex + Seq.length seq' - 1 writeIORef (customStoreGetPrivate model) (seq Seq.>< seq') stamp <- customStoreGetStamp model- flip mapM [startIndex..endIndex] $ \index -> + flip mapM [startIndex..endIndex] $ \index -> treeModelRowInserted model [index] (TreeIter stamp (fromIntegral index) 0 0) -} @@ -259,8 +275,6 @@ when (index >=0 && index < Seq.length seq) $ do writeIORef (customStoreGetPrivate model) (delete index seq) treeModelRowDeleted model [index]- --TODO we should probably fail on a bad index- where delete :: Int -> Seq a -> Seq a delete i xs = front Seq.>< Seq.drop 1 back where (front, back) = Seq.splitAt i xs@@ -270,36 +284,36 @@ listStoreClear (ListStore model) = -- Since deleting rows can cause callbacks (eg due to selection changes)- -- we have to make sure the model is consitent with the view at each+ -- we have to make sure the model is consistent with the view at each -- intermediate step of clearing the store. Otherwise at some intermediate- -- stage when the view has only been informed about some delections, the+ -- stage when the view has only been informed about some deletions, the -- user might query the model expecting to find the remaining rows are there -- but find them deleted. That'd be bad. -- let loop (-1) Seq.EmptyR = return () loop n (seq Seq.:> _) = do writeIORef (customStoreGetPrivate model) seq- treeModelRowDeleted model [n]- loop (n-1) (Seq.viewr seq)+ treeModelRowDeleted model [n]+ loop (n-1) (Seq.viewr seq) in do seq <- readIORef (customStoreGetPrivate model) loop (Seq.length seq - 1) (Seq.viewr seq) --- | Permute the rows of the store. Not yet implemented.-listStoreReorder :: ListStore a -> [Int] -> IO ()-listStoreReorder store = undefined---- | Swap two rows of the store. Not yet implemented.-listStoreSwap :: ListStore a -> Int -> Int -> IO ()-listStoreSwap store = undefined---- | Move the element at the first index in front of the element denoted by--- the second index. Not yet implemented.-listStoreMoveBefore :: ListStore a -> Int -> Int -> IO ()-listStoreMoveBefore store = undefined---- | Move the element at the first index past the element denoted by the--- second index. Not yet implemented.-listStoreMoveAfter :: ListStore a -> Int -> Int -> IO ()-listStoreMoveAfter store = undefined+---- | Permute the rows of the store. Not yet implemented.+--listStoreReorder :: ListStore a -> [Int] -> IO ()+--listStoreReorder store = undefined+--+---- | Swap two rows of the store. Not yet implemented.+--listStoreSwap :: ListStore a -> Int -> Int -> IO ()+--listStoreSwap store = undefined+--+---- | Move the element at the first index in front of the element denoted by+---- the second index. Not yet implemented.+--listStoreMoveBefore :: ListStore a -> Int -> Int -> IO ()+--listStoreMoveBefore store = undefined+--+---- | Move the element at the first index past the element denoted by the+---- second index. Not yet implemented.+--listStoreMoveAfter :: ListStore a -> Int -> Int -> IO ()+--listStoreMoveAfter store = undefined
Graphics/UI/Gtk/ModelView/Sequence.hs view
@@ -23,59 +23,59 @@ -- as described in section 4.2 of -- -- * Ralf Hinze and Ross Paterson,--- \"Finger trees: a simple general-purpose data structure\",--- submitted to /Journal of Functional Programming/.--- <http://www.soi.city.ac.uk/~ross/papers/FingerTree.html>+-- \"Finger trees: a simple general-purpose data structure\",+-- submitted to /Journal of Functional Programming/.+-- <http://www.soi.city.ac.uk/~ross/papers/FingerTree.html> -- ----------------------------------------------------------------------------- module Graphics.UI.Gtk.ModelView.Sequence (- Seq,- -- * Construction- empty, -- :: Seq a- singleton, -- :: a -> Seq a- (<|), -- :: a -> Seq a -> Seq a- (|>), -- :: Seq a -> a -> Seq a- (><), -- :: Seq a -> Seq a -> Seq a- -- * Deconstruction- null, -- :: Seq a -> Bool- -- ** Views- ViewL(..),- viewl, -- :: Seq a -> ViewL a- ViewR(..),- viewr, -- :: Seq a -> ViewR a- -- ** Indexing- length, -- :: Seq a -> Int- index, -- :: Seq a -> Int -> a- adjust, -- :: (a -> a) -> Int -> Seq a -> Seq a- update, -- :: Int -> a -> Seq a -> Seq a- take, -- :: Int -> Seq a -> Seq a- drop, -- :: Int -> Seq a -> Seq a- splitAt, -- :: Int -> Seq a -> (Seq a, Seq a)- -- * Lists- fromList, -- :: [a] -> Seq a- toList, -- :: Seq a -> [a]- -- * Folds- -- ** Right associative- foldr, -- :: (a -> b -> b) -> b -> Seq a -> b- foldr1, -- :: (a -> a -> a) -> Seq a -> a- foldr', -- :: (a -> b -> b) -> b -> Seq a -> b- foldrM, -- :: Monad m => (a -> b -> m b) -> b -> Seq a -> m b- -- ** Left associative- foldl, -- :: (a -> b -> a) -> a -> Seq b -> a- foldl1, -- :: (a -> a -> a) -> Seq a -> a- foldl', -- :: (a -> b -> a) -> a -> Seq b -> a- foldlM, -- :: Monad m => (a -> b -> m a) -> a -> Seq b -> m a- -- * Transformations- reverse, -- :: Seq a -> Seq a+ Seq,+ -- * Construction+ empty, -- :: Seq a+ singleton, -- :: a -> Seq a+ (<|), -- :: a -> Seq a -> Seq a+ (|>), -- :: Seq a -> a -> Seq a+ (><), -- :: Seq a -> Seq a -> Seq a+ -- * Deconstruction+ null, -- :: Seq a -> Bool+ -- ** Views+ ViewL(..),+ viewl, -- :: Seq a -> ViewL a+ ViewR(..),+ viewr, -- :: Seq a -> ViewR a+ -- ** Indexing+ length, -- :: Seq a -> Int+ index, -- :: Seq a -> Int -> a+ adjust, -- :: (a -> a) -> Int -> Seq a -> Seq a+ update, -- :: Int -> a -> Seq a -> Seq a+ take, -- :: Int -> Seq a -> Seq a+ drop, -- :: Int -> Seq a -> Seq a+ splitAt, -- :: Int -> Seq a -> (Seq a, Seq a)+ -- * Lists+ fromList, -- :: [a] -> Seq a+ toList, -- :: Seq a -> [a]+ -- * Folds+ -- ** Right associative+ foldr, -- :: (a -> b -> b) -> b -> Seq a -> b+ foldr1, -- :: (a -> a -> a) -> Seq a -> a+ foldr', -- :: (a -> b -> b) -> b -> Seq a -> b+ foldrM, -- :: Monad m => (a -> b -> m b) -> b -> Seq a -> m b+ -- ** Left associative+ foldl, -- :: (a -> b -> a) -> a -> Seq b -> a+ foldl1, -- :: (a -> a -> a) -> Seq a -> a+ foldl', -- :: (a -> b -> a) -> a -> Seq b -> a+ foldlM, -- :: Monad m => (a -> b -> m a) -> a -> Seq b -> m a+ -- * Transformations+ reverse, -- :: Seq a -> Seq a #if TESTING- valid,+ valid, #endif- ) where+ ) where import Prelude hiding (- null, length, take, drop, splitAt, foldl, foldl1, foldr, foldr1,- reverse)+ null, length, take, drop, splitAt, foldl, foldl', foldl1, foldr, foldr1,+ reverse) import qualified Prelude (foldr) import Data.List (intersperse) import qualified Data.List (foldl')@@ -93,7 +93,7 @@ infixl 5 |>, :> class Sized a where- size :: a -> Int+ size :: a -> Int ------------------------------------------------------------------------ -- Random access sequences@@ -103,73 +103,73 @@ newtype Seq a = Seq (FingerTree (Elem a)) instance Functor Seq where- fmap f (Seq xs) = Seq (fmap (fmap f) xs)+ fmap f (Seq xs) = Seq (fmap (fmap f) xs) instance Eq a => Eq (Seq a) where- xs == ys = length xs == length ys && toList xs == toList ys+ xs == ys = length xs == length ys && toList xs == toList ys instance Ord a => Ord (Seq a) where- compare xs ys = compare (toList xs) (toList ys)+ compare xs ys = compare (toList xs) (toList ys) #if TESTING instance (Show a) => Show (Seq a) where- showsPrec p (Seq x) = showsPrec p x+ showsPrec p (Seq x) = showsPrec p x #else instance Show a => Show (Seq a) where- showsPrec _ xs = showChar '<' .- flip (Prelude.foldr ($)) (intersperse (showChar ',')- (map shows (toList xs))) .- showChar '>'+ showsPrec _ xs = showChar '<' .+ flip (Prelude.foldr ($)) (intersperse (showChar ',')+ (map shows (toList xs))) .+ showChar '>' #endif -- Finger trees data FingerTree a- = Empty- | Single a- | Deep {-# UNPACK #-} !Int !(Digit a) (FingerTree (Node a)) !(Digit a)+ = Empty+ | Single a+ | Deep {-# UNPACK #-} !Int !(Digit a) (FingerTree (Node a)) !(Digit a) #if TESTING- deriving Show+ deriving Show #endif instance Sized a => Sized (FingerTree a) where- size Empty = 0- size (Single x) = size x- size (Deep v _ _ _) = v+ size Empty = 0+ size (Single x) = size x+ size (Deep v _ _ _) = v instance Functor FingerTree where- fmap _ Empty = Empty- fmap f (Single x) = Single (f x)- fmap f (Deep v pr m sf) =- Deep v (fmap f pr) (fmap (fmap f) m) (fmap f sf)+ fmap _ Empty = Empty+ fmap f (Single x) = Single (f x)+ fmap f (Deep v pr m sf) =+ Deep v (fmap f pr) (fmap (fmap f) m) (fmap f sf) {-# INLINE deep #-}-deep :: Sized a => Digit a -> FingerTree (Node a) -> Digit a -> FingerTree a-deep pr m sf = Deep (size pr + size m + size sf) pr m sf+deep :: Sized a => Digit a -> FingerTree (Node a) -> Digit a -> FingerTree a+deep pr m sf = Deep (size pr + size m + size sf) pr m sf -- Digits data Digit a- = One a- | Two a a- | Three a a a- | Four a a a a+ = One a+ | Two a a+ | Three a a a+ | Four a a a a #if TESTING- deriving Show+ deriving Show #endif instance Functor Digit where- fmap f (One a) = One (f a)- fmap f (Two a b) = Two (f a) (f b)- fmap f (Three a b c) = Three (f a) (f b) (f c)- fmap f (Four a b c d) = Four (f a) (f b) (f c) (f d)+ fmap f (One a) = One (f a)+ fmap f (Two a b) = Two (f a) (f b)+ fmap f (Three a b c) = Three (f a) (f b) (f c)+ fmap f (Four a b c d) = Four (f a) (f b) (f c) (f d) instance Sized a => Sized (Digit a) where- size xs = foldlDigit (\ i x -> i + size x) 0 xs+ size xs = foldlDigit (\ i x -> i + size x) 0 xs {-# SPECIALIZE digitToTree :: Digit (Elem a) -> FingerTree (Elem a) #-} {-# SPECIALIZE digitToTree :: Digit (Node a) -> FingerTree (Node a) #-}-digitToTree :: Sized a => Digit a -> FingerTree a+digitToTree :: Sized a => Digit a -> FingerTree a digitToTree (One a) = Single a digitToTree (Two a b) = deep (One a) Empty (One b) digitToTree (Three a b c) = deep (Two a b) Empty (One c)@@ -178,27 +178,27 @@ -- Nodes data Node a- = Node2 {-# UNPACK #-} !Int a a- | Node3 {-# UNPACK #-} !Int a a a+ = Node2 {-# UNPACK #-} !Int a a+ | Node3 {-# UNPACK #-} !Int a a a #if TESTING- deriving Show+ deriving Show #endif instance Functor (Node) where- fmap f (Node2 v a b) = Node2 v (f a) (f b)- fmap f (Node3 v a b c) = Node3 v (f a) (f b) (f c)+ fmap f (Node2 v a b) = Node2 v (f a) (f b)+ fmap f (Node3 v a b c) = Node3 v (f a) (f b) (f c) instance Sized (Node a) where- size (Node2 v _ _) = v- size (Node3 v _ _ _) = v+ size (Node2 v _ _) = v+ size (Node3 v _ _ _) = v {-# INLINE node2 #-}-node2 :: Sized a => a -> a -> Node a-node2 a b = Node2 (size a + size b) a b+node2 :: Sized a => a -> a -> Node a+node2 a b = Node2 (size a + size b) a b {-# INLINE node3 #-}-node3 :: Sized a => a -> a -> a -> Node a-node3 a b c = Node3 (size a + size b + size c) a b c+node3 :: Sized a => a -> a -> a -> Node a+node3 a b c = Node3 (size a + size b + size c) a b c nodeToDigit :: Node a -> Digit a nodeToDigit (Node2 _ a b) = Two a b@@ -209,14 +209,14 @@ newtype Elem a = Elem { getElem :: a } instance Sized (Elem a) where- size _ = 1+ size _ = 1 instance Functor Elem where- fmap f (Elem x) = Elem (f x)+ fmap f (Elem x) = Elem (f x) #ifdef TESTING instance (Show a) => Show (Elem a) where- showsPrec p (Elem x) = showsPrec p x+ showsPrec p (Elem x) = showsPrec p x #endif ------------------------------------------------------------------------@@ -224,298 +224,298 @@ ------------------------------------------------------------------------ -- | /O(1)/. The empty sequence.-empty :: Seq a-empty = Seq Empty+empty :: Seq a+empty = Seq Empty -- | /O(1)/. A singleton sequence.-singleton :: a -> Seq a-singleton x = Seq (Single (Elem x))+singleton :: a -> Seq a+singleton x = Seq (Single (Elem x)) -- | /O(1)/. Add an element to the left end of a sequence. -- Mnemonic: a triangle with the single element at the pointy end.-(<|) :: a -> Seq a -> Seq a-x <| Seq xs = Seq (Elem x `consTree` xs)+(<|) :: a -> Seq a -> Seq a+x <| Seq xs = Seq (Elem x `consTree` xs) {-# SPECIALIZE consTree :: Elem a -> FingerTree (Elem a) -> FingerTree (Elem a) #-} {-# SPECIALIZE consTree :: Node a -> FingerTree (Node a) -> FingerTree (Node a) #-}-consTree :: Sized a => a -> FingerTree a -> FingerTree a-consTree a Empty = Single a-consTree a (Single b) = deep (One a) Empty (One b)+consTree :: Sized a => a -> FingerTree a -> FingerTree a+consTree a Empty = Single a+consTree a (Single b) = deep (One a) Empty (One b) consTree a (Deep s (Four b c d e) m sf) = m `seq`- Deep (size a + s) (Two a b) (node3 c d e `consTree` m) sf+ Deep (size a + s) (Two a b) (node3 c d e `consTree` m) sf consTree a (Deep s (Three b c d) m sf) =- Deep (size a + s) (Four a b c d) m sf+ Deep (size a + s) (Four a b c d) m sf consTree a (Deep s (Two b c) m sf) =- Deep (size a + s) (Three a b c) m sf+ Deep (size a + s) (Three a b c) m sf consTree a (Deep s (One b) m sf) =- Deep (size a + s) (Two a b) m sf+ Deep (size a + s) (Two a b) m sf -- | /O(1)/. Add an element to the right end of a sequence. -- Mnemonic: a triangle with the single element at the pointy end.-(|>) :: Seq a -> a -> Seq a-Seq xs |> x = Seq (xs `snocTree` Elem x)+(|>) :: Seq a -> a -> Seq a+Seq xs |> x = Seq (xs `snocTree` Elem x) {-# SPECIALIZE snocTree :: FingerTree (Elem a) -> Elem a -> FingerTree (Elem a) #-} {-# SPECIALIZE snocTree :: FingerTree (Node a) -> Node a -> FingerTree (Node a) #-}-snocTree :: Sized a => FingerTree a -> a -> FingerTree a-snocTree Empty a = Single a-snocTree (Single a) b = deep (One a) Empty (One b)+snocTree :: Sized a => FingerTree a -> a -> FingerTree a+snocTree Empty a = Single a+snocTree (Single a) b = deep (One a) Empty (One b) snocTree (Deep s pr m (Four a b c d)) e = m `seq`- Deep (s + size e) pr (m `snocTree` node3 a b c) (Two d e)+ Deep (s + size e) pr (m `snocTree` node3 a b c) (Two d e) snocTree (Deep s pr m (Three a b c)) d =- Deep (s + size d) pr m (Four a b c d)+ Deep (s + size d) pr m (Four a b c d) snocTree (Deep s pr m (Two a b)) c =- Deep (s + size c) pr m (Three a b c)+ Deep (s + size c) pr m (Three a b c) snocTree (Deep s pr m (One a)) b =- Deep (s + size b) pr m (Two a b)+ Deep (s + size b) pr m (Two a b) -- | /O(log(min(n1,n2)))/. Concatenate two sequences.-(><) :: Seq a -> Seq a -> Seq a+(><) :: Seq a -> Seq a -> Seq a Seq xs >< Seq ys = Seq (appendTree0 xs ys) -- The appendTree/addDigits gunk below is machine generated appendTree0 :: FingerTree (Elem a) -> FingerTree (Elem a) -> FingerTree (Elem a) appendTree0 Empty xs =- xs+ xs appendTree0 xs Empty =- xs+ xs appendTree0 (Single x) xs =- x `consTree` xs+ x `consTree` xs appendTree0 xs (Single x) =- xs `snocTree` x+ xs `snocTree` x appendTree0 (Deep s1 pr1 m1 sf1) (Deep s2 pr2 m2 sf2) =- Deep (s1 + s2) pr1 (addDigits0 m1 sf1 pr2 m2) sf2+ Deep (s1 + s2) pr1 (addDigits0 m1 sf1 pr2 m2) sf2 addDigits0 :: FingerTree (Node (Elem a)) -> Digit (Elem a) -> Digit (Elem a) -> FingerTree (Node (Elem a)) -> FingerTree (Node (Elem a)) addDigits0 m1 (One a) (One b) m2 =- appendTree1 m1 (node2 a b) m2+ appendTree1 m1 (node2 a b) m2 addDigits0 m1 (One a) (Two b c) m2 =- appendTree1 m1 (node3 a b c) m2+ appendTree1 m1 (node3 a b c) m2 addDigits0 m1 (One a) (Three b c d) m2 =- appendTree2 m1 (node2 a b) (node2 c d) m2+ appendTree2 m1 (node2 a b) (node2 c d) m2 addDigits0 m1 (One a) (Four b c d e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits0 m1 (Two a b) (One c) m2 =- appendTree1 m1 (node3 a b c) m2+ appendTree1 m1 (node3 a b c) m2 addDigits0 m1 (Two a b) (Two c d) m2 =- appendTree2 m1 (node2 a b) (node2 c d) m2+ appendTree2 m1 (node2 a b) (node2 c d) m2 addDigits0 m1 (Two a b) (Three c d e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits0 m1 (Two a b) (Four c d e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits0 m1 (Three a b c) (One d) m2 =- appendTree2 m1 (node2 a b) (node2 c d) m2+ appendTree2 m1 (node2 a b) (node2 c d) m2 addDigits0 m1 (Three a b c) (Two d e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits0 m1 (Three a b c) (Three d e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits0 m1 (Three a b c) (Four d e f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits0 m1 (Four a b c d) (One e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits0 m1 (Four a b c d) (Two e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits0 m1 (Four a b c d) (Three e f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits0 m1 (Four a b c d) (Four e f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 appendTree1 :: FingerTree (Node a) -> Node a -> FingerTree (Node a) -> FingerTree (Node a) appendTree1 Empty a xs =- a `consTree` xs+ a `consTree` xs appendTree1 xs a Empty =- xs `snocTree` a+ xs `snocTree` a appendTree1 (Single x) a xs =- x `consTree` a `consTree` xs+ x `consTree` a `consTree` xs appendTree1 xs a (Single x) =- xs `snocTree` a `snocTree` x+ xs `snocTree` a `snocTree` x appendTree1 (Deep s1 pr1 m1 sf1) a (Deep s2 pr2 m2 sf2) =- Deep (s1 + size a + s2) pr1 (addDigits1 m1 sf1 a pr2 m2) sf2+ Deep (s1 + size a + s2) pr1 (addDigits1 m1 sf1 a pr2 m2) sf2 addDigits1 :: FingerTree (Node (Node a)) -> Digit (Node a) -> Node a -> Digit (Node a) -> FingerTree (Node (Node a)) -> FingerTree (Node (Node a)) addDigits1 m1 (One a) b (One c) m2 =- appendTree1 m1 (node3 a b c) m2+ appendTree1 m1 (node3 a b c) m2 addDigits1 m1 (One a) b (Two c d) m2 =- appendTree2 m1 (node2 a b) (node2 c d) m2+ appendTree2 m1 (node2 a b) (node2 c d) m2 addDigits1 m1 (One a) b (Three c d e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits1 m1 (One a) b (Four c d e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits1 m1 (Two a b) c (One d) m2 =- appendTree2 m1 (node2 a b) (node2 c d) m2+ appendTree2 m1 (node2 a b) (node2 c d) m2 addDigits1 m1 (Two a b) c (Two d e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits1 m1 (Two a b) c (Three d e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits1 m1 (Two a b) c (Four d e f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits1 m1 (Three a b c) d (One e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits1 m1 (Three a b c) d (Two e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits1 m1 (Three a b c) d (Three e f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits1 m1 (Three a b c) d (Four e f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits1 m1 (Four a b c d) e (One f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits1 m1 (Four a b c d) e (Two f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits1 m1 (Four a b c d) e (Three f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits1 m1 (Four a b c d) e (Four f g h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 appendTree2 :: FingerTree (Node a) -> Node a -> Node a -> FingerTree (Node a) -> FingerTree (Node a) appendTree2 Empty a b xs =- a `consTree` b `consTree` xs+ a `consTree` b `consTree` xs appendTree2 xs a b Empty =- xs `snocTree` a `snocTree` b+ xs `snocTree` a `snocTree` b appendTree2 (Single x) a b xs =- x `consTree` a `consTree` b `consTree` xs+ x `consTree` a `consTree` b `consTree` xs appendTree2 xs a b (Single x) =- xs `snocTree` a `snocTree` b `snocTree` x+ xs `snocTree` a `snocTree` b `snocTree` x appendTree2 (Deep s1 pr1 m1 sf1) a b (Deep s2 pr2 m2 sf2) =- Deep (s1 + size a + size b + s2) pr1 (addDigits2 m1 sf1 a b pr2 m2) sf2+ Deep (s1 + size a + size b + s2) pr1 (addDigits2 m1 sf1 a b pr2 m2) sf2 addDigits2 :: FingerTree (Node (Node a)) -> Digit (Node a) -> Node a -> Node a -> Digit (Node a) -> FingerTree (Node (Node a)) -> FingerTree (Node (Node a)) addDigits2 m1 (One a) b c (One d) m2 =- appendTree2 m1 (node2 a b) (node2 c d) m2+ appendTree2 m1 (node2 a b) (node2 c d) m2 addDigits2 m1 (One a) b c (Two d e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits2 m1 (One a) b c (Three d e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits2 m1 (One a) b c (Four d e f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits2 m1 (Two a b) c d (One e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits2 m1 (Two a b) c d (Two e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits2 m1 (Two a b) c d (Three e f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits2 m1 (Two a b) c d (Four e f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits2 m1 (Three a b c) d e (One f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits2 m1 (Three a b c) d e (Two f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits2 m1 (Three a b c) d e (Three f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits2 m1 (Three a b c) d e (Four f g h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits2 m1 (Four a b c d) e f (One g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits2 m1 (Four a b c d) e f (Two g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits2 m1 (Four a b c d) e f (Three g h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits2 m1 (Four a b c d) e f (Four g h i j) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2 appendTree3 :: FingerTree (Node a) -> Node a -> Node a -> Node a -> FingerTree (Node a) -> FingerTree (Node a) appendTree3 Empty a b c xs =- a `consTree` b `consTree` c `consTree` xs+ a `consTree` b `consTree` c `consTree` xs appendTree3 xs a b c Empty =- xs `snocTree` a `snocTree` b `snocTree` c+ xs `snocTree` a `snocTree` b `snocTree` c appendTree3 (Single x) a b c xs =- x `consTree` a `consTree` b `consTree` c `consTree` xs+ x `consTree` a `consTree` b `consTree` c `consTree` xs appendTree3 xs a b c (Single x) =- xs `snocTree` a `snocTree` b `snocTree` c `snocTree` x+ xs `snocTree` a `snocTree` b `snocTree` c `snocTree` x appendTree3 (Deep s1 pr1 m1 sf1) a b c (Deep s2 pr2 m2 sf2) =- Deep (s1 + size a + size b + size c + s2) pr1 (addDigits3 m1 sf1 a b c pr2 m2) sf2+ Deep (s1 + size a + size b + size c + s2) pr1 (addDigits3 m1 sf1 a b c pr2 m2) sf2 addDigits3 :: FingerTree (Node (Node a)) -> Digit (Node a) -> Node a -> Node a -> Node a -> Digit (Node a) -> FingerTree (Node (Node a)) -> FingerTree (Node (Node a)) addDigits3 m1 (One a) b c d (One e) m2 =- appendTree2 m1 (node3 a b c) (node2 d e) m2+ appendTree2 m1 (node3 a b c) (node2 d e) m2 addDigits3 m1 (One a) b c d (Two e f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits3 m1 (One a) b c d (Three e f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits3 m1 (One a) b c d (Four e f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits3 m1 (Two a b) c d e (One f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits3 m1 (Two a b) c d e (Two f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits3 m1 (Two a b) c d e (Three f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits3 m1 (Two a b) c d e (Four f g h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits3 m1 (Three a b c) d e f (One g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits3 m1 (Three a b c) d e f (Two g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits3 m1 (Three a b c) d e f (Three g h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits3 m1 (Three a b c) d e f (Four g h i j) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2 addDigits3 m1 (Four a b c d) e f g (One h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits3 m1 (Four a b c d) e f g (Two h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits3 m1 (Four a b c d) e f g (Three h i j) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2 addDigits3 m1 (Four a b c d) e f g (Four h i j k) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node2 j k) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node2 j k) m2 appendTree4 :: FingerTree (Node a) -> Node a -> Node a -> Node a -> Node a -> FingerTree (Node a) -> FingerTree (Node a) appendTree4 Empty a b c d xs =- a `consTree` b `consTree` c `consTree` d `consTree` xs+ a `consTree` b `consTree` c `consTree` d `consTree` xs appendTree4 xs a b c d Empty =- xs `snocTree` a `snocTree` b `snocTree` c `snocTree` d+ xs `snocTree` a `snocTree` b `snocTree` c `snocTree` d appendTree4 (Single x) a b c d xs =- x `consTree` a `consTree` b `consTree` c `consTree` d `consTree` xs+ x `consTree` a `consTree` b `consTree` c `consTree` d `consTree` xs appendTree4 xs a b c d (Single x) =- xs `snocTree` a `snocTree` b `snocTree` c `snocTree` d `snocTree` x+ xs `snocTree` a `snocTree` b `snocTree` c `snocTree` d `snocTree` x appendTree4 (Deep s1 pr1 m1 sf1) a b c d (Deep s2 pr2 m2 sf2) =- Deep (s1 + size a + size b + size c + size d + s2) pr1 (addDigits4 m1 sf1 a b c d pr2 m2) sf2+ Deep (s1 + size a + size b + size c + size d + s2) pr1 (addDigits4 m1 sf1 a b c d pr2 m2) sf2 addDigits4 :: FingerTree (Node (Node a)) -> Digit (Node a) -> Node a -> Node a -> Node a -> Node a -> Digit (Node a) -> FingerTree (Node (Node a)) -> FingerTree (Node (Node a)) addDigits4 m1 (One a) b c d e (One f) m2 =- appendTree2 m1 (node3 a b c) (node3 d e f) m2+ appendTree2 m1 (node3 a b c) (node3 d e f) m2 addDigits4 m1 (One a) b c d e (Two f g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits4 m1 (One a) b c d e (Three f g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits4 m1 (One a) b c d e (Four f g h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits4 m1 (Two a b) c d e f (One g) m2 =- appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2+ appendTree3 m1 (node3 a b c) (node2 d e) (node2 f g) m2 addDigits4 m1 (Two a b) c d e f (Two g h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits4 m1 (Two a b) c d e f (Three g h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits4 m1 (Two a b) c d e f (Four g h i j) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2 addDigits4 m1 (Three a b c) d e f g (One h) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node2 g h) m2 addDigits4 m1 (Three a b c) d e f g (Two h i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits4 m1 (Three a b c) d e f g (Three h i j) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2 addDigits4 m1 (Three a b c) d e f g (Four h i j k) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node2 j k) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node2 j k) m2 addDigits4 m1 (Four a b c d) e f g h (One i) m2 =- appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2+ appendTree3 m1 (node3 a b c) (node3 d e f) (node3 g h i) m2 addDigits4 m1 (Four a b c d) e f g h (Two i j) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node2 g h) (node2 i j) m2 addDigits4 m1 (Four a b c d) e f g h (Three i j k) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node2 j k) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node2 j k) m2 addDigits4 m1 (Four a b c d) e f g h (Four i j k l) m2 =- appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node3 j k l) m2+ appendTree4 m1 (node3 a b c) (node3 d e f) (node3 g h i) (node3 j k l) m2 ------------------------------------------------------------------------ -- Deconstruction ------------------------------------------------------------------------ -- | /O(1)/. Is this the empty sequence?-null :: Seq a -> Bool+null :: Seq a -> Bool null (Seq Empty) = True-null _ = False+null _ = False -- | /O(1)/. The number of elements in the sequence.-length :: Seq a -> Int+length :: Seq a -> Int length (Seq xs) = size xs -- Views@@ -524,10 +524,10 @@ -- | View of the left end of a sequence. data ViewL a- = EmptyL -- ^ empty sequence- | a :< Seq a -- ^ leftmost element and the rest of the sequence+ = EmptyL -- ^ empty sequence+ | a :< Seq a -- ^ leftmost element and the rest of the sequence #ifndef __HADDOCK__- deriving (Eq, Show)+ deriving (Eq, Show) #else instance Eq a => Eq (ViewL a) instance Show a => Show (ViewL a)@@ -535,79 +535,79 @@ instance Functor ViewL where- fmap _ EmptyL = EmptyL- fmap f (x :< xs) = f x :< fmap f xs+ fmap _ EmptyL = EmptyL+ fmap f (x :< xs) = f x :< fmap f xs -- | /O(1)/. Analyse the left end of a sequence.-viewl :: Seq a -> ViewL a-viewl (Seq xs) = case viewLTree xs of- Nothing2 -> EmptyL- Just2 (Elem x) xs' -> x :< Seq xs'+viewl :: Seq a -> ViewL a+viewl (Seq xs) = case viewLTree xs of+ Nothing2 -> EmptyL+ Just2 (Elem x) xs' -> x :< Seq xs' {-# SPECIALIZE viewLTree :: FingerTree (Elem a) -> Maybe2 (Elem a) (FingerTree (Elem a)) #-} {-# SPECIALIZE viewLTree :: FingerTree (Node a) -> Maybe2 (Node a) (FingerTree (Node a)) #-}-viewLTree :: Sized a => FingerTree a -> Maybe2 a (FingerTree a)-viewLTree Empty = Nothing2-viewLTree (Single a) = Just2 a Empty+viewLTree :: Sized a => FingerTree a -> Maybe2 a (FingerTree a)+viewLTree Empty = Nothing2+viewLTree (Single a) = Just2 a Empty viewLTree (Deep s (One a) m sf) = Just2 a (case viewLTree m of- Nothing2 -> digitToTree sf- Just2 b m' -> Deep (s - size a) (nodeToDigit b) m' sf)+ Nothing2 -> digitToTree sf+ Just2 b m' -> Deep (s - size a) (nodeToDigit b) m' sf) viewLTree (Deep s (Two a b) m sf) =- Just2 a (Deep (s - size a) (One b) m sf)+ Just2 a (Deep (s - size a) (One b) m sf) viewLTree (Deep s (Three a b c) m sf) =- Just2 a (Deep (s - size a) (Two b c) m sf)+ Just2 a (Deep (s - size a) (Two b c) m sf) viewLTree (Deep s (Four a b c d) m sf) =- Just2 a (Deep (s - size a) (Three b c d) m sf)+ Just2 a (Deep (s - size a) (Three b c d) m sf) -- | View of the right end of a sequence. data ViewR a- = EmptyR -- ^ empty sequence- | Seq a :> a -- ^ the sequence minus the rightmost element,- -- and the rightmost element+ = EmptyR -- ^ empty sequence+ | Seq a :> a -- ^ the sequence minus the rightmost element,+ -- and the rightmost element #ifndef __HADDOCK__- deriving (Eq, Show)+ deriving (Eq, Show) #else instance Eq a => Eq (ViewR a) instance Show a => Show (ViewR a) #endif instance Functor ViewR where- fmap _ EmptyR = EmptyR- fmap f (xs :> x) = fmap f xs :> f x+ fmap _ EmptyR = EmptyR+ fmap f (xs :> x) = fmap f xs :> f x -- | /O(1)/. Analyse the right end of a sequence.-viewr :: Seq a -> ViewR a-viewr (Seq xs) = case viewRTree xs of- Nothing2 -> EmptyR- Just2 xs' (Elem x) -> Seq xs' :> x+viewr :: Seq a -> ViewR a+viewr (Seq xs) = case viewRTree xs of+ Nothing2 -> EmptyR+ Just2 xs' (Elem x) -> Seq xs' :> x {-# SPECIALIZE viewRTree :: FingerTree (Elem a) -> Maybe2 (FingerTree (Elem a)) (Elem a) #-} {-# SPECIALIZE viewRTree :: FingerTree (Node a) -> Maybe2 (FingerTree (Node a)) (Node a) #-}-viewRTree :: Sized a => FingerTree a -> Maybe2 (FingerTree a) a-viewRTree Empty = Nothing2-viewRTree (Single z) = Just2 Empty z+viewRTree :: Sized a => FingerTree a -> Maybe2 (FingerTree a) a+viewRTree Empty = Nothing2+viewRTree (Single z) = Just2 Empty z viewRTree (Deep s pr m (One z)) = Just2 (case viewRTree m of- Nothing2 -> digitToTree pr- Just2 m' y -> Deep (s - size z) pr m' (nodeToDigit y)) z+ Nothing2 -> digitToTree pr+ Just2 m' y -> Deep (s - size z) pr m' (nodeToDigit y)) z viewRTree (Deep s pr m (Two y z)) =- Just2 (Deep (s - size z) pr m (One y)) z+ Just2 (Deep (s - size z) pr m (One y)) z viewRTree (Deep s pr m (Three x y z)) =- Just2 (Deep (s - size z) pr m (Two x y)) z+ Just2 (Deep (s - size z) pr m (Two x y)) z viewRTree (Deep s pr m (Four w x y z)) =- Just2 (Deep (s - size z) pr m (Three w x y)) z+ Just2 (Deep (s - size z) pr m (Three w x y)) z -- Indexing -- | /O(log(min(i,n-i)))/. The element at the specified position-index :: Seq a -> Int -> a+index :: Seq a -> Int -> a index (Seq xs) i | 0 <= i && i < size xs = case lookupTree (-i) xs of- Place _ (Elem x) -> x- | otherwise = error "index out of bounds"+ Place _ (Elem x) -> x+ | otherwise = error "index out of bounds" data Place a = Place {-# UNPACK #-} !Int a #if TESTING- deriving Show+ deriving Show #endif {-# SPECIALIZE lookupTree :: Int -> FingerTree (Elem a) -> Place (Elem a) #-}@@ -615,135 +615,135 @@ lookupTree :: Sized a => Int -> FingerTree a -> Place a lookupTree i (Single x) = Place i x lookupTree i (Deep _ pr m sf)- | vpr > 0 = lookupDigit i pr- | vm > 0 = case lookupTree vpr m of- Place i' xs -> lookupNode i' xs- | otherwise = lookupDigit vm sf- where vpr = i + size pr- vm = vpr + size m+ | vpr > 0 = lookupDigit i pr+ | vm > 0 = case lookupTree vpr m of+ Place i' xs -> lookupNode i' xs+ | otherwise = lookupDigit vm sf+ where vpr = i + size pr+ vm = vpr + size m {-# SPECIALIZE lookupNode :: Int -> Node (Elem a) -> Place (Elem a) #-} {-# SPECIALIZE lookupNode :: Int -> Node (Node a) -> Place (Node a) #-} lookupNode :: Sized a => Int -> Node a -> Place a lookupNode i (Node2 _ a b)- | va > 0 = Place i a- | otherwise = Place va b- where va = i + size a+ | va > 0 = Place i a+ | otherwise = Place va b+ where va = i + size a lookupNode i (Node3 _ a b c)- | va > 0 = Place i a- | vab > 0 = Place va b- | otherwise = Place vab c- where va = i + size a- vab = va + size b+ | va > 0 = Place i a+ | vab > 0 = Place va b+ | otherwise = Place vab c+ where va = i + size a+ vab = va + size b {-# SPECIALIZE lookupDigit :: Int -> Digit (Elem a) -> Place (Elem a) #-} {-# SPECIALIZE lookupDigit :: Int -> Digit (Node a) -> Place (Node a) #-} lookupDigit :: Sized a => Int -> Digit a -> Place a lookupDigit i (One a) = Place i a lookupDigit i (Two a b)- | va > 0 = Place i a- | otherwise = Place va b- where va = i + size a+ | va > 0 = Place i a+ | otherwise = Place va b+ where va = i + size a lookupDigit i (Three a b c)- | va > 0 = Place i a- | vab > 0 = Place va b- | otherwise = Place vab c- where va = i + size a- vab = va + size b+ | va > 0 = Place i a+ | vab > 0 = Place va b+ | otherwise = Place vab c+ where va = i + size a+ vab = va + size b lookupDigit i (Four a b c d)- | va > 0 = Place i a- | vab > 0 = Place va b- | vabc > 0 = Place vab c- | otherwise = Place vabc d- where va = i + size a- vab = va + size b- vabc = vab + size c+ | va > 0 = Place i a+ | vab > 0 = Place va b+ | vabc > 0 = Place vab c+ | otherwise = Place vabc d+ where va = i + size a+ vab = va + size b+ vabc = vab + size c -- | /O(log(min(i,n-i)))/. Replace the element at the specified position-update :: Int -> a -> Seq a -> Seq a-update i x = adjust (const x) i+update :: Int -> a -> Seq a -> Seq a+update i x = adjust (const x) i -- | /O(log(min(i,n-i)))/. Update the element at the specified position-adjust :: (a -> a) -> Int -> Seq a -> Seq a+adjust :: (a -> a) -> Int -> Seq a -> Seq a adjust f i (Seq xs) | 0 <= i && i < size xs = Seq (adjustTree (const (fmap f)) (-i) xs)- | otherwise = Seq xs+ | otherwise = Seq xs {-# SPECIALIZE adjustTree :: (Int -> Elem a -> Elem a) -> Int -> FingerTree (Elem a) -> FingerTree (Elem a) #-} {-# SPECIALIZE adjustTree :: (Int -> Node a -> Node a) -> Int -> FingerTree (Node a) -> FingerTree (Node a) #-}-adjustTree :: Sized a => (Int -> a -> a) ->- Int -> FingerTree a -> FingerTree a+adjustTree :: Sized a => (Int -> a -> a) ->+ Int -> FingerTree a -> FingerTree a adjustTree f i (Single x) = Single (f i x) adjustTree f i (Deep s pr m sf)- | vpr > 0 = Deep s (adjustDigit f i pr) m sf- | vm > 0 = Deep s pr (adjustTree (adjustNode f) vpr m) sf- | otherwise = Deep s pr m (adjustDigit f vm sf)- where vpr = i + size pr- vm = vpr + size m+ | vpr > 0 = Deep s (adjustDigit f i pr) m sf+ | vm > 0 = Deep s pr (adjustTree (adjustNode f) vpr m) sf+ | otherwise = Deep s pr m (adjustDigit f vm sf)+ where vpr = i + size pr+ vm = vpr + size m {-# SPECIALIZE adjustNode :: (Int -> Elem a -> Elem a) -> Int -> Node (Elem a) -> Node (Elem a) #-} {-# SPECIALIZE adjustNode :: (Int -> Node a -> Node a) -> Int -> Node (Node a) -> Node (Node a) #-}-adjustNode :: Sized a => (Int -> a -> a) -> Int -> Node a -> Node a+adjustNode :: Sized a => (Int -> a -> a) -> Int -> Node a -> Node a adjustNode f i (Node2 s a b)- | va > 0 = Node2 s (f i a) b- | otherwise = Node2 s a (f va b)- where va = i + size a+ | va > 0 = Node2 s (f i a) b+ | otherwise = Node2 s a (f va b)+ where va = i + size a adjustNode f i (Node3 s a b c)- | va > 0 = Node3 s (f i a) b c- | vab > 0 = Node3 s a (f va b) c- | otherwise = Node3 s a b (f vab c)- where va = i + size a- vab = va + size b+ | va > 0 = Node3 s (f i a) b c+ | vab > 0 = Node3 s a (f va b) c+ | otherwise = Node3 s a b (f vab c)+ where va = i + size a+ vab = va + size b {-# SPECIALIZE adjustDigit :: (Int -> Elem a -> Elem a) -> Int -> Digit (Elem a) -> Digit (Elem a) #-} {-# SPECIALIZE adjustDigit :: (Int -> Node a -> Node a) -> Int -> Digit (Node a) -> Digit (Node a) #-}-adjustDigit :: Sized a => (Int -> a -> a) -> Int -> Digit a -> Digit a+adjustDigit :: Sized a => (Int -> a -> a) -> Int -> Digit a -> Digit a adjustDigit f i (One a) = One (f i a) adjustDigit f i (Two a b)- | va > 0 = Two (f i a) b- | otherwise = Two a (f va b)- where va = i + size a+ | va > 0 = Two (f i a) b+ | otherwise = Two a (f va b)+ where va = i + size a adjustDigit f i (Three a b c)- | va > 0 = Three (f i a) b c- | vab > 0 = Three a (f va b) c- | otherwise = Three a b (f vab c)- where va = i + size a- vab = va + size b+ | va > 0 = Three (f i a) b c+ | vab > 0 = Three a (f va b) c+ | otherwise = Three a b (f vab c)+ where va = i + size a+ vab = va + size b adjustDigit f i (Four a b c d)- | va > 0 = Four (f i a) b c d- | vab > 0 = Four a (f va b) c d- | vabc > 0 = Four a b (f vab c) d- | otherwise = Four a b c (f vabc d)- where va = i + size a- vab = va + size b- vabc = vab + size c+ | va > 0 = Four (f i a) b c d+ | vab > 0 = Four a (f va b) c d+ | vabc > 0 = Four a b (f vab c) d+ | otherwise = Four a b c (f vabc d)+ where va = i + size a+ vab = va + size b+ vabc = vab + size c -- Splitting -- | /O(log(min(i,n-i)))/. The first @i@ elements of a sequence.-take :: Int -> Seq a -> Seq a-take i = fst . splitAt i+take :: Int -> Seq a -> Seq a+take i = fst . splitAt i -- | /O(log(min(i,n-i)))/. Elements of sequence after the first @i@.-drop :: Int -> Seq a -> Seq a-drop i = snd . splitAt i+drop :: Int -> Seq a -> Seq a+drop i = snd . splitAt i -- | /O(log(min(i,n-i)))/. Split a sequence at a given position.-splitAt :: Int -> Seq a -> (Seq a, Seq a)-splitAt i (Seq xs) = (Seq l, Seq r)- where (l, r) = split i xs+splitAt :: Int -> Seq a -> (Seq a, Seq a)+splitAt i (Seq xs) = (Seq l, Seq r)+ where (l, r) = split i xs split :: Int -> FingerTree (Elem a) ->- (FingerTree (Elem a), FingerTree (Elem a))-split i Empty = i `seq` (Empty, Empty)+ (FingerTree (Elem a), FingerTree (Elem a))+split i Empty = i `seq` (Empty, Empty) split i xs- | size xs > i = (l, consTree x r)- | otherwise = (xs, Empty)+ | size xs > i = (l, consTree x r)+ | otherwise = (xs, Empty) where Split l x r = splitTree (-i) xs data Split t a = Split t a t #if TESTING- deriving Show+ deriving Show #endif {-# SPECIALIZE splitTree :: Int -> FingerTree (Elem a) -> Split (FingerTree (Elem a)) (Elem a) #-}@@ -751,80 +751,80 @@ splitTree :: Sized a => Int -> FingerTree a -> Split (FingerTree a) a splitTree i (Single x) = i `seq` Split Empty x Empty splitTree i (Deep _ pr m sf)- | vpr > 0 = case splitDigit i pr of- Split l x r -> Split (maybe Empty digitToTree l) x (deepL r m sf)- | vm > 0 = case splitTree vpr m of- Split ml xs mr -> case splitNode (vpr + size ml) xs of- Split l x r -> Split (deepR pr ml l) x (deepL r mr sf)- | otherwise = case splitDigit vm sf of- Split l x r -> Split (deepR pr m l) x (maybe Empty digitToTree r)- where vpr = i + size pr- vm = vpr + size m+ | vpr > 0 = case splitDigit i pr of+ Split l x r -> Split (maybe Empty digitToTree l) x (deepL r m sf)+ | vm > 0 = case splitTree vpr m of+ Split ml xs mr -> case splitNode (vpr + size ml) xs of+ Split l x r -> Split (deepR pr ml l) x (deepL r mr sf)+ | otherwise = case splitDigit vm sf of+ Split l x r -> Split (deepR pr m l) x (maybe Empty digitToTree r)+ where vpr = i + size pr+ vm = vpr + size m {-# SPECIALIZE deepL :: Maybe (Digit (Elem a)) -> FingerTree (Node (Elem a)) -> Digit (Elem a) -> FingerTree (Elem a) #-} {-# SPECIALIZE deepL :: Maybe (Digit (Node a)) -> FingerTree (Node (Node a)) -> Digit (Node a) -> FingerTree (Node a) #-} deepL :: Sized a => Maybe (Digit a) -> FingerTree (Node a) -> Digit a -> FingerTree a-deepL Nothing m sf = case viewLTree m of- Nothing2 -> digitToTree sf- Just2 a m' -> deep (nodeToDigit a) m' sf-deepL (Just pr) m sf = deep pr m sf+deepL Nothing m sf = case viewLTree m of+ Nothing2 -> digitToTree sf+ Just2 a m' -> deep (nodeToDigit a) m' sf+deepL (Just pr) m sf = deep pr m sf {-# SPECIALIZE deepR :: Digit (Elem a) -> FingerTree (Node (Elem a)) -> Maybe (Digit (Elem a)) -> FingerTree (Elem a) #-} {-# SPECIALIZE deepR :: Digit (Node a) -> FingerTree (Node (Node a)) -> Maybe (Digit (Node a)) -> FingerTree (Node a) #-} deepR :: Sized a => Digit a -> FingerTree (Node a) -> Maybe (Digit a) -> FingerTree a-deepR pr m Nothing = case viewRTree m of- Nothing2 -> digitToTree pr- Just2 m' a -> deep pr m' (nodeToDigit a)-deepR pr m (Just sf) = deep pr m sf+deepR pr m Nothing = case viewRTree m of+ Nothing2 -> digitToTree pr+ Just2 m' a -> deep pr m' (nodeToDigit a)+deepR pr m (Just sf) = deep pr m sf {-# SPECIALIZE splitNode :: Int -> Node (Elem a) -> Split (Maybe (Digit (Elem a))) (Elem a) #-} {-# SPECIALIZE splitNode :: Int -> Node (Node a) -> Split (Maybe (Digit (Node a))) (Node a) #-} splitNode :: Sized a => Int -> Node a -> Split (Maybe (Digit a)) a splitNode i (Node2 _ a b)- | va > 0 = Split Nothing a (Just (One b))- | otherwise = Split (Just (One a)) b Nothing- where va = i + size a+ | va > 0 = Split Nothing a (Just (One b))+ | otherwise = Split (Just (One a)) b Nothing+ where va = i + size a splitNode i (Node3 _ a b c)- | va > 0 = Split Nothing a (Just (Two b c))- | vab > 0 = Split (Just (One a)) b (Just (One c))- | otherwise = Split (Just (Two a b)) c Nothing- where va = i + size a- vab = va + size b+ | va > 0 = Split Nothing a (Just (Two b c))+ | vab > 0 = Split (Just (One a)) b (Just (One c))+ | otherwise = Split (Just (Two a b)) c Nothing+ where va = i + size a+ vab = va + size b {-# SPECIALIZE splitDigit :: Int -> Digit (Elem a) -> Split (Maybe (Digit (Elem a))) (Elem a) #-} {-# SPECIALIZE splitDigit :: Int -> Digit (Node a) -> Split (Maybe (Digit (Node a))) (Node a) #-} splitDigit :: Sized a => Int -> Digit a -> Split (Maybe (Digit a)) a splitDigit i (One a) = i `seq` Split Nothing a Nothing splitDigit i (Two a b)- | va > 0 = Split Nothing a (Just (One b))- | otherwise = Split (Just (One a)) b Nothing- where va = i + size a+ | va > 0 = Split Nothing a (Just (One b))+ | otherwise = Split (Just (One a)) b Nothing+ where va = i + size a splitDigit i (Three a b c)- | va > 0 = Split Nothing a (Just (Two b c))- | vab > 0 = Split (Just (One a)) b (Just (One c))- | otherwise = Split (Just (Two a b)) c Nothing- where va = i + size a- vab = va + size b+ | va > 0 = Split Nothing a (Just (Two b c))+ | vab > 0 = Split (Just (One a)) b (Just (One c))+ | otherwise = Split (Just (Two a b)) c Nothing+ where va = i + size a+ vab = va + size b splitDigit i (Four a b c d)- | va > 0 = Split Nothing a (Just (Three b c d))- | vab > 0 = Split (Just (One a)) b (Just (Two c d))- | vabc > 0 = Split (Just (Two a b)) c (Just (One d))- | otherwise = Split (Just (Three a b c)) d Nothing- where va = i + size a- vab = va + size b- vabc = vab + size c+ | va > 0 = Split Nothing a (Just (Three b c d))+ | vab > 0 = Split (Just (One a)) b (Just (Two c d))+ | vabc > 0 = Split (Just (Two a b)) c (Just (One d))+ | otherwise = Split (Just (Three a b c)) d Nothing+ where va = i + size a+ vab = va + size b+ vabc = vab + size c ------------------------------------------------------------------------ -- Lists ------------------------------------------------------------------------ -- | /O(n)/. Create a sequence from a finite list of elements.-fromList :: [a] -> Seq a-fromList = Data.List.foldl' (|>) empty+fromList :: [a] -> Seq a+fromList = Data.List.foldl' (|>) empty -- | /O(n)/. List of elements of the sequence.-toList :: Seq a -> [a]-toList = foldr (:) []+toList :: Seq a -> [a]+toList = foldr (:) [] ------------------------------------------------------------------------ -- Folds@@ -840,7 +840,7 @@ foldrTree _ z Empty = z foldrTree f z (Single x) = x `f` z foldrTree f z (Deep _ pr m sf) =- foldrDigit f (foldrTree (flip (foldrNode f)) (foldrDigit f z sf) m) pr+ foldrDigit f (foldrTree (flip (foldrNode f)) (foldrDigit f z sf) m) pr foldrDigit :: (a -> b -> b) -> b -> Digit a -> b foldrDigit f z (One a) = a `f` z@@ -862,7 +862,7 @@ foldr1Tree _ Empty = error "foldr1: empty sequence" foldr1Tree _ (Single x) = x foldr1Tree f (Deep _ pr m sf) =- foldrDigit f (foldrTree (flip (foldrNode f)) (foldr1Digit f sf) m) pr+ foldrDigit f (foldrTree (flip (foldrNode f)) (foldr1Digit f sf) m) pr foldr1Digit :: (a -> a -> a) -> Digit a -> a foldr1Digit f (One a) = a@@ -880,7 +880,7 @@ foldlTree _ z Empty = z foldlTree f z (Single x) = z `f` x foldlTree f z (Deep _ pr m sf) =- foldlDigit f (foldlTree (foldlNode f) (foldlDigit f z pr) m) sf+ foldlDigit f (foldlTree (foldlNode f) (foldlDigit f z pr) m) sf foldlDigit :: (a -> b -> a) -> a -> Digit b -> a foldlDigit f z (One a) = z `f` a@@ -902,7 +902,7 @@ foldl1Tree _ Empty = error "foldl1: empty sequence" foldl1Tree _ (Single x) = x foldl1Tree f (Deep _ pr m sf) =- foldlDigit f (foldlTree (foldlNode f) (foldl1Digit f pr) m) sf+ foldlDigit f (foldlTree (foldlNode f) (foldl1Digit f pr) m) sf foldl1Digit :: (a -> a -> a) -> Digit a -> a foldl1Digit f (One a) = a@@ -950,9 +950,9 @@ reverseTree _ Empty = Empty reverseTree f (Single x) = Single (f x) reverseTree f (Deep s pr m sf) =- Deep s (reverseDigit f sf)- (reverseTree (reverseNode f) m)- (reverseDigit f pr)+ Deep s (reverseDigit f sf)+ (reverseTree (reverseNode f) m)+ (reverseDigit f pr) reverseDigit :: (a -> a) -> Digit a -> Digit a reverseDigit f (One a) = One (f a)@@ -971,76 +971,76 @@ ------------------------------------------------------------------------ instance Arbitrary a => Arbitrary (Seq a) where- arbitrary = liftM Seq arbitrary- coarbitrary (Seq x) = coarbitrary x+ arbitrary = liftM Seq arbitrary+ coarbitrary (Seq x) = coarbitrary x instance Arbitrary a => Arbitrary (Elem a) where- arbitrary = liftM Elem arbitrary- coarbitrary (Elem x) = coarbitrary x+ arbitrary = liftM Elem arbitrary+ coarbitrary (Elem x) = coarbitrary x instance (Arbitrary a, Sized a) => Arbitrary (FingerTree a) where- arbitrary = sized arb- where arb :: (Arbitrary a, Sized a) => Int -> Gen (FingerTree a)- arb 0 = return Empty- arb 1 = liftM Single arbitrary- arb n = liftM3 deep arbitrary (arb (n `div` 2)) arbitrary+ arbitrary = sized arb+ where arb :: (Arbitrary a, Sized a) => Int -> Gen (FingerTree a)+ arb 0 = return Empty+ arb 1 = liftM Single arbitrary+ arb n = liftM3 deep arbitrary (arb (n `div` 2)) arbitrary - coarbitrary Empty = variant 0- coarbitrary (Single x) = variant 1 . coarbitrary x- coarbitrary (Deep _ pr m sf) =- variant 2 . coarbitrary pr . coarbitrary m . coarbitrary sf+ coarbitrary Empty = variant 0+ coarbitrary (Single x) = variant 1 . coarbitrary x+ coarbitrary (Deep _ pr m sf) =+ variant 2 . coarbitrary pr . coarbitrary m . coarbitrary sf instance (Arbitrary a, Sized a) => Arbitrary (Node a) where- arbitrary = oneof [- liftM2 node2 arbitrary arbitrary,- liftM3 node3 arbitrary arbitrary arbitrary]+ arbitrary = oneof [+ liftM2 node2 arbitrary arbitrary,+ liftM3 node3 arbitrary arbitrary arbitrary] - coarbitrary (Node2 _ a b) = variant 0 . coarbitrary a . coarbitrary b- coarbitrary (Node3 _ a b c) =- variant 1 . coarbitrary a . coarbitrary b . coarbitrary c+ coarbitrary (Node2 _ a b) = variant 0 . coarbitrary a . coarbitrary b+ coarbitrary (Node3 _ a b c) =+ variant 1 . coarbitrary a . coarbitrary b . coarbitrary c instance Arbitrary a => Arbitrary (Digit a) where- arbitrary = oneof [- liftM One arbitrary,- liftM2 Two arbitrary arbitrary,- liftM3 Three arbitrary arbitrary arbitrary,- liftM4 Four arbitrary arbitrary arbitrary arbitrary]+ arbitrary = oneof [+ liftM One arbitrary,+ liftM2 Two arbitrary arbitrary,+ liftM3 Three arbitrary arbitrary arbitrary,+ liftM4 Four arbitrary arbitrary arbitrary arbitrary] - coarbitrary (One a) = variant 0 . coarbitrary a- coarbitrary (Two a b) = variant 1 . coarbitrary a . coarbitrary b- coarbitrary (Three a b c) =- variant 2 . coarbitrary a . coarbitrary b . coarbitrary c- coarbitrary (Four a b c d) =- variant 3 . coarbitrary a . coarbitrary b . coarbitrary c . coarbitrary d+ coarbitrary (One a) = variant 0 . coarbitrary a+ coarbitrary (Two a b) = variant 1 . coarbitrary a . coarbitrary b+ coarbitrary (Three a b c) =+ variant 2 . coarbitrary a . coarbitrary b . coarbitrary c+ coarbitrary (Four a b c d) =+ variant 3 . coarbitrary a . coarbitrary b . coarbitrary c . coarbitrary d ------------------------------------------------------------------------ -- Valid trees ------------------------------------------------------------------------ class Valid a where- valid :: a -> Bool+ valid :: a -> Bool instance Valid (Elem a) where- valid _ = True+ valid _ = True instance Valid (Seq a) where- valid (Seq xs) = valid xs+ valid (Seq xs) = valid xs instance (Sized a, Valid a) => Valid (FingerTree a) where- valid Empty = True- valid (Single x) = valid x- valid (Deep s pr m sf) =- s == size pr + size m + size sf && valid pr && valid m && valid sf+ valid Empty = True+ valid (Single x) = valid x+ valid (Deep s pr m sf) =+ s == size pr + size m + size sf && valid pr && valid m && valid sf instance (Sized a, Valid a) => Valid (Node a) where- valid (Node2 s a b) = s == size a + size b && valid a && valid b- valid (Node3 s a b c) =- s == size a + size b + size c && valid a && valid b && valid c+ valid (Node2 s a b) = s == size a + size b && valid a && valid b+ valid (Node3 s a b c) =+ s == size a + size b + size c && valid a && valid b && valid c instance Valid a => Valid (Digit a) where- valid (One a) = valid a- valid (Two a b) = valid a && valid b- valid (Three a b c) = valid a && valid b && valid c- valid (Four a b c d) = valid a && valid b && valid c && valid d+ valid (One a) = valid a+ valid (Two a b) = valid a && valid b+ valid (Three a b c) = valid a && valid b && valid c+ valid (Four a b c d) = valid a && valid b && valid c && valid d #endif
Graphics/UI/Gtk/ModelView/TreeDrag.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP, OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Interface DragSource and DragDest --@@ -56,11 +57,12 @@ -- so easy in Gtk2Hs, I think we can do without the cheat way. import System.Glib.FFI+import System.Glib.UTFString import System.Glib.GObject {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.ModelView.Types#} (TreePath, fromTreePath, withTreePath, NativeTreePath(..))-import Graphics.UI.Gtk.General.DNDTypes (SelectionDataM, SelectionData,+import Graphics.UI.Gtk.General.DNDTypes (SelectionDataM, TargetTag, atomNew) import Control.Monad (liftM) import Control.Monad.Trans (liftIO)@@ -83,7 +85,7 @@ -- 'Graphics.UI.Gtk.General.Selection.InfoId' of @0@. -- targetTreeModelRow :: TargetTag-targetTreeModelRow = unsafePerformIO $ atomNew "GTK_TREE_MODEL_ROW"+targetTreeModelRow = unsafePerformIO $ atomNew ("GTK_TREE_MODEL_ROW"::DefaultGlibString) -- %hash c:8dcb d:af3f -- | Obtains a 'TreeModel' and a path from 'SelectionDataM' whenever the target is@@ -112,6 +114,6 @@ treeSetRowDragData treeModel path = do selPtr <- ask liftM toBool $ liftIO $ withTreePath path $ \path ->- {# call unsafe gtk_tree_set_row_drag_data #} selPtr + {# call unsafe gtk_tree_set_row_drag_data #} selPtr (toTreeModel treeModel) path
Graphics/UI/Gtk/ModelView/TreeModel.chs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE Rank2Types #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) TreeModel --@@ -27,7 +28,7 @@ -- module Graphics.UI.Gtk.ModelView.TreeModel ( -- * Detail--- +-- -- | The 'TreeModel' interface defines a generic storage object for use by the -- 'TreeView' and similar widgets. Specifically, the functions in defined here -- are used by Gtk's widgets to access the stored data. Thus, rather than@@ -105,7 +106,7 @@ TypedTreeModel, TypedTreeModelClass, toTypedTreeModel,- + TreeIter(..), TreePath, @@ -154,18 +155,15 @@ ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Flags (toFlags)+import System.Glib.Flags (toFlags) import System.Glib.UTFString {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.Types#}-import System.Glib.StoreValue (TMType, GenericValue,- valueGetGenericValue)-{#import System.Glib.GValue#} (GValue(GValue), allocaGValue)-{#import Graphics.UI.Gtk.ModelView.CustomStore#} (TreeModelFlags(..),- treeModelGetRow)+{#import System.Glib.GValue#} (GValue(GValue), allocaGValue)+{#import Graphics.UI.Gtk.ModelView.CustomStore#} (TreeModelFlags(..)) {#import Graphics.UI.Gtk.ModelView.Types#} (TypedTreeModel, TypedTreeModelClass, toTypedTreeModel,@@ -197,7 +195,7 @@ makeColumnIdBool = ColumnId valueGetBool CABool -- | Create a 'ColumnId' to extract an string.-makeColumnIdString :: Int -> ColumnId row String+makeColumnIdString :: GlibString string => Int -> ColumnId row string makeColumnIdString = ColumnId valueGetString CAString -- | Create a 'ColumnId' to extract an 'Pixbuf'.@@ -219,8 +217,8 @@ instance Show (ColumnId row ty) where show (ColumnId _ _ i) = show i- + -------------------- -- Methods @@ -242,8 +240,8 @@ -- * Returns @Nothing@ if the string is not a colon separated list of numbers -- that references a valid node. ---treeModelGetIterFromString :: TreeModelClass self => self- -> String -- ^ @pathString@ - A string representation of a 'TreePath'.+treeModelGetIterFromString :: (TreeModelClass self, GlibString string) => self+ -> string -- ^ @pathString@ - A string representation of a 'TreePath'. -> IO (Maybe TreeIter) treeModelGetIterFromString self pathString = receiveTreeIter $ \iterPtr ->@@ -313,7 +311,7 @@ iterPtr (fromIntegral colId) gVal- getter gVal + getter gVal -- %hash c:5c12 d:d7db -- | Retrieve an iterator to the node following it at the current level. If@@ -427,7 +425,7 @@ {#pointer TreeModelForeachFunc#} foreign import ccall "wrapper" mkTreeModelForeachFunc ::- (Ptr () -> Ptr () -> Ptr TreeIter -> Ptr () -> IO CInt) ->+ (Ptr TreeModel -> Ptr NativeTreePath -> Ptr TreeIter -> Ptr () -> IO CInt) -> IO TreeModelForeachFunc #if GTK_CHECK_VERSION(2,2,0)@@ -438,9 +436,9 @@ -- -- * Available since Gtk+ version 2.2 ---treeModelGetStringFromIter :: TreeModelClass self => self+treeModelGetStringFromIter :: (TreeModelClass self, GlibString string) => self -> TreeIter -- ^ @iter@ - An 'TreeIter'.- -> IO String -- ^ the returned string representation+ -> IO string -- ^ the returned string representation treeModelGetStringFromIter self iter = with iter $ \iter -> {# call gtk_tree_model_get_string_from_iter #} (toTreeModel self)@@ -582,11 +580,11 @@ -> TreePath -- ^ @path@ - A 'TreePath' pointing to the tree node whose -- children have been reordered -> Maybe TreeIter -- ^ @iter@ - A valid 'TreeIter' pointing to the node whose- -- children have been reordered, or @Nothing@ if + -- children have been reordered, or @Nothing@ if -- @path@ is @[]@. -> [Int] -- ^ @newOrder@ - a list of integers giving the previous position -- of each node at this hierarchy level.- + -> IO () treeModelRowsReordered self path iter array = do n <- treeModelIterNChildren self iter@@ -610,21 +608,21 @@ -- | This signal is emitted when a row in the model has changed. -- rowChanged :: TreeModelClass self => Signal self (TreePath -> TreeIter -> IO ())-rowChanged = Signal (connect_BOXED_BOXED__NONE "row_changed" peekTreePath peekTreeIter)+rowChanged = Signal (connect_BOXED_BOXED__NONE "row-changed" peekTreePath peekTreeIter) -- %hash c:f31a d:3c6b -- | This signal is emitted when a new row has been inserted in the model. -- -- rowInserted :: TreeModelClass self => Signal self (TreePath -> TreeIter -> IO ())-rowInserted = Signal (connect_BOXED_BOXED__NONE "row_inserted" peekTreePath peekTreeIter)+rowInserted = Signal (connect_BOXED_BOXED__NONE "row-inserted" peekTreePath peekTreeIter) -- %hash c:7279 d:5ef -- | This signal is emitted when a row has gotten the first child row or lost -- its last child row. -- rowHasChildToggled :: TreeModelClass self => Signal self (TreePath -> TreeIter -> IO ())-rowHasChildToggled = Signal (connect_BOXED_BOXED__NONE "row_has_child_toggled" peekTreePath peekTreeIter)+rowHasChildToggled = Signal (connect_BOXED_BOXED__NONE "row-has-child-toggled" peekTreePath peekTreeIter) -- %hash c:f669 d:367f -- | This signal is emitted when a row has been deleted.@@ -638,7 +636,7 @@ -- need to be released in the 'rowDeleted' handler. -- rowDeleted :: TreeModelClass self => Signal self (TreePath -> IO ())-rowDeleted = Signal (connect_BOXED__NONE "row_deleted" peekTreePath)+rowDeleted = Signal (connect_BOXED__NONE "row-deleted" peekTreePath) -- %hash c:46dd d:b2e5 -- | This signal is emitted when the children of a node in the 'TreeModel'@@ -651,7 +649,7 @@ rowsReordered :: TreeModelClass self => Signal self (TreePath -> Maybe TreeIter -> [Int] -> IO ()) rowsReordered = Signal $ \after model user ->- connect_BOXED_BOXED_PTR__NONE "rows_reordered" peekTreePath+ connect_BOXED_BOXED_PTR__NONE "rows-reordered" peekTreePath (maybePeek peekTreeIter) after model $ \path iter arrayPtr -> do n <- treeModelIterNChildren model iter -- hopefully the model is never buggy, otherwise this can segfault
Graphics/UI/Gtk/ModelView/TreeModelFilter.chs view
@@ -50,11 +50,13 @@ -- @ -- | 'GObject' -- | +----TreeModelFilter+-- | +----TypedTreeModelFilter -- @ #if GTK_CHECK_VERSION(2,4,0) -- * Types TreeModelFilter,+ TypedTreeModelFilter, TreeModelFilterClass, castToTreeModelFilter, gTypeTreeModelFilter, toTreeModelFilter,@@ -79,15 +81,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.GObject (constructNewGObject) import System.Glib.Attributes import System.Glib.Properties {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.ModelView.TreeModel#}-{#import Graphics.UI.Gtk.ModelView.CustomStore#} {#import Graphics.UI.Gtk.ModelView.Types#} {# context lib="gtk" prefix="gtk" #}@@ -116,14 +116,14 @@ -> IO (TypedTreeModelFilter row) treeModelFilterNew childModel [] = liftM unsafeTreeModelFilterToGeneric $- constructNewGObject mkTreeModelFilter $ + wrapNewGObject mkTreeModelFilter $ liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) $ {# call gtk_tree_model_filter_new #} (toTreeModel childModel) (NativeTreePath nullPtr) treeModelFilterNew childModel root = liftM unsafeTreeModelFilterToGeneric $- constructNewGObject mkTreeModelFilter $ + wrapNewGObject mkTreeModelFilter $ liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelFilter) $ withTreePath root $ \root -> {# call gtk_tree_model_filter_new #}@@ -148,13 +148,9 @@ -- up to date. -- treeModelFilterSetVisibleFunc :: TreeModelFilterClass self => self- -> Maybe (TreeIter -> IO Bool) -- ^ @func@ - The visible function or- -- @Nothing@ to reset this function.+ -> (TreeIter -> IO Bool) -- ^ @func@ - The visible function -> IO ()-treeModelFilterSetVisibleFunc self Nothing =- {# call gtk_tree_model_filter_set_visible_func #}- (toTreeModelFilter self) nullFunPtr nullPtr nullFunPtr-treeModelFilterSetVisibleFunc self (Just func) = do+treeModelFilterSetVisibleFunc self func = do funcPtr <- mkTreeModelFilterVisibleFunc $ \_ tiPtr _ -> do ti <- peekTreeIter tiPtr liftM fromBool $ func ti@@ -164,7 +160,7 @@ {#pointer TreeModelFilterVisibleFunc #} foreign import ccall "wrapper" mkTreeModelFilterVisibleFunc ::- (Ptr TreeModelFilter -> Ptr TreeIter -> Ptr () -> IO {#type gboolean#}) ->+ (Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO {#type gboolean#}) -> IO TreeModelFilterVisibleFunc -- %hash c:a56d d:b42e@@ -172,7 +168,7 @@ -- should look for visibility information. A row containing @True@ means -- that this row should be shown. ---treeModelFilterSetVisibleColumn :: +treeModelFilterSetVisibleColumn :: (TreeModelFilterClass (self row), TypedTreeModelClass self) => self row@@ -202,7 +198,7 @@ -> TreeIter -> IO TreeIter treeModelFilterConvertChildIterToIter self childIter =- with childIter $ \childIterPtr -> + with childIter $ \childIterPtr -> alloca $ \filterIterPtr -> do {# call tree_model_filter_convert_child_iter_to_iter #} (toTreeModelFilter self)@@ -298,6 +294,6 @@ -- treeModelFilterVirtualRoot :: TreeModelFilterClass self => ReadAttr self TreePath treeModelFilterVirtualRoot = readAttrFromBoxedOpaqueProperty (peekTreePath . castPtr)- "virtual-root" + "virtual-root" {#call pure unsafe gtk_tree_path_get_type#} #endif
Graphics/UI/Gtk/ModelView/TreeModelSort.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.ModelView.TreeModelSort ( -- * Detail--- +-- -- | The 'TreeModelSort' is a model which implements the 'TreeSortable' -- interface. It does not hold any data itself, but rather is created with a -- child model and proxies its data. It has identical rows to its@@ -66,11 +66,9 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.GObject (constructNewGObject,- makeNewGObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.ModelView.TreeModel#} {#import Graphics.UI.Gtk.ModelView.Types#}@@ -95,7 +93,7 @@ TypedTreeModelClass childModel) => childModel row -> IO (TypedTreeModelSort row) treeModelSortNewWithModel childModel = liftM unsafeTreeModelSortToGeneric $- constructNewGObject mkTreeModelSort $+ wrapNewGObject mkTreeModelSort $ liftM (castPtr :: Ptr TreeModel -> Ptr TreeModelSort) $ {# call tree_model_sort_new_with_model #} (toTreeModel childModel)@@ -150,7 +148,7 @@ -> TreeIter -> IO TreeIter treeModelSortConvertChildIterToIter self childIter =- with childIter $ \childIterPtr -> + with childIter $ \childIterPtr -> alloca $ \sortIterPtr -> do {# call tree_model_sort_convert_child_iter_to_iter #} (toTreeModelSort self)
Graphics/UI/Gtk/ModelView/TreeRowReference.chs view
@@ -44,7 +44,7 @@ treeRowReferenceValid, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI {#import Graphics.UI.Gtk.Types#}@@ -68,7 +68,7 @@ -> TreePath -> IO (Maybe TreeRowReference) treeRowReferenceNew self path = withTreePath path $ \path -> do- rowRefPtr <- + rowRefPtr <- {#call gtk_tree_row_reference_new#} (toTreeModel self) path if rowRefPtr==nullPtr then return Nothing else liftM (Just . TreeRowReference) $
Graphics/UI/Gtk/ModelView/TreeSelection.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.ModelView.TreeSelection ( -- * Detail--- +-- -- | The 'TreeSelection' object is a helper object to manage the selection for -- a 'TreeView' widget. The 'TreeSelection' object is automatically created -- when a new 'TreeView' widget is created, and cannot exist independentally of@@ -95,17 +95,21 @@ treeSelectionMode, -- * Signals+ treeSelectionSelectionChanged,++#ifndef DISABLE_DEPRECATED+-- * Deprecated onSelectionChanged, afterSelectionChanged+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.GList (fromGList) import System.Glib.Attributes-import System.Glib.GObject (destroyFunPtr)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.UI.Gtk.General.Enums (SelectionMode(..))@@ -146,7 +150,7 @@ treeSelectionSetSelectFunction :: TreeSelectionClass self => self -> TreeSelectionCB -> IO () treeSelectionSetSelectFunction ts fun = do- fPtr <- mkTreeSelectionFunc (\_ _ tp _ -> do+ fPtr <- mkTreeSelectionFunc (\_ _ tp _ _ -> do path <- peekTreePath (castPtr tp) liftM fromBool $ fun path )@@ -156,14 +160,14 @@ (castFunPtrToPtr fPtr) destroyFunPtr --- | Callback type for a function that is called everytime the selection+-- | Callback type for a function that is called every time the selection -- changes. This function is set with 'treeSelectionSetSelectFunction'. -- type TreeSelectionCB = TreePath -> IO Bool {#pointer TreeSelectionFunc#} foreign import ccall "wrapper" mkTreeSelectionFunc ::- (Ptr () -> Ptr () -> Ptr TreePath -> Ptr () -> IO CInt)->+ (Ptr TreeSelection -> Ptr TreeModel -> Ptr NativeTreePath -> {#type gint#} -> Ptr () -> IO CInt)-> IO TreeSelectionFunc -- | Retrieve the 'TreeView' widget that this 'TreeSelection' works on.@@ -194,7 +198,7 @@ -> TreeSelectionForeachCB -> IO () treeSelectionSelectedForeach self fun = do- fPtr <- mkTreeSelectionForeachFunc (\_ _ iterPtr -> do+ fPtr <- mkTreeSelectionForeachFunc (\_ _ iterPtr _ -> do -- make a deep copy of the iterator. This makes it possible to store this -- iterator in Haskell land somewhere. The TreeModel parameter is not -- passed to the function due to performance reasons. But since it is@@ -214,7 +218,7 @@ {#pointer TreeSelectionForeachFunc#} foreign import ccall "wrapper" mkTreeSelectionForeachFunc ::- (Ptr () -> Ptr () -> Ptr TreeIter -> IO ()) -> IO TreeSelectionForeachFunc+ (Ptr TreeModel -> Ptr NativeTreePath -> Ptr TreeIter -> Ptr () -> IO ()) -> IO TreeSelectionForeachFunc #if GTK_CHECK_VERSION(2,2,0) -- | Creates a list of paths of all selected rows.@@ -228,7 +232,7 @@ -- treeSelectionGetSelectedRows :: TreeSelectionClass self => self -> IO [TreePath] -- ^ returns a list containing a 'TreePath' for- -- each selected row.+ -- each selected row. treeSelectionGetSelectedRows self = {# call gtk_tree_selection_get_selected_rows #} (toTreeSelection self)@@ -278,7 +282,7 @@ treeSelectionPathIsSelected self path = liftM toBool $ withTreePath path $ \path ->- {# call unsafe tree_selection_path_is_selected #}+ {# call tree_selection_path_is_selected #} (toTreeSelection self) path @@ -308,7 +312,7 @@ treeSelectionIterIsSelected self iter = liftM toBool $ with iter $ \iterPtr ->- {# call unsafe tree_selection_iter_is_selected #}+ {# call tree_selection_iter_is_selected #} (toTreeSelection self) iterPtr @@ -379,8 +383,16 @@ -- rows are selected, and it may occasionally be emitted when nothing has -- happened. --+treeSelectionSelectionChanged :: TreeSelectionClass self => Signal self (IO ())+treeSelectionSelectionChanged = Signal (connect_NONE__NONE "changed")++#ifndef DISABLE_DEPRECATED+--------------------+-- Deprecated Signals+ onSelectionChanged, afterSelectionChanged :: TreeSelectionClass self => self -> IO () -> IO (ConnectId self) onSelectionChanged = connect_NONE__NONE "changed" False afterSelectionChanged = connect_NONE__NONE "changed" True+#endif
Graphics/UI/Gtk/ModelView/TreeSortable.chs view
@@ -44,7 +44,7 @@ -- 'Graphics.UI.Gtk.ModelView.ListStore.ListStore' or -- 'Graphics.UI.Gtk.ModelView.TreeStore.TreeStore' model in a -- 'Graphics.UI.Gtk.ModelView.TreeModelSort.TreeModelSort'.--- +-- -- A 'Graphics.UI.Gtk.ModelView.TreeViewColumn' can be sorted by the user -- though clicking into the column's header. The rows in the view will then be -- sorted by the sorting function set for that column. Specifically, a set of@@ -88,17 +88,14 @@ sortColumnChanged ) where -import Control.Monad (liftM, when)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Flags (Flags, toFlags)-import System.Glib.UTFString-import System.Glib.GObject (destroyFunPtr) {#import Graphics.UI.Gtk.Types#}-{#import Graphics.UI.Gtk.General.Enums#} (SortType(..))+{#import Graphics.UI.Gtk.General.Enums#} (SortType(..)) {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.ModelView.Types#}-import Graphics.UI.Gtk.General.Structs (SortColumnId,+import Graphics.UI.Gtk.General.Structs (SortColumnId, treeSortableDefaultSortColumnId ) {# context lib="gtk" prefix="gtk" #}@@ -112,7 +109,7 @@ -- the returned Boolean flag is @False@. -- treeSortableGetSortColumnId :: TreeSortableClass self => self- -> IO (SortType, Bool, SortColumnId) -- ^ @(type, columnSet, sortColumnId)@ + -> IO (SortType, Bool, SortColumnId) -- ^ @(type, columnSet, sortColumnId)@ -- returns @True@ in @columnSet@ if @sortColumnId@ is not -- 'treeSortableDefaultSortColumnId'. The @type@ value indicates increasing -- or decreasing ordering.@@ -183,11 +180,20 @@ -- 'treeSortableDefaultSortColumnId' then the model will sort using -- this function. --+-- | If @sortFunc@ is 'Nothing', then there will be no default comparison function.+-- This means that once the+-- model has been sorted, it can't go back to the default state. In this case, when the current sort+-- column id of sortable is 'TreeSortableDefaultSortColumnId', the model will be unsorted. treeSortableSetDefaultSortFunc :: TreeSortableClass self => self- -> (TreeIter -> TreeIter -> IO Ordering)+ -> Maybe (TreeIter -> TreeIter -> IO Ordering) -- ^ @sortFunc@ - The comparison function+ -- or 'Nothing' to use default comparison function. -> IO ()-treeSortableSetDefaultSortFunc self sortFunc = do+treeSortableSetDefaultSortFunc self Nothing = do+ {# call tree_sortable_set_default_sort_func #}+ (toTreeSortable self)+ nullFunPtr nullPtr nullFunPtr+treeSortableSetDefaultSortFunc self (Just sortFunc) = do fPtr <- mkTreeIterCompareFunc (\_ iter1Ptr iter2Ptr _ -> do iter1 <- peek iter1Ptr iter2 <- peek iter2Ptr@@ -224,4 +230,4 @@ -- | -- sortColumnChanged :: TreeSortableClass self => Signal self (IO ())-sortColumnChanged = Signal (connect_NONE__NONE "sort_column_changed")+sortColumnChanged = Signal (connect_NONE__NONE "sort-column-changed")
Graphics/UI/Gtk/ModelView/TreeStore.hs view
@@ -1,9 +1,10 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) CustomStore TreeModel -- -- Author : Duncan Coutts, Axel Simon ----- Created: 11 Feburary 2006+-- Created: 11 February 2006 -- -- Copyright (C) 2005 Duncan Coutts, Axel Simon --@@ -56,14 +57,14 @@ ) where import Data.Bits-import Data.Word (Word)+import Data.Word (Word32) import Data.Maybe ( fromMaybe, isJust ) import Data.Tree-import Control.Monad ( liftM, when )+import Control.Monad ( when ) import Control.Exception (assert) import Data.IORef import Graphics.UI.Gtk.ModelView.Types-import Graphics.UI.Gtk.Types (GObjectClass(..), TreeModelClass)+import Graphics.UI.Gtk.Types (GObjectClass(..)) import Graphics.UI.Gtk.ModelView.CustomStore import Graphics.UI.Gtk.ModelView.TreeModel import Graphics.UI.Gtk.ModelView.TreeDrag@@ -101,6 +102,20 @@ -- * The given rose tree determines the initial content and may be the empty -- list. Each 'Tree' in the forest corresponds to one top-level node. --+-- * The TreeStore maintains the initially given Forest and aligns the 'TreePath'+-- bits to fit in 96-bit length 'TreeIter' storage.+--+-- * Additionally, a cache is used to achieve higher performance if operating on+-- recently used TreePaths.+--+-- * __Note:__ due to the limited amount of bits available in TreeIter storage, only+-- limited depth forests can be used with this implementation, the result of too deep+-- Forests is an undefined behaviour while trying to retrieve the deeply nested nodes.+-- For example: assuming the average requiement is 8 bits per tree level (max number of+-- children at the level is 255), then we can only use 12 levels deep trees (96/8) -+-- any further levels in a TreePath will not be encoded in the corresponding TreeIter+-- storage.+-- treeStoreNew :: Forest a -> IO (TreeStore a) treeStoreNew forest = treeStoreNewDND forest (Just treeStoreDefaultDragSourceIface)@@ -111,7 +126,7 @@ -- * In addition to 'treeStoreNew', this function takes an two interfaces -- to implement user-defined drag-and-drop functionality. ---treeStoreNewDND :: Forest a -- ^ the inital tree stored in this model+treeStoreNewDND :: Forest a -- ^ the initial tree stored in this model -> Maybe (DragSourceIface TreeStore a) -- ^ an optional interface for drags -> Maybe (DragDestIface TreeStore a) -- ^ an optional interface to handle drops -> IO (TreeStore a)@@ -216,24 +231,22 @@ -- low level bit-twiddling utility functions -- --- TODO: figure out how these things work when Word is 64 bits--bitsNeeded :: Word -> Int+bitsNeeded :: Word32 -> Int bitsNeeded n = bitsNeeded' 0 n where bitsNeeded' b 0 = b bitsNeeded' b n = bitsNeeded' (b+1) (n `shiftR` 1) -getBitSlice :: TreeIter -> Int -> Int -> Word+getBitSlice :: TreeIter -> Int -> Int -> Word32 getBitSlice (TreeIter _ a b c) off count = getBitSliceWord a off count .|. getBitSliceWord b (off-32) count .|. getBitSliceWord c (off-64) count - where getBitSliceWord :: Word -> Int -> Int -> Word+ where getBitSliceWord :: Word32 -> Int -> Int -> Word32 getBitSliceWord word off count =- word `shiftR` off .&. (1 `shiftL` count - 1)+ word `shift` (-off) .&. (1 `shiftL` count - 1) -setBitSlice :: TreeIter -> Int -> Int -> Word -> TreeIter+setBitSlice :: TreeIter -> Int -> Int -> Word32 -> TreeIter setBitSlice (TreeIter stamp a b c) off count value = assert (value < 1 `shiftL` count) $ TreeIter stamp@@ -241,37 +254,37 @@ (setBitSliceWord b (off-32) count value) (setBitSliceWord c (off-64) count value) - where setBitSliceWord :: Word -> Int -> Int -> Word -> Word+ where setBitSliceWord :: Word32 -> Int -> Int -> Word32 -> Word32 setBitSliceWord word off count value =- let mask = (1 `shiftL` count - 1) `shiftL` off- in (word .&. complement mask) .|. (value `shiftL` off)+ let mask = (1 `shiftL` count - 1) `shift` off+ in (word .&. complement mask) .|. (value `shift` off) -iterPrefixEqual :: TreeIter -> TreeIter -> Int -> Bool-iterPrefixEqual (TreeIter _ a1 b1 c1) (TreeIter _ a2 b2 c2) pos- | pos>64 = let mask = 1 `shiftL` (pos-64) - 1 in- a1==a2 && b1==b2 && (c1 .&. mask) == (c2 .&. mask)- | pos>32 = let mask = 1 `shiftL` (pos-32) - 1 in- a1==a2 && (b1 .&. mask) == (b2 .&. mask)- | otherwise = let mask = 1 `shiftL` pos - 1 in- (a1 .&. mask) == (a2 .&. mask)+--iterPrefixEqual :: TreeIter -> TreeIter -> Int -> Bool+--iterPrefixEqual (TreeIter _ a1 b1 c1) (TreeIter _ a2 b2 c2) pos+-- | pos>64 = let mask = 1 `shiftL` (pos-64) - 1 in+-- a1==a2 && b1==b2 && (c1 .&. mask) == (c2 .&. mask)+-- | pos>32 = let mask = 1 `shiftL` (pos-32) - 1 in+-- a1==a2 && (b1 .&. mask) == (b2 .&. mask)+-- | otherwise = let mask = 1 `shiftL` pos - 1 in+-- (a1 .&. mask) == (a2 .&. mask) -- | The invalid tree iterator. -- invalidIter :: TreeIter invalidIter = TreeIter 0 0 0 0 -showIterBits (TreeIter _ a b c) = [showBits a, showBits b, showBits c]--showBits :: Bits a => a -> String-showBits a = [ if testBit a i then '1' else '0' | i <- [0..bitSize a - 1] ]+--showIterBits (TreeIter _ a b c) = [showBits a, showBits b, showBits c]+--+--showBits :: Bits a => a -> String+--showBits a = [ if testBit a i then '1' else '0' | i <- [0..bitSize a - 1] ] -- | Calculate the maximum number of nodes on a per-level basis. -- calcForestDepth :: Forest a -> Depth calcForestDepth f = map bitsNeeded $- takeWhile (/=0) $- foldr calcTreeDepth (repeat 0) f+ takeWhile (/=0) $+ foldr calcTreeDepth (repeat 0) f where calcTreeDepth Node { subForest = f } (d:ds) = (d+1): zipWith max ds (foldr calcTreeDepth (repeat 0) f)@@ -284,7 +297,7 @@ where gP pos [] = [] gP pos (d:ds) = let idx = getBitSlice iter pos d in- if idx==0 then [] else fromIntegral (idx-1) : gP (pos+d) ds+ if idx==0 then [] else fromIntegral (idx-1) : gP (pos+d) ds -- | Try to convert a path into a 'TreeIter'. --@@ -293,7 +306,7 @@ where fP pos ti _ [] = Just ti -- the remaining bits are zero anyway fP pos ti [] _ = Nothing- fP pos ti (d:ds) (p:ps) = let idx = fromIntegral (p+1) :: Word in+ fP pos ti (d:ds) (p:ps) = let idx = fromIntegral (p+1) in if idx >= bit d then Nothing else fP (pos+d) (setBitSlice ti pos d idx) ds ps @@ -304,7 +317,7 @@ -- for which this lookup was started and the innermost frame (the last -- element of the list) contains the root of the tree. ---type Cache a = [(TreeIter, Forest a)] +type Cache a = [(TreeIter, Forest a)] -- | Create a traversal structure that allows a pre-order traversal in linear@@ -329,7 +342,7 @@ -- advanceCache :: Depth -> TreeIter -> Cache a -> Cache a advanceCache depth goal [] = []-advanceCache depth goal cache@((rootIter,_):_) = +advanceCache depth goal cache@((rootIter,_):_) = moveToSameLevel 0 depth where moveToSameLevel pos [] = cache@@ -348,16 +361,16 @@ -- advance the current iterator to coincide with the goal iterator -- at this level moveWithinLevel pos d ((ti,forest):parents) = let- diff = fromIntegral (goalIdx-curIdx)- (dropped, remain) = splitAt diff forest- advance = length dropped- ti' = setBitSlice ti pos d (curIdx+fromIntegral advance)- in- if advance==diff then moveToChild (pos+d) ds ((ti',remain):parents)- else (ti',remain):parents -- node not found+ diff = fromIntegral (goalIdx-curIdx)+ (dropped, remain) = splitAt diff forest+ advance = length dropped+ ti' = setBitSlice ti pos d (curIdx+fromIntegral advance)+ in+ if advance==diff then moveToChild (pos+d) ds ((ti',remain):parents)+ else (ti',remain):parents -- node not found in moveWithinLevel pos d $ case ds of [] -> cache- (d':_) -> dropWhile (isNonZero (pos+d) d') cache+ (d':_) -> dropWhile (isNonZero (pos+d) d') cache -- Descend into the topmost forest to find the goal iterator. The position -- and the remainding depths specify the index in the cache that is zero.@@ -370,16 +383,16 @@ [] -> cache -- impossible request Node { subForest = children }:_ -> let- childIdx :: Int- childIdx = fromIntegral (getBitSlice goal pos d)-1- (dropped, remain) = splitAt childIdx children- advanced = length dropped- ti' = setBitSlice ti pos d (fromIntegral advanced+1)- in if advanced<childIdx then ((ti',remain):cache) else - moveToChild (pos+d) ds ((ti',remain):cache)+ childIdx :: Int+ childIdx = fromIntegral (getBitSlice goal pos d)-1+ (dropped, remain) = splitAt childIdx children+ advanced = length dropped+ ti' = setBitSlice ti pos d (fromIntegral advanced+1)+ in if advanced<childIdx then ((ti',remain):cache) else+ moveToChild (pos+d) ds ((ti',remain):cache) -- | Advance to the given iterator and return weather this was successful.--- +-- checkSuccess :: Depth -> TreeIter -> Cache a -> (Bool, Cache a) checkSuccess depth iter cache = case advanceCache depth iter cache of cache'@((cur,sibs):_) -> (cmp cur iter && not (null sibs), cache')@@ -387,7 +400,6 @@ where cmp (TreeIter _ a1 b1 c1) (TreeIter _ a2 b2 c2) = a1==a2 && b1==b2 && c2==c2- cache'@((cur,sibs):_) = advanceCache depth iter cache -- | Get the leaf index of this iterator. --@@ -409,7 +421,7 @@ -- iterNext :: Depth -> TreeIter -> Cache a -> (Maybe TreeIter, Cache a) iterNext depth iter cache = let- (pos,leaf,child) = getTreeIterLeaf depth iter+ (pos,leaf,_child) = getTreeIterLeaf depth iter curIdx = getBitSlice iter pos leaf nextIdx = curIdx+1 nextIter = setBitSlice iter pos leaf nextIdx@@ -422,10 +434,10 @@ -- | Move down to the child of the given iterator. -- iterNthChild :: Depth -> Int -> TreeIter -> Cache a ->- (Maybe TreeIter, Cache a)+ (Maybe TreeIter, Cache a) iterNthChild depth childIdx_ iter cache = let (pos,leaf,child) = getTreeIterLeaf depth iter- childIdx = fromIntegral childIdx_+1 :: Word+ childIdx = fromIntegral childIdx_+1 nextIter = setBitSlice iter (pos+leaf) child childIdx in if childIdx>=bit child then (Nothing, cache) else@@ -445,7 +457,7 @@ -- iterParent :: Depth -> TreeIter -> Maybe TreeIter iterParent depth iter = let- (pos,leaf,child) = getTreeIterLeaf depth iter+ (pos,leaf,_child) = getTreeIterLeaf depth iter in if pos==0 then Nothing else if getBitSlice iter pos leaf==0 then Nothing else Just (setBitSlice iter pos leaf 0)@@ -523,7 +535,7 @@ -- of the parent. -- insertIntoForest :: Forest a -> Forest a -> TreePath -> Int ->- Maybe (Forest a, Int, Bool)+ Maybe (Forest a, Int, Bool) insertIntoForest forest nodes [] pos | pos<0 = Just (forest++nodes, length forest, null forest) | otherwise = Just (prev++nodes++next, length prev, null forest)@@ -531,13 +543,13 @@ insertIntoForest forest nodes (p:ps) pos = case splitAt p forest of (prev, []) -> Nothing (prev, Node { rootLabel = val,- subForest = for}:next) ->+ subForest = for}:next) -> case insertIntoForest for nodes ps pos of Nothing -> Nothing Just (for, pos, toggle) -> Just (prev++Node { rootLabel = val,- subForest = for }:next,- pos, toggle)- + subForest = for }:next,+ pos, toggle)+ -- | Remove a node from the store. -- -- * The node denoted by the path is removed, along with all its children.@@ -555,12 +567,12 @@ Nothing -> (store, (False, False)) Just (newForest, toggle) -> (Store { depth = d, -- this might be a space leak- content = storeToCache newForest }, (True, toggle))+ content = storeToCache newForest }, (True, toggle)) when found $ do when (toggle && not (null path)) $ do Store { depth = depth } <- readIORef (customStoreGetPrivate model) let parent = init path- Just iter = fromPath depth parent+ Just iter = fromPath depth parent treeModelRowHasChildToggled model parent iter treeModelRowDeleted model path return found@@ -588,12 +600,12 @@ deleteFromForest forest (p:ps) = case splitAt p forest of (prev, kill@Node { rootLabel = val,- subForest = for}:next) ->+ subForest = for}:next) -> if null ps then Just (prev++next, null prev && null next) else case deleteFromForest for ps of Nothing -> Nothing- Just (for,toggle) -> Just (prev++Node {rootLabel = val,- subForest = for }:next, toggle)+ Just (for,toggle) -> Just (prev++Node {rootLabel = val,+ subForest = for }:next, toggle) (prev, []) -> Nothing @@ -621,14 +633,14 @@ treeStoreChangeM :: TreeStore a -> TreePath -> (a -> IO a) -> IO Bool treeStoreChangeM (TreeStore model) path act = do customStoreInvalidateIters model- store@Store { depth = d, content = cache } <- + store@Store { depth = d, content = cache } <- readIORef (customStoreGetPrivate model) (store'@Store { depth = d, content = cache }, found) <- do mRes <- changeForest (cacheToStore cache) act path return $ case mRes of Nothing -> (store, False) Just newForest -> (Store { depth = d,- content = storeToCache newForest }, True)+ content = storeToCache newForest }, True) writeIORef (customStoreGetPrivate model) store' let Just iter = fromPath d path stamp <- customStoreGetStamp model@@ -644,17 +656,17 @@ changeForest forest act (p:ps) = case splitAt p forest of (prev, []) -> return Nothing (prev, Node { rootLabel = val,- subForest = for}:next) ->+ subForest = for}:next) -> if null ps then do val' <- act val return (Just (prev++Node { rootLabel = val',- subForest = for }:next))+ subForest = for }:next)) else do mFor <- changeForest for act ps case mFor of Nothing -> return Nothing- Just for -> return $ Just (prev++Node { rootLabel = val,- subForest = for }:next)+ Just for -> return $ Just (prev++Node { rootLabel = val,+ subForest = for }:next) -- | Extract one node from the current model. Fails if the given -- 'TreePath' refers to a non-existent node.@@ -667,7 +679,7 @@ -- treeStoreGetTree :: TreeStore a -> TreePath -> IO (Tree a) treeStoreGetTree (TreeStore model) path = do- store@Store { depth = d, content = cache } <- + store@Store { depth = d, content = cache } <- readIORef (customStoreGetPrivate model) case fromPath d path of (Just iter) -> do@@ -679,11 +691,11 @@ _ -> fail ("treeStoreGetTree: path does not exist " ++ show path) -- | Extract a subtree from the current model. Like 'treeStoreGetTree'--- but returns @Nothing@ if the path refers to a non-existant node.+-- but returns @Nothing@ if the path refers to a non-existent node. -- treeStoreLookup :: TreeStore a -> TreePath -> IO (Maybe (Tree a)) treeStoreLookup (TreeStore model) path = do- store@Store { depth = d, content = cache } <- + store@Store { depth = d, content = cache } <- readIORef (customStoreGetPrivate model) case fromPath d path of (Just iter) -> do
Graphics/UI/Gtk/ModelView/TreeView.chs view
@@ -56,14 +56,14 @@ -- module Graphics.UI.Gtk.ModelView.TreeView ( -- * Description--- +-- -- | Widget that displays any object that implements the 'TreeModel' -- interface. ----- The widget supports scrolling natively. This implies that pixel +-- The widget supports scrolling natively. This implies that pixel -- coordinates can be given in two formats: relative to the current view's -- upper left corner or relative to the whole list's coordinates. The former--- are called widget coordinates while the letter are called tree +-- are called widget coordinates while the letter are called tree -- coordinates. -- * Class Hierarchy@@ -146,7 +146,9 @@ treeViewConvertWidgetToBinWindowCoords, treeViewConvertWidgetToTreeCoords, #endif+#if GTK_MAJOR_VERSION < 3 treeViewCreateRowDragIcon,+#endif treeViewGetEnableSearch, treeViewSetEnableSearch, treeViewGetSearchColumn,@@ -185,6 +187,12 @@ treeViewSetGridLines, #endif #endif+#if GTK_CHECK_VERSION(2,12,0)+ treeViewSetTooltipRow,+ treeViewSetTooltipCell,+ treeViewGetTooltipContext,+#endif+ -- * Attributes treeViewModel, treeViewHAdjustment,@@ -214,20 +222,25 @@ treeViewGridLines, treeViewSearchEntry, #endif+#if GTK_CHECK_VERSION(2,12,0)+ treeViewTooltipColumn,+#endif -- * Signals columnsChanged, cursorChanged, rowCollapsed, rowExpanded,+ rowActivated, testCollapseRow, testExpandRow, -- * Deprecated #ifndef DISABLE_DEPRECATED+#if GTK_MAJOR_VERSION < 3 treeViewWidgetToTreeCoords, treeViewTreeToWidgetCoords,-+#endif onColumnsChanged, afterColumnsChanged, onCursorChanged,@@ -247,25 +260,22 @@ #endif ) where -import Control.Monad (liftM, mapM)-import Data.Maybe (fromMaybe)+import Control.Monad (liftM,)+import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.UTFString-import System.Glib.GList (fromGList)+import System.Glib.GList (fromGList) import System.Glib.Flags import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (makeNewGObject, constructNewGObject,- destroyFunPtr) import Graphics.UI.Gtk.Gdk.Enums (DragAction(..)) import Graphics.UI.Gtk.Gdk.Events (Modifier(..))-import Graphics.UI.Gtk.General.Structs (Point, Rectangle)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.General.Structs (Point, Rectangle)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-{#import Graphics.UI.Gtk.ModelView.TreeViewColumn#}-import Graphics.UI.Gtk.ModelView.TreeModel (ColumnId, columnIdToNumber,+import Graphics.UI.Gtk.ModelView.TreeModel (columnIdToNumber, makeColumnIdString) {#import Graphics.UI.Gtk.ModelView.Types#} {#import Graphics.UI.Gtk.General.DNDTypes#} (TargetList(..))@@ -283,7 +293,7 @@ liftM (castPtr :: Ptr Widget -> Ptr TreeView) $ {# call tree_view_new #} --- | Create a new 'TreeView' +-- | Create a new 'TreeView' -- widget with @model@ as the storage model. -- treeViewNewWithModel :: TreeModelClass model => model -> IO TreeView@@ -308,12 +318,12 @@ -- | Set the 'TreeModel' for the current View. -- treeViewSetModel :: (TreeViewClass self, TreeModelClass model) => self- -> model+ -> Maybe model -> IO () treeViewSetModel self model = {# call tree_view_set_model #} (toTreeView self)- (toTreeModel model)+ (maybe (TreeModel nullForeignPtr) toTreeModel model) -- | Retrieve a 'TreeSelection' that -- holds the current selected nodes of the View.@@ -383,7 +393,7 @@ {# call tree_view_columns_autosize #} (toTreeView self) --- | Set wether the columns headers are sensitive to mouse clicks.+-- | Set whether the columns headers are sensitive to mouse clicks. -- treeViewSetHeadersClickable :: TreeViewClass self => self -> Bool -> IO () treeViewSetHeadersClickable self setting =@@ -458,9 +468,9 @@ -- treeViewGetColumn :: TreeViewClass self => self -> Int -> IO (Maybe TreeViewColumn) treeViewGetColumn self pos = do- tvcPtr <- {# call unsafe tree_view_get_column #} (toTreeView self) + tvcPtr <- {# call unsafe tree_view_get_column #} (toTreeView self) (fromIntegral pos)- if tvcPtr==nullPtr then return Nothing else + if tvcPtr==nullPtr then return Nothing else liftM Just $ makeNewObject mkTreeViewColumn (return tvcPtr) -- | Return all 'TreeViewColumn's in this 'TreeView'.@@ -572,7 +582,7 @@ {#pointer TreeViewColumnDropFunc#} foreign import ccall "wrapper" mkTreeViewColumnDropFunc ::- (Ptr () -> Ptr TreeViewColumn -> Ptr TreeViewColumn -> Ptr TreeViewColumn ->+ (Ptr TreeView -> Ptr TreeViewColumn -> Ptr TreeViewColumn -> Ptr TreeViewColumn -> Ptr () -> IO {#type gboolean#}) -> IO TreeViewColumnDropFunc -- | Scroll to a coordinate.@@ -596,32 +606,43 @@ -- | Scroll to a cell. ----- * Scroll to a cell as specified by @path@ and @tvc@. --- The cell is aligned within the 'TreeView' widget as--- follows: horizontally by @hor@ from left (@0.0@) to--- right (@1.0@) and vertically by @ver@ from top--- (@0.0@) to buttom (@1.0@).+-- Moves the alignments of tree_view to the position specified by mbColumn and mbPath.+-- If mbColumn is Nothing, then no horizontal scrolling occurs. Likewise, if mbPath+-- is Nothing no vertical scrolling occurs. At a minimum, one of mbColumn or mbPath+-- need to be provided. @rowAlign@ determines where the row is placed, and+-- @colAlign@ determines where column is placed. Both are expected to be between+-- 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment,+-- 0.5 means center. --+-- If Nothing is passed instead of @rowAlign@ and @colAlign@, then the tree does+-- the minimum amount of work to scroll the cell onto the screen. This means+-- that the cell will be scrolled to the edge closest to its current position.+-- If the cell is currently visible on the screen, nothing is done.+--+-- This function only works if the model is set, and path is a valid row on+-- the model. If the model changes before the tree_view is realized, the+-- centered path will be modified to reflect this change.+-- treeViewScrollToCell :: TreeViewClass self => self- -> TreePath- -> TreeViewColumn+ -> Maybe TreePath+ -> Maybe TreeViewColumn -> Maybe (Float, Float) -> IO ()-treeViewScrollToCell self path column (Just (ver,hor)) =- withTreePath path $ \path ->+treeViewScrollToCell self mbPath mbColumn (Just (rowAlign, colAlign)) =+ maybeWithTreePath mbPath $ \path -> {# call tree_view_scroll_to_cell #} (toTreeView self) path- column- 1 - (realToFrac ver)- (realToFrac hor)-treeViewScrollToCell self path column Nothing = - withTreePath path $ \path ->+ (maybe (TreeViewColumn nullForeignPtr) toTreeViewColumn mbColumn)+ 1+ (realToFrac rowAlign)+ (realToFrac colAlign)+treeViewScrollToCell self mbPath mbColumn Nothing =+ maybeWithTreePath mbPath $ \path -> {# call tree_view_scroll_to_cell #} (toTreeView self) path- column+ (maybe (TreeViewColumn nullForeignPtr) toTreeViewColumn mbColumn) 0 0.0 0.0@@ -632,7 +653,7 @@ -- selects it. This is useful when you want to focus the user\'s -- attention on a particular row. If @focusColumn@ is given, -- then the input focus is given to the column specified by--- it. Additionally, if @focusColumn@ is specified, and +-- it. Additionally, if @focusColumn@ is specified, and -- @startEditing@ is @True@, -- then editing will be started in the -- specified cell. This function is often followed by a@@ -662,7 +683,7 @@ -- | Selects a cell in a specific row. -- -- * Similar to 'treeViewSetCursor' but allows a column to--- containt several 'CellRenderer's.+-- contain several 'CellRenderer's. -- -- * Only available in Gtk 2.2 and higher. --@@ -772,7 +793,7 @@ (toTreeView self) path --- | Call function for every expaned row.+-- | Call function for every expanded row. -- treeViewMapExpandedRows :: TreeViewClass self => self -> (TreePath -> IO ())@@ -788,7 +809,7 @@ {#pointer TreeViewMappingFunc#} foreign import ccall "wrapper" mkTreeViewMappingFunc ::- (Ptr () -> Ptr NativeTreePath -> Ptr () -> IO ()) ->+ (Ptr TreeView -> Ptr NativeTreePath -> Ptr () -> IO ()) -> IO TreeViewMappingFunc -- | Check if row is expanded.@@ -895,7 +916,7 @@ tvc (castPtr (rPtr :: Ptr Rectangle)) >> peek rPtr-treeViewGetCellArea self (Just tp) tvc = +treeViewGetCellArea self (Just tp) tvc = withTreePath tp $ \tp -> alloca $ \rPtr -> do {# call unsafe tree_view_get_cell_area #}@@ -913,7 +934,7 @@ -- If @path@ is @Nothing@ or points to a path not -- currently displayed, the @y@ and @height@ fields of -- the 'Rectangle' will be filled with @0@. The background--- areas tile the widget's area to cover the entire tree window +-- areas tile the widget's area to cover the entire tree window -- (except for the area used for header buttons). Contrast this with -- 'treeViewGetCellArea'. --@@ -929,7 +950,7 @@ tvc (castPtr (rPtr :: Ptr Rectangle)) >> peek rPtr-treeViewGetBackgroundArea self (Just tp) tvc = +treeViewGetBackgroundArea self (Just tp) tvc = withTreePath tp $ \tp -> alloca $ \rPtr -> {# call unsafe tree_view_get_background_area #} (toTreeView self)@@ -952,14 +973,16 @@ peek rPtr #ifndef DISABLE_DEPRECATED+#if GTK_MAJOR_VERSION < 3 -- | 'treeViewTreeToWidgetCoords' has been deprecated since version 2.12 and should not be used in--- newly-written code. Due to historial reasons the name of this function is incorrect. For converting+-- newly-written code. Due to historical reasons the name of this function is incorrect. For converting -- bin window coordinates to coordinates relative to bin window, please see -- 'treeViewConvertBinWindowToWidgetCoords'.--- +-- -- Converts tree coordinates (coordinates in full scrollable area of the tree) to bin window -- coordinates. --+-- Removed in Gtk3. treeViewTreeToWidgetCoords :: TreeViewClass self => self -> Point -- ^ @(tx, ty)@ - tree X and Y coordinates -> IO Point -- ^ @(wx, wy)@ returns widget X and Y coordinates@@ -977,12 +1000,13 @@ return (fromIntegral wx, fromIntegral wy) -- | 'treeViewWidgetToTreeCoords' has been deprecated since version 2.12 and should not be used in--- newly-written code. Due to historial reasons the name of this function is incorrect. For converting+-- newly-written code. Due to historical reasons the name of this function is incorrect. For converting -- coordinates relative to the widget to bin window coordinates, please see -- 'treeViewConvertWidgetToBinWindowCoords'.--- +-- -- Converts bin window coordinates to coordinates for the tree (the full scrollable area of the tree). --+-- Removed in Gtk3. treeViewWidgetToTreeCoords :: TreeViewClass self => self -> Point -- ^ @(wx, wy)@ - widget X and Y coordinates -> IO Point -- ^ @(tx, ty)@ returns tree X and Y coordinates@@ -999,12 +1023,13 @@ ty <- peek tyPtr return (fromIntegral tx, fromIntegral ty) #endif+#endif #if GTK_CHECK_VERSION(2,12,0) -- | Converts bin window coordinates to coordinates for the tree (the full scrollable area of the tree). treeViewConvertBinWindowToTreeCoords :: TreeViewClass self => self -> Point -- ^ @(bx, by)@ - bin window X and Y coordinates- -> IO Point -- ^ @(tx, ty)@ returns tree X and Y coordinates + -> IO Point -- ^ @(tx, ty)@ returns tree X and Y coordinates treeViewConvertBinWindowToTreeCoords self (bx, by) = alloca $ \txPtr -> alloca $ \tyPtr -> do@@ -1021,7 +1046,7 @@ -- | Converts bin window coordinates (see 'treeViewGetBinWindow' to widget relative coordinates. treeViewConvertBinWindowToWidgetCoords :: TreeViewClass self => self -> Point -- ^ @(bx, by)@ - bin window X and Y coordinates- -> IO Point -- ^ @(wx, wy)@ returns widget X and Y coordinates + -> IO Point -- ^ @(wx, wy)@ returns widget X and Y coordinates treeViewConvertBinWindowToWidgetCoords self (bx, by) = alloca $ \wxPtr -> alloca $ \wyPtr -> do@@ -1039,7 +1064,7 @@ -- coordinates. treeViewConvertTreeToBinWindowCoords :: TreeViewClass self => self -> Point -- ^ @(tx, ty)@ - tree X and Y coordinates- -> IO Point -- ^ @(bx, by)@ returns bin window X and Y coordinates + -> IO Point -- ^ @(bx, by)@ returns bin window X and Y coordinates treeViewConvertTreeToBinWindowCoords self (tx, ty) = alloca $ \bxPtr -> alloca $ \byPtr -> do@@ -1056,7 +1081,7 @@ -- | Converts tree coordinates (coordinates in full scrollable area of the tree) to widget coordinates. treeViewConvertTreeToWidgetCoords :: TreeViewClass self => self -> Point -- ^ @(tx, ty)@ - tree X and Y coordinates- -> IO Point -- ^ @(wx, wy)@ returns widget X and Y coordinates + -> IO Point -- ^ @(wx, wy)@ returns widget X and Y coordinates treeViewConvertTreeToWidgetCoords self (wx, wy) = alloca $ \bxPtr -> alloca $ \byPtr -> do@@ -1073,7 +1098,7 @@ -- | Converts widget coordinates to coordinates for the window (see 'treeViewGetBinWindow' ). treeViewConvertWidgetToBinWindowCoords :: TreeViewClass self => self -> Point -- ^ @(wx, wy)@ - widget X and Y coordinates- -> IO Point -- ^ @(bx, by)@ returns bin window X and Y coordinates + -> IO Point -- ^ @(bx, by)@ returns bin window X and Y coordinates treeViewConvertWidgetToBinWindowCoords self (wx, wy) = alloca $ \bxPtr -> alloca $ \byPtr -> do@@ -1090,7 +1115,7 @@ -- | Converts widget coordinates to coordinates for the tree (the full scrollable area of the tree). treeViewConvertWidgetToTreeCoords :: TreeViewClass self => self -> Point -- ^ @(wx, wy)@ - bin window X and Y coordinates- -> IO Point -- ^ @(tx, ty)@ returns tree X and Y coordinates + -> IO Point -- ^ @(tx, ty)@ returns tree X and Y coordinates treeViewConvertWidgetToTreeCoords self (wx, wy) = alloca $ \txPtr -> alloca $ \tyPtr -> do@@ -1105,18 +1130,21 @@ return (fromIntegral tx, fromIntegral ty) #endif +#if GTK_MAJOR_VERSION < 3 -- | Creates a 'Pixmap' representation of the row at the given path. This image -- can be used for a drag icon. --+-- Removed in Gtk3. treeViewCreateRowDragIcon :: TreeViewClass self => self -> TreePath -> IO Pixmap treeViewCreateRowDragIcon self path =- constructNewGObject mkPixmap $+ wrapNewGObject mkPixmap $ withTreePath path $ \path -> {# call unsafe tree_view_create_row_drag_icon #} (toTreeView self) path+#endif -- | Returns whether or not the tree allows to start interactive searching by -- typing in text.@@ -1148,8 +1176,8 @@ -- %hash c:ecc5 d:bed6 -- | Gets the column searched on by the interactive search code. ---treeViewGetSearchColumn :: TreeViewClass self => self- -> IO (ColumnId row String) -- ^ returns the column the interactive search code searches in.+treeViewGetSearchColumn :: (TreeViewClass self, GlibString string) => self+ -> IO (ColumnId row string) -- ^ returns the column the interactive search code searches in. treeViewGetSearchColumn self = liftM (makeColumnIdString . fromIntegral) $ {# call unsafe tree_view_get_search_column #}@@ -1167,8 +1195,8 @@ -- search column is not used if a comparison function is set, see -- 'treeViewSetSearchEqualFunc'. ---treeViewSetSearchColumn :: TreeViewClass self => self- -> (ColumnId row String) -- ^ @column@ - the column of the model to search in, or -1 to disable+treeViewSetSearchColumn :: (TreeViewClass self, GlibString string) => self+ -> (ColumnId row string) -- ^ @column@ - the column of the model to search in, or -1 to disable -- searching -> IO () treeViewSetSearchColumn self column =@@ -1184,15 +1212,15 @@ -- the 'treeViewSearchColumn' (which isn't used anyway when a comparison -- function is installed). ---treeViewSetSearchEqualFunc :: TreeViewClass self => self- -> Maybe (String -> TreeIter -> IO Bool)+treeViewSetSearchEqualFunc :: (TreeViewClass self, GlibString string) => self+ -> Maybe (string -> TreeIter -> IO Bool) -> IO () treeViewSetSearchEqualFunc self (Just pred) = do fPtr <- mkTreeViewSearchEqualFunc (\_ _ keyPtr iterPtr _ -> do key <- peekUTFString keyPtr iter <- peek iterPtr liftM (fromBool . not) $ pred key iter)- {# call tree_view_set_search_equal_func #} (toTreeView self) fPtr + {# call tree_view_set_search_equal_func #} (toTreeView self) fPtr (castFunPtrToPtr fPtr) destroyFunPtr {# call tree_view_set_search_column #} (toTreeView self) 0 treeViewSetSearchEqualFunc self Nothing = do@@ -1274,7 +1302,7 @@ (toTreeView self) -- | Enables of disables the hover expansion mode of the tree view. Hover--- expansion makes rows expand or collaps if the pointer moves over them.+-- expansion makes rows expand or collapse if the pointer moves over them. -- -- * Available since Gtk+ version 2.6 --@@ -1322,7 +1350,7 @@ startPath <- fromTreePath startTPPtr endPath <- fromTreePath endTPPtr return (startPath, endPath)- + #endif #if GTK_CHECK_VERSION(2,10,0)@@ -1451,7 +1479,7 @@ foreign import ccall "wrapper" mkTreeViewRowSeparatorFunc :: (Ptr TreeModel -> Ptr TreeIter -> Ptr () -> IO {#type gboolean#}) -> IO TreeViewRowSeparatorFunc- + #if GTK_CHECK_VERSION(2,10,0) -- %hash c:778a d:eacd -- | Returns whether rubber banding is turned on for @treeView@. If the@@ -1542,12 +1570,68 @@ #endif #endif +#if GTK_CHECK_VERSION(2,12,0)+-- | Sets the tip area of @tooltip@ to be the area covered by @path@. See also+-- 'treeViewTooltipColumn' for a simpler alternative. See also+-- 'tooltipSetTipArea'.+treeViewSetTooltipRow :: TreeViewClass self => self+ -> Tooltip -- ^ the @tooltip@+ -> TreePath -- ^ @path@ - the position of the @tooltip@+ -> IO ()+treeViewSetTooltipRow self tip path =+ withTreePath path $ \path ->+ {#call gtk_tree_view_set_tooltip_row #} (toTreeView self) tip path++-- | Sets the tip area of tooltip to the area path, column and cell have in+-- common. For example if @path@ is @Nothing@ and @column@ is set, the tip area will be+-- set to the full area covered by column. See also+-- 'tooltipSetTipArea'. Note that if @path@ is not specified and @cell@ is+-- set and part of a column containing the expander, the tooltip might not+-- show and hide at the correct position. In such cases @path@ must be set to+-- the current node under the mouse cursor for this function to operate+-- correctly. See also 'treeViewTooltipColumn' for a simpler alternative.+--+treeViewSetTooltipCell :: (TreeViewClass self, TreeViewColumnClass col,+ CellRendererClass renderer) => self+ -> Tooltip -- ^ the @tooltip@+ -> Maybe TreePath -- ^ @path@ at which the tip should be shown+ -> Maybe col -- ^ @column@ at which the tip should be shown+ -> Maybe renderer -- ^ the @renderer@ for which to show the tip+ -> IO ()+treeViewSetTooltipCell self tip mPath mColumn mRenderer =+ (case mPath of Just path -> withTreePath path+ Nothing -> \f -> f (NativeTreePath nullPtr)) $ \path -> do+ {#call gtk_tree_view_set_tooltip_cell#} (toTreeView self) tip path+ (maybe (TreeViewColumn nullForeignPtr) toTreeViewColumn mColumn)+ (maybe (CellRenderer nullForeignPtr) toCellRenderer mRenderer)++-- | This function is supposed to be used in a 'widgetQueryTooltip' signal handler+-- for this 'TreeView'. The @point@ value which is received in the+-- signal handler should be passed to this function without modification. A+-- return value of @Just iter@ indicates that there is a tree view row at the given+-- coordinates (if @Just (x,y)@ is passed in, denoting a mouse position), resp.+-- the cursor row (if @Nothing@ is passed in, denoting a keyboard request).+--+treeViewGetTooltipContext :: TreeViewClass self => self+ -> Maybe Point -- ^ @point@ - the coordinates of the mouse or @Nothing@+ -- if a keyboard tooltip is to be generated+ -> IO (Maybe TreeIter) -- ^ @Just iter@ if a tooltip should be shown for that row+treeViewGetTooltipContext self (Just (x,y)) =+ alloca $ \xPtr -> alloca $ \yPtr -> receiveTreeIter $+ {#call gtk_tree_view_get_tooltip_context#} (toTreeView self)+ xPtr yPtr 0 nullPtr nullPtr+treeViewGetTooltipContext self Nothing =+ receiveTreeIter $+ {#call gtk_tree_view_get_tooltip_context#} (toTreeView self)+ nullPtr nullPtr 1 nullPtr nullPtr+#endif+ -------------------- -- Attributes -- | The model for the tree view. ---treeViewModel :: (TreeViewClass self, TreeModelClass model) => ReadWriteAttr self (Maybe TreeModel) model+treeViewModel :: TreeViewClass self => Attr self (Maybe TreeModel) treeViewModel = newAttr treeViewGetModel treeViewSetModel@@ -1619,11 +1703,9 @@ -- %hash c:e732 -- | Model column to search through when searching through code. ----- Allowed values: >= -1------ Default value: -1+-- Default value: 'invalidColumnId' ---treeViewSearchColumn :: TreeViewClass self => Attr self (ColumnId row String)+treeViewSearchColumn :: (TreeViewClass self, GlibString string) => Attr self (ColumnId row string) treeViewSearchColumn = newAttr treeViewGetSearchColumn treeViewSetSearchColumn@@ -1660,7 +1742,7 @@ -- %hash c:c694 d:3f15 -- | Enables of disables the hover expansion mode of @treeView@. Hover--- expansion makes rows expand or collaps if the pointer moves over them.+-- expansion makes rows expand or collapse if the pointer moves over them. -- -- This mode is primarily intended for 'TreeView's in popups, e.g. in -- 'ComboBox' or 'EntryCompletion'.@@ -1740,6 +1822,34 @@ treeViewSetSearchEntry #endif +#if GTK_CHECK_VERSION(2,12,0)+-- | The column for which to show tooltips.+--+-- If you only plan to have simple (text-only) tooltips on full rows, you can+-- use this function to have 'TreeView' handle these automatically for you.+-- @column@ should be set to a column in model containing the tooltip texts,+-- or @-1@ to disable this feature. When enabled, 'widgetHasTooltip' will be+-- set to @True@ and this view will connect to the 'widgetQueryTooltip' signal+-- handler.+--+-- Note that the signal handler sets the text as 'Markup',+-- so \&, \<, etc have to be escaped in the text.+--+-- Default value: 'invalidColumnId'+--+treeViewTooltipColumn :: (TreeViewClass self, GlibString string) => Attr self (ColumnId row string)+treeViewTooltipColumn = newAttr+ (\self -> liftM (makeColumnIdString . fromIntegral) $+ {# call unsafe tree_view_get_tooltip_column #}+ (toTreeView self)+ )+ (\self column ->+ {# call tree_view_set_tooltip_column #}+ (toTreeView self)+ (fromIntegral (columnIdToNumber column))+ )+#endif+ -------------------- -- Signals @@ -1763,6 +1873,13 @@ rowExpanded :: TreeViewClass self => Signal self (TreeIter -> TreePath -> IO ()) rowExpanded = Signal (connect_BOXED_BOXED__NONE "row-expanded" peek readNTP) +-- | A row was activated.+--+-- * Activation usually means the user has pressed return on a row.+--+rowActivated :: TreeViewClass self => Signal self (TreePath -> TreeViewColumn -> IO ())+rowActivated = Signal (connect_BOXED_OBJECT__NONE "row-activated" readNTP)+ -- %hash c:9ee6 d:325e -- | The given row has been collapsed (child nodes are hidden). --@@ -1809,10 +1926,10 @@ onRowActivated, afterRowActivated :: TreeViewClass self => self -> (TreePath -> TreeViewColumn -> IO ()) -> IO (ConnectId self)-onRowActivated = connect_BOXED_OBJECT__NONE "row_activated" - readNTP False-afterRowActivated = connect_BOXED_OBJECT__NONE "row_activated" - readNTP True+onRowActivated = connect_BOXED_OBJECT__NONE "row_activated"+ readNTP False+afterRowActivated = connect_BOXED_OBJECT__NONE "row_activated"+ readNTP True -- | Children of this node were hidden. --@@ -1839,7 +1956,7 @@ -- * Connect to this signal if you want to provide you own search facility. -- Note that you must handle all keyboard input yourself. ---onStartInteractiveSearch, afterStartInteractiveSearch :: +onStartInteractiveSearch, afterStartInteractiveSearch :: TreeViewClass self => self -> IO () -> IO (ConnectId self) #if GTK_CHECK_VERSION(2,2,0)@@ -1853,7 +1970,7 @@ onStartInteractiveSearch = connect_NONE__NONE "start_interactive_search" False-afterStartInteractiveSearch = +afterStartInteractiveSearch = connect_NONE__NONE "start_interactive_search" True #endif@@ -1861,7 +1978,7 @@ -- | Determine if this row should be collapsed. -- -- * If the application connects to this function and returns @False@,--- the specifc row will not be altered.+-- the specific row will not be altered. -- onTestCollapseRow, afterTestCollapseRow :: TreeViewClass self => self -> (TreeIter -> TreePath -> IO Bool)@@ -1874,7 +1991,7 @@ -- | Determine if this row should be expanded. -- -- * If the application connects to this function and returns @False@,--- the specifc row will not be altered.+-- the specific row will not be altered. -- onTestExpandRow, afterTestExpandRow :: TreeViewClass self => self -> (TreeIter -> TreePath -> IO Bool)
Graphics/UI/Gtk/ModelView/TreeViewColumn.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.ModelView.TreeViewColumn ( -- * Detail--- +-- -- | The 'TreeViewColumn' object represents a visible column in a 'TreeView' -- widget. It allows to set properties of the column header, and functions as a -- holding pen for the cell renderers which determine how the data in the@@ -55,7 +55,9 @@ treeViewColumnPackStart, treeViewColumnPackEnd, treeViewColumnClear,+#if GTK_MAJOR_VERSION < 3 treeViewColumnGetCellRenderers,+#endif treeViewColumnSetSpacing, treeViewColumnGetSpacing, treeViewColumnSetVisible,@@ -126,20 +128,22 @@ afterColClicked ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString-{#import System.Glib.GList#} (fromGList)+#if GTK_MAJOR_VERSION < 3+{#import System.Glib.GList#} (fromGList)+#endif import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Enums (TreeViewColumnSizing(..),- SortType(..))+import Graphics.UI.Gtk.General.Enums (TreeViewColumnSizing(..),+ SortType(..)) import Graphics.UI.Gtk.General.Structs (SortColumnId)-{#import Graphics.UI.Gtk.ModelView.TreeModel#} ()+{#import Graphics.UI.Gtk.ModelView.TreeModel#} () {# context lib="gtk" prefix="gtk" #} @@ -149,7 +153,7 @@ -- | Generate a new TreeViewColumn widget. -- treeViewColumnNew :: IO TreeViewColumn-treeViewColumnNew = makeNewObject mkTreeViewColumn +treeViewColumnNew = makeNewObject mkTreeViewColumn {# call tree_view_column_new #} @@ -193,14 +197,17 @@ {# call tree_view_column_clear #} self +#if GTK_MAJOR_VERSION < 3 -- | Retrieve all 'CellRenderer's that are contained in this column. --+-- Removed in Gtk3. treeViewColumnGetCellRenderers :: TreeViewColumn -> IO [CellRenderer] treeViewColumnGetCellRenderers self = {# call unsafe tree_view_column_get_cell_renderers #} self >>= fromGList >>= mapM (makeNewObject mkCellRenderer . return)+#endif -- | Set the number of pixels between two cell renderers. --@@ -251,7 +258,7 @@ {# call unsafe tree_view_column_get_resizable #} self --- | Set wether the column can be resized.+-- | Set whether the column can be resized. -- treeViewColumnSetSizing :: TreeViewColumn -> TreeViewColumnSizing@@ -342,7 +349,7 @@ -- | Set the widget's title if a custom widget has not been set. ---treeViewColumnSetTitle :: TreeViewColumn -> String -> IO ()+treeViewColumnSetTitle :: GlibString string => TreeViewColumn -> string -> IO () treeViewColumnSetTitle self title = withUTFString title $ \titlePtr -> {# call tree_view_column_set_title #}@@ -351,7 +358,7 @@ -- | Get the widget's title. ---treeViewColumnGetTitle :: TreeViewColumn -> IO (Maybe String)+treeViewColumnGetTitle :: GlibString string => TreeViewColumn -> IO (Maybe string) treeViewColumnGetTitle self = {# call unsafe tree_view_column_get_title #} self@@ -387,7 +394,7 @@ -- showing the column title. In case only a text title was set this will be a -- 'Alignment' widget with a 'Label' inside. ---treeViewColumnGetWidget :: TreeViewColumn +treeViewColumnGetWidget :: TreeViewColumn -> IO (Maybe Widget) -- ^ returns the 'Widget' in the column header, or 'Nothing' treeViewColumnGetWidget self = do widgetPtr <- {# call unsafe tree_view_column_get_widget #} self@@ -437,7 +444,7 @@ -- -- * Sets the logical @columnId@ that this column sorts on when -- this column is selected for sorting. The selected column's header--- will be clickable after this call. Logical refers to the +-- will be clickable after this call. Logical refers to the -- 'Graphics.UI.Gtk.ModelView.TreeSortable.SortColumnId' for which -- a comparison function was set. --@@ -661,7 +668,7 @@ -- -- Default value: \"\" ---treeViewColumnTitle :: ReadWriteAttr TreeViewColumn (Maybe String) String+treeViewColumnTitle :: GlibString string => ReadWriteAttr TreeViewColumn (Maybe string) string treeViewColumnTitle = newAttr treeViewColumnGetTitle treeViewColumnSetTitle
Graphics/UI/Gtk/ModelView/Types.chs view
@@ -1,5 +1,9 @@+{-# LANGUAGE GADTs #-} {-# LANGUAGE MagicHash #-}+{-# LANGUAGE Rank2Types #-}+{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_HADDOCK hide #-}+{-# OPTIONS_GHC -fno-warn-unused-binds #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) CustomStore TreeModel --@@ -33,41 +37,43 @@ TypedTreeModelClass, toTypedTreeModel, unsafeTreeModelToGeneric,- + TypedTreeModelSort(..), unsafeTreeModelSortToGeneric, TypedTreeModelFilter(..), unsafeTreeModelFilterToGeneric,- + -- TreeIter TreeIter(..), receiveTreeIter, peekTreeIter, treeIterSetStamp,- + -- TreePath TreePath, NativeTreePath(..), newTreePath, withTreePath,+ maybeWithTreePath, peekTreePath, fromTreePath, stringToTreePath,- + -- Columns ColumnAccess(..), ColumnId(..),- + -- Storing the model in a ComboBox- comboQuark, + comboQuark, ) where import GHC.Exts (unsafeCoerce#) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.GValue (GValue) import System.Glib.GObject (Quark, quarkFromString)-{#import Graphics.UI.Gtk.Types#} (TreeModel, TreeModelSort, TreeModelFilter,+{#import Graphics.UI.Gtk.Types#} (TreeModel, TreeModelSort, TreeModelFilter, Pixbuf) import Data.Char ( isDigit ) import Control.Monad ( liftM )@@ -114,8 +120,8 @@ -- use of the three words is therefore implementation specific. See also -- 'TreePath'. ---data TreeIter = TreeIter {-# UNPACK #-} !CInt !Word !Word !Word- deriving Show+data TreeIter = TreeIter {-# UNPACK #-} !CInt !Word32 !Word32 !Word32+ deriving Show {#pointer *TreeIter as TreeIterPtr -> TreeIter #} @@ -131,7 +137,7 @@ (ptrToWord user_data2) (ptrToWord user_data3)) - where ptrToWord :: Ptr a -> Word+ where ptrToWord :: Ptr a -> Word32 ptrToWord ptr = fromIntegral (ptr `minusPtr` nullPtr) poke ptr (TreeIter stamp user_data user_data2 user_data3) = do@@ -140,7 +146,7 @@ {# set TreeIter->user_data2 #} ptr (wordToPtr user_data2) {# set TreeIter->user_data3 #} ptr (wordToPtr user_data3) - where wordToPtr :: Word -> Ptr a+ where wordToPtr :: Word32 -> Ptr a wordToPtr word = nullPtr `plusPtr` fromIntegral word -- Pass a pointer to a structure large enough to hold a GtkTreeIter@@ -196,6 +202,9 @@ nativeTreePathFree nativePath return res +maybeWithTreePath :: Maybe TreePath -> (NativeTreePath -> IO a) -> IO a+maybeWithTreePath mbTp act = maybe (act (NativeTreePath nullPtr)) (`withTreePath` act) mbTp+ nativeTreePathGetIndices :: NativeTreePath -> IO [Int] nativeTreePathGetIndices tp = do depth <- liftM fromIntegral $ {# call unsafe tree_path_get_depth #} tp@@ -207,13 +216,13 @@ -- | Convert the given pointer to a tree path. peekTreePath :: Ptr NativeTreePath -> IO TreePath peekTreePath tpPtr | tpPtr==nullPtr = return []- | otherwise =+ | otherwise = nativeTreePathGetIndices (NativeTreePath tpPtr) -- | Convert the given pointer to a tree path. Frees the pointer. fromTreePath :: Ptr NativeTreePath -> IO TreePath fromTreePath tpPtr | tpPtr==nullPtr = return []- | otherwise = do+ | otherwise = do path <- nativeTreePathGetIndices (NativeTreePath tpPtr) nativeTreePathFree (NativeTreePath tpPtr) return path@@ -221,10 +230,11 @@ -- | Convert a comma or colon separated string into a 'TreePath'. Any -- non-digit characters are assumed to separate indices, thus, the function -- always is always successful.-stringToTreePath :: String -> TreePath-stringToTreePath "" = []-stringToTreePath path = getNum 0 (dropWhile (not . isDigit) path)+stringToTreePath :: DefaultGlibString -> TreePath+stringToTreePath = stringToTreePath' . glibToString where+ stringToTreePath' "" = []+ stringToTreePath' path = getNum 0 (dropWhile (not . isDigit) path) getNum acc ('0':xs) = getNum (10*acc) xs getNum acc ('1':xs) = getNum (10*acc+1) xs getNum acc ('2':xs) = getNum (10*acc+2) xs@@ -235,23 +245,23 @@ getNum acc ('7':xs) = getNum (10*acc+7) xs getNum acc ('8':xs) = getNum (10*acc+8) xs getNum acc ('9':xs) = getNum (10*acc+9) xs- getNum acc xs = acc:stringToTreePath (dropWhile (not . isDigit) xs)+ getNum acc xs = acc:stringToTreePath' (dropWhile (not . isDigit) xs) -- | Accessing a row for a specific value. Used for 'ColumnMap'.-data ColumnAccess row- = CAInvalid- | CAInt (row -> Int)- | CABool (row -> Bool)- | CAString (row -> String)- | CAPixbuf (row -> Pixbuf)+data ColumnAccess row where+ CAInvalid :: ColumnAccess row+ CAInt :: (row -> Int) -> ColumnAccess row+ CABool :: (row -> Bool) -> ColumnAccess row+ CAString :: GlibString string => (row -> string) -> ColumnAccess row+ CAPixbuf :: (row -> Pixbuf) -> ColumnAccess row -- | The type of a tree column.-data ColumnId row ty +data ColumnId row ty = ColumnId (GValue -> IO ty) ((row -> ty) -> ColumnAccess row) Int -- it shouldn't matter if the following function is actually inlined-{-# NOINLINE comboQuark #-} +{-# NOINLINE comboQuark #-} comboQuark :: Quark comboQuark =- unsafePerformIO $ quarkFromString "comboBoxHaskellStringModelQuark"- + unsafePerformIO $ quarkFromString ("comboBoxHaskellStringModelQuark"::DefaultGlibString)+
Graphics/UI/Gtk/Multiline/TextBuffer.chs view
@@ -30,12 +30,12 @@ -- -- gtk_text_buffer_insert_with_tags equivalent to calling textBufferInsert, -- then textBufferApplyTag on the inserted text.--- +-- -- gtk_text_buffer_insert_with_tags_by_name same as gtk_text_buffer_insert_with_tags,--- just use textTagName handle tag name. +-- just use textTagName handle tag name. -- -- gtk_text_buffer_create_tag Equivalent to calling textTagNew--- and then adding the tag to the buffer's tag table. +-- and then adding the tag to the buffer's tag table. -- -- The following functions do not make sense due to Haskell's wide character -- representation of Unicode:@@ -53,7 +53,7 @@ -- module Graphics.UI.Gtk.Multiline.TextBuffer ( -- * Detail--- +-- -- | You may wish to begin by reading the text widget conceptual overview -- which gives an overview of all the objects and data types related to the -- text widget and how they work together.@@ -79,9 +79,13 @@ textBufferGetCharCount, textBufferGetTagTable, textBufferInsert,+ textBufferInsertByteString, textBufferInsertAtCursor,+ textBufferInsertByteStringAtCursor, textBufferInsertInteractive,+ textBufferInsertByteStringInteractive, textBufferInsertInteractiveAtCursor,+ textBufferInsertByteStringInteractiveAtCursor, textBufferInsertRange, textBufferInsertRangeInteractive, textBufferDelete,@@ -191,21 +195,19 @@ #endif ) where -import Control.Monad (liftM)+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 Data.ByteString (ByteString) import Data.ByteString.Unsafe (unsafeUseAsCStringLen, unsafePackCStringFinalizer) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.Multiline.Types#}-import Graphics.UI.Gtk.Multiline.TextMark (TextMark, MarkName)-import Graphics.UI.Gtk.Multiline.TextTag (TextTag, TagName)+import Graphics.UI.Gtk.Multiline.TextMark (MarkName)+import Graphics.UI.Gtk.Multiline.TextTag (TagName) {# context lib="gtk" prefix="gtk" #} @@ -219,7 +221,7 @@ -- new one -> IO TextBuffer textBufferNew table =- constructNewGObject mkTextBuffer $+ wrapNewGObject mkTextBuffer $ {# call unsafe text_buffer_new #} (maybe (TextTagTable nullForeignPtr) toTextTagTable table) @@ -253,13 +255,13 @@ (toTextBuffer self) -- | Inserts @text@ at position @iter@. Emits the--- \"insert_text\" signal; insertion actually occurs in the default handler for+-- 'insertText' signal; insertion actually occurs in the default handler for -- the signal. @iter@ is invalidated when insertion occurs (because the buffer -- contents change). ---textBufferInsert :: TextBufferClass self => self+textBufferInsert :: (TextBufferClass self, GlibString string) => self -> TextIter -- ^ @iter@ - a position in the buffer- -> String -- ^ @text@ - text to insert+ -> string -- ^ @text@ - text to insert -> IO () textBufferInsert self iter text = withUTFStringLen text $ \(textPtr, len) ->@@ -269,10 +271,27 @@ textPtr (fromIntegral len) +-- | Inserts @text@ at position @iter@. Similar+-- to 'textBufferInsert' but uses 'ByteString' buffers.+--+-- * The passed-in buffer must contain a valid UTF-8 encoded string.+--+textBufferInsertByteString :: TextBufferClass self => self+ -> TextIter -- ^ @iter@ - a position in the buffer+ -> ByteString -- ^ @text@ - text to insert+ -> IO ()+textBufferInsertByteString self iter text =+ unsafeUseAsCStringLen text $ \(textPtr, len) ->+ {# call text_buffer_insert #}+ (toTextBuffer self)+ iter+ textPtr+ (fromIntegral len)+ -- | Simply calls 'textBufferInsert', using the current cursor position as the -- insertion point. ---textBufferInsertAtCursor :: TextBufferClass self => self -> String -> IO ()+textBufferInsertAtCursor :: (TextBufferClass self, GlibString string) => self -> string -> IO () textBufferInsertAtCursor self text = withUTFStringLen text $ \(textPtr, len) -> {# call text_buffer_insert_at_cursor #}@@ -280,6 +299,19 @@ textPtr (fromIntegral len) +-- | Simply calls 'textBufferInsert', using the current cursor position as the+-- insertion point. Similar to 'textBufferInsertAtCursor' but uses 'ByteString' buffers.+--+-- * The passed-in buffer must contain a valid UTF-8 encoded string.+--+textBufferInsertByteStringAtCursor :: TextBufferClass self => self -> ByteString -> IO ()+textBufferInsertByteStringAtCursor self text =+ unsafeUseAsCStringLen text $ \(textPtr, len) ->+ {# call text_buffer_insert_at_cursor #}+ (toTextBuffer self)+ textPtr+ (fromIntegral len)+ -- | Like 'textBufferInsert', but the insertion will not occur if @iter@ is at -- a non-editable location in the buffer. Usually you want to prevent -- insertions at ineditable locations if the insertion results from a user@@ -289,9 +321,9 @@ -- decide if the text should be inserted. This value could be set to the result -- of 'Graphics.UI.Gtk.Multiline.TextView.textViewGetEditable'. ---textBufferInsertInteractive :: TextBufferClass self => self+textBufferInsertInteractive :: (TextBufferClass self, GlibString string) => self -> TextIter -- ^ @iter@ - a position in @buffer@- -> String -- ^ @text@ - the text to insert+ -> string -- ^ @text@ - the text to insert -> Bool -- ^ @defaultEditable@ - default editability of buffer -> IO Bool -- ^ returns whether text was actually inserted textBufferInsertInteractive self iter text defaultEditable =@@ -304,10 +336,29 @@ (fromIntegral len) (fromBool defaultEditable) +-- | Similar to 'textBufferInsertInteractive' but uses 'ByteString' buffers.+--+-- * The passed-in buffer must contain a valid UTF-8 encoded string.+--+textBufferInsertByteStringInteractive :: TextBufferClass self => self+ -> TextIter -- ^ @iter@ - a position in @buffer@+ -> ByteString -- ^ @text@ - the text to insert+ -> Bool -- ^ @defaultEditable@ - default editability of buffer+ -> IO Bool -- ^ returns whether text was actually inserted+textBufferInsertByteStringInteractive self iter text defaultEditable =+ liftM toBool $+ unsafeUseAsCStringLen text $ \(textPtr, len) ->+ {# call text_buffer_insert_interactive #}+ (toTextBuffer self)+ iter+ textPtr+ (fromIntegral len)+ (fromBool defaultEditable)+ -- | Calls 'textBufferInsertInteractive' at the cursor position. ---textBufferInsertInteractiveAtCursor :: TextBufferClass self => self- -> String -- ^ @text@ - the text to insert+textBufferInsertInteractiveAtCursor :: (TextBufferClass self, GlibString string) => self+ -> string -- ^ @text@ - the text to insert -> Bool -- ^ @defaultEditable@ - default editability of buffer -> IO Bool -- ^ returns whether text was actually inserted textBufferInsertInteractiveAtCursor self text defaultEditable =@@ -319,13 +370,30 @@ (fromIntegral len) (fromBool defaultEditable) +-- | Similar to 'textBufferInsertInteractiveAtCursor' but uses 'ByteString' buffers.+--+-- * The passed-in buffer must contain a valid UTF-8 encoded string.+--+textBufferInsertByteStringInteractiveAtCursor :: TextBufferClass self => self+ -> ByteString -- ^ @text@ - the text to insert+ -> Bool -- ^ @defaultEditable@ - default editability of buffer+ -> IO Bool -- ^ returns whether text was actually inserted+textBufferInsertByteStringInteractiveAtCursor self text defaultEditable =+ liftM toBool $+ unsafeUseAsCStringLen text $ \(textPtr, len) ->+ {# call text_buffer_insert_interactive_at_cursor #}+ (toTextBuffer self)+ textPtr+ (fromIntegral len)+ (fromBool defaultEditable)+ -- | Copies text, tags, and pixbufs between @start@ and @end@ (the order of -- @start@ and @end@ doesn't matter) and inserts the copy at @iter@. Used -- instead of simply getting\/inserting text because it preserves images and -- tags. If @start@ and @end@ are in a different buffer from @buffer@, the two -- buffers must share the same tag table. ----- Implemented via emissions of the insert-text and apply-tag signals, so+-- Implemented via emissions of the insert-text and 'applyTag' signals, so -- expect those. -- textBufferInsertRange :: TextBufferClass self => self@@ -363,7 +431,7 @@ -- | Deletes text between @start@ and @end@. The order of @start@ and @end@ is -- not actually relevant; 'textBufferDelete' will reorder them. This function--- actually emits the \"delete_range\" signal, and the default handler of that+-- actually emits the 'deleteRange' signal, and the default handler of that -- signal deletes the text. Because the buffer is modified, all outstanding -- iterators become invalid after calling this function; however, the @start@ -- and @end@ will be re-initialized to point to the location where text was@@ -400,8 +468,8 @@ -- | Deletes current contents of @buffer@, and inserts @text@ instead. ---textBufferSetText :: TextBufferClass self => self- -> String -- ^ @text@ - text to insert+textBufferSetText :: (TextBufferClass self, GlibString string) => self+ -> string -- ^ @text@ - text to insert -> IO () textBufferSetText self text = withUTFStringLen text $ \(textPtr, len) ->@@ -417,11 +485,11 @@ -- /not/ correspond to character indexes into the buffer. Contrast -- with 'textBufferGetSlice'. ---textBufferGetText :: TextBufferClass self => self+textBufferGetText :: (TextBufferClass self, GlibString string) => self -> TextIter -- ^ @start@ - start of a range -> TextIter -- ^ @end@ - end of a range -> Bool -- ^ @includeHiddenChars@ - whether to include invisible text- -> IO String+ -> IO string textBufferGetText self start end includeHiddenChars = {# call unsafe text_buffer_get_text #} (toTextBuffer self)@@ -439,11 +507,11 @@ -- that @(chr 0xFFFC)@ can occur in normal text as well, so it is not a reliable -- indicator that a pixbuf or widget is in the buffer. ---textBufferGetSlice :: TextBufferClass self => self+textBufferGetSlice :: (TextBufferClass self, GlibString string) => self -> TextIter -- ^ @start@ - start of a range -> TextIter -- ^ @end@ - end of a range -> Bool -- ^ @includeHiddenChars@ - whether to include invisible text- -> IO String+ -> IO string textBufferGetSlice self start end includeHiddenChars = {# call unsafe text_buffer_get_slice #} (toTextBuffer self)@@ -534,7 +602,7 @@ -- standard left-to-right cursor is a mark with right gravity (when you type, -- the cursor stays on the right side of the text you're typing). ----- Emits the \"mark_set\" signal as notification of the mark's initial+-- Emits the 'markSet' signal as notification of the mark's initial -- placement. -- textBufferCreateMark :: TextBufferClass self => self@@ -552,7 +620,7 @@ (fromBool leftGravity) #if GTK_CHECK_VERSION(2,12,0)--- | Adds the mark at position given by the 'TextIter'. +-- | Adds the mark at position given by the 'TextIter'. -- The mark may not be added to any other buffer. -- -- Emits the 'markSet' signal as notification of the mark's initial placement.@@ -598,7 +666,7 @@ -- return @True@ after this function has been -- called on a mark; 'Graphics.UI.Gtk.Multiline.TextMark.textMarkGetDeleted' -- indicates that a mark no longer--- belongs to a buffer. The \"mark_deleted\" signal will be emitted as+-- belongs to a buffer. The 'markDeleted' signal will be emitted as -- notification after the mark is deleted. -- textBufferDeleteMark :: (TextBufferClass self, TextMarkClass mark) => self@@ -676,7 +744,7 @@ (toTextBuffer self) where_ --- | Emits the \"apply_tag\" signal on the buffer. The default handler for the+-- | Emits the 'applyTag' signal on the buffer. The default handler for the -- signal applies @tag@ to the given range. @start@ and @end@ do not have to be -- in order. --@@ -692,7 +760,7 @@ start end --- | Emits the \"remove_tag\" signal. The default handler for the signal+-- | Emits the 'removeTag' signal. The default handler for the signal -- removes all occurrences of @tag@ from the given range. @start@ and @end@ -- don't have to be in order. --@@ -787,7 +855,7 @@ iter (fromIntegral charOffset) return iter- + -- | Create an iterator at a specific line. -- textBufferGetIterAtLine :: TextBufferClass self => self@@ -859,7 +927,7 @@ -- time it was saved. Whenever the buffer is saved to disk, call -- @'textBufferSetModified' buffer False@. When the buffer is -- modified, it will automatically toggled on the modified bit again. When the--- modified bit flips, the buffer emits a \"modified_changed\" signal.+-- modified bit flips, the buffer emits a 'modifiedChanged' signal. -- textBufferSetModified :: TextBufferClass self => self -> Bool -> IO () textBufferSetModified self setting =@@ -915,8 +983,8 @@ -- operations between 'textBufferBeginUserAction' and 'textBufferEndUserAction' -- can then be grouped when creating an undo stack. 'TextBuffer' maintains a -- count of calls to 'textBufferBeginUserAction' that have not been closed with--- a call to 'textBufferEndUserAction', and emits the \"begin_user_action\" and--- \"end_user_action\" signals only for the outermost pair of calls. This+-- a call to 'textBufferEndUserAction', and emits the 'beginUserAction' and+-- 'endUserAction' signals only for the outermost pair of calls. This -- allows you to build user actions from other user actions. -- -- The \"interactive\" buffer mutation functions, such as@@ -1053,8 +1121,8 @@ -- 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 -- ^ @location@ - location to insert pasted text+ -> Clipboard -- ^ @clipboard@ - the GtkClipboard to paste from+ -> TextIter -- ^ @location@ - location to insert pasted text -> Bool -- ^ @defaultEditable@ - whether the buffer is editable by default -> IO () textBufferPasteClipboard self clipboard overrideLocation defaultEditable =@@ -1069,7 +1137,7 @@ -- 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.) textBufferPasteClipboardAtCursor :: TextBufferClass self => self- -> Clipboard -- ^ @clipboard@ - the GtkClipboard to paste from+ -> Clipboard -- ^ @clipboard@ - the GtkClipboard to paste from -> Bool -- ^ @defaultEditable@ - whether the buffer is editable by default -> IO () textBufferPasteClipboardAtCursor self clipboard defaultEditable =@@ -1081,7 +1149,7 @@ -- | Copies the currently-selected text to a clipboard. textBufferCopyClipboard :: TextBufferClass self => self- -> Clipboard -- ^ @clipboard@ - the GtkClipboard object to copy to+ -> Clipboard -- ^ @clipboard@ - the GtkClipboard object to copy to -> IO () textBufferCopyClipboard self clipboard = {# call gtk_text_buffer_copy_clipboard #}@@ -1091,7 +1159,7 @@ -- | 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+ -> Clipboard -- ^ @clipboard@ - the GtkClipboard object to cut to -> Bool -- ^ @defaultEditable@ - whether the buffer is editable by default -> IO () textBufferCutClipboard self clipboard defaultEditable =@@ -1101,11 +1169,11 @@ (fromBool defaultEditable) #endif --- | Adds clipboard to the list of clipboards in which the selection contents of @self@ are available. +-- | Adds clipboard to the list of clipboards in which the selection contents of @self@ are available. -- In most cases, @clipboard@ will be the 'Clipboard' of type 'selectionPrimary' for a view of @self@. -- textBufferAddSelectionClipboard :: TextBufferClass self => self- -> Clipboard -- ^ @clipboard@ - the 'Clipboard' object to add+ -> Clipboard -- ^ @clipboard@ - the 'Clipboard' object to add -> IO () textBufferAddSelectionClipboard self clipboard = {# call text_buffer_add_selection_clipboard #} (toTextBuffer self) clipboard@@ -1115,7 +1183,7 @@ textBufferRemoveSelectionClipboard :: TextBufferClass self => self -> Clipboard -- ^ @clipboard@ - the 'Clipboard' object to remove -> IO ()-textBufferRemoveSelectionClipboard self clipboard = +textBufferRemoveSelectionClipboard self clipboard = {# call text_buffer_remove_selection_clipboard #} (toTextBuffer self) clipboard --------------------@@ -1134,7 +1202,7 @@ -- -- Default value: \"\" ---textBufferText :: TextBufferClass self => Attr self String+textBufferText :: (TextBufferClass self, GlibString string) => Attr self string textBufferText = newAttrFromStringProperty "text" #endif @@ -1151,7 +1219,7 @@ -- | A 'TextTag' was applied to a region of text. ---applyTag :: TextBufferClass self => Signal self (TextTag -> TextIter -> TextIter -> IO ()) +applyTag :: TextBufferClass self => Signal self (TextTag -> TextIter -> TextIter -> IO ()) applyTag = Signal (connect_OBJECT_BOXED_BOXED__NONE "apply-tag" mkTextIterCopy mkTextIterCopy) -- | A new atomic user action is started.@@ -1181,19 +1249,31 @@ -- | A 'Pixbuf' is inserted into the buffer. --+-- * See note in 'bufferInsertText'.+-- insertPixbuf :: TextBufferClass self => Signal self (TextIter -> Pixbuf -> IO ()) insertPixbuf = Signal (connect_BOXED_OBJECT__NONE "insert-pixbuf" mkTextIterCopy) --- | The 'insertChildAnchor' signal is emitted to insert a 'TextChildAnchor' in a 'TextBuffer'. +-- | The 'insertChildAnchor' signal is emitted to insert a 'TextChildAnchor' in a 'TextBuffer'. -- Insertion actually occurs in the default handler. --+-- * See note in 'bufferInsertText'.+-- insertChildAnchor :: TextBufferClass self => Signal self (TextIter -> TextChildAnchor -> IO ()) insertChildAnchor = Signal (connect_BOXED_OBJECT__NONE "insert-child-anchor" mkTextIterCopy) --- | Some text was inserted.+-- | Some text is inserted. Insertion actually occurs in the default handler. ---bufferInsertText :: TextBufferClass self => Signal self (TextIter -> String -> IO ())-bufferInsertText = Signal (connect_BOXED_STRING__NONE "insert-text" mkTextIterCopy)+-- * The function connected to this handler may not modify the buffer since+-- this would invalidate the iterator. If this function replaces the+-- default handler, it needs to stop the emission of this signal in order+-- to prevent the default handler from running. If additional text should+-- be inserted, this can be done using the 'after' function to connect.+--+bufferInsertText :: (TextBufferClass self, GlibString string) => Signal self (TextIter -> string -> IO ())+bufferInsertText = Signal $ \after obj handler ->+ connect_BOXED_PTR_INT__NONE "insert-text" mkTextIterCopy after obj+ (\iter strPtr strLen -> peekUTFStringLen (strPtr, strLen) >>= handler iter) -- | A 'TextMark' within the buffer was deleted. --@@ -1208,8 +1288,8 @@ modifiedChanged :: TextBufferClass self => Signal self (IO ()) modifiedChanged = Signal (connect_NONE__NONE "modified-changed") --- | The 'pasteDone' signal is emitted after paste operation has been completed. --- This is useful to properly scroll the view to the end of the pasted text. +-- | The 'pasteDone' signal is emitted after paste operation has been completed.+-- This is useful to properly scroll the view to the end of the pasted text. -- See 'textBufferPasteClipboard' for more details. pasteDone :: TextBufferClass self => Signal self (Clipboard -> IO ()) pasteDone = Signal (connect_OBJECT__NONE "paste-done")@@ -1229,9 +1309,9 @@ onApplyTag, afterApplyTag :: TextBufferClass self => self -> (TextTag -> TextIter -> TextIter -> IO ()) -> IO (ConnectId self)-onApplyTag = connect_OBJECT_BOXED_BOXED__NONE "apply-tag" +onApplyTag = connect_OBJECT_BOXED_BOXED__NONE "apply-tag" mkTextIterCopy mkTextIterCopy False-afterApplyTag = connect_OBJECT_BOXED_BOXED__NONE "apply-tag" +afterApplyTag = connect_OBJECT_BOXED_BOXED__NONE "apply-tag" mkTextIterCopy mkTextIterCopy True -- | A new atomic user action is started.@@ -1285,19 +1365,19 @@ -- | Some text was inserted. ---onBufferInsertText, afterBufferInsertText :: TextBufferClass self => self- -> (TextIter -> String -> IO ())+onBufferInsertText, afterBufferInsertText :: (TextBufferClass self, GlibString string) => self+ -> (TextIter -> string -> IO ()) -> IO (ConnectId self)-onBufferInsertText self user = +onBufferInsertText self user = connect_BOXED_PTR_INT__NONE "insert-text" mkTextIterCopy False self $ \iter strP strLen -> do str <- peekUTFStringLen (strP,strLen)- user iter str -afterBufferInsertText self user = + user iter str+afterBufferInsertText self user = connect_BOXED_PTR_INT__NONE "insert-text" mkTextIterCopy True self $ \iter strP strLen -> do str <- peekUTFStringLen (strP,strLen)- user iter str + user iter str -- | A 'TextMark' within the buffer was deleted. --@@ -1328,9 +1408,9 @@ onRemoveTag, afterRemoveTag :: TextBufferClass self => self -> (TextTag -> TextIter -> TextIter -> IO ()) -> IO (ConnectId self)-onRemoveTag = connect_OBJECT_BOXED_BOXED__NONE "remove-tag" +onRemoveTag = connect_OBJECT_BOXED_BOXED__NONE "remove-tag" mkTextIterCopy mkTextIterCopy False-afterRemoveTag = connect_OBJECT_BOXED_BOXED__NONE "remove-tag" +afterRemoveTag = connect_OBJECT_BOXED_BOXED__NONE "remove-tag" mkTextIterCopy mkTextIterCopy True #endif
Graphics/UI/Gtk/Multiline/TextIter.chs view
@@ -34,7 +34,7 @@ -- Stability : provisional -- Portability : portable (depends on GHC) ----- An iterator is an abstract datatype representing a pointer into a +-- An iterator is an abstract datatype representing a pointer into a -- 'TextBuffer'. -- module Graphics.UI.Gtk.Multiline.TextIter (@@ -138,18 +138,17 @@ textIterLine, ) where -import Control.Monad (liftM)-import Data.Maybe (fromMaybe)-import Data.Char (chr)+import Control.Monad (liftM)+import Data.Maybe (fromMaybe)+import Data.Char (chr) import System.Glib.FFI-import System.Glib.Flags (fromFlags)+import System.Glib.Flags (fromFlags) import System.Glib.UTFString import System.Glib.Attributes-import System.Glib.GObject (makeNewGObject) import System.Glib.GList {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (TextSearchFlags(..))+import Graphics.UI.Gtk.General.Enums (TextSearchFlags(..)) {#import Graphics.UI.Gtk.Multiline.Types#} {#import Graphics.UI.Gtk.Multiline.TextTag#} {#import Graphics.Rendering.Pango.BasicTypes#}@@ -201,7 +200,7 @@ -- If the element at this iterator is a non-character -- element, such as an image embedded in the buffer, the Unicode \"unknown\" -- character 0xFFFC is returned. If invoked on the end iterator,--- @Nothigng@ is returned.+-- @Nothing@ is returned. -- textIterGetChar :: TextIter -> IO (Maybe Char) textIterGetChar ti = do@@ -216,7 +215,7 @@ -- Note that 0xFFFC can occur in normal text as well, so it is not a reliable -- indicator that a pixbuf or widget is in the buffer. ---textIterGetSlice :: TextIter -> TextIter -> IO String+textIterGetSlice :: GlibString string => TextIter -> TextIter -> IO string textIterGetSlice end start = do cStr <- {#call text_iter_get_slice#} start end str <- peekUTFString cStr@@ -228,7 +227,7 @@ -- * Pictures (and other objects) are stripped form the output. Thus, this -- function does not preserve offsets. ---textIterGetText :: TextIter -> TextIter -> IO String+textIterGetText :: GlibString string => TextIter -> TextIter -> IO string textIterGetText start end = do cStr <- {#call text_iter_get_text#} start end str <- peekUTFString cStr@@ -239,7 +238,7 @@ -- text is usually invisible because a 'TextTag' with the \"invisible\" -- attribute turned on has been applied to it. ---textIterGetVisibleSlice :: TextIter -> TextIter -> IO String+textIterGetVisibleSlice :: GlibString string => TextIter -> TextIter -> IO string textIterGetVisibleSlice start end = do cStr <- {#call text_iter_get_visible_slice#} start end str <- peekUTFString cStr@@ -250,7 +249,7 @@ -- text is usually invisible because a 'TextTag' with the \"invisible\" -- attribute turned on has been applied to it. ---textIterGetVisibleText :: TextIter -> TextIter -> IO String+textIterGetVisibleText :: GlibString string => TextIter -> TextIter -> IO string textIterGetVisibleText start end = do cStr <- {#call text_iter_get_visible_text#} start end str <- peekUTFString cStr@@ -265,8 +264,8 @@ if pbPtr==nullPtr then return Nothing else liftM Just $ makeNewGObject mkPixbuf (return pbPtr) --- | If the location at @iter@ contains a child anchor, --- the anchor is returned (with no new reference count added). +-- | If the location at @iter@ contains a child anchor,+-- the anchor is returned (with no new reference count added). -- Otherwise, @Nothing@ is returned. -- textIterGetChildAnchor :: TextIter -> IO (Maybe TextChildAnchor)@@ -330,7 +329,7 @@ {#call unsafe text_iter_ends_tag#} ti (TextTag nullForeignPtr) -- | Query if the 'TextIter' is at the--- beginning or the end of a 'TextTag'. This is equivalent to +-- beginning or the end of a 'TextTag'. This is equivalent to -- ('textIterBeginsTag' || 'textIterEndsTag'), i.e. it -- tells you whether a range with @tag@ applied to it begins /or/ ends at -- @iter@.@@ -375,7 +374,7 @@ -- 'textIterCanInsert' to handle this case. -- textIterEditable :: TextIter -> Bool -> IO Bool-textIterEditable ti def = liftM toBool $ +textIterEditable ti def = liftM toBool $ {#call unsafe text_iter_editable#} ti (fromBool def) -- | Check if new text can be inserted at 'TextIter'.@@ -392,7 +391,7 @@ -- if you want to insert text depending on the current editable status. -- textIterCanInsert :: TextIter -> Bool -> IO Bool-textIterCanInsert ti def = liftM toBool $ +textIterCanInsert ti def = liftM toBool $ {#call unsafe text_iter_can_insert#} ti (fromBool def) -- | Determine if 'TextIter' begins a new@@ -435,28 +434,28 @@ -- sentence. -- textIterStartsSentence :: TextIter -> IO Bool-textIterStartsSentence ti = liftM toBool $ +textIterStartsSentence ti = liftM toBool $ {#call unsafe text_iter_starts_sentence#} ti -- | Determine if 'TextIter' ends a -- sentence. -- textIterEndsSentence :: TextIter -> IO Bool-textIterEndsSentence ti = liftM toBool $ +textIterEndsSentence ti = liftM toBool $ {#call unsafe text_iter_ends_sentence#} ti -- | Determine if 'TextIter' is inside -- a sentence. -- textIterInsideSentence :: TextIter -> IO Bool-textIterInsideSentence ti = liftM toBool $ +textIterInsideSentence ti = liftM toBool $ {#call unsafe text_iter_inside_sentence#} ti -- | Determine if 'TextIter' is at a -- cursor position. -- textIterIsCursorPosition :: TextIter -> IO Bool-textIterIsCursorPosition ti = liftM toBool $ +textIterIsCursorPosition ti = liftM toBool $ {#call unsafe text_iter_is_cursor_position#} ti -- | Return number of characters in this line.@@ -467,17 +466,17 @@ textIterGetCharsInLine ti = liftM fromIntegral $ {#call unsafe text_iter_get_chars_in_line#} ti --- | Computes the effect of any tags applied to this spot in the text. --- The values parameter should be initialized to the default settings you wish to use if no tags are in effect. --- You'd typically obtain the defaults from 'textViewGetDefaultAttributes'. --- 'textIterGetAttributes' will modify values, applying the effects of any tags present at iter. +-- | Computes the effect of any tags applied to this spot in the text.+-- The values parameter should be initialized to the default settings you wish to use if no tags are in effect.+-- You'd typically obtain the defaults from 'textViewGetDefaultAttributes'.+-- 'textIterGetAttributes' will modify values, applying the effects of any tags present at iter. -- If any tags affected values, the function returns @True@. -- textIterGetAttributes :: TextIter -> TextAttributes -> IO Bool textIterGetAttributes ti ta = liftM toBool $ {#call unsafe text_iter_get_attributes#} ti ta --- | A convenience wrapper around 'textIterGetAttributes', which returns the language in effect at iter. +-- | A convenience wrapper around 'textIterGetAttributes', which returns the language in effect at iter. -- If no tags affecting language apply to iter, the return value is identical to that of 'getDefaultLanguage'. -- textIterGetLanguage :: TextIter -> IO Language@@ -488,36 +487,36 @@ -- the buffer. -- textIterIsEnd :: TextIter -> IO Bool-textIterIsEnd ti = liftM toBool $ +textIterIsEnd ti = liftM toBool $ {#call unsafe text_iter_is_end#} ti -- | Determine if 'TextIter' is at the -- beginning of the buffer. -- textIterIsStart :: TextIter -> IO Bool-textIterIsStart ti = liftM toBool $ +textIterIsStart ti = liftM toBool $ {#call unsafe text_iter_is_start#} ti -- | Move 'TextIter' forwards. ----- * Retuns True if the iterator is pointing to a character.+-- * Returns True if the iterator is pointing to a character. -- textIterForwardChar :: TextIter -> IO Bool-textIterForwardChar ti = liftM toBool $ +textIterForwardChar ti = liftM toBool $ {#call unsafe text_iter_forward_char#} ti -- | Move 'TextIter' backwards. ----- * Retuns True if the movement was possible.+-- * Returns True if the movement was possible. -- textIterBackwardChar :: TextIter -> IO Bool-textIterBackwardChar ti = liftM toBool $ +textIterBackwardChar ti = liftM toBool $ {#call unsafe text_iter_backward_char#} ti -- | Move 'TextIter' forwards by -- @n@ characters. ----- * Retuns @True@ if the iterator is pointing to a new character (and @False@ if+-- * Returns @True@ if the iterator is pointing to a new character (and @False@ if -- the iterator points to a picture or has not moved). -- -- * Note that images embedded@@ -525,49 +524,49 @@ -- move onto an image instead of a character. -- textIterForwardChars :: TextIter -> Int -> IO Bool-textIterForwardChars ti n = liftM toBool $ +textIterForwardChars ti n = liftM toBool $ {#call unsafe text_iter_forward_chars#} ti (fromIntegral n) -- | Move 'TextIter' backwards by -- @n@ characters. ----- * Retuns @True@ if the iterator is pointing to a new character (and @False@ if+-- * Returns @True@ if the iterator is pointing to a new character (and @False@ if -- the iterator points to a picture or has not moved). -- textIterBackwardChars :: TextIter -> Int -> IO Bool-textIterBackwardChars ti n = liftM toBool $ +textIterBackwardChars ti n = liftM toBool $ {#call unsafe text_iter_backward_chars#} ti (fromIntegral n) -- | Move 'TextIter' forwards. ----- * Retuns True if the iterator is pointing to a new line (and False if the+-- * Returns True if the iterator is pointing to a new line (and False if the -- iterator points to a picture or has not moved). -- -- * If 'TextIter' is on the first line, it will be moved to the -- beginning of the buffer. -- textIterForwardLine :: TextIter -> IO Bool-textIterForwardLine ti = liftM toBool $ +textIterForwardLine ti = liftM toBool $ {#call unsafe text_iter_forward_line#} ti -- | Move 'TextIter' backwards. ----- * Retuns True if the iterator is pointing to a new line (and False if the+-- * Returns True if the iterator is pointing to a new line (and False if the -- iterator points to a picture or has not moved). -- -- * If 'TextIter' is on the first line, it will be moved to the end -- of the buffer. -- textIterBackwardLine :: TextIter -> IO Bool-textIterBackwardLine ti = liftM toBool $ +textIterBackwardLine ti = liftM toBool $ {#call unsafe text_iter_backward_line#} ti -- | Move 'TextIter' forwards by -- @n@ lines. ----- * Retuns True if the iterator is pointing to a new line (and False if the+-- * Returns True if the iterator is pointing to a new line (and False if the -- iterator points to a picture or has not moved). -- -- * If 'TextIter' is on the first line, it will be moved to the@@ -576,13 +575,13 @@ -- * @n@ can be negative. -- textIterForwardLines :: TextIter -> Int -> IO Bool-textIterForwardLines ti n = liftM toBool $ +textIterForwardLines ti n = liftM toBool $ {#call unsafe text_iter_forward_lines#} ti (fromIntegral n) -- | Move 'TextIter' backwards by -- @n@ lines. ----- * Retuns True if the iterator is pointing to a new line (and False if the+-- * Returns True if the iterator is pointing to a new line (and False if the -- iterator points to a picture or has not moved). -- -- * If 'TextIter' is on the first line, it will be moved to the end@@ -591,50 +590,50 @@ -- * @n@ can be negative. -- textIterBackwardLines :: TextIter -> Int -> IO Bool-textIterBackwardLines ti n = liftM toBool $ +textIterBackwardLines ti n = liftM toBool $ {#call unsafe text_iter_backward_lines#} ti (fromIntegral n) -- | Move 'TextIter' forwards by -- @n@ word ends. ----- * Retuns True if the iterator is pointing to a new word end.+-- * Returns True if the iterator is pointing to a new word end. -- textIterForwardWordEnds :: TextIter -> Int -> IO Bool-textIterForwardWordEnds ti n = liftM toBool $ +textIterForwardWordEnds ti n = liftM toBool $ {#call unsafe text_iter_forward_word_ends#} ti (fromIntegral n) -- | Move 'TextIter' backwards by -- @n@ word beginnings. ----- * Retuns True if the iterator is pointing to a new word start.+-- * Returns True if the iterator is pointing to a new word start. -- textIterBackwardWordStarts :: TextIter -> Int -> IO Bool-textIterBackwardWordStarts ti n = liftM toBool $ +textIterBackwardWordStarts ti n = liftM toBool $ {#call unsafe text_iter_backward_word_starts#} ti (fromIntegral n) -- | Move 'TextIter' forwards to the -- next word end. ----- * Retuns True if the iterator has moved to a new word end.+-- * Returns True if the iterator has moved to a new word end. -- textIterForwardWordEnd :: TextIter -> IO Bool-textIterForwardWordEnd ti = liftM toBool $ +textIterForwardWordEnd ti = liftM toBool $ {#call unsafe text_iter_forward_word_end#} ti -- | Move 'TextIter' backwards to -- the next word beginning. ----- * Retuns True if the iterator has moved to a new word beginning.+-- * Returns True if the iterator has moved to a new word beginning. -- textIterBackwardWordStart :: TextIter -> IO Bool-textIterBackwardWordStart ti = liftM toBool $ +textIterBackwardWordStart ti = liftM toBool $ {#call unsafe text_iter_backward_word_start#} ti -- | Move 'TextIter' forwards to -- the next cursor position. -- -- * Some characters are composed of two Unicode codes. This function ensures--- that 'TextIter' does not point inbetween such double characters.+-- that 'TextIter' does not point in between such double characters. -- -- * Returns True if 'TextIter' moved and points to a character (not -- to an object).@@ -647,7 +646,7 @@ -- to the next cursor position. -- -- * Some characters are composed of two Unicode codes. This function ensures--- that 'TextIter' does not point inbetween such double characters.+-- that 'TextIter' does not point in between such double characters. -- -- * Returns True if 'TextIter' moved and points to a character (not -- to an object).@@ -663,7 +662,7 @@ -- to an object). -- textIterForwardCursorPositions :: TextIter -> Int -> IO Bool-textIterForwardCursorPositions ti n = liftM toBool $ +textIterForwardCursorPositions ti n = liftM toBool $ {#call unsafe text_iter_forward_cursor_positions#} ti (fromIntegral n) -- | Move 'TextIter' backwards@@ -673,51 +672,51 @@ -- to an object). -- textIterBackwardCursorPositions :: TextIter -> Int -> IO Bool-textIterBackwardCursorPositions ti n = liftM toBool $ +textIterBackwardCursorPositions ti n = liftM toBool $ {#call unsafe text_iter_backward_cursor_positions#} ti (fromIntegral n) -- | Move 'TextIter' forwards by -- @n@ sentence ends. ----- * Retuns True if the iterator is pointing to a new sentence end.+-- * Returns True if the iterator is pointing to a new sentence end. -- textIterForwardSentenceEnds :: TextIter -> Int -> IO Bool-textIterForwardSentenceEnds ti n = liftM toBool $ +textIterForwardSentenceEnds ti n = liftM toBool $ {#call unsafe text_iter_forward_sentence_ends#} ti (fromIntegral n) -- | Move 'TextIter' backwards -- by @n@ sentence beginnings. ----- * Retuns True if the iterator is pointing to a new sentence start.+-- * Returns True if the iterator is pointing to a new sentence start. -- textIterBackwardSentenceStarts :: TextIter -> Int -> IO Bool-textIterBackwardSentenceStarts ti n = liftM toBool $ +textIterBackwardSentenceStarts ti n = liftM toBool $ {#call unsafe text_iter_backward_sentence_starts#} ti (fromIntegral n) -- | Move 'TextIter' forwards to -- the next sentence end. ----- * Retuns True if the iterator has moved to a new sentence end.+-- * Returns True if the iterator has moved to a new sentence end. -- textIterForwardSentenceEnd :: TextIter -> IO Bool-textIterForwardSentenceEnd ti = liftM toBool $ +textIterForwardSentenceEnd ti = liftM toBool $ {#call unsafe text_iter_forward_sentence_end#} ti -- | Move 'TextIter' backwards -- to the next sentence beginning. ----- * Retuns True if the iterator has moved to a new sentence beginning.+-- * Returns True if the iterator has moved to a new sentence beginning. -- textIterBackwardSentenceStart :: TextIter -> IO Bool-textIterBackwardSentenceStart ti = liftM toBool $ +textIterBackwardSentenceStart ti = liftM toBool $ {#call unsafe text_iter_backward_sentence_start#} ti -- | Set 'TextIter' to an offset within the -- buffer. -- textIterSetOffset :: TextIter -> Int -> IO ()-textIterSetOffset ti n = +textIterSetOffset ti n = {#call unsafe text_iter_set_offset#} ti (fromIntegral n) -- | Set 'TextIter' to a line within the@@ -727,7 +726,7 @@ -- moves @iter@ to the start of the last line in the buffer. -- textIterSetLine :: TextIter -> Int -> IO ()-textIterSetLine ti n = +textIterSetLine ti n = {#call unsafe text_iter_set_line#} ti (fromIntegral n) -- | Set 'TextIter' to an offset within the line.@@ -738,14 +737,14 @@ -- next line. -- textIterSetLineOffset :: TextIter -> Int -> IO ()-textIterSetLineOffset ti n = +textIterSetLineOffset ti n = {#call unsafe text_iter_set_line_offset#} ti (fromIntegral n) -- | Like 'textIterSetLineOffset', but the offset is in visible characters, -- i.e. text with a tag making it invisible is not counted in the offset. -- textIterSetVisibleLineOffset :: TextIter -> Int -> IO ()-textIterSetVisibleLineOffset ti n = +textIterSetVisibleLineOffset ti n = {#call unsafe text_iter_set_visible_line_offset#} ti (fromIntegral n) -- | Moves @iter@ forward to the \"end iterator,\" which points one past the@@ -775,7 +774,7 @@ -- textIterForwardToTagToggle :: TextIter -> Maybe TextTag -> IO Bool textIterForwardToTagToggle ti tt = liftM toBool $- {#call unsafe text_iter_forward_to_tag_toggle#} ti + {#call unsafe text_iter_forward_to_tag_toggle#} ti (fromMaybe (TextTag nullForeignPtr) tt) -- | Moves 'TextIter' backward to@@ -787,17 +786,13 @@ -- textIterBackwardToTagToggle :: TextIter -> Maybe TextTag -> IO Bool textIterBackwardToTagToggle ti tt = liftM toBool $- {#call unsafe text_iter_backward_to_tag_toggle#} ti + {#call unsafe text_iter_backward_to_tag_toggle#} ti (fromMaybe (TextTag nullForeignPtr) tt) --- Setup a callback for a predicate function.----type TextCharPredicateCB = Char -> Bool- {#pointer TextCharPredicate#} foreign import ccall "wrapper" mkTextCharPredicate ::- ({#type gunichar#} -> Ptr () -> {#type gboolean#}) -> IO TextCharPredicate+ ({#type gunichar#} -> Ptr () -> IO {#type gboolean#}) -> IO TextCharPredicate -- | Move 'TextIter' forward until a -- predicate function returns True.@@ -810,8 +805,8 @@ textIterForwardFindChar :: TextIter -> (Char -> Bool) -> Maybe TextIter -> IO Bool textIterForwardFindChar ti pred limit = do- fPtr <- mkTextCharPredicate (\c _ -> fromBool $ pred (chr (fromIntegral c)))- res <- liftM toBool $ {#call text_iter_forward_find_char#} + fPtr <- mkTextCharPredicate (\c _ -> return $ fromBool $ pred (chr (fromIntegral c)))+ res <- liftM toBool $ {#call text_iter_forward_find_char#} ti fPtr nullPtr (fromMaybe (TextIter nullForeignPtr) limit) freeHaskellFunPtr fPtr return res@@ -827,8 +822,8 @@ textIterBackwardFindChar :: TextIter -> (Char -> Bool) -> Maybe TextIter -> IO Bool textIterBackwardFindChar ti pred limit = do- fPtr <- mkTextCharPredicate (\c _ -> fromBool $ pred (chr (fromIntegral c)))- res <- liftM toBool $ {#call text_iter_backward_find_char#} + fPtr <- mkTextCharPredicate (\c _ -> return $ fromBool $ pred (chr (fromIntegral c)))+ res <- liftM toBool $ {#call text_iter_backward_find_char#} ti fPtr nullPtr (fromMaybe (TextIter nullForeignPtr) limit) freeHaskellFunPtr fPtr return res@@ -842,14 +837,14 @@ -- -- * Returns the start and end position of the string found. ---textIterForwardSearch :: TextIter -> String -> [TextSearchFlags] ->+textIterForwardSearch :: GlibString string => TextIter -> string -> [TextSearchFlags] -> Maybe TextIter -> IO (Maybe (TextIter, TextIter)) textIterForwardSearch ti str flags limit = do start <- makeEmptyTextIter end <- makeEmptyTextIter found <- liftM toBool $ withUTFString str $ \cStr ->- {#call unsafe text_iter_forward_search#} ti cStr - ((fromIntegral.fromFlags) flags) start end + {#call unsafe text_iter_forward_search#} ti cStr+ ((fromIntegral.fromFlags) flags) start end (fromMaybe (TextIter nullForeignPtr) limit) return $ if found then Just (start,end) else Nothing @@ -862,14 +857,14 @@ -- -- * Returns the start and end position of the string found. ---textIterBackwardSearch :: TextIter -> String -> [TextSearchFlags] ->+textIterBackwardSearch :: GlibString string => TextIter -> string -> [TextSearchFlags] -> Maybe TextIter -> IO (Maybe (TextIter, TextIter)) textIterBackwardSearch ti str flags limit = do start <- makeEmptyTextIter end <- makeEmptyTextIter found <- liftM toBool $ withUTFString str $ \cStr ->- {#call unsafe text_iter_backward_search#} ti cStr - ((fromIntegral.fromFlags) flags) start end + {#call unsafe text_iter_backward_search#} ti cStr+ ((fromIntegral.fromFlags) flags) start end (fromMaybe (TextIter nullForeignPtr) limit) return $ if found then Just (start,end) else Nothing @@ -946,10 +941,10 @@ -- | Calls 'textIterForwardVisibleWordEnd' up to count times. ---textIterForwardVisibleWordEnds :: TextIter - -> Int -- ^ @couter@ - number of times to move - -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator -textIterForwardVisibleWordEnds self count = +textIterForwardVisibleWordEnds :: TextIter+ -> Int -- ^ @counter@ - number of times to move+ -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator+textIterForwardVisibleWordEnds self count = liftM toBool $ {# call text_iter_forward_visible_word_ends #} self@@ -957,76 +952,76 @@ -- | Calls 'textIterBackwardVisibleWordStart' up to count times. ---textIterBackwardVisibleWordStarts :: TextIter - -> Int -- ^ @couter@ - number of times to move - -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator +textIterBackwardVisibleWordStarts :: TextIter+ -> Int -- ^ @counter@ - number of times to move+ -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator textIterBackwardVisibleWordStarts self count = liftM toBool $ {# call text_iter_backward_visible_word_starts #} self (fromIntegral count) --- | Moves forward to the next visible word end. --- (If iter is currently on a word end, moves forward to the next one after that.) --- Word breaks are determined by Pango and should be correct for nearly any language +-- | Moves forward to the next visible word end.+-- (If iter is currently on a word end, moves forward to the next one after that.)+-- Word breaks are determined by Pango and should be correct for nearly any language -- (if not, the correct fix would be to the Pango word break algorithms). -- textIterForwardVisibleWordEnd :: TextIter- -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator + -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator textIterForwardVisibleWordEnd self = liftM toBool $ {# call text_iter_forward_visible_word_end #} self --- | Moves backward to the previous visible word start. --- (If iter is currently on a word start, moves backward to the next one after that.) --- Word breaks are determined by Pango and should be correct for nearly any language +-- | Moves backward to the previous visible word start.+-- (If iter is currently on a word start, moves backward to the next one after that.)+-- Word breaks are determined by Pango and should be correct for nearly any language -- (if not, the correct fix would be to the Pango word break algorithms).--- +-- textIterBackwardVisibleWordStart :: TextIter- -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator + -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator textIterBackwardVisibleWordStart self = liftM toBool $ {# call text_iter_backward_visible_word_start #} self --- | Moves iter forward to the next visible cursor position. +-- | Moves iter forward to the next visible cursor position. -- See 'textIterForwardCursorPosition' for details. -- textIterForwardVisibleCursorPosition :: TextIter- -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator + -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator textIterForwardVisibleCursorPosition self = liftM toBool $ {# call text_iter_forward_visible_cursor_position #} self --- | Moves iter forward to the previous visible cursor position. +-- | Moves iter forward to the previous visible cursor position. -- See 'textIterBackwardCursorPosition' for details.--- +-- textIterBackwardVisibleCursorPosition :: TextIter- -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator + -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator textIterBackwardVisibleCursorPosition self = liftM toBool $ {# call text_iter_backward_visible_cursor_position #} self --- | Moves up to count visible cursor positions. +-- | Moves up to count visible cursor positions. -- See 'textIterForwardCursorPosition' for details. textIterForwardVisibleCursorPositions :: TextIter- -> Int -- ^ @couter@ - number of times to move - -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator + -> Int -- ^ @counter@ - number of times to move+ -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator textIterForwardVisibleCursorPositions self count = liftM toBool $ {# call text_iter_forward_visible_cursor_positions #} self (fromIntegral count) --- | Moves up to count visible cursor positions. +-- | Moves up to count visible cursor positions. -- See 'textIterBackwardCursorPosition' for details. ---textIterBackwardVisibleCursorPositions :: TextIter - -> Int -- ^ @couter@ - number of times to move - -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator +textIterBackwardVisibleCursorPositions :: TextIter+ -> Int -- ^ @counter@ - number of times to move+ -> IO Bool -- ^ return @True@ if iter moved and is not the end iterator textIterBackwardVisibleCursorPositions self count = liftM toBool $ {# call text_iter_backward_visible_cursor_positions #}@@ -1045,26 +1040,26 @@ res <- {#call unsafe text_iter_compare#} ti1 ti2 return $ case res of (-1) -> LT- 0 -> EQ- 1 -> GT+ 0 -> EQ+ 1 -> GT --- | Checks whether iter falls in the range [start, end). +-- | Checks whether iter falls in the range [start, end). -- start and end must be in ascending order. ---textIterInRange :: TextIter +textIterInRange :: TextIter -> TextIter -- ^ @start@ start of range -> TextIter -- ^ @end@ end of range -> IO Bool -- ^ @True@ if iter is in the range textIterInRange ti start end = liftM toBool $ {# call unsafe text_iter_in_range #} ti start end --- | Swaps the value of first and second if second comes before first in the buffer. --- That is, ensures that first and second are in sequence. --- Most text buffer functions that take a range call this automatically on your behalf, so there's no real reason to call it yourself in those cases. +-- | Swaps the value of first and second if second comes before first in the buffer.+-- That is, ensures that first and second are in sequence.+-- Most text buffer functions that take a range call this automatically on your behalf, so there's no real reason to call it yourself in those cases. -- There are some exceptions, such as 'textIterInRange', that expect a pre-sorted range. -- textIterOrder :: TextIter -> TextIter -> IO ()-textIterOrder first second = +textIterOrder first second = {# call text_iter_order #} first second --------------------
Graphics/UI/Gtk/Multiline/TextMark.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Multiline.TextMark ( -- * Detail--- +-- -- | You may wish to begin by reading the text widget conceptual overview -- which gives an overview of all the objects and data types related to the -- text widget and how they work together.@@ -80,22 +80,23 @@ textMarkGetLeftGravity, -- * Attributes+ textMarkName, textMarkVisible,+ textMarkLeftGravity ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (makeNewGObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #} -- | The name of a mark.-type MarkName = String+type MarkName = DefaultGlibString -------------------- -- Constructors@@ -113,12 +114,12 @@ -- -- * Available since Gtk+ version 2.12 ---textMarkNew :: +textMarkNew :: Maybe MarkName -- ^ @markName@ - name for mark, or @Nothing@ -> Bool -- ^ @leftGravity@ - whether the mark has left gravity -> IO TextMark textMarkNew markName leftGravity =- makeNewGObject mkTextMark $+ wrapNewGObject mkTextMark $ maybeWith withUTFString markName $ \markNamePtr -> {# call text_mark_new #} markNamePtr@@ -188,7 +189,7 @@ -------------------- -- Attributes --- | Retreives the name of a mark.+-- | Retrieves the name of a mark. -- textMarkName :: TextMarkClass self => ReadAttr self (Maybe MarkName) textMarkName = readAttrFromMaybeStringProperty "name"
Graphics/UI/Gtk/Multiline/TextTag.chs view
@@ -19,7 +19,7 @@ -- Lesser General Public License for more details. -- -- TODO--- +-- -- Didn't bind `textTagTabs` properties, we need to bind PangoTab first (in `pango-tabs.c`) -- -- |@@ -31,7 +31,7 @@ -- module Graphics.UI.Gtk.Multiline.TextTag ( -- * Detail--- +-- -- | You may wish to begin by reading the text widget conceptual overview -- which gives an overview of all the objects and data types related to the -- text widget and how they work together.@@ -79,13 +79,17 @@ textTagBackgroundFullHeight, textTagBackgroundFullHeightSet, textTagBackgroundGdk,+#if GTK_MAJOR_VERSION < 3 textTagBackgroundStipple, textTagBackgroundStippleSet,+#endif textTagForeground, textTagForegroundSet, textTagForegroundGdk,+#if GTK_MAJOR_VERSION < 3 textTagForegroundStipple, textTagForegroundStippleSet,+#endif textTagDirection, textTagEditable, textTagEditableSet,@@ -150,29 +154,31 @@ #endif ) where -import Control.Monad (liftM)+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) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} import Graphics.Rendering.Pango.Font import Graphics.Rendering.Pango.BasicTypes (FontDescription (..), makeNewFontDescription)-import Graphics.Rendering.Pango.Enums (FontStyle(..), Variant(..),- Stretch(..), Underline(..))-import Graphics.UI.Gtk.General.Enums (TextDirection(..),- Justification(..), WrapMode(..))+import Graphics.Rendering.Pango.Enums (FontStyle(..), Variant(..),+ Stretch(..), Underline(..))+import Graphics.UI.Gtk.General.Enums (TextDirection(..),+ Justification(..), WrapMode(..)) import Graphics.UI.Gtk.General.Structs (Color(..)) import Graphics.UI.Gtk.Multiline.Types ( TextIter, mkTextIterCopy )-import Graphics.UI.Gtk.Gdk.Events (Event, marshalEvent)+#ifndef DISABLE_DEPRECATED+import Graphics.UI.Gtk.Gdk.Events (Event, marshalEvent)+#endif import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny) import Control.Monad.Reader ( runReaderT ) {# context lib="gtk" prefix="gtk" #} -type TagName = String+type TagName = DefaultGlibString -------------------- -- Constructors@@ -183,14 +189,14 @@ -- textTagNew :: Maybe TagName -> IO TextTag textTagNew (Just name) =- constructNewGObject mkTextTag $- withCString name $ \namePtr ->+ wrapNewGObject mkTextTag $+ withUTFString name $ \namePtr -> {# call unsafe text_tag_new #} namePtr textTagNew Nothing =- constructNewGObject mkTextTag $ {# call unsafe text_tag_new #} nullPtr- + wrapNewGObject mkTextTag $ {# call unsafe text_tag_new #} nullPtr + -------------------- -- Methods @@ -234,20 +240,20 @@ -- | Copies src and returns a new 'TextAttributes'. ---textAttributesCopy :: - TextAttributes -- ^ @src@ - a 'TextAttributes' to be copied +textAttributesCopy ::+ TextAttributes -- ^ @src@ - a 'TextAttributes' to be copied -> IO TextAttributes textAttributesCopy src = {#call text_attributes_copy#} src >>= makeNewTextAttributes --- | Copies the values from src to dest so that dest has the same values as src. +-- | Copies the values from src to dest so that dest has the same values as src. -- textAttributesCopyValues :: TextAttributes -> TextAttributes -> IO () textAttributesCopyValues src dest = {# call text_attributes_copy_values #} src dest -- | This function is use internal for transform TextAttributes.--- Don't expoert this function.+-- Don't export this function. makeNewTextAttributes :: Ptr TextAttributes -> IO TextAttributes makeNewTextAttributes ptr = liftM TextAttributes $ newForeignPtr ptr text_attributes_unref@@ -262,14 +268,14 @@ -- -- Default value: @Nothing@ ---textTagName :: TextTagClass self => Attr self (Maybe String)+textTagName :: (TextTagClass self, GlibString string) => Attr self (Maybe string) textTagName = newAttrFromMaybeStringProperty "name" -- | Background color as a string. -- -- Default value: \"\" ---textTagBackground :: TextTagClass self => WriteAttr self String+textTagBackground :: (TextTagClass self, GlibString string) => WriteAttr self string textTagBackground = writeAttrFromStringProperty "background" -- | Whether this tag affects the background color.@@ -290,7 +296,7 @@ -- | Whether this tag affects background height. -- -- Default value: @False@--- +-- textTagBackgroundFullHeightSet :: TextTagClass self => Attr self Bool textTagBackgroundFullHeightSet = newAttrFromBoolProperty "background-full-height-set" @@ -301,28 +307,32 @@ newAttrFromBoxedStorableProperty "background-gdk" {#call pure unsafe gdk_color_get_type#} +#if GTK_MAJOR_VERSION < 3 -- | Bitmap to use as a mask when drawing the text background. --+-- Removed in Gtk3. textTagBackgroundStipple :: (TextTagClass self, PixmapClass pixmap) => ReadWriteAttr self Pixmap pixmap textTagBackgroundStipple = newAttrFromObjectProperty "background-stipple" {# call pure unsafe gdk_pixmap_get_type #} -- | Whether this tag affects the background stipple.--- +-- -- Default value: @False@ --+-- Removed in Gtk3. textTagBackgroundStippleSet :: TextTagClass self => Attr self Bool textTagBackgroundStippleSet = newAttrFromBoolProperty "background-stipple-set"+#endif -- | Foreground color as a string. -- -- Default value: \"\" ---textTagForeground :: TextTagClass self => WriteAttr self String+textTagForeground :: (TextTagClass self, GlibString string) => WriteAttr self string textTagForeground = writeAttrFromStringProperty "foreground" -- | Whether this tag affects the foreground color.--- +-- -- Default value: @False@ -- textTagForegroundSet :: TextTagClass self => Attr self Bool@@ -335,18 +345,22 @@ newAttrFromBoxedStorableProperty "foreground-gdk" {# call pure unsafe gdk_color_get_type #} +#if GTK_MAJOR_VERSION < 3 -- | Bitmap to use as a mask when drawing the text foreground. --+-- Removed in Gtk3. textTagForegroundStipple :: (TextTagClass self, PixmapClass pixmap) => ReadWriteAttr self Pixmap pixmap textTagForegroundStipple = newAttrFromObjectProperty "foreground-stipple" {# call pure unsafe gdk_pixmap_get_type #} -- | Whether this tag affects the foreground stipple.--- +-- -- Default value: @False@ --+-- Removed in Gtk3. textTagForegroundStippleSet :: TextTagClass self => Attr self Bool textTagForegroundStippleSet = newAttrFromBoolProperty "foreground-stipple-set"+#endif -- | Text direction, e.g. right-to-left or left-to-right. --@@ -364,7 +378,7 @@ textTagEditable = newAttrFromBoolProperty "editable" -- | Whether this tag affects text editability.--- +-- -- Default value: @False@ -- textTagEditableSet :: TextTagClass self => Attr self Bool@@ -374,7 +388,7 @@ -- -- Default value: \"\" ---textTagFont :: TextTagClass self => Attr self String+textTagFont :: (TextTagClass self, GlibString string) => Attr self string textTagFont = newAttrFromStringProperty "font" -- | Font description as a 'FontDescription' struct.@@ -388,11 +402,11 @@ -- -- Default value: \"\" ---textTagFamily :: TextTagClass self => Attr self String+textTagFamily :: (TextTagClass self, GlibString string) => Attr self string textTagFamily = newAttrFromStringProperty "family" -- | Whether this tag affects the font family.--- +-- -- Default value: @False@ -- textTagFamilySet :: TextTagClass self => Attr self Bool@@ -407,7 +421,7 @@ {# call pure unsafe pango_style_get_type #} -- | Whether this tag affects the font style.--- +-- -- Default value: @False@ -- textTagStyleSet :: TextTagClass self => Attr self Bool@@ -417,7 +431,7 @@ -- textTagTabs :: TextTagClass self => Attr self TabArray -- | Whether this tag affects tabs.--- +-- -- Default value: @False@ -- textTagTabsSet :: TextTagClass self => Attr self Bool@@ -432,7 +446,7 @@ {# call pure unsafe pango_variant_get_type #} -- | Whether this tag affects the font variant.--- +-- -- Default value: @False@ -- textTagVariantSet :: TextTagClass self => Attr self Bool@@ -449,7 +463,7 @@ textTagWeight = newAttrFromIntProperty "weight" -- | Whether this tag affects the font weight.--- +-- -- Default value: @False@ -- textTagWeightSet :: TextTagClass self => Attr self Bool@@ -477,7 +491,7 @@ textTagSize = newAttrFromIntProperty "size" -- | Whether this tag affects the font size.--- +-- -- Default value: @False@ -- textTagSizeSet :: TextTagClass self => Attr self Bool@@ -494,7 +508,7 @@ textTagScale = newAttrFromDoubleProperty "scale" -- | Whether this tag scales the font size by a factor.--- +-- -- Default value: @False@ -- textTagScaleSet :: TextTagClass self => Attr self Bool@@ -518,7 +532,7 @@ {# call pure unsafe gtk_justification_get_type #} -- | Whether this tag affects paragraph justification.--- +-- -- Default value: @False@ -- textTagJustificationSet :: TextTagClass self => Attr self Bool@@ -530,11 +544,11 @@ -- -- Default value: \"\" ---textTagLanguage :: TextTagClass self => Attr self String+textTagLanguage :: (TextTagClass self, GlibString string) => Attr self string textTagLanguage = newAttrFromStringProperty "language" -- | Whether this tag affects the language the text is rendered as.--- +-- -- Default value: @False@ -- textTagLanguageSet :: TextTagClass self => Attr self Bool@@ -550,7 +564,7 @@ textTagLeftMargin = newAttrFromIntProperty "left-margin" -- | Whether this tag affects the left margin.--- +-- -- Default value: @False@ -- textTagLeftMarginSet :: TextTagClass self => Attr self Bool@@ -566,7 +580,7 @@ textTagRightMargin = newAttrFromIntProperty "right-margin" -- | Whether this tag affects the right margin.--- +-- -- Default value: @False@ -- textTagRightMarginSet :: TextTagClass self => Attr self Bool@@ -580,7 +594,7 @@ textTagIndent = newAttrFromIntProperty "indent" -- | Whether this tag affects indentation.--- +-- -- Default value: @False@ -- textTagIndentSet :: TextTagClass self => Attr self Bool@@ -608,7 +622,7 @@ textTagPixelsAboveLines = newAttrFromIntProperty "pixels-above-lines" -- | Whether this tag affects the number of pixels above lines.--- +-- -- Default value: @False@ -- textTagPixelsAboveLinesSet :: TextTagClass self => Attr self Bool@@ -624,7 +638,7 @@ textTagPixelsBelowLines = newAttrFromIntProperty "pixels-below-lines" -- | Whether this tag affects the number of pixels below lines.--- +-- -- Default value: @False@ -- textTagPixelsBelowLinesSet :: TextTagClass self => Attr self Bool@@ -640,7 +654,7 @@ textTagPixelsInsideWrap = newAttrFromIntProperty "pixels-inside-wrap" -- | Whether this tag affects the number of pixels between wrapped lines.--- +-- -- Default value: @False@ -- textTagPixelsInsideWrapSet :: TextTagClass self => Attr self Bool@@ -654,7 +668,7 @@ textTagStrikethrough = newAttrFromBoolProperty "strikethrough" -- | Whether this tag affects strikethrough.--- +-- -- Default value: @False@ -- textTagStrikethroughSet :: TextTagClass self => Attr self Bool@@ -669,7 +683,7 @@ {# call pure unsafe pango_underline_get_type #} -- | Whether this tag affects underlining.--- +-- -- Default value: @False@ -- textTagUnderlineSet :: TextTagClass self => Attr self Bool@@ -685,7 +699,7 @@ {# call pure unsafe gtk_wrap_mode_get_type #} -- | Whether this tag affects line wrap mode.--- +-- -- Default value: @False@ -- textTagWrapModeSet :: TextTagClass self => Attr self Bool@@ -704,7 +718,7 @@ textTagInvisible = newAttrFromBoolProperty "invisible" -- | Whether this tag affects text visibility.--- +-- -- Default value: @False@ -- textTagInvisibleSet :: TextTagClass self => Attr self Bool@@ -714,11 +728,11 @@ -- -- Default value: \"\" ---textTagParagraphBackground :: TextTagClass self => WriteAttr self String+textTagParagraphBackground :: (TextTagClass self, GlibString string) => WriteAttr self string textTagParagraphBackground = writeAttrFromStringProperty "paragraph-background" -- | Whether this tag affects the paragraph background color.--- +-- -- Default value: @False@ -- textTagParagraphBackgroundSet :: TextTagClass self => Attr self Bool@@ -727,7 +741,7 @@ -- | The paragraph background color as a as a (possibly unallocated) 'Color'. -- textTagParagraphBackgroundGdk :: TextTagClass self => Attr self Color-textTagParagraphBackgroundGdk = +textTagParagraphBackgroundGdk = newAttrFromBoxedStorableProperty "paragraph-background-gdk" {# call pure unsafe gdk_color_get_type #} #endif@@ -770,7 +784,7 @@ -- e.g. mouse clicks to implement hyperlinking. -- onTextTagEvent :: TextTagClass t => t -> (Event -> TextIter -> IO ()) ->- IO (ConnectId t)+ IO (ConnectId t) onTextTagEvent tt act = connect_PTR_BOXED_BOXED__BOOL "event" marshalEvent mkTextIterCopy False tt (\_ event iter -> act event iter >> return False)
Graphics/UI/Gtk/Multiline/TextTagTable.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget TextTagTable --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Multiline.TextTagTable ( -- * Detail--- +-- -- | You may wish to begin by reading the text widget conceptual overview -- which gives an overview of all the objects and data types related to the -- text widget and how they work together.@@ -55,10 +56,10 @@ textTagTableGetSize ) where -import Control.Monad (liftM)+import Control.Monad (liftM, void) -import System.Glib.FFI-import System.Glib.GObject (constructNewGObject, makeNewGObject)+import System.Glib.FFI (withForeignPtr, nullPtr, Ptr(..), CInt(..), CChar(..), FunPtr(..), maybeNull)+import System.Glib.UTFString {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -70,7 +71,7 @@ -- textTagTableNew :: IO TextTagTable textTagTableNew =- constructNewGObject mkTextTagTable $+ wrapNewGObject mkTextTagTable $ {# call unsafe text_tag_table_new #} --------------------@@ -83,7 +84,7 @@ -- an already-added tag. -- textTagTableAdd :: (TextTagTableClass self, TextTagClass tag) => self -> tag -> IO ()-textTagTableAdd self tag =+textTagTableAdd self tag = void $ {# call text_tag_table_add #} (toTextTagTable self) (toTextTag tag)@@ -98,13 +99,13 @@ -- | Look up a named tag. ---textTagTableLookup :: TextTagTableClass self => self- -> String -- ^ @name@ - name of a tag+textTagTableLookup :: (TextTagTableClass self, GlibString string) => self+ -> string -- ^ @name@ - name of a tag -> IO (Maybe TextTag) -- ^ returns The tag, or @Nothing@ if none by that name -- is in the table. textTagTableLookup self name = maybeNull (makeNewGObject mkTextTag) $- withCString name $ \namePtr ->+ withUTFString name $ \namePtr -> {# call unsafe text_tag_table_lookup #} (toTextTagTable self) namePtr
Graphics/UI/Gtk/Multiline/TextView.chs view
@@ -20,14 +20,14 @@ -- -- TODO ----- If PangoTabArray is bound: --- Fucntions: textViewSetTabs and textViewGetTabs+-- If PangoTabArray is bound:+-- Functions: textViewSetTabs and textViewGetTabs -- Properties: textViewTabs ----- All on... and after... signales had incorrect names (underscore instead of hypens). Thus+-- All on... and after... signals had incorrect names (underscore instead of hyphens). Thus -- they could not have been used in applications and removing them can't break anything.--- Thus, I've removed them. Also, all key-binding singals are now removed as there is--- no way to add additional key bindings programatically in a type-safe way, let alone+-- Thus, I've removed them. Also, all key-binding signals are now removed as there is+-- no way to add additional key bindings programmatically in a type-safe way, let alone -- use these signals. -- -- |@@ -39,7 +39,7 @@ -- module Graphics.UI.Gtk.Multiline.TextView ( -- * Detail--- +-- -- | You may wish to begin by reading the text widget conceptual overview -- which gives an overview of all the objects and data types related to the -- text widget and how they work together.@@ -143,6 +143,12 @@ textViewSetAcceptsTab, textViewGetAcceptsTab, #endif+#if GTK_CHECK_VERSION(2,22,0)+ textViewGetHadjustment,+ textViewGetVadjustment,+ textViewImContextFilterKeypress,+ textViewResetImContext,+#endif -- * Attributes textViewPixelsAboveLines,@@ -179,26 +185,29 @@ setTextViewScrollAdjustments, toggleCursorVisible, toggleOverwrite,+ textViewPreeditChanged ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI+import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties (newAttrFromStringProperty)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import System.Glib.GObject (constructNewGObject, makeNewGObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Gdk.EventM (EventM, EKey)+import Control.Monad.Reader ( ask )+import Control.Monad.Trans ( liftIO ) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.Multiline.Types#}-{#import Graphics.UI.Gtk.Multiline.TextIter#} {#import Graphics.UI.Gtk.Multiline.TextTag#}-import Graphics.UI.Gtk.General.Enums (TextWindowType(..), DeleteType(..),- DirectionType(..), Justification(..),- MovementStep(..), WrapMode(..),+import Graphics.UI.Gtk.General.Enums (TextWindowType(..), DeleteType(..),+ DirectionType(..), Justification(..),+ MovementStep(..), WrapMode(..), ScrollStep (..))-import System.Glib.GList (fromGList)-import Graphics.UI.Gtk.General.Structs (Rectangle(..))+import System.Glib.GList (fromGList)+import Graphics.UI.Gtk.General.Structs (Rectangle(..)) {# context lib="gtk" prefix="gtk" #} @@ -299,7 +308,7 @@ -- vertical alignment of mark within visible area (if @Nothing@, -- scroll just enough to get the iterator onscreen) -> IO Bool -- ^ returns @True@ if scrolling occurred-textViewScrollToIter self iter withinMargin align = +textViewScrollToIter self iter withinMargin align = let (useAlign, xalign, yalign) = case align of Nothing -> (False, 0, 0) Just (xalign, yalign) -> (True, xalign, yalign)@@ -664,7 +673,7 @@ -- textChildAnchorNew :: IO TextChildAnchor textChildAnchorNew =- constructNewGObject mkTextChildAnchor+ wrapNewGObject mkTextChildAnchor {# call unsafe text_child_anchor_new #} -- | Retrieve all 'Widget's at this@@ -708,7 +717,7 @@ (fromIntegral xpos) (fromIntegral ypos) --- | Move a child widget within the 'TextView'. This is really only apprpriate+-- | Move a child widget within the 'TextView'. This is really only appropriate -- for \"floating\" child widgets added using 'textViewAddChildInWindow'. -- textViewMoveChild :: (TextViewClass self, WidgetClass child) => self@@ -1012,6 +1021,59 @@ (toTextView self) #endif +#if GTK_CHECK_VERSION(2,22,0)+-- | Gets the horizontal-scrolling 'Adjustment'.+--+-- * Available since Gtk+ version 2.22+--+textViewGetHadjustment :: TextViewClass self => self -> IO Adjustment+textViewGetHadjustment self =+ makeNewObject mkAdjustment $+ {#call gtk_text_view_get_hadjustment #}+ (toTextView self)++-- | Gets the vertical-scrolling 'Adjustment'.+--+-- * Available since Gtk+ version 2.22+--+textViewGetVadjustment :: TextViewClass self => self -> IO Adjustment+textViewGetVadjustment self =+ makeNewObject mkAdjustment $+ {#call gtk_text_view_get_vadjustment #}+ (toTextView self)++-- | Allow the 'TextView' input method to internally handle key press and release events. If this+-- function returns 'True', then no further processing should be done for this key event. See+-- 'imContextFilterKeypress'.+--+-- Note that you are expected to call this function from your handler when overriding key event+-- handling. This is needed in the case when you need to insert your own key handling between the input+-- method and the default key event handling of the 'TextView'.+--+-- * Available since Gtk+ version 2.22+--+textViewImContextFilterKeypress :: TextViewClass self => self -> EventM EKey Bool+textViewImContextFilterKeypress self = do+ ptr <- ask+ liftIO $ liftM toBool $+ {# call gtk_text_view_im_context_filter_keypress #}+ (toTextView self)+ (castPtr ptr)++-- | Reset the input method context of the text view if needed.+--+-- This can be necessary in the case where modifying the buffer would confuse on-going input method+-- behavior.+--+-- * Available since Gtk+ version 2.22+--+textViewResetImContext :: TextViewClass self => self -> IO ()+textViewResetImContext self =+ {#call gtk_text_view_reset_im_context #} (toTextView self)+++#endif+ -------------------- -- Attributes @@ -1058,13 +1120,13 @@ textViewSetEditable -- | Which IM (input method) module should be used for this entry. See GtkIMContext.--- Setting this to a non-empty value overrides the system-wide IM module setting. +-- Setting this to a non-empty value overrides the system-wide IM module setting. -- See the GtkSettings "gtk-im-module" property. -- -- Default value: \"\" ---textViewImModule :: TextViewClass self => Attr self String-textViewImModule = +textViewImModule :: TextViewClass self => Attr self DefaultGlibString+textViewImModule = newAttrFromStringProperty "im-module" -- | Whether to wrap lines never, at word boundaries, or at character@@ -1166,7 +1228,7 @@ -- | Copying to the clipboard. ----- * This signal is emitted when a selection is copied to the clipboard. +-- * This signal is emitted when a selection is copied to the clipboard. -- -- * The action itself happens when the 'TextView' processes this -- signal.@@ -1202,8 +1264,8 @@ -- * The action itself happens when the 'TextView' processes this -- signal. ---insertAtCursor :: TextViewClass self => Signal self (String -> IO ())-insertAtCursor = Signal (connect_STRING__NONE "insert-at-cursor")+insertAtCursor :: (TextViewClass self, GlibString string) => Signal self (string -> IO ())+insertAtCursor = Signal (connect_GLIBSTRING__NONE "insert-at-cursor") -- | Moving the cursor. --@@ -1216,11 +1278,11 @@ moveCursor :: TextViewClass self => Signal self (MovementStep -> Int -> Bool -> IO ()) moveCursor = Signal (connect_ENUM_INT_BOOL__NONE "move-cursor") --- | The 'moveViewport' signal is a keybinding signal which can be bound to key combinations --- to allow the user to move the viewport, i.e. +-- | The 'moveViewport' signal is a keybinding signal which can be bound to key combinations+-- to allow the user to move the viewport, i.e. -- change what part of the text view is visible in a containing scrolled window. -- There are no default bindings for this signal.--- +-- moveViewport :: TextViewClass self => Signal self (ScrollStep -> Int -> IO ()) moveViewport = Signal (connect_ENUM_INT__NONE "move-viewport") @@ -1247,7 +1309,7 @@ -- | Pasting from the clipboard. ----- * This signal is emitted when something is pasted from the clipboard. +-- * This signal is emitted when something is pasted from the clipboard. -- -- * The action itself happens when the 'TextView' processes this -- signal.@@ -1266,7 +1328,7 @@ -- | Inserting an anchor. ----- * This signal is emitted when anchor is inserted into the text. +-- * This signal is emitted when anchor is inserted into the text. -- -- * The action itself happens when the 'TextView' processes this -- signal.@@ -1279,14 +1341,14 @@ setAnchor :: TextViewClass self => Signal self (IO ()) setAnchor = Signal (connect_NONE__NONE "set-anchor") --- | The 'setTextViewScrollAdjustments' signal is a keybinding signal which +-- | The 'setTextViewScrollAdjustments' signal is a keybinding signal which -- gets emitted to toggle the visibility of the cursor. -- The default binding for this signal is F7. -- setTextViewScrollAdjustments :: TextViewClass self => Signal self (Adjustment -> Adjustment -> IO ()) setTextViewScrollAdjustments = Signal (connect_OBJECT_OBJECT__NONE "set-scroll-adjustments") --- | The 'toggleCursorVisible' signal is a keybinding signal +-- | The 'toggleCursorVisible' signal is a keybinding signal -- which gets emitted to toggle the visibility of the cursor. -- The default binding for this signal is F7. --@@ -1296,11 +1358,18 @@ -- | Insert Overwrite mode has changed. -- -- * This signal is emitted when the 'TextView' changes from--- inserting mode to overwriting mode and vice versa. +-- inserting mode to overwriting mode and vice versa. -- -- * The action itself happens when the 'TextView' processes this -- signal. -- toggleOverwrite :: TextViewClass self => Signal self (IO ()) toggleOverwrite = Signal (connect_NONE__NONE "toggle-overwrite")++-- | If an input method is used, the typed text will not immediately be committed to the buffer. So if+-- you are interested in the text, connect to this signal.+--+-- This signal is only emitted if the text at the given position is actually editable.+textViewPreeditChanged :: (TextViewClass self, GlibString string) => Signal self (string -> IO ())+textViewPreeditChanged = Signal (connect_GLIBSTRING__NONE "preedit-changed")
Graphics/UI/Gtk/Multiline/Types.chs view
@@ -32,7 +32,7 @@ ) where import System.Glib.FFI-import Graphics.UI.Gtk.General.Structs (textIterSize)+import Graphics.UI.Gtk.General.Structs (textIterSize) {# context lib="gtk" prefix="gtk" #} @@ -50,7 +50,7 @@ copyBytes iterPtr' iterPtr textIterSize return (TextIter iter') --- | Interal marshaling util+-- | Internal marshaling util -- mkTextIterCopy :: Ptr TextIter -> IO TextIter mkTextIterCopy iterPtr = do
Graphics/UI/Gtk/Ornaments/Frame.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget Frame --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Ornaments.Frame ( -- * Detail--- +-- -- | The frame widget is a Bin that surrounds its child with a decorative -- frame and an optional label. If present, the label is drawn in a gap in the -- top side of the frame. The position of the label can be controlled with@@ -72,15 +73,15 @@ frameLabelWidget, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (ShadowType(..))+import Graphics.UI.Gtk.General.Enums (ShadowType(..)) {# context lib="gtk" prefix="gtk" #} @@ -103,8 +104,8 @@ -- | Sets the text of the label. ---frameSetLabel :: FrameClass self => self- -> String -- ^ @label@ - the text to use as the label of the frame+frameSetLabel :: (FrameClass self, GlibString string) => self+ -> string -- ^ @label@ - the text to use as the label of the frame -> IO () frameSetLabel self label = withUTFString label $ \labelPtr ->@@ -184,9 +185,9 @@ -- | If the frame's label widget is a 'Label', returns the text in the label -- widget. ---frameGetLabel :: FrameClass self => self- -> IO String -- ^ returns the text in the label, or if there was no label- -- widget or the lable widget was not a 'Label' then an +frameGetLabel :: (FrameClass self, GlibString string) => self+ -> IO string -- ^ returns the text in the label, or if there was no label+ -- widget or the label widget was not a 'Label' then an -- exception is thrown frameGetLabel self = throwIfNull "frameGetLabel: the title of the frame was not a Label widget."@@ -199,7 +200,7 @@ -- | Text of the frame's label. ---frameLabel :: FrameClass self => Attr self String+frameLabel :: (FrameClass self, GlibString string) => Attr self string frameLabel = newAttr frameGetLabel frameSetLabel
Graphics/UI/Gtk/Ornaments/HSeparator.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget HSeparator --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Ornaments.HSeparator ( -- * Detail--- +-- -- | The 'HSeparator' widget is a horizontal separator, used to group the -- widgets within a window. It displays a horizontal line with a shadow to make -- it appear sunken into the interface.@@ -51,10 +52,10 @@ hSeparatorNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
Graphics/UI/Gtk/Ornaments/VSeparator.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VSeparator --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Ornaments.VSeparator ( -- * Detail--- +-- -- | The 'VSeparator' widget is a vertical separator, used to group the -- widgets within a window. It displays a vertical line with a shadow to make -- it appear sunken into the interface.@@ -51,10 +52,10 @@ vSeparatorNew, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}
+ Graphics/UI/Gtk/Printing/PageSetup.chs view
@@ -0,0 +1,397 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget PageSetup+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Stores page setup information+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Printing.PageSetup (++-- * Detail+--+-- | A 'PageSetup' object stores the page size, orientation and margins. The+-- idea is that you can get one of these from the page setup dialog and then+-- pass it to the 'PrintOperation' when printing. The benefit of splitting this+-- out of the 'PrintSettings' is that these affect the actual layout of the+-- page, and thus need to be set long before user prints.+--+-- The margins specified in this object are the \"print margins\", i.e. the+-- parts of the page that the printer cannot print on. These are different from+-- the layout margins that a word processor uses; they are typically used to+-- determine the /minimal/ size for the layout margins.+--+-- To obtain a 'PageSetup' use 'pageSetupNew' to get the defaults, or use+-- 'printRunPageSetupDialog' to show the page setup dialog and receive the+-- resulting page setup.+--+-- Printing support was added in Gtk+ 2.10.+--++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----PageSetup+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ PageSetup,+ PageSetupClass,+ castToPageSetup,+ toPageSetup,++-- * Constructors+ pageSetupNew,+#if GTK_CHECK_VERSION(2,12,0)+ pageSetupNewFromFile,+#endif++-- * Methods+ pageSetupCopy,+ pageSetupGetTopMargin,+ pageSetupSetTopMargin,+ pageSetupGetBottomMargin,+ pageSetupSetBottomMargin,+ pageSetupGetLeftMargin,+ pageSetupSetLeftMargin,+ pageSetupGetRightMargin,+ pageSetupSetRightMargin,+ pageSetupSetPaperSizeAndDefaultMargins,+ pageSetupGetPaperWidth,+ pageSetupGetPaperHeight,+ pageSetupGetPageWidth,+ pageSetupGetPageHeight,+#if GTK_CHECK_VERSION(2,14,0)+ pageSetupLoadFile,+#endif+#if GTK_CHECK_VERSION(2,12,0)+ pageSetupToFile,+#endif++-- * Attributes+ pageSetupOrientation,+ pageSetupPaperSize,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.GError+import System.Glib.Attributes+import System.Glib.UTFString+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Printing.PaperSize#} (PaperSize(..), mkPaperSize, Unit(..))+{#import Graphics.UI.Gtk.Printing.PrintSettings#} (PageOrientation (..))++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)+--------------------+-- Constructors++-- | Creates a new 'PageSetup'.+--+pageSetupNew :: IO PageSetup+pageSetupNew =+ wrapNewGObject mkPageSetup $+ {# call gtk_page_setup_new #}++#if GTK_CHECK_VERSION(2,12,0)+-- | Reads the page setup from the file @fileName@. Returns a new 'PageSetup'+-- object with the restored page setup.+--+-- * Available since Gtk+ version 2.12+--+pageSetupNewFromFile :: GlibString string+ => string -- ^ @fileName@ - the filename to read the page setup from+ -> IO PageSetup+pageSetupNewFromFile fileName =+ propagateGError $ \errorPtr ->+ withUTFString fileName $ \fileNamePtr -> do+ setupPtr <- {# call gtk_page_setup_new_from_file #}+ fileNamePtr+ errorPtr+ wrapNewGObject mkPageSetup (return setupPtr)++#endif++--------------------+-- Methods++-- | Copies a 'PageSetup'.+--+pageSetupCopy :: PageSetupClass self => self+ -> IO PageSetup -- ^ returns a copy of @other@+pageSetupCopy self =+ wrapNewGObject mkPageSetup $+ {# call gtk_page_setup_copy #}+ (toPageSetup self)++-- | Gets the page orientation of the 'PageSetup'.+pageSetupGetOrientation :: PageSetupClass self => self+ -> IO PageOrientation -- ^ returns the page orientation+pageSetupGetOrientation self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_page_setup_get_orientation #}+ (toPageSetup self)++-- | Sets the page orientation of the 'PageSetup'.+pageSetupSetOrientation :: PageSetupClass self => self+ -> PageOrientation -- ^ @orientation@ - a 'PageOrientation' value+ -> IO ()+pageSetupSetOrientation self orientation =+ {# call gtk_page_setup_set_orientation #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) orientation)++-- | Gets the paper size of the 'PageSetup'.+pageSetupGetPaperSize :: PageSetupClass self => self+ -> IO PaperSize -- ^ returns the paper size+pageSetupGetPaperSize self =+ {# call gtk_page_setup_get_paper_size #}+ (toPageSetup self)+ >>= mkPaperSize . castPtr++pageSetupSetPaperSize :: PageSetupClass self => self+ -> PaperSize -- ^ @size@ - a 'PaperSize'+ -> IO ()+pageSetupSetPaperSize self size =+ {# call gtk_page_setup_set_paper_size #}+ (toPageSetup self)+ size++-- | Gets the top margin in units of @unit@.+--+pageSetupGetTopMargin :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the top margin+pageSetupGetTopMargin self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_top_margin #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++-- | Sets the top margin of the 'PageSetup'.+--+pageSetupSetTopMargin :: PageSetupClass self => self+ -> Double -- ^ @margin@ - the new top margin in units of @unit@+ -> Unit -- ^ @unit@ - the units for @margin@+ -> IO ()+pageSetupSetTopMargin self margin unit =+ {# call gtk_page_setup_set_top_margin #}+ (toPageSetup self)+ (realToFrac margin)+ ((fromIntegral . fromEnum) unit)++-- | Gets the bottom margin in units of @unit@.+--+pageSetupGetBottomMargin :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the bottom margin+pageSetupGetBottomMargin self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_bottom_margin #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++-- | Sets the bottom margin of the 'PageSetup'.+--+pageSetupSetBottomMargin :: PageSetupClass self => self+ -> Double -- ^ @margin@ - the new bottom margin in units of @unit@+ -> Unit -- ^ @unit@ - the units for @margin@+ -> IO ()+pageSetupSetBottomMargin self margin unit =+ {# call gtk_page_setup_set_bottom_margin #}+ (toPageSetup self)+ (realToFrac margin)+ ((fromIntegral . fromEnum) unit)++-- | Gets the left margin in units of @unit@.+--+pageSetupGetLeftMargin :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the left margin+pageSetupGetLeftMargin self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_left_margin #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++-- | Sets the left margin of the 'PageSetup'.+--+pageSetupSetLeftMargin :: PageSetupClass self => self+ -> Double -- ^ @margin@ - the new left margin in units of @unit@+ -> Unit -- ^ @unit@ - the units for @margin@+ -> IO ()+pageSetupSetLeftMargin self margin unit =+ {# call gtk_page_setup_set_left_margin #}+ (toPageSetup self)+ (realToFrac margin)+ ((fromIntegral . fromEnum) unit)++-- | Gets the right margin in units of @unit@.+--+pageSetupGetRightMargin :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the right margin+pageSetupGetRightMargin self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_right_margin #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++-- | Sets the right margin of the 'PageSetup'.+--+pageSetupSetRightMargin :: PageSetupClass self => self+ -> Double -- ^ @margin@ - the new right margin in units of @unit@+ -> Unit -- ^ @unit@ - the units for @margin@+ -> IO ()+pageSetupSetRightMargin self margin unit =+ {# call gtk_page_setup_set_right_margin #}+ (toPageSetup self)+ (realToFrac margin)+ ((fromIntegral . fromEnum) unit)++-- | Sets the paper size of the 'PageSetup' and modifies the margins according+-- to the new paper size.+--+pageSetupSetPaperSizeAndDefaultMargins :: PageSetupClass self => self+ -> PaperSize -- ^ @size@ - a 'PaperSize'+ -> IO ()+pageSetupSetPaperSizeAndDefaultMargins self size =+ {# call gtk_page_setup_set_paper_size_and_default_margins #}+ (toPageSetup self)+ size++-- | Returns the paper width in units of @unit@.+--+-- Note that this function takes orientation, but not margins into+-- consideration. See 'pageSetupGetPageWidth'.+--+pageSetupGetPaperWidth :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the paper width.+pageSetupGetPaperWidth self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_paper_width #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++-- | Returns the paper height in units of @unit@.+--+-- Note that this function takes orientation, but not margins into+-- consideration. See 'pageSetupGetPageHeight'.+--+pageSetupGetPaperHeight :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the paper height.+pageSetupGetPaperHeight self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_paper_height #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++-- | Returns the page width in units of @unit@.+--+-- Note that this function takes orientation and margins into consideration.+-- See 'pageSetupGetPaperWidth'.+--+pageSetupGetPageWidth :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the page width.+pageSetupGetPageWidth self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_page_width #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++-- | Returns the page height in units of @unit@.+--+-- Note that this function takes orientation and margins into consideration.+-- See 'pageSetupGetPaperHeight'.+--+pageSetupGetPageHeight :: PageSetupClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the page height.+pageSetupGetPageHeight self unit =+ liftM realToFrac $+ {# call gtk_page_setup_get_page_height #}+ (toPageSetup self)+ ((fromIntegral . fromEnum) unit)++#if GTK_CHECK_VERSION(2,14,0)+-- | Reads the page setup from the file @fileName@. See 'pageSetupToFile'.+--+-- * Available since Gtk+ version 2.14+--+pageSetupLoadFile :: (PageSetupClass self, GlibString string) => self+ -> string -- ^ @fileName@ - the filename to read the page setup from+ -> IO Bool -- ^ returns @True@ on success+pageSetupLoadFile self fileName =+ liftM toBool $+ propagateGError $ \errorPtr ->+ withUTFString fileName $ \fileNamePtr ->+ {# call gtk_page_setup_load_file #}+ (toPageSetup self)+ fileNamePtr+ errorPtr++#endif++#if GTK_CHECK_VERSION(2,12,0)+-- | This function saves the information from @setup@ to @fileName@.+--+-- * Available since Gtk+ version 2.12+--+pageSetupToFile :: (PageSetupClass self, GlibString string) => self+ -> string -- ^ @fileName@ - the file to save to+ -> IO Bool -- ^ returns @True@ on success+pageSetupToFile self fileName =+ liftM toBool $+ propagateGError $ \errorPtr ->+ withUTFString fileName $ \fileNamePtr ->+ {# call gtk_page_setup_to_file #}+ (toPageSetup self)+ fileNamePtr+ errorPtr++#endif+-- | The page orientation of the 'PageSetup'.+pageSetupOrientation :: PageSetupClass self => Attr self PageOrientation+pageSetupOrientation = newAttr+ pageSetupGetOrientation+ pageSetupSetOrientation++-- | The paper size of the 'PageSetup'.+pageSetupPaperSize :: PageSetupClass self => Attr self PaperSize+pageSetupPaperSize = newAttr+ pageSetupGetPaperSize+ pageSetupSetPaperSize++#endif+
+ Graphics/UI/Gtk/Printing/PaperSize.chs view
@@ -0,0 +1,361 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget PaperSize+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Support for named paper sizes+--+module Graphics.UI.Gtk.Printing.PaperSize (++-- * Detail+--+-- | 'PaperSize' handles paper sizes. It uses the+-- standard called \"PWG 5101.1-2002 PWG: Standard for Media Standardized+-- Names\" to name the paper sizes (and to get the data for the page sizes). In+-- addition to standard paper sizes, 'PaperSize' allows+-- to construct custom paper sizes with arbitrary dimensions.+--+-- The 'PaperSize' object stores not only the+-- dimensions (width and height) of a paper size and its name, it also provides+-- default print margins.+--+-- Printing support has been added in Gtk+ 2.10.++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ PaperSize(..),+ mkPaperSize,++-- * Enums+ Unit(..),++-- * Constructors+ paperSizeNew,+ paperSizeNewFromPpd,+ paperSizeNewCustom,++-- * Methods+ paperSizeCopy,+ paperSizeIsEqual,+ paperSizeGetName,+ paperSizeGetDisplayName,+ paperSizeGetPpdName,+ paperSizeGetWidth,+ paperSizeGetHeight,+ paperSizeIsCustom,+ paperSizeSetSize,+ paperSizeGetDefaultTopMargin,+ paperSizeGetDefaultBottomMargin,+ paperSizeGetDefaultLeftMargin,+ paperSizeGetDefaultRightMargin,+ paperSizeGetDefault,+#endif+#if GTK_CHECK_VERSION(2,12,0)+ paperSizeGetPaperSizes,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.GList++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Types+{#pointer *PaperSize foreign newtype#}++--------------------+-- Enums+{#enum Unit {underscoreToCase} deriving (Bounded,Eq,Show)#}++--------------------+-- Constructors++mkPaperSize :: Ptr PaperSize -> IO PaperSize+mkPaperSize pPtr = do+ size <- newForeignPtr pPtr paper_size_free+ return (PaperSize size)++foreign import ccall unsafe ">k_paper_size_free"+ paper_size_free :: FinalizerPtr PaperSize++#if GTK_CHECK_VERSION(2,10,0)+-- | Creates a new 'PaperSize' object by parsing a PWG+-- 5101.1-2002 paper name.+--+-- If @name@ is Nothing, the default paper size is returned, see 'paperSizeGetDefault'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeNew :: GlibString string+ => Maybe string -- ^ @name@ - a paper size name, or 'Nothing'+ -> IO PaperSize+paperSizeNew name =+ maybeWith withUTFString name $ \namePtr ->+ {# call gtk_paper_size_new #}+ namePtr+ >>= mkPaperSize++-- | Creates a new 'PaperSize' object by using PPD+-- information.+--+-- If @ppdName@ is not a recognized PPD paper name, @ppdDisplayName@,+-- @width@ and @height@ are used to construct a custom 'PaperSize' object.+--+-- * Available since Gtk+ version 2.10+--+paperSizeNewFromPpd :: GlibString string+ => string -- ^ @ppdName@ - a PPD paper name+ -> string -- ^ @ppdDisplayName@ - the corresponding human-readable name+ -> Double -- ^ @width@ - the paper width, in points+ -> Double -- ^ @height@ - the paper height in points+ -> IO PaperSize+paperSizeNewFromPpd ppdName ppdDisplayName width height =+ withUTFString ppdDisplayName $ \ppdDisplayNamePtr ->+ withUTFString ppdName $ \ppdNamePtr ->+ {# call gtk_paper_size_new_from_ppd #}+ ppdNamePtr+ ppdDisplayNamePtr+ (realToFrac width)+ (realToFrac height)+ >>= mkPaperSize++-- | Creates a new 'PaperSize' object with the given+-- parameters.+--+-- * Available since Gtk+ version 2.10+--+paperSizeNewCustom :: GlibString string+ => string -- ^ @name@ - the paper name+ -> string -- ^ @displayName@ - the human-readable name+ -> Double -- ^ @width@ - the paper width, in units of @unit@+ -> Double -- ^ @height@ - the paper height, in units of @unit@+ -> Unit -- ^ @unit@ - the unit for @width@ and @height@+ -> IO PaperSize+paperSizeNewCustom name displayName width height unit =+ withUTFString displayName $ \displayNamePtr ->+ withUTFString name $ \namePtr ->+ {# call gtk_paper_size_new_custom #}+ namePtr+ displayNamePtr+ (realToFrac width)+ (realToFrac height)+ ((fromIntegral . fromEnum) unit)+ >>= mkPaperSize+++--------------------+-- Methods++-- | Copies an existing 'PaperSize'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeCopy :: PaperSize+ -> IO PaperSize -- ^ returns a copy of @other@+paperSizeCopy self =+ {# call gtk_paper_size_copy #} self >>= mkPaperSize++-- | Compares two 'PaperSize' objects.+--+-- * Available since Gtk+ version 2.10+--+paperSizeIsEqual :: PaperSize+ -> PaperSize -- ^ @size2@ - another 'PaperSize' object+ -> IO Bool -- ^ returns @True@, if @size1@ and @size2@ represent+ -- the same paper size+paperSizeIsEqual self size2 =+ liftM toBool $+ {# call gtk_paper_size_is_equal #}+ self+ size2++-- | Gets the name of the 'PaperSize'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetName :: GlibString string => PaperSize+ -> IO string -- ^ returns the name of @size@+paperSizeGetName self =+ {# call gtk_paper_size_get_name #}+ self+ >>= peekUTFString++-- | Gets the human-readable name of the 'PaperSize'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetDisplayName :: GlibString string => PaperSize+ -> IO string -- ^ returns the human-readable name of @size@+paperSizeGetDisplayName self =+ {# call gtk_paper_size_get_display_name #}+ self+ >>= peekUTFString++-- | Gets the PPD name of the 'PaperSize', which may be+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetPpdName :: GlibString string => PaperSize+ -> IO (Maybe string) -- ^ returns the PPD name of @size@, or 'Nothing'+paperSizeGetPpdName self =+ {# call gtk_paper_size_get_ppd_name #}+ self+ >>= maybePeekUTFString++-- | Gets the paper width of the 'PaperSize', in units+-- of @unit@.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetWidth :: PaperSize+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the paper width+paperSizeGetWidth self unit =+ liftM realToFrac $+ {# call gtk_paper_size_get_width #}+ self+ ((fromIntegral . fromEnum) unit)++-- | Gets the paper height of the 'PaperSize', in units+-- of @unit@.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetHeight :: PaperSize+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the paper height+paperSizeGetHeight self unit =+ liftM realToFrac $+ {# call gtk_paper_size_get_height #}+ self+ ((fromIntegral . fromEnum) unit)++-- | Returns @True@ if @size@ is not a standard paper size.+--+paperSizeIsCustom :: PaperSize+ -> IO Bool -- ^ returns whether @size@ is a custom paper size.+paperSizeIsCustom self =+ liftM toBool $+ {# call gtk_paper_size_is_custom #}+ self++-- | Changes the dimensions of a @size@ to @width@ x @height@.+--+-- * Available since Gtk+ version 2.10+--+paperSizeSetSize :: PaperSize+ -> Double -- ^ @width@ - the new width in units of @unit@+ -> Double -- ^ @height@ - the new height in units of @unit@+ -> Unit -- ^ @unit@ - the unit for @width@ and @height@+ -> IO ()+paperSizeSetSize self width height unit =+ {# call gtk_paper_size_set_size #}+ self+ (realToFrac width)+ (realToFrac height)+ ((fromIntegral . fromEnum) unit)++-- | Gets the default top margin for the 'PaperSize'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetDefaultTopMargin :: PaperSize+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the default top margin+paperSizeGetDefaultTopMargin self unit =+ liftM realToFrac $+ {# call gtk_paper_size_get_default_top_margin #}+ self+ ((fromIntegral . fromEnum) unit)++-- | Gets the default bottom margin for the 'PaperSize'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetDefaultBottomMargin :: PaperSize+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the default bottom margin+paperSizeGetDefaultBottomMargin self unit =+ liftM realToFrac $+ {# call gtk_paper_size_get_default_bottom_margin #}+ self+ ((fromIntegral . fromEnum) unit)++-- | Gets the default left margin for the 'PaperSize'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetDefaultLeftMargin :: PaperSize+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the default left margin+paperSizeGetDefaultLeftMargin self unit =+ liftM realToFrac $+ {# call gtk_paper_size_get_default_left_margin #}+ self+ ((fromIntegral . fromEnum) unit)++-- | Gets the default right margin for the 'PaperSize'.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetDefaultRightMargin :: PaperSize+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the default right margin+paperSizeGetDefaultRightMargin self unit =+ liftM realToFrac $+ {# call gtk_paper_size_get_default_right_margin #}+ self+ ((fromIntegral . fromEnum) unit)++-- | Returns the name of the default paper size, which depends on the current+-- locale.+--+-- * Available since Gtk+ version 2.10+--+paperSizeGetDefault :: GlibString string+ => IO string -- ^ returns the name of the default paper size.+paperSizeGetDefault =+ {# call gtk_paper_size_get_default #}+ >>= peekUTFString++#endif++#if GTK_CHECK_VERSION(2,12,0)+-- | Creates a list of known paper sizes.+--+-- * Available since Gtk+ version 2.12+--+paperSizeGetPaperSizes ::+ Bool -- ^ @includeCustom@ - whether to include custom+ -- paper sizes as defined in the page setup dialog+ -> IO [PaperSize]+paperSizeGetPaperSizes includeCustom = do+ glist <- {# call gtk_paper_size_get_paper_sizes #} (fromBool includeCustom)+ list <- fromGList glist+ mapM mkPaperSize list+#endif+
+ Graphics/UI/Gtk/Printing/PrintContext.chs view
@@ -0,0 +1,226 @@+{-# LANGUAGE CPP, OverloadedStrings #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget PrintContext+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Encapsulates context for drawing pages+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Printing.PrintContext (++-- * Detail+--+-- | A 'PrintContext' encapsulates context information that is required when+-- drawing pages for printing, such as the cairo context and important+-- parameters like page size and resolution. It also lets you easily create+-- 'PangoLayout' and 'Context' objects that match the font metrics of the cairo+-- surface.+--+-- 'PrintContext' objects gets passed to the 'beginPrint', 'endPrint',+-- 'requestPageSetup' and 'drawPage' signals on the 'PrintOperation'.+--+-- Printing support was added in Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----PrintContext+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ PrintContext,+ PrintContextClass,+ castToPrintContext,+ toPrintContext,++-- * Methods+ printContextGetCairoContext,+ printContextSetCairoContext,+ printContextGetPageSetup,+ printContextGetWidth,+ printContextGetHeight,+ printContextGetDpiX,+ printContextGetDpiY,+ printContextGetPangoFontmap,+ printContextCreatePangoContext,+ printContextCreatePangoLayout,+#if GTK_CHECK_VERSION(2,20,0)+ printContextGetHardMargins,+#endif+#endif+ ) where++import Control.Monad (liftM)+import Data.IORef (newIORef)++import System.Glib.FFI+import System.Glib.UTFString+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.Rendering.Pango.Types#}+{#import Graphics.Rendering.Pango.BasicTypes#}+{#import Graphics.Rendering.Cairo.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)+--------------------+-- Methods++-- | Obtains the cairo context that is associated with the 'PrintContext'.+--+printContextGetCairoContext :: PrintContextClass self => self+ -> IO Cairo -- ^ returns the cairo context of @context@+printContextGetCairoContext self =+ liftM Cairo $+ {# call gtk_print_context_get_cairo_context #} (toPrintContext self)++-- | Sets a new cairo context on a print context.+--+-- This function is intended to be used when implementing an internal print+-- preview, it is not needed for printing, since Gtk+ itself creates a suitable+-- cairo context in that case.+--+printContextSetCairoContext :: PrintContextClass self => self+ -> Cairo -- ^ @cr@ - the cairo context+ -> Double -- ^ @dpiX@ - the horizontal resolution to use with @cr@+ -> Double -- ^ @dpiY@ - the vertical resolution to use with @cr@+ -> IO ()+printContextSetCairoContext self cr dpiX dpiY =+ {# call gtk_print_context_set_cairo_context #}+ (toPrintContext self)+ cr+ (realToFrac dpiX)+ (realToFrac dpiY)++-- | Obtains the 'PageSetup' that determines the page dimensions of the+-- 'PrintContext'.+--+printContextGetPageSetup :: PrintContextClass self => self+ -> IO PageSetup -- ^ returns the page setup of @context@+printContextGetPageSetup self =+ makeNewGObject mkPageSetup $+ {# call gtk_print_context_get_page_setup #}+ (toPrintContext self)++-- | Obtains the width of the 'PrintContext', in pixels.+--+printContextGetWidth :: PrintContextClass self => self+ -> IO Double -- ^ returns the width of @context@+printContextGetWidth self =+ liftM realToFrac $+ {# call gtk_print_context_get_width #}+ (toPrintContext self)++-- | Obtains the height of the 'PrintContext', in pixels.+--+printContextGetHeight :: PrintContextClass self => self+ -> IO Double -- ^ returns the height of @context@+printContextGetHeight self =+ liftM realToFrac $+ {# call gtk_print_context_get_height #}+ (toPrintContext self)++-- | Obtains the horizontal resolution of the 'PrintContext', in dots per+-- inch.+--+printContextGetDpiX :: PrintContextClass self => self+ -> IO Double -- ^ returns the horizontal resolution of @context@+printContextGetDpiX self =+ liftM realToFrac $+ {# call gtk_print_context_get_dpi_x #}+ (toPrintContext self)++-- | Obtains the vertical resolution of the 'PrintContext', in dots per inch.+--+printContextGetDpiY :: PrintContextClass self => self+ -> IO Double -- ^ returns the vertical resolution of @context@+printContextGetDpiY self =+ liftM realToFrac $+ {# call gtk_print_context_get_dpi_y #}+ (toPrintContext self)++-- | Returns a 'FontMap' that is suitable for use with the 'PrintContext'.+--+printContextGetPangoFontmap :: PrintContextClass self => self+ -> IO FontMap -- ^ returns the font map of @context@+printContextGetPangoFontmap self =+ makeNewGObject mkFontMap $+ {# call gtk_print_context_get_pango_fontmap #}+ (toPrintContext self)++-- | Creates a new 'Context' that can be used with the 'PrintContext'.+--+printContextCreatePangoContext :: PrintContextClass self => self+ -> IO PangoContext -- ^ returns a new Pango context for @context@+printContextCreatePangoContext self =+ wrapNewGObject mkPangoContext $+ {# call gtk_print_context_create_pango_context #}+ (toPrintContext self)++-- | Creates a new 'PangoLayout' that is suitable for use with the+-- 'PrintContext'.+--+printContextCreatePangoLayout :: PrintContextClass self => self+ -> IO PangoLayout -- ^ returns a new Pango layout for @context@+printContextCreatePangoLayout self = do+ pl <- wrapNewGObject mkPangoLayoutRaw $+ {# call gtk_print_context_create_pango_layout #}+ (toPrintContext self)+ ps <- makeNewPangoString (""::DefaultGlibString)+ psRef <- newIORef ps+ return (PangoLayout psRef pl)++#if GTK_CHECK_VERSION(2,20,0)+printContextGetHardMargins :: PrintContextClass self => self+ -> IO (Maybe (Double, Double, Double, Double))+ -- ^ returns @(top, bottom, left, right)@+ -- @top@ top hardware printer margin+ -- @bottom@ bottom hardware printer margin+ -- @left@ left hardware printer margin+ -- @right@ right hardware printer margin+printContextGetHardMargins self =+ alloca $ \ topPtr ->+ alloca $ \ bottomPtr ->+ alloca $ \ leftPtr ->+ alloca $ \ rightPtr -> do+ success <- liftM toBool $ {#call gtk_print_context_get_hard_margins #}+ (toPrintContext self)+ topPtr+ bottomPtr+ leftPtr+ rightPtr+ if success+ then do+ top <- liftM realToFrac $ peek topPtr+ bottom <- liftM realToFrac $ peek bottomPtr+ left <- liftM realToFrac $ peek leftPtr+ right <- liftM realToFrac $ peek rightPtr+ return $ Just (top, bottom, left, right)+ else return Nothing+#endif++#endif
+ Graphics/UI/Gtk/Printing/PrintOperation.chs view
@@ -0,0 +1,944 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget PrintOperation+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- High-level Printing API+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Printing.PrintOperation (++-- * Detail+--+-- | 'PrintOperation' is the high-level, portable printing API. It looks a bit+-- different than other Gtk+ dialogs such as the 'FileChooser', since some+-- platforms don't expose enough infrastructure to implement a good print+-- dialog. On such platforms, 'PrintOperation' uses the native print dialog. On+-- platforms which do not provide a native print dialog, Gtk+ uses its own, see+-- 'PrintUnixDialog'.+--+-- The typical way to use the high-level printing API is to create a+-- 'PrintOperation' object with 'printOperationNew' when the user selects to+-- print. Then you set some properties on it, e.g. the page size, any+-- 'PrintSettings' from previous print operations, the number of pages, the+-- current page, etc.+--+-- Then you start the print operation by calling 'printOperationRun'. It+-- will then show a dialog, let the user select a printer and options. When the+-- user finished the dialog various signals will be emitted on the+-- 'PrintOperation', the main one being 'draw-page' signal, which you are supposed to+-- catch and render the page on the provided 'PrintContext' using Cairo.+--+-- By default 'PrintOperation' uses an external application to do print+-- preview. To implement a custom print preview, an application must connect to+-- the preview signal. The functions 'printOperationPrintPreviewRenderPage',+-- 'printOperationPreviewEndPreview' and 'printOperationPreviewIsSelected' are+-- useful when implementing a print preview.+--+-- Printing support was added in Gtk+ 2.10.+--++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----PrintOperation+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ PrintOperation,+ PrintOperationClass,+ castToPrintOperation,+ toPrintOperation,++ PrintOperationPreview,+ PrintOperationPreviewClass,+ castToPrintOperationPreview,+ toPrintOperationPreview,++-- * Enums+ PrintStatus(..),+ PrintOperationAction(..),+ PrintOperationResult(..),+ PrintError(..),++-- * Constructors+ printOperationNew,++-- * Methods+ printOperationSetAllowAsync,+ printOperationGetError,+ printOperationSetJobName,+ printOperationSetNPages,+#if GTK_CHECK_VERSION(2,18,0)+ printOperationGetNPagesToPrint,+#endif+ printOperationSetCurrentPage,+ printOperationSetUseFullPage,+ printOperationSetUnit,+ printOperationSetExportFilename,+ printOperationSetShowProgress,+ printOperationSetTrackPrintStatus,+ printOperationSetCustomTabLabel,+ printOperationRun,+ printOperationCancel,+#if GTK_CHECK_VERSION(2,16,0)+ printOperationDrawPageFinish,+ printOperationSetDeferDrawing,+#endif+ printOperationGetStatus,+ printOperationGetStatusString,+ printOperationIsFinished,+ printRunPageSetupDialog,+ printRunPageSetupDialogAsync,++ printOperationPreviewEndPreview,+ printOperationPreviewIsSelected,+ printOperationPreviewRenderPage,++-- * Attributes+ printOperationDefaultPageSetup,+ printOperationPrintSettings,+ printOperationJobName,+ printOperationNPages,+ printOperationCurrentPage,+ printOperationUseFullPage,+ printOperationTrackPrintStatus,+ printOperationUnit,+ printOperationShowProgress,+ printOperationAllowAsync,+ printOperationExportFilename,+ printOperationStatus,+ printOperationStatusString,+ printOperationCustomTabLabel,+#if GTK_CHECK_VERSION(2,18,0)+ printOperationSupportSelection,+ printOperationHasSelection,+ printOperationEmbedPageSetup,+ printOperationNPagesToPrint,+#endif++-- * Signals+ printOptDone,+ printOptBeginPrint,+ printOptPaginate,+ printOptRequestPageSetup,+ printOptDrawPage,+ printOptEndPrint,+ printOptStatusChanged,+ printOptCreateCustomWidget,+#if GTK_CHECK_VERSION(2,18,0)+ printOptUpdateCustomWidget,+#endif+ printOptCustomWidgetApply,+ printOptPreview,+ printOptReady,+ printOptGotPageSize,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import System.Glib.UTFString+import System.Glib.GError+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}+import Graphics.UI.Gtk.Printing.PaperSize (Unit(..))++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)+--------------------+-- Interfaces++instance PrintOperationPreviewClass PrintOperation++--------------------+-- Enums+-- | The status gives a rough indication of the completion of a running print operation.+{#enum PrintStatus {underscoreToCase} deriving (Bounded,Eq,Show)#}++-- | The action parameter to 'printOperationRun' determines what action the print operation should+-- perform.+{#enum PrintOperationAction {underscoreToCase} deriving (Bounded,Eq,Show)#}++-- | A value of this type is returned by 'printOperationRun'.+{#enum PrintOperationResult {underscoreToCase} deriving (Bounded,Eq,Show)#}++-- | Error codes that identify various errors that can occur while using the GTK+ printing support.+{#enum PrintError {underscoreToCase} deriving (Bounded,Eq,Show)#}++--------------------+-- Constructors++-- | Creates a new 'PrintOperation'.+--+printOperationNew :: IO PrintOperation+printOperationNew =+ wrapNewGObject mkPrintOperation $+ {# call gtk_print_operation_new #}++--------------------+-- Methods++-- | Sets whether the 'printOperationRun' may return before the print+-- operation is completed. Note that some platforms may not allow asynchronous+-- operation.+--+printOperationSetAllowAsync :: PrintOperationClass self => self+ -> Bool -- ^ @allowAsync@ - @True@ to allow asynchronous operation+ -> IO ()+printOperationSetAllowAsync self allowAsync =+ {# call gtk_print_operation_set_allow_async #}+ (toPrintOperation self)+ (fromBool allowAsync)++-- | Call this when the result of a print operation is+-- 'PrintOperationResultError', either as returned by 'printOperationRun', or+-- in the 'done' signal handler. The returned+-- 'GError' will contain more details on what went wrong.+--+printOperationGetError :: PrintOperationClass self => self -> IO ()+printOperationGetError self =+ propagateGError $ \errorPtr ->+ {# call gtk_print_operation_get_error #}+ (toPrintOperation self)+ errorPtr++-- | Sets the name of the print job. The name is used to identify the job+-- (e.g. in monitoring applications like eggcups).+--+-- If you don't set a job name, Gtk+ picks a default one by numbering+-- successive print jobs.+--+printOperationSetJobName :: (PrintOperationClass self, GlibString string) => self+ -> string -- ^ @jobName@ - a string that identifies the print job+ -> IO ()+printOperationSetJobName self jobName =+ withUTFString jobName $ \jobNamePtr ->+ {# call gtk_print_operation_set_job_name #}+ (toPrintOperation self)+ jobNamePtr++-- | Sets the number of pages in the document.+--+-- This /must/ be set to a positive number before the rendering starts. It+-- may be set in a 'beginPrint' signal handler.+--+-- Note that the page numbers passed to the 'requestPageSetup'+-- and 'drawPage' signals+-- are 0-based, i.e. if the user chooses to print all pages, the last+-- 'draw-page' signal will be for page @nPages@ - 1.+--+printOperationSetNPages :: PrintOperationClass self => self+ -> Int -- ^ @nPages@ - the number of pages+ -> IO ()+printOperationSetNPages self nPages =+ {# call gtk_print_operation_set_n_pages #}+ (toPrintOperation self)+ (fromIntegral nPages)++#if GTK_CHECK_VERSION(2,18,0)+-- | Returns the number of pages that will be printed.+--+-- Note that this value is set during print preparation phase+-- ('PrintStatusPreparing'), so this function should never be called before the+-- data generation phase ('PrintStatusGeneratingData'). You can connect to the+-- 'statusChanged' signal and call+-- 'printOperationGetNPagesToPrint' when print status is+-- 'PrintStatusGeneratingData'. This is typically used to track the progress of+-- print operation.+--+-- * Available since Gtk+ version 2.18+--+printOperationGetNPagesToPrint :: PrintOperationClass self => self+ -> IO Int -- ^ returns the number of pages that will be printed+printOperationGetNPagesToPrint self =+ liftM fromIntegral $+ {# call gtk_print_operation_get_n_pages_to_print #}+ (toPrintOperation self)+#endif++-- | Sets the current page.+--+-- If this is called before 'printOperationRun', the user will be able to+-- select to print only the current page.+--+-- Note that this only makes sense for pre-paginated documents.+--+printOperationSetCurrentPage :: PrintOperationClass self => self+ -> Int -- ^ @currentPage@ - the current page, 0-based+ -> IO ()+printOperationSetCurrentPage self currentPage =+ {# call gtk_print_operation_set_current_page #}+ (toPrintOperation self)+ (fromIntegral currentPage)++-- | If @fullPage@ is @True@, the transformation for the cairo context+-- obtained from 'PrintContext' puts the origin at the top left corner of the+-- page (which may not be the top left corner of the sheet, depending on page+-- orientation and the number of pages per sheet). Otherwise, the origin is at+-- the top left corner of the imageable area (i.e. inside the margins).+--+printOperationSetUseFullPage :: PrintOperationClass self => self+ -> Bool -- ^ @fullPage@ - @True@ to set up the 'PrintContext' for the full+ -- page+ -> IO ()+printOperationSetUseFullPage self fullPage =+ {# call gtk_print_operation_set_use_full_page #}+ (toPrintOperation self)+ (fromBool fullPage)++-- | Sets up the transformation for the cairo context obtained from+-- 'PrintContext' in such a way that distances are measured in units of @unit@.+--+printOperationSetUnit :: PrintOperationClass self => self+ -> Unit -- ^ @unit@ - the unit to use+ -> IO ()+printOperationSetUnit self unit =+ {# call gtk_print_operation_set_unit #}+ (toPrintOperation self)+ ((fromIntegral . fromEnum) unit)++-- | Sets up the 'PrintOperation' to generate a file instead of showing the+-- print dialog. The intended use of this function is for implementing \"Export+-- to PDF\" actions. Currently, PDF is the only supported format.+--+-- \"Print to PDF\" support is independent of this and is done by letting+-- the user pick the \"Print to PDF\" item from the list of printers in the+-- print dialog.+--+printOperationSetExportFilename :: (PrintOperationClass self, GlibString string) => self+ -> string -- ^ @filename@ - the filename for the exported file+ -> IO ()+printOperationSetExportFilename self filename =+ withUTFString filename $ \filenamePtr ->+ {# call gtk_print_operation_set_export_filename #}+ (toPrintOperation self)+ filenamePtr++-- | If @showProgress@ is @True@, the print operation will show a progress+-- dialog during the print operation.+--+printOperationSetShowProgress :: PrintOperationClass self => self+ -> Bool -- ^ @showProgress@ - @True@ to show a progress dialog+ -> IO ()+printOperationSetShowProgress self showProgress =+ {# call gtk_print_operation_set_show_progress #}+ (toPrintOperation self)+ (fromBool showProgress)++-- | If track_status is @True@, the print operation will try to continue+-- report on the status of the print job in the printer queues and printer.+-- This can allow your application to show things like \"out of paper\" issues,+-- and when the print job actually reaches the printer.+--+-- This function is often implemented using some form of polling, so it+-- should not be enabled unless needed.+--+printOperationSetTrackPrintStatus :: PrintOperationClass self => self+ -> Bool -- ^ @trackStatus@ - @True@ to track status after printing+ -> IO ()+printOperationSetTrackPrintStatus self trackStatus =+ {# call gtk_print_operation_set_track_print_status #}+ (toPrintOperation self)+ (fromBool trackStatus)++-- | Sets the label for the tab holding custom widgets.+--+printOperationSetCustomTabLabel :: (PrintOperationClass self, GlibString string) => self+ -> string -- ^ @label@ - the label to use, or empty to use the default+ -- label+ -> IO ()+printOperationSetCustomTabLabel self label =+ withUTFString label $ \labelPtr ->+ {# call gtk_print_operation_set_custom_tab_label #}+ (toPrintOperation self)+ labelPtr++-- | Runs the print operation, by first letting the user modify print settings+-- in the print dialog, and then print the document.+--+-- Normally that this function does not return until the rendering of all+-- pages is complete. You can connect to the 'statusChanged' signal on @op@ to obtain some information about the+-- progress of the print operation. Furthermore, it may use a recursive+-- mainloop to show the print dialog.+--+-- If you call 'printOperationSetAllowAsync' or set the 'allowAsync'+-- property the operation will run asynchronously+-- if this is supported on the platform. The 'done' signal will be emitted with the result of the operation when+-- the it is done (i.e. when the dialog is canceled, or when the print succeeds+-- or fails).+--+printOperationRun :: (PrintOperationClass self, WindowClass parent) => self+ -> PrintOperationAction -- ^ @action@ - the action to start+ -> parent -- ^ @parent@ - Transient parent of the dialog+ -> IO PrintOperationResult -- ^ returns the result of the print operation. A+ -- return value of 'PrintOperationResultApply'+ -- indicates that the printing was completed+ -- successfully. In this case, it is a good idea to+ -- obtain the used print settings with+ -- 'printOperationGetPrintSettings' and store them+ -- for reuse with the next print operation. A value+ -- of 'PrintOperationResultInProgress' means the+ -- operation is running asynchronously, and will+ -- emit the 'done' signal when done.+printOperationRun self action parent =+ liftM (toEnum . fromIntegral) $+ propagateGError $ \errorPtr ->+ {# call gtk_print_operation_run #}+ (toPrintOperation self)+ ((fromIntegral . fromEnum) action)+ (toWindow parent)+ errorPtr++-- | Cancels a running print operation. This function may be called from a+-- 'beginPrint', 'paginate' or 'drawPage' signal handler+-- to stop the currently running print operation.+--+printOperationCancel :: PrintOperationClass self => self -> IO ()+printOperationCancel self =+ {# call gtk_print_operation_cancel #}+ (toPrintOperation self)++#if GTK_CHECK_VERSION(2,16,0)+-- | Signalize that drawing of particular page is complete.+--+-- It is called after completion of page drawing (e.g. drawing in another+-- thread). If 'printOperationSetDeferDrawing' was called before, then this+-- function has to be called by application. In another case it is called by+-- the library itself.+--+-- * Available since Gtk+ version 2.16+--+printOperationDrawPageFinish :: PrintOperationClass self => self -> IO ()+printOperationDrawPageFinish self =+ {# call gtk_print_operation_draw_page_finish #}+ (toPrintOperation self)++-- | Sets up the 'PrintOperation' to wait for calling of+-- 'printOperationDrawPageFinish' from application. It can be used for drawing+-- page in another thread.+--+-- This function must be called in the callback of \"draw-page\" signal.+--+-- * Available since Gtk+ version 2.16+--+printOperationSetDeferDrawing :: PrintOperationClass self => self -> IO ()+printOperationSetDeferDrawing self =+ {# call gtk_print_operation_set_defer_drawing #}+ (toPrintOperation self)+#endif++-- | Returns the status of the print operation. Also see+-- 'printOperationGetStatusString'.+--+printOperationGetStatus :: PrintOperationClass self => self+ -> IO PrintStatus -- ^ returns the status of the print operation+printOperationGetStatus self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_print_operation_get_status #}+ (toPrintOperation self)++-- | Returns a string representation of the status of the print operation. The+-- string is translated and suitable for displaying the print status e.g. in a+-- 'Statusbar'.+--+-- Use 'printOperationGetStatus' to obtain a status value that is suitable+-- for programmatic use.+--+printOperationGetStatusString :: (PrintOperationClass self, GlibString string) => self+ -> IO string -- ^ returns a string representation of the status of the print+ -- operation+printOperationGetStatusString self =+ {# call gtk_print_operation_get_status_string #}+ (toPrintOperation self)+ >>= peekUTFString++-- | A convenience function to find out if the print operation is finished,+-- either successfully ('PrintStatusFinished') or unsuccessfully+-- ('PrintStatusFinishedAborted').+--+-- Note: when you enable print status tracking the print operation can be in+-- a non-finished state even after done has been called, as the operation+-- status then tracks the print job status on the printer.+--+printOperationIsFinished :: PrintOperationClass self => self+ -> IO Bool -- ^ returns @True@, if the print operation is finished.+printOperationIsFinished self =+ liftM toBool $+ {# call gtk_print_operation_is_finished #}+ (toPrintOperation self)++-- | Runs a page setup dialog, letting the user modify the values from @pageSetup@. If the user cancels+-- the dialog, the returned 'PageSetup' is identical to the passed in @pageSetup@, otherwise it+-- contains the modifications done in the dialog.+--+-- Note that this function may use a recursive mainloop to show the page setup dialog. See+-- 'printRunPageSetupDialogAsync' if this is a problem.+printRunPageSetupDialog :: (WindowClass window, PageSetupClass pageSetup, PrintSettingsClass setting)+ => window -- ^ @parent@ transient parent.+ -> pageSetup -- ^ @pageSetup@ an existing 'PageSetup'.+ -> setting -- ^ @settings@ a 'PrintSettings'+ -> IO PageSetup -- ^ returns a new 'PageSetup'+printRunPageSetupDialog window pageSetup setting =+ wrapNewGObject mkPageSetup $+ {#call gtk_print_run_page_setup_dialog #}+ (toWindow window)+ (toPageSetup pageSetup)+ (toPrintSettings setting)++{#pointer PageSetupDoneFunc#}++foreign import ccall "wrapper" mkGtkPageSetupDoneFunc ::+ (Ptr PageSetup -> Ptr () -> IO ())+ -> IO PageSetupDoneFunc++-- | Runs a page setup dialog, letting the user modify the values from @pageSetup@.+--+-- In contrast to 'printRunPageSetupDialog', this function returns after showing the page setup+-- dialog on platforms that support this, and calls @doneCb@ from a signal handler for the 'response'+-- signal of the dialog.+printRunPageSetupDialogAsync :: (WindowClass window, PageSetupClass pageSetup, PrintSettingsClass setting)+ => window -- ^ @parent@ transient parent.+ -> pageSetup -- ^ @pageSetup@ an existing 'PageSetup'.+ -> setting -- ^ @settings@ a 'PrintSettings'+ -> (PageSetup -> IO ()) -- ^ @doneCb@ a function to call when the user saves the modified page setup+ -> IO ()+printRunPageSetupDialogAsync window pageSetup setting doneCb = do+ funcPtr <- mkGtkPageSetupDoneFunc $ \setupPtr _ -> do+ setup <- makeNewGObject mkPageSetup (return setupPtr)+ doneCb setup+ {#call gtk_print_run_page_setup_dialog_async #}+ (toWindow window)+ (toPageSetup pageSetup)+ (toPrintSettings setting)+ funcPtr+ nullPtr++-- | Ends a preview.+--+-- This function must be called to finish a custom print preview.+printOperationPreviewEndPreview :: PrintOperationPreviewClass self+ => self+ -> IO ()+printOperationPreviewEndPreview self =+ {# call gtk_print_operation_preview_end_preview #}+ (toPrintOperationPreview self)++-- | Returns whether the given page is included in the set of pages that have been selected for printing.+printOperationPreviewIsSelected :: PrintOperationPreviewClass self+ => self -- ^ @preview@ a 'PrintOperationPreview'+ -> Int -- ^ @pageNr@ a page number+ -> IO Bool -- ^ returns 'True' if the page has been selected for printing+printOperationPreviewIsSelected self pageNr =+ liftM toBool $+ {# call gtk_print_operation_preview_is_selected #}+ (toPrintOperationPreview self)+ (fromIntegral pageNr)++-- | Renders a page to the preview, using the print context that was passed to the "preview" handler+-- together with preview.+--+-- A custom iprint preview should use this function in its 'expose' handler to render the currently+-- selected page.+--+-- Note that this function requires a suitable cairo context to be associated with the print context.+printOperationPreviewRenderPage :: PrintOperationPreviewClass self+ => self -- ^ @preview@ a 'PrintOperationPreview'+ -> Int -- ^ @pageNr@ the page to render+ -> IO ()+printOperationPreviewRenderPage self pageNr =+ {# call gtk_print_operation_preview_render_page #}+ (toPrintOperationPreview self)+ (fromIntegral pageNr)++--------------------+-- Attributes++-- | The 'PageSetup' used by default.+--+-- This page setup will be used by 'printOperationRun', but it can be overridden on a per-page+-- basis by connecting to the 'requestPageSetup' signal.+--+-- Since 2.10+printOperationDefaultPageSetup :: (PrintOperationClass self, PageSetupClass pageSetup) => ReadWriteAttr self PageSetup pageSetup+printOperationDefaultPageSetup = newAttrFromObjectProperty "default-page-setup"+ {# call pure unsafe gtk_page_setup_get_type #}++-- | The 'PrintSettings' used for initializing the dialog.+--+-- Setting this property is typically used to re-establish print settings from a previous print+-- operation, see 'printOperationRun'.+--+-- Since 2.10+printOperationPrintSettings :: (PrintOperationClass self, PrintSettingsClass printSettings) => ReadWriteAttr self PrintSettings printSettings+printOperationPrintSettings = newAttrFromObjectProperty "print-settings"+ {# call pure unsafe gtk_print_settings_get_type #}++-- | A string used to identify the job (e.g. in monitoring applications like eggcups).+--+-- If you don't set a job name, GTK+ picks a default one by numbering successive print jobs.+--+-- Default value: \"\"+--+-- Since 2.10+printOperationJobName :: (PrintOperationClass self, GlibString string) => Attr self string+printOperationJobName = newAttrFromStringProperty "job-name"++-- | The number of pages in the document.+--+-- This must be set to a positive number before the rendering starts. It may be set in a 'beginPrint'+-- signal handler.+--+-- Note that the page numbers passed to the 'requestPageSetup' and 'drawPage' signals are 0-based,+-- i.e. if the user chooses to print all pages, the last 'drawPage' signal will be for page @nPages@ -+-- 1.+--+-- Allowed values: >= 'GMaxulong'+--+-- Default value: -1+--+-- Since 2.10+printOperationNPages :: PrintOperationClass self => Attr self Int+printOperationNPages = newAttrFromIntProperty "n-pages"++-- | The current page in the document.+--+-- If this is set before 'printOperationRun', the user will be able to select to print only the+-- current page.+--+-- Note that this only makes sense for pre-paginated documents.+--+-- Allowed values: >= 'GMaxulong'+--+-- Default value: -1+--+-- Since 2.10+printOperationCurrentPage :: PrintOperationClass self => Attr self Int+printOperationCurrentPage = newAttrFromIntProperty "current-page"++-- | If 'True', the transformation for the cairo context obtained from 'PrintContext' puts the origin at+-- the top left corner of the page (which may not be the top left corner of the sheet, depending on+-- page orientation and the number of pages per sheet). Otherwise, the origin is at the top left corner+-- of the imageable area (i.e. inside the margins).+--+-- Default value: 'False'+--+-- Since 2.10+printOperationUseFullPage :: PrintOperationClass self => Attr self Bool+printOperationUseFullPage = newAttrFromBoolProperty "use-full-page"++-- | If 'True', the print operation will try to continue report on the status of the print job in the+-- printer queues and printer. This can allow your application to show things like "out of paper"+-- issues, and when the print job actually reaches the printer. However, this is often implemented+-- using polling, and should not be enabled unless needed.+--+-- Default value: 'False'+--+-- Since 2.10+printOperationTrackPrintStatus :: PrintOperationClass self => Attr self Bool+printOperationTrackPrintStatus = newAttrFromBoolProperty "track-print-status"++-- | The transformation for the cairo context obtained from 'PrintContext' is set up in such a way that+-- distances are measured in units of unit.+--+-- Default value: ''UnitPixel''+--+-- Since 2.10+--+printOperationUnit :: PrintOperationClass self => Attr self Unit+printOperationUnit = newAttrFromEnumProperty "unit"+ {# call pure unsafe gtk_unit_get_type #}++-- | Determines whether to show a progress dialog during the print operation.+--+-- Default value: 'False'+--+-- Since 2.10+printOperationShowProgress :: PrintOperationClass self => Attr self Bool+printOperationShowProgress = newAttrFromBoolProperty "show-progress"++-- | Determines whether the print operation may run asynchronously or not.+--+-- Some systems don't support asynchronous printing, but those that do will return+-- ''PrintOperationResultInProgress'' as the status, and emit the "done" signal when the operation+-- is actually done.+--+-- The Windows port does not support asynchronous operation at all (this is unlikely to change). On+-- other platforms, all actions except for ''PrintOperationActionExport'' support asynchronous+-- operation.+--+-- Default value: 'False'+--+-- Since 2.10+printOperationAllowAsync :: PrintOperationClass self => Attr self Bool+printOperationAllowAsync = newAttrFromBoolProperty "allow-async"++-- | The name of a file to generate instead of showing the print dialog. Currently, PDF is the only+-- supported format.+--+-- The intended use of this property is for implementing "Export to PDF" actions.+--+-- "Print to PDF" support is independent of this and is done by letting the user pick the "Print to+-- PDF" item from the list of printers in the print dialog.+--+-- Default value: 'Nothing'+--+-- Since 2.10+printOperationExportFilename :: (PrintOperationClass self, GlibString string) => Attr self string+printOperationExportFilename = newAttrFromStringProperty "export-filename"++-- | The status of the print operation.+--+-- Default value: ''PrintStatusInitial''+--+-- Since 2.10+printOperationStatus :: PrintOperationClass self => ReadAttr self PrintStatus+printOperationStatus = readAttrFromEnumProperty "status"+ {# call pure unsafe gtk_print_status_get_type #}++-- | A string representation of the status of the print operation. The string is translated and suitable+-- for displaying the print status e.g. in a 'Statusbar'.+--+-- See the 'printOperationStatus' property for a status value that is suitable for programmatic use.+--+-- Default value: \"\"+--+-- Since 2.10+printOperationStatusString :: (PrintOperationClass self, GlibString string) => ReadAttr self string+printOperationStatusString = readAttrFromStringProperty "status-string"++-- | Used as the label of the tab containing custom widgets. Note that this property may be ignored on+-- some platforms.+--+-- If this is 'Nothing', GTK+ uses a default label.+--+-- Default value: 'Nothing'+--+-- Since 2.10+printOperationCustomTabLabel :: (PrintOperationClass self, GlibString string) => Attr self string+printOperationCustomTabLabel = newAttrFromStringProperty "custom-tab-label"++#if GTK_CHECK_VERSION(2,18,0)+-- | If 'True', the print operation will support print of selection. This allows the print dialog to show a+-- "Selection" button.+--+-- Default value: 'False'+--+-- Since 2.18+printOperationSupportSelection :: PrintOperationClass self => Attr self Bool+printOperationSupportSelection = newAttrFromBoolProperty "support-selection"++-- | Determines whether there is a selection in your application. This can allow your application to+-- print the selection. This is typically used to make a "Selection" button sensitive.+--+-- Default value: 'False'+--+-- Since 2.18+printOperationHasSelection :: PrintOperationClass self => Attr self Bool+printOperationHasSelection = newAttrFromBoolProperty "has-selection"++-- | If 'True', page size combo box and orientation combo box are embedded into page setup page.+--+-- Default value: 'False'+--+-- Since 2.18+printOperationEmbedPageSetup :: PrintOperationClass self => Attr self Bool+printOperationEmbedPageSetup = newAttrFromBoolProperty "embed-page-setup"++-- | The number of pages that will be printed.+--+-- Note that this value is set during print preparation phase (''PrintStatusPreparing''), so this+-- value should never be get before the data generation phase (''PrintStatusGeneratingData''). You+-- can connect to the 'statusChanged' signal and call 'printOperationGetNPagesToPrint' when+-- print status is ''PrintStatusGeneratingData''. This is typically used to track the progress of+-- print operation.+--+-- Allowed values: >= 'GMaxulong'+--+-- Default value: -1+--+-- Since 2.18+printOperationNPagesToPrint :: PrintOperationClass self => ReadAttr self Int+printOperationNPagesToPrint = readAttrFromIntProperty "n-pages-to-print"+#endif++--------------------+-- Signals++-- | Emitted when the print operation run has finished doing everything+-- required for printing.+--+-- @result@ gives you information about what happened during the run. If+-- @result@ is 'PrintOperationResultError' then you can call+-- 'printOperationGetError' for more information.+--+-- If you enabled print status tracking then 'printOperationIsFinished' may+-- still return @False@ after 'done' was+-- emitted.+--+printOptDone :: PrintOperationClass self => Signal self (PrintOperationResult -> IO ())+printOptDone = Signal (connect_ENUM__NONE "done")++-- | Emitted after the user has finished changing print settings in the+-- dialog, before the actual rendering starts.+--+-- A typical use for 'begin-print' is to use the parameters from the+-- 'PrintContext' and paginate the document accordingly, and then set the+-- number of pages with 'printOperationSetNPages'.+--+printOptBeginPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ())+printOptBeginPrint = Signal (connect_OBJECT__NONE "begin_print")++-- | Emitted after the 'beginPrint' signal,+-- but before the actual rendering starts. It keeps getting emitted until a+-- connected signal handler returns @True@.+--+-- The 'paginate' signal is intended to be used for paginating a document in+-- small chunks, to avoid blocking the user interface for a long time. The+-- signal handler should update the number of pages using+-- 'printOperationSetNPages', and return @True@ if the document has been+-- completely paginated.+--+-- If you don't need to do pagination in chunks, you can simply do it all in+-- the 'begin-print handler', and set the number of pages from there.+--+printOptPaginate :: PrintOperationClass self => Signal self (PrintContext -> IO Bool)+printOptPaginate = Signal (connect_OBJECT__BOOL "paginate")++-- | Emitted once for every page that is printed, to give the application a+-- chance to modify the page setup. Any changes done to @setup@ will be in+-- force only for printing this page.+--+printOptRequestPageSetup :: PrintOperationClass self => Signal self (PrintContext -> Int -> PageSetup -> IO ())+printOptRequestPageSetup = Signal (connect_OBJECT_INT_OBJECT__NONE "request_page_setup")++-- | Emitted for every page that is printed. The signal handler must render+-- the @pageNr@'s page onto the cairo context obtained from @context@ using+-- 'printContextGetCairoContext'.+--+-- Use 'printOperationSetUseFullPage' and 'printOperationSetUnit' before+-- starting the print operation to set up the transformation of the cairo+-- context according to your needs.+--+printOptDrawPage :: PrintOperationClass self => Signal self (PrintContext -> Int -> IO ())+printOptDrawPage = Signal (connect_OBJECT_INT__NONE "draw_page")++-- | Emitted after all pages have been rendered. A handler for this signal can+-- clean up any resources that have been allocated in the 'beginPrint' handler.+--+printOptEndPrint :: PrintOperationClass self => Signal self (PrintContext -> IO ())+printOptEndPrint = Signal (connect_OBJECT__NONE "end_print")++-- | Emitted at between the various phases of the print operation. See+-- 'PrintStatus' for the phases that are being discriminated. Use+-- 'printOperationGetStatus' to find out the current status.+--+printOptStatusChanged :: PrintOperationClass self => Signal self (IO ())+printOptStatusChanged = Signal (connect_NONE__NONE "status_changed")++-- | Emitted when displaying the print dialog. If you return a widget in a+-- handler for this signal it will be added to a custom tab in the print+-- dialog. You typically return a container widget with multiple widgets in it.+--+-- The print dialog owns the returned widget, and its lifetime is not+-- controlled by the application. However, the widget is guaranteed to stay+-- around until the 'customWidgetApply'+-- signal is emitted on the operation. Then you can read out any information+-- you need from the widgets.+--+printOptCreateCustomWidget :: PrintOperationClass self => Signal self (IO Widget)+printOptCreateCustomWidget = Signal (connect_NONE__OBJECTPTR "create_custom_widget")++-- | Signal helper functions.+connect_NONE__OBJECTPTR ::+ GObjectClass obj => SignalName ->+ ConnectAfter -> obj ->+ (IO Widget) ->+ IO (ConnectId obj)+connect_NONE__OBJECTPTR signal after obj user =+ connectGeneric signal after obj action+ where action :: Ptr GObject -> IO (Ptr Widget)+ action _ =+ failOnGError $ do+ x <- user+ return $ unsafeForeignPtrToPtr (unWidget (toWidget x))++#if GTK_CHECK_VERSION(2,18,0)+-- | Emitted after change of selected printer. The actual page setup and print+-- settings are passed to the custom widget, which can actualize itself+-- according to this change.+--+-- * Available since Gtk+ version 2.18+--+printOptUpdateCustomWidget :: PrintOperationClass self => Signal self (Widget -> PageSetup -> PrintSettings -> IO ())+printOptUpdateCustomWidget = Signal (connect_OBJECT_OBJECT_OBJECT__NONE "update_custom_widget")+#endif++-- | Emitted right before 'beginPrint' if you+-- added a custom widget in the 'createCustomWidtet' handler. When you get this signal you should read the+-- information from the custom widgets, as the widgets are not guaraneed to be+-- around at a later time.+--+printOptCustomWidgetApply :: PrintOperationClass self => Signal self (Widget -> IO ())+printOptCustomWidgetApply = Signal (connect_OBJECT__NONE "custom_widget_apply")++-- | Gets emitted when a preview is requested from the native dialog.+--+-- The default handler for this signal uses an external viewer application+-- to preview.+--+-- To implement a custom print preview, an application must return @True@+-- from its handler for this signal. In order to use the provided @context@ for+-- the preview implementation, it must be given a suitable cairo context with+-- 'printContextSetCairoContext'.+--+-- The custom preview implementation can use+-- 'printOperationPreviewIsSelected' and 'printOperationPreviewRenderPage' to+-- find pages which are selected for print and render them. The preview must be+-- finished by calling 'printOperationPreviewEndPreview' (typically in response+-- to the user clicking a close button).+--+printOptPreview :: PrintOperationClass self => Signal self (PrintOperationPreview -> PrintContext -> Window -> IO Bool)+printOptPreview = Signal (connect_OBJECT_OBJECT_OBJECT__BOOL "preview")++-- | The 'ready' signal gets emitted once per preview operation, before the first page is rendered.+--+-- A handler for this signal can be used for setup tasks.+printOptReady :: PrintOperationPreviewClass self => Signal self (PrintContext -> IO ())+printOptReady = Signal (connect_OBJECT__NONE "ready")++-- | The 'gotPageSize' signal is emitted once for each page that gets rendered to the preview.+--+-- A handler for this signal should update the context according to @pageSetup@ and set up a suitable+-- cairo context, using 'printContextSetCairoContext'.+printOptGotPageSize :: PrintOperationPreviewClass self => Signal self (PrintContext -> PageSetup -> IO ())+printOptGotPageSize = Signal (connect_OBJECT_OBJECT__NONE "got_page_size")+#endif
+ Graphics/UI/Gtk/Printing/PrintSettings.chs view
@@ -0,0 +1,1075 @@+{-# LANGUAGE CPP #-}+{-# LANGUAGE ScopedTypeVariables #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget PrintSettings+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Stores print settings+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Printing.PrintSettings (++-- * Detail+--+-- | A 'PrintSettings' object represents the settings of a print dialog in a+-- system-independent way. The main use for this object is that once you\'ve+-- printed you can get a settings object that represents the settings the user+-- chose, and the next time you print you can pass that object in so that the+-- user doesn't have to re-set all his settings.+--+-- Its also possible to enumerate the settings so that you can easily save+-- the settings for the next time your app runs, or even store them in a+-- document. The predefined keys try to use shared values as much as possible+-- so that moving such a document between systems still works.+--+-- Printing support was added in Gtk+ 2.10.+--++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----PrintSettings+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ PrintSettings,+ PrintSettingsClass,+ castToPrintSettings,+ toPrintSettings,+ -- PageRange,++-- * Enums+ PageOrientation(..),+#if GTK_CHECK_VERSION(2,14,0)+ NumberUpLayout(..),+#endif+ PrintQuality(..),+ PrintDuplex(..),+ PrintPages(..),+ PageSet(..),++-- * Constructors+ printSettingsNew,+#if GTK_CHECK_VERSION(2,12,0)+ printSettingsNewFromFile,+#endif++-- * Methods+ printSettingsCopy,+ printSettingsHasKey,+ printSettingsGet,+ printSettingsSet,+ printSettingsUnset,+ printSettingsForeach,+ printSettingsGetBool,+ printSettingsSetBool,+ printSettingsGetDouble,+ printSettingsGetDoubleWithDefault,+ printSettingsSetDouble,+ printSettingsGetLength,+ printSettingsSetLength,+ printSettingsGetInt,+ printSettingsGetIntWithDefault,+ printSettingsSetInt,+ printSettingsGetPaperWidth,+ printSettingsSetPaperWidth,+ printSettingsGetPaperHeight,+ printSettingsSetPaperHeight,+#if GTK_CHECK_VERSION(2,16,0)+ printSettingsSetResolutionXy,+ printSettingsGetResolutionX,+ printSettingsGetResolutionY,+#endif+ -- printSettingsGetPageRanges,+ -- printSettingsSetPageRanges,+#if GTK_CHECK_VERSION(2,14,0)+ printSettingsLoadFile,+#endif+#if GTK_CHECK_VERSION(2,12,0)+ printSettingsToFile,+#endif++-- * Attributes+ printSettingsPrinter,+ printSettingsOrientation,+ printSettingsPaperSize,+ printSettingsUseColor,+ printSettingsCollate,+ printSettingsReverse,+ printSettingsDuplex,+ printSettingsQuality,+ printSettingsNCopies,+ printSettingsNumberUp,+ printSettingsResolution,+ printSettingsScale,+ printSettingsPrintPages,+ printSettingsPageSet,+ printSettingsDefaultSource,+ printSettingsMediaType,+ printSettingsDither,+ printSettingsFinishings,+ printSettingsOutputBin,+#if GTK_CHECK_VERSION(2,14,0)+ printSettingsNumberUpLayout,+#endif+#if GTK_CHECK_VERSION(2,16,0)+ printSettingsPrinterLpi,+#endif+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.UTFString+import System.Glib.GError+{#import Graphics.UI.Gtk.Types#}+#if GTK_CHECK_VERSION(2,10,0)+import Graphics.UI.Gtk.Printing.PaperSize (PaperSize(PaperSize), mkPaperSize, Unit(..))+#endif++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)+--------------------+-- Enums+{#enum PageOrientation {underscoreToCase} deriving (Bounded,Eq,Show)#}++{#enum PrintQuality {underscoreToCase} deriving (Bounded,Eq,Show)#}++{#enum PrintDuplex {underscoreToCase} deriving (Bounded,Eq,Show)#}++{#enum PrintPages {underscoreToCase} deriving (Bounded,Eq,Show)#}++{#enum PageSet {underscoreToCase} deriving (Bounded,Eq,Show)#}++#if GTK_CHECK_VERSION(2,14,0)+-- | Used to determine the layout of pages on a sheet when printing multiple pages per sheet.+{#enum NumberUpLayout {underscoreToCase} deriving (Bounded,Eq,Show)#}+#endif++--------------------+-- Constructors++-- | Creates a new 'PrintSettings' object.+--+printSettingsNew :: IO PrintSettings+printSettingsNew =+ wrapNewGObject mkPrintSettings $+ {# call gtk_print_settings_new #}++#if GTK_CHECK_VERSION(2,12,0)+-- | Reads the print settings from @fileName@. Returns a new 'PrintSettings'+-- object with the restored settings.+--+-- * Available since Gtk+ version 2.12+--+printSettingsNewFromFile :: GlibFilePath fp+ => fp -- ^ @fileName@ - the filename to read the settings from+ -> IO PrintSettings+printSettingsNewFromFile fileName =+ wrapNewGObject mkPrintSettings $+ propagateGError $ \errorPtr ->+ withUTFFilePath fileName $ \fileNamePtr ->+ {# call gtk_print_settings_new_from_file #}+ fileNamePtr+ errorPtr++#endif++--------------------+-- Methods++-- | Copies a 'PrintSettings' object.+--+printSettingsCopy :: PrintSettingsClass self => self+ -> IO PrintSettings -- ^ returns a newly allocated copy of @other@+printSettingsCopy self =+ wrapNewGObject mkPrintSettings $+ {# call gtk_print_settings_copy #}+ (toPrintSettings self)++-- | Returns @True@, if a value is associated with @key@.+--+printSettingsHasKey :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> IO Bool -- ^ returns @True@, if @key@ has a value+printSettingsHasKey self key =+ liftM toBool $+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_has_key #}+ (toPrintSettings self)+ keyPtr++-- | Looks up the string value associated with @key@.+--+printSettingsGet :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> IO string -- ^ returns the string value for @key@+printSettingsGet self key =+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_get #}+ (toPrintSettings self)+ keyPtr+ >>= peekUTFString++-- | Associates @value@ with @key@.+--+printSettingsSet :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> string -- ^ @value@ - a string value+ -> IO ()+printSettingsSet self key value =+ withUTFString value $ \valuePtr ->+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_set #}+ (toPrintSettings self)+ keyPtr+ valuePtr++-- | Removes any value associated with @key@+--+printSettingsUnset :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> IO ()+printSettingsUnset self key =+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_unset #}+ (toPrintSettings self)+ keyPtr++-- | Calls @func@ for each key-value pair of @settings@.+--+printSettingsForeach :: PrintSettingsClass self => self+ -> (String -> IO ()) -- ^ @func@ - the function to call+ -> IO ()+printSettingsForeach self func = do+ funcPtr <- mkPrintSettingsFunc $ \_ strPtr _ -> do+ str <- peekCString strPtr+ func str+ {# call gtk_print_settings_foreach #}+ (toPrintSettings self)+ funcPtr+ (castFunPtrToPtr funcPtr)++{#pointer PrintSettingsFunc#}++foreign import ccall "wrapper" mkPrintSettingsFunc ::+ (CString -> CString -> Ptr () -> IO ())+ -> IO PrintSettingsFunc++-- | Returns the boolean represented by the value that is associated with+-- @key@.+--+-- The string \"true\" represents @True@, any other string @False@.+--+printSettingsGetBool :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> IO Bool -- ^ returns @True@, if @key@ maps to a true value.+printSettingsGetBool self key =+ liftM toBool $+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_get_bool #}+ (toPrintSettings self)+ keyPtr++-- | Sets @key@ to a boolean value.+--+printSettingsSetBool :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> Bool -- ^ @value@ - a boolean+ -> IO ()+printSettingsSetBool self key value =+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_set_bool #}+ (toPrintSettings self)+ keyPtr+ (fromBool value)++-- | Returns the double value associated with @key@, or 0.+--+printSettingsGetDouble :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> IO Double -- ^ returns the double value of @key@+printSettingsGetDouble self key =+ liftM realToFrac $+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_get_double #}+ (toPrintSettings self)+ keyPtr++-- | Returns the floating point number represented by the value that is+-- associated with @key@, or @defaultVal@ if the value does not represent a+-- floating point number.+--+-- Floating point numbers are parsed with 'gAsciiStrtod'.+--+printSettingsGetDoubleWithDefault :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> Double -- ^ @def@ - the default value+ -> IO Double -- ^ returns the floating point number associated with @key@+printSettingsGetDoubleWithDefault self key def =+ liftM realToFrac $+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_get_double_with_default #}+ (toPrintSettings self)+ keyPtr+ (realToFrac def)++-- | Sets @key@ to a double value.+--+printSettingsSetDouble :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> Double -- ^ @value@ - a double value+ -> IO ()+printSettingsSetDouble self key value =+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_set_double #}+ (toPrintSettings self)+ keyPtr+ (realToFrac value)++-- | Returns the value associated with @key@, interpreted as a length. The+-- returned value is converted to @units@.+--+printSettingsGetLength :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> Unit -- ^ @unit@ - the unit of the return value+ -> IO Double -- ^ returns the length value of @key@, converted to @unit@+printSettingsGetLength self key unit =+ liftM realToFrac $+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_get_length #}+ (toPrintSettings self)+ keyPtr+ ((fromIntegral . fromEnum) unit)++-- | Associates a length in units of @unit@ with @key@.+--+printSettingsSetLength :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> Double -- ^ @value@ - a length+ -> Unit -- ^ @unit@ - the unit of @length@+ -> IO ()+printSettingsSetLength self key value unit =+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_set_length #}+ (toPrintSettings self)+ keyPtr+ (realToFrac value)+ ((fromIntegral . fromEnum) unit)++-- | Returns the integer value of @key@, or 0.+--+printSettingsGetInt :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> IO Int -- ^ returns the integer value of @key@+printSettingsGetInt self key =+ liftM fromIntegral $+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_get_int #}+ (toPrintSettings self)+ keyPtr++-- | Returns the value of @key@, interpreted as an integer, or the default+-- value.+--+printSettingsGetIntWithDefault :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> Int -- ^ @def@ - the default value+ -> IO Int -- ^ returns the integer value of @key@+printSettingsGetIntWithDefault self key def =+ liftM fromIntegral $+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_get_int_with_default #}+ (toPrintSettings self)+ keyPtr+ (fromIntegral def)++-- | Sets @key@ to an integer value.+--+printSettingsSetInt :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @key@ - a key+ -> Int -- ^ @value@ - an integer+ -> IO ()+printSettingsSetInt self key value =+ withUTFString key $ \keyPtr ->+ {# call gtk_print_settings_set_int #}+ (toPrintSettings self)+ keyPtr+ (fromIntegral value)++-- | Convenience function to obtain the value of ''PrintSettingsPrinter''.+printSettingsGetPrinter :: (PrintSettingsClass self, GlibString string) => self+ -> IO string -- ^ returns the printer name+printSettingsGetPrinter self =+ {# call gtk_print_settings_get_printer #}+ (toPrintSettings self)+ >>= peekUTFString++-- | Convenience function to obtain the value of ''PrintSettingsPrinter''.+printSettingsSetPrinter :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @printer@ - the printer name+ -> IO ()+printSettingsSetPrinter self printer =+ withUTFString printer $ \printerPtr ->+ {# call gtk_print_settings_set_printer #}+ (toPrintSettings self)+ printerPtr++-- | Get the value of ''PrintSettingsOrientation'', converted to a 'PageOrientation'.+printSettingsGetOrientation :: PrintSettingsClass self => self+ -> IO PageOrientation -- ^ returns the orientation+printSettingsGetOrientation self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_print_settings_get_orientation #}+ (toPrintSettings self)++-- | Sets the value of ''PrintSettingsOrientation''.+printSettingsSetOrientation :: PrintSettingsClass self => self+ -> PageOrientation -- ^ @orientation@ - a page orientation+ -> IO ()+printSettingsSetOrientation self orientation =+ {# call gtk_print_settings_set_orientation #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) orientation)++-- | Gets the value of 'PrintSettingsPaperFormat', converted to a 'PaperSize'.+printSettingsGetPaperSize :: PrintSettingsClass self => self+ -> IO PaperSize -- ^ returns the paper size+printSettingsGetPaperSize self =+ {# call gtk_print_settings_get_paper_size #}+ (toPrintSettings self)+ >>= mkPaperSize . castPtr++-- | Sets the value of 'PrintSettingsPaperFormat', 'PrintSettingsPaperWidth' and+-- 'PrintSettingsPaperHeight'.+printSettingsSetPaperSize :: PrintSettingsClass self => self+ -> PaperSize -- ^ @paperSize@ - a paper size+ -> IO ()+printSettingsSetPaperSize self (PaperSize paperSize) =+ {# call gtk_print_settings_set_paper_size #}+ (toPrintSettings self)+ (castPtr $ unsafeForeignPtrToPtr $ paperSize)++-- | Gets the value of 'PrintSettingsPaperWidth', converted to unit.+--+printSettingsGetPaperWidth :: PrintSettingsClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the paper width, in units of @unit@+printSettingsGetPaperWidth self unit =+ liftM realToFrac $+ {# call gtk_print_settings_get_paper_width #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) unit)++-- | Sets the value of 'PrintSettingsPaperWidth'.+--+printSettingsSetPaperWidth :: PrintSettingsClass self => self+ -> Double -- ^ @width@ - the paper width+ -> Unit -- ^ @unit@ - the units of @width@+ -> IO ()+printSettingsSetPaperWidth self width unit =+ {# call gtk_print_settings_set_paper_width #}+ (toPrintSettings self)+ (realToFrac width)+ ((fromIntegral . fromEnum) unit)++-- | Gets the value of 'PrintSettingsPaperHeight', converted to unit.+--+printSettingsGetPaperHeight :: PrintSettingsClass self => self+ -> Unit -- ^ @unit@ - the unit for the return value+ -> IO Double -- ^ returns the paper height, in units of @unit@+printSettingsGetPaperHeight self unit =+ liftM realToFrac $+ {# call gtk_print_settings_get_paper_height #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) unit)++-- | Sets the value of 'PrintSettingsPaperHeight'.+--+printSettingsSetPaperHeight :: PrintSettingsClass self => self+ -> Double -- ^ @height@ - the paper height+ -> Unit -- ^ @unit@ - the units of @height@+ -> IO ()+printSettingsSetPaperHeight self height unit =+ {# call gtk_print_settings_set_paper_height #}+ (toPrintSettings self)+ (realToFrac height)+ ((fromIntegral . fromEnum) unit)++-- | Gets the value of ''PrintSettingsUseColor''.+printSettingsGetUseColor :: PrintSettingsClass self => self+ -> IO Bool -- ^ returns whether to use color+printSettingsGetUseColor self =+ liftM toBool $+ {# call gtk_print_settings_get_use_color #}+ (toPrintSettings self)++-- | Sets the value of ''PrintSettingsUseColor''.+printSettingsSetUseColor :: PrintSettingsClass self => self+ -> Bool -- ^ @useColor@ - whether to use color+ -> IO ()+printSettingsSetUseColor self useColor =+ {# call gtk_print_settings_set_use_color #}+ (toPrintSettings self)+ (fromBool useColor)++-- | Gets the value of ''PrintSettingsCollate''.+printSettingsGetCollate :: PrintSettingsClass self => self+ -> IO Bool -- ^ returns whether to collate the printed pages+printSettingsGetCollate self =+ liftM toBool $+ {# call gtk_print_settings_get_collate #}+ (toPrintSettings self)++-- | Sets the value of ''PrintSettingsCollate''.+printSettingsSetCollate :: PrintSettingsClass self => self+ -> Bool -- ^ @collate@ - whether to collate the output+ -> IO ()+printSettingsSetCollate self collate =+ {# call gtk_print_settings_set_collate #}+ (toPrintSettings self)+ (fromBool collate)++-- | Gets the value of ''PrintSettingsReverse''.+printSettingsGetReverse :: PrintSettingsClass self => self+ -> IO Bool -- ^ returns whether to reverse the order of the printed pages+printSettingsGetReverse self =+ liftM toBool $+ {# call gtk_print_settings_get_reverse #}+ (toPrintSettings self)++-- | Sets the value of ''PrintSettingsReverse''.+printSettingsSetReverse :: PrintSettingsClass self => self+ -> Bool -- ^ @reverse@ - whether to reverse the output+ -> IO ()+printSettingsSetReverse self reverse =+ {# call gtk_print_settings_set_reverse #}+ (toPrintSettings self)+ (fromBool reverse)++-- | Gets the value of ''PrintSettingsDuplex''.+printSettingsGetDuplex :: PrintSettingsClass self => self+ -> IO PrintDuplex -- ^ returns whether to print the output in duplex.+printSettingsGetDuplex self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_print_settings_get_duplex #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsDuplex'.+printSettingsSetDuplex :: PrintSettingsClass self => self+ -> PrintDuplex -- ^ @duplex@ - a 'PrintDuplex' value+ -> IO ()+printSettingsSetDuplex self duplex =+ {# call gtk_print_settings_set_duplex #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) duplex)++-- | Gets the value of 'PrintSettingsQuality'.+printSettingsGetQuality :: PrintSettingsClass self => self+ -> IO PrintQuality -- ^ returns the print quality+printSettingsGetQuality self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_print_settings_get_quality #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsQuality'.+printSettingsSetQuality :: PrintSettingsClass self => self+ -> PrintQuality -- ^ @quality@ - a 'PrintQuality' value+ -> IO ()+printSettingsSetQuality self quality =+ {# call gtk_print_settings_set_quality #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) quality)++-- | Gets the value of 'PrintSettingsNCopies'.+printSettingsGetNCopies :: PrintSettingsClass self => self+ -> IO Int -- ^ returns the number of copies to print+printSettingsGetNCopies self =+ liftM fromIntegral $+ {# call gtk_print_settings_get_n_copies #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsNCopies'.+printSettingsSetNCopies :: PrintSettingsClass self => self+ -> Int -- ^ @numCopies@ - the number of copies+ -> IO ()+printSettingsSetNCopies self numCopies =+ {# call gtk_print_settings_set_n_copies #}+ (toPrintSettings self)+ (fromIntegral numCopies)++-- | Gets the value of 'PrintSettingsNumberUp'.+printSettingsGetNumberUp :: PrintSettingsClass self => self+ -> IO Int -- ^ returns the number of pages per sheet+printSettingsGetNumberUp self =+ liftM fromIntegral $+ {# call gtk_print_settings_get_number_up #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsNumberUp'.+printSettingsSetNumberUp :: PrintSettingsClass self => self+ -> Int -- ^ @numberUp@ - the number of pages per sheet+ -> IO ()+printSettingsSetNumberUp self numberUp =+ {# call gtk_print_settings_set_number_up #}+ (toPrintSettings self)+ (fromIntegral numberUp)++#if GTK_CHECK_VERSION(2,14,0)+-- | Gets the value of 'PrintSettingsNumberUpLayout'.+printSettingsGetNumberUpLayout :: PrintSettingsClass self => self+ -> IO NumberUpLayout -- ^ returns layout of page in number-up mode+printSettingsGetNumberUpLayout self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_print_settings_get_number_up_layout #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsNumberUpLayout'.+printSettingsSetNumberUpLayout :: PrintSettingsClass self => self+ -> NumberUpLayout -- ^ @numberUpLayout@ - a 'NumberUpLayout' value+ -> IO ()+printSettingsSetNumberUpLayout self numberUpLayout =+ {# call gtk_print_settings_set_number_up_layout #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) numberUpLayout)+#endif++-- | Gets the value of 'PrintSettingsResolution'.+printSettingsGetResolution :: PrintSettingsClass self => self+ -> IO Int -- ^ returns the resolution in dpi+printSettingsGetResolution self =+ liftM fromIntegral $+ {# call gtk_print_settings_get_resolution #}+ (toPrintSettings self)++-- | Sets the values of 'PrintSettingsResolution', 'PrintSettingsResolutionX' and+-- 'PrintSettingsResolutionY'.+printSettingsSetResolution :: PrintSettingsClass self => self+ -> Int -- ^ @resolution@ - the resolution in dpi+ -> IO ()+printSettingsSetResolution self resolution =+ {# call gtk_print_settings_set_resolution #}+ (toPrintSettings self)+ (fromIntegral resolution)++#if GTK_CHECK_VERSION(2,16,0)+-- | Sets the values of 'PrintSettingsResolution', 'PrintSettingsResolutionX' and+-- 'PrintSettingsResolutionY'.+--+-- * Available since Gtk+ version 2.16+--+printSettingsSetResolutionXy :: PrintSettingsClass self => self+ -> Int -- ^ @resolutionX@ - the horizontal resolution in dpi+ -> Int -- ^ @resolutionY@ - the vertical resolution in dpi+ -> IO ()+printSettingsSetResolutionXy self resolutionX resolutionY =+ {# call gtk_print_settings_set_resolution_xy #}+ (toPrintSettings self)+ (fromIntegral resolutionX)+ (fromIntegral resolutionY)++-- | Gets the value of @GTK_PRINT_SETTINGS_RESOLUTION_X@.+--+-- * Available since Gtk+ version 2.16+--+printSettingsGetResolutionX :: PrintSettingsClass self => self+ -> IO Int -- ^ returns the horizontal resolution in dpi+printSettingsGetResolutionX self =+ liftM fromIntegral $+ {# call gtk_print_settings_get_resolution_x #}+ (toPrintSettings self)++-- | Gets the value of @GTK_PRINT_SETTINGS_RESOLUTION_Y@.+--+-- * Available since Gtk+ version 2.16+--+printSettingsGetResolutionY :: PrintSettingsClass self => self+ -> IO Int -- ^ returns the vertical resolution in dpi+printSettingsGetResolutionY self =+ liftM fromIntegral $+ {# call gtk_print_settings_get_resolution_y #}+ (toPrintSettings self)++-- | Gets the value of 'PrintSettingsPrinterLpi'.+printSettingsGetPrinterLpi :: PrintSettingsClass self => self+ -> IO Double -- ^ returns the resolution in lpi (lines per inch)+printSettingsGetPrinterLpi self =+ liftM realToFrac $+ {# call gtk_print_settings_get_printer_lpi #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsPrinterLpi'.+printSettingsSetPrinterLpi :: PrintSettingsClass self => self+ -> Double -- ^ @lpi@ - the resolution in lpi (lines per inch)+ -> IO ()+printSettingsSetPrinterLpi self lpi =+ {# call gtk_print_settings_set_printer_lpi #}+ (toPrintSettings self)+ (realToFrac lpi)+#endif++-- | Gets the value of 'PrintSettingsScale'.+printSettingsGetScale :: PrintSettingsClass self => self+ -> IO Double -- ^ returns the scale in percent+printSettingsGetScale self =+ liftM realToFrac $+ {# call gtk_print_settings_get_scale #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsScale'.+printSettingsSetScale :: PrintSettingsClass self => self+ -> Double -- ^ @scale@ - the scale in percent+ -> IO ()+printSettingsSetScale self scale =+ {# call gtk_print_settings_set_scale #}+ (toPrintSettings self)+ (realToFrac scale)++-- | Gets the value of 'PrintSettingsPrintPages'.+printSettingsGetPrintPages :: PrintSettingsClass self => self+ -> IO PrintPages -- ^ returns which pages to print+printSettingsGetPrintPages self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_print_settings_get_print_pages #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsPrintPages'.+printSettingsSetPrintPages :: PrintSettingsClass self => self+ -> PrintPages -- ^ @pages@ - a 'PrintPages' value+ -> IO ()+printSettingsSetPrintPages self pages =+ {# call gtk_print_settings_set_print_pages #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) pages)++-- | Gets the value of 'PrintSettingsPageRanges'.+--+-- printSettingsGetPageRanges :: PrintSettingsClass self => self+-- -> IO [PageRange] -- ^ returns an array of 'PageRange'.+-- printSettingsGetPageRanges self =+-- alloca $ \numRangesPtr -> do+-- rangeListPtr <- {# call gtk_print_settings_get_page_ranges #}+-- (toPrintSettings self)+-- numRangesPtr+-- rangeLen <- peek numRangesPtr+-- ptrList <- peekArray (fromIntegral rangeLen) (castPtr rangeListPtr)+-- rangeList <- mapM peek ptrList+-- {#call unsafe g_free#} (castPtr rangeListPtr)+-- return rangeList++-- | Sets the value of @GTK_PRINT_SETTINGS_PAGE_RANGES@.+--+-- printSettingsSetPageRanges :: PrintSettingsClass self => self+-- -> [PageRange] -- ^ @pageRanges@ - an array of 'PageRange'+-- -> IO ()+-- printSettingsSetPageRanges self rangeList =+-- withArrayLen (concatMap (\(PageRange x y) -> [fromIntegral x, fromIntegral y]) rangeList)+-- $ \rangeLen rangeListPtr ->+-- {# call gtk_print_settings_set_page_ranges #}+-- (toPrintSettings self)+-- (castPtr rangeListPtr)+-- (fromIntegral rangeLen)++-- | Gets the value of 'PrintSettingsPageSet'.+printSettingsGetPageSet :: PrintSettingsClass self => self+ -> IO PageSet -- ^ returns the set of pages to print+printSettingsGetPageSet self =+ liftM (toEnum . fromIntegral) $+ {# call gtk_print_settings_get_page_set #}+ (toPrintSettings self)++-- | Sets the value of 'PrintSettingsPageSet'.+printSettingsSetPageSet :: PrintSettingsClass self => self+ -> PageSet -- ^ @pageSet@ - a 'PageSet' value+ -> IO ()+printSettingsSetPageSet self pageSet =+ {# call gtk_print_settings_set_page_set #}+ (toPrintSettings self)+ ((fromIntegral . fromEnum) pageSet)++-- | Gets the value of 'PrintSettingsDefaultSource'.+printSettingsGetDefaultSource :: (PrintSettingsClass self, GlibString string) => self+ -> IO string -- ^ returns the default source+printSettingsGetDefaultSource self =+ {# call gtk_print_settings_get_default_source #}+ (toPrintSettings self)+ >>= peekUTFString++-- | Sets the value of 'PrintSettingsDefaultSource'.+printSettingsSetDefaultSource :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @defaultSource@ - the default source+ -> IO ()+printSettingsSetDefaultSource self defaultSource =+ withUTFString defaultSource $ \defaultSourcePtr ->+ {# call gtk_print_settings_set_default_source #}+ (toPrintSettings self)+ defaultSourcePtr++-- | Gets the value of 'PrintSettingsMediaType'.+printSettingsGetMediaType :: (PrintSettingsClass self, GlibString string) => self+ -> IO string -- ^ returns the media type+printSettingsGetMediaType self =+ {# call gtk_print_settings_get_media_type #}+ (toPrintSettings self)+ >>= peekUTFString++-- | Sets the value of 'PrintSettingsMediaType'.+printSettingsSetMediaType :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @mediaType@ - the media type+ -> IO ()+printSettingsSetMediaType self mediaType =+ withUTFString mediaType $ \mediaTypePtr ->+ {# call gtk_print_settings_set_media_type #}+ (toPrintSettings self)+ mediaTypePtr++-- | Gets the value of 'PrintSettingsDither'.+printSettingsGetDither :: (PrintSettingsClass self, GlibString string) => self+ -> IO string -- ^ returns the dithering that is used+printSettingsGetDither self =+ {# call gtk_print_settings_get_dither #}+ (toPrintSettings self)+ >>= peekUTFString++-- | Sets the value of 'PrintSettingsDither'.+printSettingsSetDither :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @dither@ - the dithering that is used+ -> IO ()+printSettingsSetDither self dither =+ withUTFString dither $ \ditherPtr ->+ {# call gtk_print_settings_set_dither #}+ (toPrintSettings self)+ ditherPtr++-- | Gets the value of 'PrintSettingsFinishings'.+printSettingsGetFinishings :: (PrintSettingsClass self, GlibString string) => self+ -> IO string -- ^ returns the finishings+printSettingsGetFinishings self =+ {# call gtk_print_settings_get_finishings #}+ (toPrintSettings self)+ >>= peekUTFString++-- | Sets the value of 'PrintSettingsFinishings'.+printSettingsSetFinishings :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @finishings@ - the finishings+ -> IO ()+printSettingsSetFinishings self finishings =+ withUTFString finishings $ \finishingsPtr ->+ {# call gtk_print_settings_set_finishings #}+ (toPrintSettings self)+ finishingsPtr++-- | Gets the value of 'PrintSettingsOutputBin'.+printSettingsGetOutputBin :: (PrintSettingsClass self, GlibString string) => self+ -> IO string -- ^ returns the output bin+printSettingsGetOutputBin self =+ {# call gtk_print_settings_get_output_bin #}+ (toPrintSettings self)+ >>= peekUTFString++-- | Sets the value of 'PrintSettingsOutputBin'.+printSettingsSetOutputBin :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @outputBin@ - the output bin+ -> IO ()+printSettingsSetOutputBin self outputBin =+ withUTFString outputBin $ \outputBinPtr ->+ {# call gtk_print_settings_set_output_bin #}+ (toPrintSettings self)+ outputBinPtr+++#if GTK_CHECK_VERSION(2,14,0)+-- | Reads the print settings from @fileName@. See 'printSettingsToFile'.+--+-- * Available since Gtk+ version 2.14+--+printSettingsLoadFile :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @fileName@ - the filename to read the settings from+ -> IO Bool -- ^ returns @True@ on success+printSettingsLoadFile self fileName =+ liftM toBool $+ propagateGError $ \errorPtr ->+ withUTFString fileName $ \fileNamePtr ->+ {# call gtk_print_settings_load_file #}+ (toPrintSettings self)+ fileNamePtr+ errorPtr++#endif++#if GTK_CHECK_VERSION(2,12,0)+-- | This function saves the print settings from @settings@ to @fileName@.+--+-- * Available since Gtk+ version 2.12+--+printSettingsToFile :: (PrintSettingsClass self, GlibString string) => self+ -> string -- ^ @fileName@ - the file to save to+ -> IO Bool -- ^ returns @True@ on success+printSettingsToFile self fileName =+ liftM toBool $+ propagateGError $ \errorPtr ->+ withUTFString fileName $ \fileNamePtr ->+ {# call gtk_print_settings_to_file #}+ (toPrintSettings self)+ fileNamePtr+ errorPtr+#endif++-- | Obtain the value of 'PrintSettingsPrinter'.+printSettingsPrinter :: (PrintSettingsClass self, GlibString string) => Attr self string+printSettingsPrinter = newAttr+ printSettingsGetPrinter+ printSettingsSetPrinter++-- | The value of ''PrintSettingsOrientation'', converted to a 'PageOrientation'.+printSettingsOrientation :: PrintSettingsClass self => Attr self PageOrientation+printSettingsOrientation = newAttr+ printSettingsGetOrientation+ printSettingsSetOrientation++-- | The value of 'PrintSettingsPaperFormat', converted to a 'PaperSize'.+printSettingsPaperSize :: PrintSettingsClass self => Attr self PaperSize+printSettingsPaperSize = newAttr+ printSettingsGetPaperSize+ printSettingsSetPaperSize++-- | The value of ''PrintSettingsUseColor''.+printSettingsUseColor :: PrintSettingsClass self => Attr self Bool+printSettingsUseColor = newAttr+ printSettingsGetUseColor+ printSettingsSetUseColor++-- | The value of ''PrintSettingsCollate''.+printSettingsCollate :: PrintSettingsClass self => Attr self Bool+printSettingsCollate = newAttr+ printSettingsGetCollate+ printSettingsSetCollate++-- | The value of ''PrintSettingsReverse''.+printSettingsReverse :: PrintSettingsClass self => Attr self Bool+printSettingsReverse = newAttr+ printSettingsGetReverse+ printSettingsSetReverse++-- | The value of ''PrintSettingsDuplex''.+printSettingsDuplex :: PrintSettingsClass self => Attr self PrintDuplex+printSettingsDuplex = newAttr+ printSettingsGetDuplex+ printSettingsSetDuplex++-- | The value of ''PrintSettingsQuality''.+printSettingsQuality :: PrintSettingsClass self => Attr self PrintQuality+printSettingsQuality = newAttr+ printSettingsGetQuality+ printSettingsSetQuality++-- | The value of 'PrintSettingsNCopies'.+printSettingsNCopies :: PrintSettingsClass self => Attr self Int+printSettingsNCopies = newAttr+ printSettingsGetNCopies+ printSettingsSetNCopies++-- | The value of 'PrintSettingsNumberUp'.+printSettingsNumberUp :: PrintSettingsClass self => Attr self Int+printSettingsNumberUp = newAttr+ printSettingsGetNumberUp+ printSettingsSetNumberUp++-- | The value of 'PrintSettingsResolution'.+printSettingsResolution :: PrintSettingsClass self => Attr self Int+printSettingsResolution = newAttr+ printSettingsGetResolution+ printSettingsSetResolution++-- | The value of 'PrintSettingsScale'.+printSettingsScale :: PrintSettingsClass self => Attr self Double+printSettingsScale = newAttr+ printSettingsGetScale+ printSettingsSetScale++-- | The value of 'PrintSettingsPrintPages'.+printSettingsPrintPages :: PrintSettingsClass self => Attr self PrintPages+printSettingsPrintPages = newAttr+ printSettingsGetPrintPages+ printSettingsSetPrintPages++-- | The value of 'PrintSettingsPageSet'.+printSettingsPageSet :: PrintSettingsClass self => Attr self PageSet+printSettingsPageSet = newAttr+ printSettingsGetPageSet+ printSettingsSetPageSet++-- | The value of 'PrintSettingsDefaultSource'.+printSettingsDefaultSource :: (PrintSettingsClass self, GlibString string) => Attr self string+printSettingsDefaultSource = newAttr+ printSettingsGetDefaultSource+ printSettingsSetDefaultSource++-- | The value of 'PrintSettingsMediaType'.+printSettingsMediaType :: (PrintSettingsClass self, GlibString string) => Attr self string+printSettingsMediaType = newAttr+ printSettingsGetMediaType+ printSettingsSetMediaType++-- | The value of 'PrintSettingsDither'.+printSettingsDither :: (PrintSettingsClass self, GlibString string) => Attr self string+printSettingsDither = newAttr+ printSettingsGetDither+ printSettingsSetDither++-- | The value of 'PrintSettingsFinishings'.+printSettingsFinishings :: (PrintSettingsClass self, GlibString string) => Attr self string+printSettingsFinishings = newAttr+ printSettingsGetFinishings+ printSettingsSetFinishings++-- | The value of 'PrintSettingsOutputBin'.+printSettingsOutputBin :: (PrintSettingsClass self, GlibString string) => Attr self string+printSettingsOutputBin = newAttr+ printSettingsGetOutputBin+ printSettingsSetOutputBin++#if GTK_CHECK_VERSION(2,14,0)+-- | The value of 'PrintSettingsNumberUpLayout'.+printSettingsNumberUpLayout :: PrintSettingsClass self => Attr self NumberUpLayout+printSettingsNumberUpLayout = newAttr+ printSettingsGetNumberUpLayout+ printSettingsSetNumberUpLayout+#endif++#if GTK_CHECK_VERSION(2,16,0)+-- | The value of 'PrintSettingsPrinterLpi'.+printSettingsPrinterLpi :: PrintSettingsClass self => Attr self Double+printSettingsPrinterLpi = newAttr+ printSettingsGetPrinterLpi+ printSettingsSetPrinterLpi+#endif+#endif+
+ Graphics/UI/Gtk/Recent/RecentChooser.chs view
@@ -0,0 +1,442 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Interface RecentChooser+--+-- Author : Andy Stewart+--+-- Created: 27 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Interface implemented by widgets displaying recently used files+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Recent.RecentChooser (++-- * Detail+--+-- | 'RecentChooser' is an interface that can be implemented by widgets+-- displaying the list of recently used files. In Gtk+, the main objects that+-- implement this interface are 'RecentChooserWidget', 'RecentChooserDialog'+-- and 'RecentChooserMenu'.+--+-- Recently used files are supported since Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GInterface'+-- | +----RecentChooser+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ RecentChooser,+ RecentChooserClass,+ castToRecentChooser,+ toRecentChooser,++-- * Enums+ RecentChooserError(..),+ RecentSortType(..),++-- * Methods+ recentChooserSetSortFunc,+ recentChooserSetCurrentURI,+ recentChooserGetCurrentURI,+ recentChooserGetCurrentItem,+ recentChooserSelectURI,+ recentChooserUnselectURI,+ recentChooserSelectAll,+ recentChooserUnselectAll,+ recentChooserGetItems,+ recentChooserGetURIs,+ recentChooserAddFilter,+ recentChooserRemoveFilter,+ recentChooserListFilters,++-- * Attributes+ recentChooserShowPrivate,+ recentChooserShowTips,+ recentChooserShowIcons,+ recentChooserShowNotFound,+ recentChooserSelectMultiple,+ recentChooserLocalOnly,+ recentChooserLimit,+ recentChooserSortType,+ recentChooserFilter,++-- * Signals+ recentChooserSelectionChanged,+ recentChooserItemActivated,+#endif+ ) where++#if GTK_CHECK_VERSION(2,10,0)++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+import System.Glib.GList+import System.Glib.GError (checkGError)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo, mkRecentInfo)+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Enums+-- | These identify the various errors that can occur while calling 'RecentChooser' functions.+{#enum RecentChooserError {underscoreToCase} deriving (Bounded,Eq,Show)#}++-- | Used to specify the sorting method to be applied to the recently used resource list.+{#enum RecentSortType {underscoreToCase} deriving (Bounded,Eq,Show)#}++--------------------+-- Methods++-- | Sets the comparison function used when sorting to be @sortFunc@. If the+-- @chooser@ has the sort type set to 'RecentSortCustom' then the chooser will+-- sort using this function.+--+-- To the comparison function will be passed two 'RecentInfo' structs and @sortData@; @sortFunc@ should return a positive+-- integer if the first item comes before the second, zero if the two items are+-- equal and a negative integer if the first item comes after the second.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserSetSortFunc :: RecentChooserClass self => self+ -> (Maybe (RecentInfo -> IO Int))+ -> IO ()+recentChooserSetSortFunc self Nothing =+ {# call gtk_recent_chooser_set_sort_func #}+ (toRecentChooser self) nullFunPtr nullPtr nullFunPtr+recentChooserSetSortFunc self (Just func) = do+ fPtr <- mkRecentSortFunc $ \_ infoPtr _ -> do+ info <- mkRecentInfo infoPtr+ liftM fromIntegral (func info)+ {# call gtk_recent_chooser_set_sort_func #}+ (toRecentChooser self)+ fPtr+ (castFunPtrToPtr fPtr)+ destroyFunPtr++{#pointer RecentSortFunc#}++foreign import ccall "wrapper" mkRecentSortFunc ::+ (Ptr RecentInfo -> Ptr RecentInfo -> Ptr () -> IO {#type gint#})+ -> IO RecentSortFunc++-- | Sets @uri@ as the current URI for @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserSetCurrentURI :: (RecentChooserClass self, GlibString string) => self+ -> string -- ^ @uri@ - a URI+ -> IO Bool -- ^ returns @True@ if the URI was found.+recentChooserSetCurrentURI self uri =+ checkGError ( \errorPtr ->+ liftM toBool $+ withUTFString uri $ \uriPtr ->+ {# call gtk_recent_chooser_set_current_uri #}+ (toRecentChooser self)+ uriPtr+ errorPtr)+ (\_ -> return False)++-- | Gets the URI currently selected by @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserGetCurrentURI :: (RecentChooserClass self, GlibString string) => self+ -> IO string -- ^ returns a newly string holding a URI.+recentChooserGetCurrentURI self =+ {# call gtk_recent_chooser_get_current_uri #}+ (toRecentChooser self)+ >>= readUTFString++-- | Gets the 'RecentInfo' currently selected by+-- @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserGetCurrentItem :: RecentChooserClass self => self+ -> IO RecentInfo -- ^ returns a 'RecentInfo'.+ -- Use 'recentInfoUnref' when when you have finished+ -- using it.+recentChooserGetCurrentItem self = do+ info <- {# call gtk_recent_chooser_get_current_item #} (toRecentChooser self)+ mkRecentInfo info++-- | Selects @uri@ inside @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserSelectURI :: (RecentChooserClass self, GlibString string) => self+ -> string -- ^ @uri@ - a URI+ -> IO Bool -- ^ returns @True@ if @uri@ was found.+recentChooserSelectURI self uri =+ checkGError ( \errorPtr ->+ liftM toBool $+ withUTFString uri $ \uriPtr ->+ {# call gtk_recent_chooser_select_uri #}+ (toRecentChooser self)+ uriPtr+ errorPtr)+ (\_ -> return False)++-- | Unselects @uri@ inside @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserUnselectURI :: (RecentChooserClass self, GlibString string) => self+ -> string -- ^ @uri@ - a URI+ -> IO ()+recentChooserUnselectURI self uri =+ withUTFString uri $ \uriPtr ->+ {# call gtk_recent_chooser_unselect_uri #}+ (toRecentChooser self)+ uriPtr++-- | Selects all the items inside @chooser@, if the @chooser@ supports+-- multiple selection.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserSelectAll :: RecentChooserClass self => self -> IO ()+recentChooserSelectAll self =+ {# call gtk_recent_chooser_select_all #}+ (toRecentChooser self)++-- | Unselects all the items inside @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserUnselectAll :: RecentChooserClass self => self -> IO ()+recentChooserUnselectAll self =+ {# call gtk_recent_chooser_unselect_all #}+ (toRecentChooser self)++-- | Gets the list of recently used resources in form of 'RecentInfo'+--+-- The return value of this function is affected by the \"sort-type\" and+-- \"limit\" properties of @chooser@.+--+recentChooserGetItems :: RecentChooserClass self => self+ -> IO [RecentInfo] -- ^ returns A list of 'RecentInfo' objects.+recentChooserGetItems self = do+ glist <- {# call gtk_recent_chooser_get_items #} (toRecentChooser self)+ list <- fromGList glist+ mapM mkRecentInfo list++-- | Gets the URI of the recently used resources.+--+-- The return value of this function is affected by the \"sort-type\" and+-- \"limit\" properties of @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserGetURIs :: (RecentChooserClass self, GlibString string) => self+ -> IO [string]+recentChooserGetURIs self =+ alloca $ \lengthPtr -> do+ str <- {# call gtk_recent_chooser_get_uris #}+ (toRecentChooser self)+ lengthPtr+ length <- peek lengthPtr+ mapM peekUTFString =<< peekArray (fromIntegral length) str++-- | Adds @filter@ to the list of 'RecentFilter' objects held by @chooser@.+--+-- If no previous filter objects were defined, this function will call+-- 'recentChooserSetFilter'.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserAddFilter :: (RecentChooserClass self, RecentFilterClass filter) => self+ -> filter -- ^ @filter@ - a 'RecentFilter'+ -> IO ()+recentChooserAddFilter self filter =+ {# call gtk_recent_chooser_add_filter #}+ (toRecentChooser self)+ (toRecentFilter filter)++-- | Removes @filter@ from the list of 'RecentFilter' objects held by+-- @chooser@.+--+recentChooserRemoveFilter :: (RecentChooserClass self, RecentFilterClass filter) => self+ -> filter -- ^ @filter@ - a 'RecentFilter'+ -> IO ()+recentChooserRemoveFilter self filter =+ {# call gtk_recent_chooser_remove_filter #}+ (toRecentChooser self)+ (toRecentFilter filter)++-- | Gets the 'RecentFilter' objects held by @chooser@.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserListFilters :: RecentChooserClass self => self+ -> IO [RecentFilter] -- ^ returns A singly linked list of 'RecentFilter'.+recentChooserListFilters self = do+ glist <- {# call gtk_recent_chooser_list_filters #}+ (toRecentChooser self)+ list <- fromGList glist+ mapM (\x -> makeNewObject mkRecentFilter (return (castPtr x))) list++--------------------+-- Attributes++-- | Whether the private items should be displayed.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.10+--+recentChooserShowPrivate :: RecentChooserClass self => Attr self Bool+recentChooserShowPrivate = newAttrFromBoolProperty "show-private"++-- | Whether this 'RecentChooser' should display a tooltip containing the full path of the recently used+-- resources.+--+-- Default value: 'False'+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserShowTips :: RecentChooserClass self => Attr self Bool+recentChooserShowTips = newAttrFromBoolProperty "show-tips"++-- | Whether this 'RecentChooser' should display an icon near the item.+--+-- Default value: 'True'+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserShowIcons :: RecentChooserClass self => Attr self Bool+recentChooserShowIcons = newAttrFromBoolProperty "show-icons"++-- | Whether this 'RecentChooser' should display the recently used resources even if not present+-- anymore. Setting this to 'False' will perform a potentially expensive check on every local resource+-- (every remote resource will always be displayed).+--+-- Default value: 'True'+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserShowNotFound :: RecentChooserClass self => Attr self Bool+recentChooserShowNotFound = newAttrFromBoolProperty "show-not-found"++-- | Allow the user to select multiple resources.+--+-- Default value: 'False'+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserSelectMultiple :: RecentChooserClass self => Attr self Bool+recentChooserSelectMultiple = newAttrFromBoolProperty "select-multiple"++-- | Whether this 'RecentChooser' should display only local (file:) resources.+--+-- Default value: 'True'+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserLocalOnly :: RecentChooserClass self => Attr self Bool+recentChooserLocalOnly = newAttrFromBoolProperty "local-only"++-- | The maximum number of recently used resources to be displayed, or -1 to display all items. By+-- default, the 'Setting':gtk-recent-files-limit setting is respected: you can override that limit on+-- a particular instance of 'RecentChooser' by setting this property.+--+-- Allowed values: >= 'GMaxulong'+--+-- Default value: -1+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserLimit :: RecentChooserClass self => Attr self Int+recentChooserLimit = newAttrFromIntProperty "limit"++-- | Sorting order to be used when displaying the recently used resources.+--+-- Default value: ''RecentSortNone''+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserSortType :: RecentChooserClass self => Attr self RecentSortType+recentChooserSortType = newAttrFromEnumProperty "sort-type"+ {# call pure unsafe gtk_recent_sort_type_get_type #}++-- | The 'RecentFilter' object to be used when displaying the recently used resources.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserFilter :: (RecentChooserClass self, RecentFilterClass recentFilter) => ReadWriteAttr self RecentFilter recentFilter+recentChooserFilter = newAttrFromObjectProperty "filter"+ {# call pure unsafe gtk_recent_filter_get_type #}++--------------------+-- Signals++-- | This signal is emitted when there is a change in the set of selected+-- recently used resources. This can happen when a user modifies the selection+-- with the mouse or the keyboard, or when explicitly calling functions to+-- change the selection.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserSelectionChanged :: RecentChooserClass self => Signal self (IO ())+recentChooserSelectionChanged = Signal (connect_NONE__NONE "selection_changed")++-- | This signal is emitted when the user \"activates\" a recent item in the+-- recent chooser. This can happen by double-clicking on an item in the+-- recently used resources list, or by pressing Enter.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserItemActivated :: RecentChooserClass self => Signal self (IO ())+recentChooserItemActivated = Signal (connect_NONE__NONE "item_activated")+#endif
+ Graphics/UI/Gtk/Recent/RecentChooserMenu.chs view
@@ -0,0 +1,149 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget RecentChooserMenu+--+-- Author : Andy Stewart+--+-- Created: 27 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Displays recently used files in a menu+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Recent.RecentChooserMenu (++-- * Detail+--+-- | 'RecentChooserMenu' is a widget suitable for displaying recently used+-- files inside a menu. It can be used to set a sub-menu of a 'MenuItem' using+-- 'menuItemSetSubmenu', or as the menu of a 'MenuToolButton'.+--+-- Note that 'RecentChooserMenu' does not have any methods of its own.+-- Instead, you should use the functions that work on a 'RecentChooser'.+--+-- Note also that 'RecentChooserMenu' does not support multiple filters, as+-- it has no way to let the user choose between them as the+-- 'RecentChooserWidget' and 'RecentChooserDialog' widgets do. Thus using+-- 'recentChooserAddFilter' on a 'RecentChooserMenu' widget will yield the same+-- effects as using 'recentChooserSetFilter', replacing any currently set+-- filter with the supplied filter; 'recentChooserRemoveFilter' will remove any+-- currently set 'RecentFilter' object and will unset the current filter;+-- 'recentChooserListFilters' will return a list containing a single+-- 'RecentFilter' object.+--+-- Recently used files are supported since Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'MenuShell'+-- | +----'Menu'+-- | +----RecentChooserMenu+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ RecentChooserMenu,+ RecentChooserMenuClass,+ castToRecentChooserMenu,+ toRecentChooserMenu,++-- * Constructors+ recentChooserMenuNew,+ recentChooserMenuNewForManager,++-- * Attributes+ recentChooserMenuShowNumbers,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)++--------------------+-- Constructors++-- | Creates a new 'RecentChooserMenu' widget.+--+-- This kind of widget shows the list of recently used resources as a menu,+-- each item as a menu item. Each item inside the menu might have an icon,+-- representing its MIME type, and a number, for mnemonic access.+--+-- This widget implements the 'RecentChooser' interface.+--+-- This widget creates its own 'RecentManager' object. See the+-- 'recentChooserMenuNewForManager' function to know how to create a+-- 'RecentChooserMenu' widget bound to another 'RecentManager' object.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserMenuNew :: IO RecentChooserMenu+recentChooserMenuNew =+ makeNewObject mkRecentChooserMenu $+ liftM (castPtr :: Ptr Widget -> Ptr RecentChooserMenu) $+ {# call gtk_recent_chooser_menu_new #}++-- | Creates a new 'RecentChooserMenu' widget using @manager@ as the+-- underlying recently used resources manager.+--+-- This is useful if you have implemented your own recent manager, or if you+-- have a customized instance of a 'RecentManager' object or if you wish to+-- share a common 'RecentManager' object among multiple 'RecentChooser'+-- widgets.+--+--+-- * Available since Gtk+ version 2.10+--+recentChooserMenuNewForManager :: RecentManagerClass manager+ => manager -- ^ @manager@ - a 'RecentManager'+ -> IO RecentChooserMenu -- ^ returns a new 'RecentChooserMenu', bound to manager.+recentChooserMenuNewForManager manager =+ makeNewObject mkRecentChooserMenu $+ liftM (castPtr :: Ptr Widget -> Ptr RecentChooserMenu) $+ {# call gtk_recent_chooser_menu_new_for_manager #}+ (toRecentManager manager)++--------------------+-- Attributes++-- | Whether the first ten items in the menu should be prepended by a number acting as a unique mnemonic.+--+-- Default value: 'False'+--+-- * Available since Gtk+ version 2.10+--+recentChooserMenuShowNumbers :: RecentChooserMenuClass self => Attr self Bool+recentChooserMenuShowNumbers = newAttrFromBoolProperty "show-numbers"+#endif
+ Graphics/UI/Gtk/Recent/RecentChooserWidget.chs view
@@ -0,0 +1,105 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget RecentChooserWidget+--+-- Author : Andy Stewart+--+-- Created: 27 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Displays recently used files+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Recent.RecentChooserWidget (++-- * Detail+--+-- | 'RecentChooserWidget' is a widget suitable for selecting recently used+-- files. It is the main building block of a 'RecentChooserDialog'. Most+-- applications will only need to use the latter; you can use+-- 'RecentChooserWidget' as part of a larger window if you have special needs.+--+-- Note that 'RecentChooserWidget' does not have any methods of its own.+-- Instead, you should use the functions that work on a 'RecentChooser'.+--+-- Recently used files are supported since Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'Box'+-- | +----'VBox'+-- | +----RecentChooserWidget+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ RecentChooserWidget,+ RecentChooserWidgetClass,+ castToRecentChooserWidget,+ toRecentChooserWidget,++-- * Constructors+ recentChooserWidgetNew,+ recentChooserWidgetNewForManager,+#endif+ ) where++#if GTK_CHECK_VERSION(2,10,0)++import Control.Monad (liftM)++import System.Glib.FFI+{#import Graphics.UI.Gtk.Types#}+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Constructors++-- | Creates a new 'RecentChooserWidget' object. This is an embeddable widget+-- used to access the recently used resources list.+--+recentChooserWidgetNew :: IO RecentChooserWidget+recentChooserWidgetNew =+ makeNewObject mkRecentChooserWidget $+ liftM (castPtr :: Ptr Widget -> Ptr RecentChooserWidget) $+ {# call gtk_recent_chooser_widget_new #}++-- | Creates a new 'RecentChooserWidget' with a specified recent manager.+--+-- This is useful if you have implemented your own recent manager, or if you+-- have a customized instance of a 'RecentManager' object.+--+recentChooserWidgetNewForManager :: RecentManagerClass manager+ => manager -- ^ @manager@ - a 'RecentManager'+ -> IO RecentChooserWidget -- ^ returns a new 'RecentChooserWidget'+recentChooserWidgetNewForManager manager =+ makeNewObject mkRecentChooserWidget $+ liftM (castPtr :: Ptr Widget -> Ptr RecentChooserWidget) $+ {# call gtk_recent_chooser_widget_new_for_manager #}+ (toRecentManager manager)+#endif
+ Graphics/UI/Gtk/Recent/RecentFilter.chs view
@@ -0,0 +1,223 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget RecentFilter+--+-- Author : Andy Stewart+--+-- Created: 27 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A filter for selecting a subset of recently used files+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Recent.RecentFilter (++-- * Detail+--+-- | A 'RecentFilter' can be used to restrict the files being shown in a+-- 'RecentChooser'. Files can be filtered based on their name (with+-- 'recentFilterAddPattern'), on their mime type (with+-- 'fileFilterAddMimeType'), on the application that has registered them (with+-- 'recentFilterAddApplication'), or by a custom filter function (with+-- 'recentFilterAddCustom').+--+-- Filtering by mime type handles aliasing and subclassing of mime types;+-- e.g. a filter for text\/plain also matches a file with mime type+-- application\/rtf, since application\/rtf is a subclass of text\/plain. Note+-- that 'RecentFilter' allows wildcards for the subtype of a mime type, so you+-- can e.g. filter for image\/.+--+-- Normally, filters are used by adding them to a 'RecentChooser', see+-- 'recentChooserAddFilter', but it is also possible to manually use a filter+-- on a file with 'recentFilterFilter'.+--+-- Recently used files are supported since Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----RecentFilter+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ RecentFilter,+ RecentFilterClass,+ castToRecentFilter,+ toRecentFilter,++-- * Enums+ RecentFilterFlags(..),++-- * Constructors+ recentFilterNew,++-- * Methods+ recentFilterGetName,+ recentFilterSetName,+ recentFilterAddMimeType,+ recentFilterAddPattern,+ recentFilterAddPixbufFormats,+ recentFilterAddApplication,+ recentFilterAddGroup,+ recentFilterAddAge,+#endif+ ) where++#if GTK_CHECK_VERSION(2,10,0)++import System.Glib.FFI+import System.Glib.UTFString+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++---------------------+-- Enums+-- | These flags indicate what parts of a 'RecentFilterInfo' struct are filled or need to be filled.+{#enum RecentFilterFlags {underscoreToCase} deriving (Bounded,Eq,Show)#}++--------------------+-- Constructors++-- | Creates a new 'RecentFilter' with no rules added to it. Such filter does+-- not accept any recently used resources, so is not particularly useful until+-- you add rules with 'recentFilterAddPattern', 'recentFilterAddMimeType',+-- 'recentFilterAddApplication', 'recentFilterAddAge'. To create a filter that+-- accepts any recently used resource, use:+--+-- > filter <- recentFilterNew+-- > recentFilterAddPattern filter "*"+--+-- * Available since Gtk+ version 2.10+--+recentFilterNew :: IO RecentFilter+recentFilterNew =+ makeNewObject mkRecentFilter $+ {# call gtk_recent_filter_new #}++--------------------+-- Methods+-- | Gets the human-readable name for the filter. See 'recentFilterSetName'.+--+-- * Available since Gtk+ version 2.10+--+recentFilterGetName :: (RecentFilterClass self, GlibString string) => self+ -> IO string -- ^ returns the name of the filter+recentFilterGetName self =+ {# call gtk_recent_filter_get_name #}+ (toRecentFilter self)+ >>= peekUTFString++-- | Sets the human-readable name of the filter; this is the string that will be displayed in the+-- recently used resources selector user interface if there is a selectable list of filters.+--+-- * Available since Gtk+ version 2.10+--+recentFilterSetName :: (RecentFilterClass self, GlibString string) => self+ -> string -- ^ @name@ - then human readable name of @filter@+ -> IO ()+recentFilterSetName self name =+ withUTFString name $ \namePtr ->+ {# call gtk_recent_filter_set_name #}+ (toRecentFilter self)+ namePtr++-- | Adds a rule that allows resources based on their registered MIME type.+--+-- * Available since Gtk+ version 2.10+--+recentFilterAddMimeType :: (RecentFilterClass self, GlibString string) => self+ -> string -- ^ @mimeType@ - a MIME type+ -> IO ()+recentFilterAddMimeType self mimeType =+ withUTFString mimeType $ \mimeTypePtr ->+ {# call gtk_recent_filter_add_mime_type #}+ (toRecentFilter self)+ mimeTypePtr++-- | Adds a rule that allows resources based on a pattern matching their+-- display name.+--+-- * Available since Gtk+ version 2.10+--+recentFilterAddPattern :: (RecentFilterClass self, GlibString string) => self+ -> string -- ^ @pattern@ - a file pattern+ -> IO ()+recentFilterAddPattern self pattern =+ withUTFString pattern $ \patternPtr ->+ {# call gtk_recent_filter_add_pattern #}+ (toRecentFilter self)+ patternPtr++-- | Adds a rule allowing image files in the formats supported by 'Pixbuf'.+--+recentFilterAddPixbufFormats :: RecentFilterClass self => self -> IO ()+recentFilterAddPixbufFormats self =+ {# call gtk_recent_filter_add_pixbuf_formats #}+ (toRecentFilter self)++-- | Adds a rule that allows resources based on the name of the application+-- that has registered them.+--+--+-- * Available since Gtk+ version 2.10+--+recentFilterAddApplication :: (RecentFilterClass self, GlibString string) => self+ -> string -- ^ @application@ - an application name+ -> IO ()+recentFilterAddApplication self application =+ withUTFString application $ \applicationPtr ->+ {# call gtk_recent_filter_add_application #}+ (toRecentFilter self)+ applicationPtr++-- | Adds a rule that allows resources based on the name of the group to which+-- they belong+--+--+-- * Available since Gtk+ version 2.10+--+recentFilterAddGroup :: (RecentFilterClass self, GlibString string) => self+ -> string -- ^ @group@ - a group name+ -> IO ()+recentFilterAddGroup self group =+ withUTFString group $ \groupPtr ->+ {# call gtk_recent_filter_add_group #}+ (toRecentFilter self)+ groupPtr++-- | Adds a rule that allows resources based on their age - that is, the+-- number of days elapsed since they were last modified.+--+-- * Available since Gtk+ version 2.10+--+recentFilterAddAge :: RecentFilterClass self => self+ -> Int -- ^ @days@ - number of days+ -> IO ()+recentFilterAddAge self days =+ {# call gtk_recent_filter_add_age #}+ (toRecentFilter self)+ (fromIntegral days)+#endif
+ Graphics/UI/Gtk/Recent/RecentInfo.chs view
@@ -0,0 +1,351 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget RecentInfo+--+-- Author : Andy Stewart+--+-- Created: 27 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+--+module Graphics.UI.Gtk.Recent.RecentInfo (++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ RecentInfo,+ mkRecentInfo,++-- * Methods+ recentInfoExists,+ recentInfoGetAdded,+ recentInfoGetAge,+ recentInfoGetApplicationInfo,+ recentInfoGetApplications,+ recentInfoGetDescription,+ recentInfoGetDisplayName,+ recentInfoGetGroups,+ recentInfoGetIcon,+ recentInfoGetMimeType,+ recentInfoGetModified,+ recentInfoGetPrivateHint,+ recentInfoGetShortName,+ recentInfoGetURI,+ recentInfoGetURIDisplay,+ recentInfoGetVisited,+ recentInfoHasApplication,+ recentInfoHasGroup,+ recentInfoIsLocal,+ recentInfoLastApplication,+ recentInfoMatch,+#endif+ ) where++#if GTK_CHECK_VERSION(2,10,0)++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Types+{#pointer *RecentInfo foreign newtype#}++--------------------+-- Methods++-- | Helper function for build 'RecentInfo'+mkRecentInfo :: Ptr RecentInfo -> IO RecentInfo+mkRecentInfo rPtr = do+ info <- newForeignPtr rPtr gtk_recent_info_unref+ return (RecentInfo info)++foreign import ccall unsafe ">k_recent_info_unref"+ gtk_recent_info_unref :: FinalizerPtr RecentInfo++-- | Checks whether the resource pointed by info still exists. At the moment this check is done only on+-- resources pointing to local files.+--+-- * Available since Gtk+ version 2.10+--+recentInfoExists :: RecentInfo+ -> IO Bool -- ^ returns 'True' if the resource exists+recentInfoExists self =+ liftM toBool $+ {# call gtk_recent_info_exists #}+ self++-- | Gets the timestamp (seconds from system's Epoch) when the resource was added to the recently used+-- resources list.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetAdded :: RecentInfo+ -> IO Int -- ^ returns the number of seconds elapsed from system's Epoch when the resource was added to the list, or -1 on failure.+recentInfoGetAdded self =+ liftM fromIntegral $+ {# call gtk_recent_info_get_added #}+ self++-- | Gets the number of days elapsed since the last update of the resource pointed by info.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetAge :: RecentInfo+ -> IO Int -- ^ returns a positive integer containing the number of days elapsed since the time this resource was last modified.+recentInfoGetAge self =+ liftM fromIntegral $+ {# call gtk_recent_info_get_age #}+ self++-- | Gets the data regarding the application that has registered the resource pointed by info.+--+-- If the command line contains any escape characters defined inside the storage specification, they+-- will be expanded.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetApplicationInfo :: GlibString string => RecentInfo+ -> string -- ^ @appName@ the name of the application that has registered this item+ -> IO (Maybe ([string], Int, Int))+ -- ^ @appExec@ return location for the string containing the command line. transfer none.+ -- ^ @count@ return location for the number of times this item was registered. out.+ -- ^ @time@ out. out.+recentInfoGetApplicationInfo self appName =+ alloca $ \countPtr ->+ alloca $ \timePtr ->+ allocaArray 0 $ \execPtr ->+ withUTFString appName $ \appNamePtr -> do+ success <- liftM toBool $+ {# call gtk_recent_info_get_application_info #}+ self+ appNamePtr+ execPtr+ countPtr+ timePtr+ if success+ then do+ exec <- mapM peekUTFString =<< peekArray 0 execPtr+ count <- peek countPtr+ time <- peek timePtr+ return (Just (exec, fromIntegral count, fromIntegral time))+ else return Nothing++-- | Retrieves the list of applications that have registered this resource.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetApplications :: GlibString string => RecentInfo -> IO [string]+recentInfoGetApplications self =+ alloca $ \lengthPtr -> do+ str <- {# call gtk_recent_info_get_applications #} self lengthPtr+ length <- peek lengthPtr+ mapM peekUTFString =<< peekArray (fromIntegral length) str++-- | Gets the (short) description of the resource.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetDescription :: GlibString string => RecentInfo+ -> IO string -- ^ returns the description of the resource.+recentInfoGetDescription self =+ {# call gtk_recent_info_get_description #}+ self+ >>= peekUTFString++-- | Gets the name of the resource. If none has been defined, the basename of the resource is obtained.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetDisplayName :: GlibString string => RecentInfo+ -> IO string -- ^ returns the display name of the resource.+recentInfoGetDisplayName self =+ {# call gtk_recent_info_get_display_name #}+ self+ >>= peekUTFString++-- | Returns all groups registered for the recently used item info.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetGroups :: GlibString string => RecentInfo -> IO [string]+recentInfoGetGroups self =+ alloca $ \lengthPtr -> do+ str <- {# call gtk_recent_info_get_groups #} self lengthPtr+ length <- peek lengthPtr+ mapM peekUTFString =<< peekArray (fromIntegral length) str++-- | Retrieves the icon of size size associated to the resource MIME type.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetIcon :: RecentInfo+ -> Int -- ^ @size@ the size of the icon in pixels+ -> IO (Maybe Pixbuf) -- ^ returns a 'Pixbuf' containing the icon, or 'Nothing'+recentInfoGetIcon self size =+ maybeNull (makeNewGObject mkPixbuf) $+ {# call gtk_recent_info_get_icon #}+ self+ (fromIntegral size)++-- | Gets the MIME type of the resource.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetMimeType :: GlibString string => RecentInfo+ -> IO string -- ^ returns the MIME type of the resource.+recentInfoGetMimeType self =+ {# call gtk_recent_info_get_mime_type #}+ self+ >>= peekUTFString++-- | Gets the timestamp (seconds from system's Epoch) when the resource was last modified.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetModified :: RecentInfo+ -> IO Int -- ^ returns the number of seconds elapsed from system's Epoch when the resource was last modified, or -1 on failure.+recentInfoGetModified self =+ liftM fromIntegral $+ {# call gtk_recent_info_get_modified #}+ self++-- | Gets the value of the "private" flag. Resources in the recently used list that have this flag set to+-- 'True' should only be displayed by the applications that have registered them.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetPrivateHint :: RecentInfo+ -> IO Bool -- ^ returns 'True' if the private flag was found, 'False' otherwise.+recentInfoGetPrivateHint self =+ liftM toBool $+ {# call gtk_recent_info_get_private_hint #}+ self++-- | Computes a valid UTF-8 string that can be used as the name of the item in a menu or list. For+-- example, calling this function on an item that refers to \"file:///foo/bar.txt\" will yield \"bar.txt\".+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetShortName :: GlibString string => RecentInfo+ -> IO string+recentInfoGetShortName self =+ {# call gtk_recent_info_get_short_name #}+ self+ >>= readUTFString++-- | Gets the URI of the resource.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetURI :: GlibString string => RecentInfo+ -> IO string -- ^ returns the URI of the resource.+recentInfoGetURI self =+ {# call gtk_recent_info_get_uri #}+ self+ >>= peekUTFString++-- | Gets a displayable version of the resource's URI. If the resource is local, it returns a local path;+-- if the resource is not local, it returns the UTF-8 encoded content of 'recentInfoGetUri'.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetURIDisplay :: GlibString string => RecentInfo -> IO string+recentInfoGetURIDisplay self =+ {# call gtk_recent_info_get_uri_display #}+ self+ >>= readUTFString++-- | Gets the timestamp (seconds from system's Epoch) when the resource was last visited.+--+-- * Available since Gtk+ version 2.10+--+recentInfoGetVisited :: RecentInfo+ -> IO Int -- ^ returns the number of seconds elapsed from system's Epoch when the resource was last visited, or -1 on failure.+recentInfoGetVisited self =+ liftM fromIntegral $+ {# call gtk_recent_info_get_visited #}+ self++-- | Checks whether an application registered this resource using @appName@.+--+-- * Available since Gtk+ version 2.10+--+recentInfoHasApplication :: GlibString string => RecentInfo+ -> string -- ^ @appName@ a string containing an application name+ -> IO Bool -- ^ returns 'True' if an application with name @appName@ was found, 'False' otherwise.+recentInfoHasApplication self appName =+ liftM toBool $+ withUTFString appName $ \appNamePtr ->+ {# call gtk_recent_info_has_application #}+ self+ appNamePtr++-- | Checks whether @groupName@ appears inside the groups registered for the recently used item info.+--+-- * Available since Gtk+ version 2.10+--+recentInfoHasGroup :: GlibString string => RecentInfo+ -> string -- ^ @groupName@ name of a group+ -> IO Bool -- ^ returns 'True' if the group was found.+recentInfoHasGroup self groupName =+ liftM toBool $+ withUTFString groupName $ \groupNamePtr ->+ {# call gtk_recent_info_has_group #}+ self+ groupNamePtr++-- | Checks whether the resource is local or not by looking at the scheme of its URI.+--+-- * Available since Gtk+ version 2.10+--+recentInfoIsLocal :: RecentInfo+ -> IO Bool -- ^ returns 'True' if the resource is local.+recentInfoIsLocal self =+ liftM toBool $+ {# call gtk_recent_info_is_local #}+ self++-- | Gets the name of the last application that have registered the recently used resource represented by+-- info.+--+-- * Available since Gtk+ version 2.10+--+recentInfoLastApplication :: GlibString string => RecentInfo+ -> IO string -- ^ returns an application name.+recentInfoLastApplication self =+ {# call gtk_recent_info_last_application #}+ self+ >>= readUTFString++-- | Checks whether two 'RecentInfo' structures point to the same resource.+--+-- * Available since Gtk+ version 2.10+--+recentInfoMatch :: RecentInfo -> RecentInfo+ -> IO Bool -- ^ returns 'True' if both 'RecentInfo' structures point to se same resource, 'False' otherwise.+recentInfoMatch self infoB =+ liftM toBool $+ {# call gtk_recent_info_match #}+ self+ infoB+#endif
+ Graphics/UI/Gtk/Recent/RecentManager.chs view
@@ -0,0 +1,320 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget RecentManager+--+-- Author : Andy Stewart+--+-- Created: 27 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Managing Recently Used Files+--+-- * Module available since Gtk+ version 2.10+--+-- TODO:+-- GtkRecentData+-- gtk_recent_manager_add_full+--+module Graphics.UI.Gtk.Recent.RecentManager (++-- * Detail+--+-- | 'RecentManager' provides a facility for adding, removing and looking up+-- recently used files. Each recently used file is identified by its URI, and+-- has meta-data associated to it, like the names and command lines of the+-- applications that have registered it, the number of time each application+-- has registered the same file, the mime type of the file and whether the file+-- should be displayed only by the applications that have registered it.+--+-- The 'RecentManager' acts like a database of all the recently used files.+-- You can create new 'RecentManager' objects, but it is more efficient to use+-- the standard recent manager for the 'Screen' so that information about the+-- recently used files is shared with other people using them. In case the+-- default screen is being used, adding a new recently used file is as simple+-- as:+--+-- Recently used files are supported since Gtk+ 2.10.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----RecentManager+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ RecentManager,+ RecentManagerClass,+ castToRecentManager,+ toRecentManager,++-- * Constructors+ recentManagerNew,++-- * Methods+ recentManagerGetDefault,+ recentManagerAddItem,+ recentManagerRemoveItem,+ recentManagerLookupItem,+ recentManagerHasItem,+ recentManagerMoveItem,+ recentManagerGetItems,+ recentManagerPurgeItems,++-- * Attributes+ recentManagerFilename,+ recentManagerLimit,+ recentManagerSize,++-- * Signals+ recentManagerChanged,+#endif+ ) where++#if GTK_CHECK_VERSION(2,10,0)++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import System.Glib.GList+import System.Glib.UTFString+import System.Glib.GError (propagateGError, checkGError)+{#import Graphics.UI.Gtk.Recent.RecentInfo#} (RecentInfo, mkRecentInfo)+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Constructors++-- | Creates a new recent manager object. Recent manager objects are used to+-- handle the list of recently used resources. A 'RecentManager' object+-- monitors the recently used resources list, and emits the \"changed\" signal+-- each time something inside the list changes.+--+-- * Available since Gtk+ version 2.10+--+recentManagerNew :: IO RecentManager+recentManagerNew =+ wrapNewGObject mkRecentManager $+ {# call gtk_recent_manager_new #}++--------------------+-- Methods++-- | Gets a unique instance of 'RecentManager'.+--+-- * Available since Gtk+ version 2.10+--+recentManagerGetDefault :: IO RecentManager -- ^ returns A unique 'RecentManager'.+recentManagerGetDefault =+ makeNewGObject mkRecentManager $+ {# call gtk_recent_manager_get_default #}++-- | Adds a new resource, pointed by @uri@, into the recently used resources+-- list.+--+-- This function automatically retrieves some of the needed metadata and+-- setting other metadata to common default values; it then feeds the data to+-- 'recentManagerAddFull'.+--+-- See 'recentManagerAddFull' if you want to explicitly define the metadata+-- for the resource pointed by @uri@.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerAddItem :: (RecentManagerClass self, GlibString string) => self+ -> string -- ^ @uri@ - a valid URI+ -> IO Bool -- ^ returns @True@ if the new item was successfully added to the+ -- recently used resources list+recentManagerAddItem self uri =+ liftM toBool $+ withUTFString uri $ \uriPtr ->+ {# call gtk_recent_manager_add_item #}+ (toRecentManager self)+ uriPtr++-- | Removes a resource pointed by @uri@ from the recently used resources list+-- handled by a recent manager.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerRemoveItem :: (RecentManagerClass self, GlibString string) => self+ -> string -- ^ @uri@ - the URI of the item you wish to remove+ -> IO Bool -- ^ returns @True@ if the item pointed by @uri@ has been+ -- successfully removed by the recently used resources list, and+ -- @False@ otherwise.+recentManagerRemoveItem self uri =+ checkGError (\errorPtr ->+ liftM toBool $+ withUTFString uri $ \uriPtr ->+ {# call gtk_recent_manager_remove_item #}+ (toRecentManager self)+ uriPtr+ errorPtr)+ (\_ -> return False)++-- | Searches for a URI inside the recently used resources list, and returns a+-- structure containing information about the resource like its MIME type, or+-- its display name.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerLookupItem :: (RecentManagerClass self, GlibString string) => self+ -> string -- ^ @uri@ - a URI+ -> IO RecentInfo -- ^ returns a 'RecentInfo'+ -- structure containing information about the+ -- resource pointed by @uri@, or {@NULL@, FIXME: this+ -- should probably be converted to a Maybe data type}+ -- if the URI was not registered in the recently used+ -- resources list.+recentManagerLookupItem self uri =+ propagateGError $ \errorPtr ->+ withUTFString uri $ \uriPtr -> do+ result <- {# call unsafe gtk_recent_manager_lookup_item #}+ (toRecentManager self)+ uriPtr+ errorPtr+ mkRecentInfo result++-- | Checks whether there is a recently used resource registered with @uri@+-- inside the recent manager.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerHasItem :: (RecentManagerClass self, GlibString string) => self+ -> string -- ^ @uri@ - a URI+ -> IO Bool -- ^ returns @True@ if the resource was found, @False@ otherwise.+recentManagerHasItem self uri =+ liftM toBool $+ withUTFString uri $ \uriPtr ->+ {# call gtk_recent_manager_has_item #}+ (toRecentManager self)+ uriPtr++-- | Changes the location of a recently used resource from @uri@ to @newUri@.+--+-- Please note that this function will not affect the resource pointed by+-- the URIs, but only the URI used in the recently used resources list.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerMoveItem :: (RecentManagerClass self, GlibString string) => self+ -> string -- ^ @uri@ - the URI of a recently used resource+ -> string -- ^ @newUri@ - the new URI of the recently used resource to remove the item pointed by @uri@ in the list+ -> IO Bool -- ^ returns @True@ on success.+recentManagerMoveItem self uri newUri =+ checkGError ( \errorPtr ->+ liftM toBool $+ withUTFString newUri $ \newUriPtr ->+ withUTFString uri $ \uriPtr ->+ {# call gtk_recent_manager_move_item #}+ (toRecentManager self)+ uriPtr+ newUriPtr+ errorPtr)+ (\_ -> return False)++-- | Gets the list of recently used resources.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerGetItems :: RecentManagerClass self => self+ -> IO [RecentInfo] -- ^ returns a list of newly allocated+ -- 'RecentInfo' objects.+recentManagerGetItems self = do+ glist <- {# call gtk_recent_manager_get_items #}+ (toRecentManager self)+ list <- fromGList glist+ mapM mkRecentInfo list++-- | Purges every item from the recently used resources list.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerPurgeItems :: RecentManagerClass self => self+ -> IO Int -- ^ returns the number of items that have been removed from the+ -- recently used resources list.+recentManagerPurgeItems self =+ liftM fromIntegral $+ propagateGError $ \errorPtr ->+ {# call gtk_recent_manager_purge_items #}+ (toRecentManager self)+ errorPtr++--------------------+-- Attributes++-- | The full path to the file to be used to store and read the recently used resources list+--+-- Default value: 'Nothing'+--+-- * Available since Gtk+ version 2.10+--+recentManagerFilename :: (RecentManagerClass self, GlibString string) => ReadAttr self string+recentManagerFilename = readAttrFromStringProperty "filename"++-- | The maximum number of items to be returned by the 'recentManagerGetItems' function.+--+-- Allowed values: >= 'GMaxulong'+--+-- Default value: -1+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerLimit :: RecentManagerClass self => Attr self Int+recentManagerLimit = newAttrFromIntProperty "limit"++-- | The size of the recently used resources list.+--+-- Allowed values: >= 'GMaxulong'+--+-- Default value: 0+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerSize :: RecentManagerClass self => ReadAttr self Int+recentManagerSize = readAttrFromIntProperty "size"++--------------------+-- Signals++-- | Emitted when the current recently used resources manager changes its+-- contents.+--+--+-- * Available since Gtk+ version 2.10+--+recentManagerChanged :: RecentManagerClass self => Signal self (IO ())+recentManagerChanged = Signal (connect_NONE__NONE "changed")+#endif
Graphics/UI/Gtk/Scrolling/HScrollbar.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget HScrollbar --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Scrolling.HScrollbar ( -- * Detail--- +-- -- | The 'HScrollbar' widget is a widget arranged horizontally creating a -- scrollbar. See 'Scrollbar' for details on scrollbars. An 'Adjustment' -- may be added to handle the adjustment of the scrollbar using@@ -57,10 +58,10 @@ hScrollbarNewDefaults ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -70,7 +71,7 @@ -- | Creates a new horizontal scrollbar. ---hScrollbarNew :: +hScrollbarNew :: Adjustment -- ^ @adjustment@ - the 'Adjustment' to use. -> IO HScrollbar hScrollbarNew adjustment =
Graphics/UI/Gtk/Scrolling/ScrolledWindow.chs view
@@ -27,7 +27,7 @@ -- module Graphics.UI.Gtk.Scrolling.ScrolledWindow ( -- * Detail--- +-- -- | 'ScrolledWindow' is a 'Bin' subclass: it's a container the accepts a -- single child widget. 'ScrolledWindow' adds scrollbars to the child widget -- and optionally draws a beveled frame around the child widget.@@ -95,12 +95,24 @@ ShadowType(..), scrolledWindowSetShadowType, scrolledWindowGetShadowType,+#if GTK_MAJOR_VERSION >= 3+ scrolledWindowSetMinContentWidth,+ scrolledWindowGetMinContentWidth,+ scrolledWindowSetMinContentHeight,+ scrolledWindowGetMinContentHeight,+#endif scrolledWindowSetHAdjustment, scrolledWindowSetVAdjustment, #if GTK_CHECK_VERSION(2,8,0) scrolledWindowGetHScrollbar, scrolledWindowGetVScrollbar, #endif+#if GTK_CHECK_VERSION(3,4,0)+ scrolledWindowSetKineticScrolling,+ scrolledWindowGetKineticScrolling,+ scrolledWindowSetCaptureButtonPress,+ scrolledWindowGetCaptureButtonPress,+#endif -- * Attributes scrolledWindowHAdjustment,@@ -109,18 +121,25 @@ scrolledWindowVscrollbarPolicy, scrolledWindowWindowPlacement, scrolledWindowShadowType,+#if GTK_MAJOR_VERSION >= 3+ scrolledWindowMinContentWidth,+ scrolledWindowMinContentHeight,+#endif scrolledWindowPlacement,+#if GTK_CHECK_VERSION(3,4,0)+ scrolledWindowKineticScrolling,+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Enums (PolicyType(..), CornerType(..), ShadowType(..))+import Graphics.UI.Gtk.General.Enums (PolicyType(..), CornerType(..), ShadowType(..)) {# context lib="gtk" prefix="gtk" #} @@ -133,7 +152,7 @@ -- @Nothing@ for the adjustments, which will cause the scrolled window to -- create them for you. ---scrolledWindowNew :: +scrolledWindowNew :: Maybe Adjustment -- ^ @hadjustment@ - Horizontal adjustment. -> Maybe Adjustment -- ^ @vadjustment@ - Vertical adjustment. -> IO ScrolledWindow@@ -170,7 +189,7 @@ -- 'PolicyType' enumeration. If 'PolicyAlways', the scrollbar is always -- present; if 'PolicyNever', the scrollbar is never present; if -- 'PolicyAutomatic', the scrollbar is present only if needed (that is, if the--- slider part of the bar would be smaller than the trough - the display is+-- slider part of the bar would be smaller than the through - the display is -- larger than the page size). -- scrolledWindowSetPolicy :: ScrolledWindowClass self => self@@ -259,6 +278,42 @@ {# call unsafe scrolled_window_get_shadow_type #} (toScrolledWindow self) +#if GTK_MAJOR_VERSION >= 3+-- | Sets the minimum width that @scrolledWindow@ should keep visible.+-- Note that this can and (usually will) be smaller than the minimum size of the content.+--+scrolledWindowSetMinContentWidth :: ScrolledWindowClass self => self -> Int -> IO ()+scrolledWindowSetMinContentWidth self width =+ {# call gtk_scrolled_window_set_min_content_width #}+ (toScrolledWindow self)+ (fromIntegral width)++-- | Gets the minimum content width of @scrolledWindow@, or -1 if not set.+--+scrolledWindowGetMinContentWidth :: ScrolledWindowClass self => self -> IO Int+scrolledWindowGetMinContentWidth self =+ liftM fromIntegral $+ {# call unsafe scrolled_window_get_min_content_width #}+ (toScrolledWindow self)++-- | Sets the minimum height that @scrolledWindow@ should keep visible.+-- Note that this can and (usually will) be smaller than the minimum size of the content.+--+scrolledWindowSetMinContentHeight :: ScrolledWindowClass self => self -> Int -> IO ()+scrolledWindowSetMinContentHeight self height =+ {# call gtk_scrolled_window_set_min_content_height #}+ (toScrolledWindow self)+ (fromIntegral height)++-- | Gets the minimum content height of @scrolledWindow@, or -1 if not set.+--+scrolledWindowGetMinContentHeight :: ScrolledWindowClass self => self -> IO Int+scrolledWindowGetMinContentHeight self =+ liftM fromIntegral $+ {# call unsafe scrolled_window_get_min_content_height #}+ (toScrolledWindow self)+#endif+ -- | Sets the 'Adjustment' for the horizontal scrollbar. -- scrolledWindowSetHAdjustment :: ScrolledWindowClass self => self -> Adjustment -> IO ()@@ -305,6 +360,51 @@ (toScrolledWindow self) #endif +#if GTK_CHECK_VERSION(3,4,0)+-- | Turns kinetic scrolling on or off. Kinetic scrolling only applies to+-- devices with source GDK_SOURCE_TOUCHSCREEN.+--+scrolledWindowSetKineticScrolling :: ScrolledWindowClass self => self -> Bool -> IO ()+scrolledWindowSetKineticScrolling self kineticScrolling =+ {# call scrolled_window_set_kinetic_scrolling #}+ (toScrolledWindow self)+ (fromBool kineticScrolling)++-- | Returns the specified kinetic scrolling behavior.+--+scrolledWindowGetKineticScrolling :: ScrolledWindowClass self => self -> IO Bool+scrolledWindowGetKineticScrolling self =+ liftM toBool $+ {# call scrolled_window_get_kinetic_scrolling #}+ (toScrolledWindow self)++-- | Changes the behaviour of @scrolledWindow@ wrt. to the initial event that+-- possibly starts kinetic scrolling. When @captureButtonPress@ is set to+-- True, the event is captured by the scrolled window, and then later replayed+-- if it is meant to go to the child widget.+--+-- This should be enabled if any child widgets perform non-reversible actions+-- on "button-press-event". If they don't, and handle additionally handle+-- "grab-broken-event", it might be better to set captureButtonPress to False.+--+-- This setting only has an effect if kinetic scrolling is enabled.+--+scrolledWindowSetCaptureButtonPress :: ScrolledWindowClass self => self -> Bool -> IO ()+scrolledWindowSetCaptureButtonPress self captureButtonPress =+ {# call gtk_scrolled_window_set_capture_button_press #}+ (toScrolledWindow self)+ (fromBool captureButtonPress)++-- | Return whether button presses are captured during kinetic scrolling.+-- See @scrolledWindowSetCaptureButtonPress@.+--+scrolledWindowGetCaptureButtonPress :: ScrolledWindowClass self => self -> IO Bool+scrolledWindowGetCaptureButtonPress self =+ liftM toBool $+ {# call gtk_scrolled_window_get_capture_button_press #}+ (toScrolledWindow self)+#endif+ -------------------- -- Attributes @@ -355,6 +455,26 @@ scrolledWindowGetShadowType scrolledWindowSetShadowType +#if GTK_MAJOR_VERSION >= 3+-- | Minimum width that @scrolledWindow@ should keep visible.+--+-- Default value: -1+--+scrolledWindowMinContentWidth :: ScrolledWindowClass self => Attr self Int+scrolledWindowMinContentWidth = newAttr+ scrolledWindowGetMinContentWidth+ scrolledWindowSetMinContentWidth++-- | Minimum height that @scrolledWindow@ should keep visible.+--+-- Default value: -1+--+scrolledWindowMinContentHeight :: ScrolledWindowClass self => Attr self Int+scrolledWindowMinContentHeight = newAttr+ scrolledWindowGetMinContentHeight+ scrolledWindowSetMinContentHeight+#endif+ -- | \'placement\' property. See 'scrolledWindowGetPlacement' and -- 'scrolledWindowSetPlacement' --@@ -362,3 +482,14 @@ scrolledWindowPlacement = newAttr scrolledWindowGetPlacement scrolledWindowSetPlacement++#if GTK_CHECK_VERSION(3,4,0)+-- | The kinetic scrolling behavior flags. Kinetic scrolling only applies to+-- devices with source GDK_SOURCE_TOUCHSCREEN+--+scrolledWindowKineticScrolling :: ScrolledWindowClass self => Attr self Bool+scrolledWindowKineticScrolling = newAttr+ scrolledWindowGetKineticScrolling+ scrolledWindowSetKineticScrolling+#endif+
Graphics/UI/Gtk/Scrolling/VScrollbar.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget VScrollbar --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Scrolling.VScrollbar ( -- * Detail--- +-- -- | The 'VScrollbar' widget is a widget arranged vertically creating a -- scrollbar. See 'Scrollbar' for details on scrollbars. An 'Adjustment' -- may be added to handle the adjustment of the scrollbar using@@ -57,10 +58,10 @@ vScrollbarNewDefaults ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -70,7 +71,7 @@ -- | Creates a new vertical scrollbar. ---vScrollbarNew :: +vScrollbarNew :: Adjustment -- ^ @adjustment@ - the 'Adjustment' to use. -> IO VScrollbar vScrollbarNew adjustment =
Graphics/UI/Gtk/Selectors/ColorButton.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Selectors.ColorButton ( -- * Detail--- +-- -- | The 'ColorButton' is a button which displays the currently selected color -- an allows to open a color selection dialog to change the color. It is -- suitable widget for selecting a color in a preference dialog.@@ -78,15 +78,15 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Structs (Color)+import Graphics.UI.Gtk.General.Structs (Color) {# context lib="gtk" prefix="gtk" #} @@ -108,7 +108,7 @@ -- | Creates a new color button. ---colorButtonNewWithColor :: +colorButtonNewWithColor :: Color -- ^ @color@ - A 'Color' to set the current color with. -> IO ColorButton colorButtonNewWithColor color =@@ -185,8 +185,8 @@ -- | Sets the title for the color selection dialog. ---colorButtonSetTitle :: ColorButtonClass self => self- -> String -- ^ @title@ - String containing new window title.+colorButtonSetTitle :: (ColorButtonClass self, GlibString string) => self+ -> string -- ^ @title@ - String containing new window title. -> IO () colorButtonSetTitle self title = withUTFString title $ \titlePtr ->@@ -196,8 +196,8 @@ -- | Gets the title of the color selection dialog. ---colorButtonGetTitle :: ColorButtonClass self => self- -> IO String -- ^ returns An internal string, do not free the return value+colorButtonGetTitle :: (ColorButtonClass self, GlibString string) => self+ -> IO string -- ^ returns An internal string, do not free the return value colorButtonGetTitle self = {# call gtk_color_button_get_title #} (toColorButton self)@@ -221,7 +221,7 @@ -- -- Default value: \"Pick a Color\" ---colorButtonTitle :: ColorButtonClass self => Attr self String+colorButtonTitle :: (ColorButtonClass self, GlibString string) => Attr self string colorButtonTitle = newAttr colorButtonGetTitle colorButtonSetTitle@@ -240,7 +240,7 @@ -------------------- -- Signals --- | The ::color-set signal is emitted when the user selects a color. When+-- | The 'colorSet' signal is emitted when the user selects a color. When -- handling this signal, use 'colorButtonGetColor' and 'colorButtonGetAlpha' to -- find out which color was just selected. --
Graphics/UI/Gtk/Selectors/ColorSelection.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget ColorSelection --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Selectors.ColorSelection ( -- * Detail--- +-- -- | The 'ColorSelection' is a widget that is used to select a color. It -- consists of a color wheel and number of sliders and entry boxes for color -- parameters such as hue, saturation, value, red, green, blue, and opacity. It@@ -75,11 +76,11 @@ colorSelectionPreviousAlpha, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} import Graphics.UI.Gtk.General.Structs (Color) @@ -145,7 +146,7 @@ -- colorSelectionGetHasOpacityControl :: ColorSelectionClass self => self -> IO Bool -- ^ returns @True@ if the color selector has an opacity control.- -- @False@ if it does't.+ -- @False@ if it doesn't. colorSelectionGetHasOpacityControl self = liftM toBool $ {# call unsafe color_selection_get_has_opacity_control #}
Graphics/UI/Gtk/Selectors/ColorSelectionDialog.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget ColorSelectionDialog --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Selectors.ColorSelectionDialog ( -- * Detail--- +-- -- | The 'ColorSelectionDialog' provides a standard dialog which allows the -- user to select a color much like the 'FileSelection' provides a standard -- dialog for file selection.@@ -54,22 +55,26 @@ colorSelectionDialogNew, -- * Methods+#if GTK_MAJOR_VERSION < 3 colorSelectionDialogGetColor, colorSelectionDialogGetOkButton, colorSelectionDialogGetCancelButton, colorSelectionDialogGetHelpButton,+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.General.Structs (colorSelectionDialogGetColor,- colorSelectionDialogGetOkButton,- colorSelectionDialogGetCancelButton,- colorSelectionDialogGetHelpButton)+#if GTK_MAJOR_VERSION < 3+import Graphics.UI.Gtk.General.Structs (colorSelectionDialogGetColor,+ colorSelectionDialogGetOkButton,+ colorSelectionDialogGetCancelButton,+ colorSelectionDialogGetHelpButton)+#endif {# context lib="gtk" prefix="gtk" #} @@ -78,8 +83,8 @@ -- | Creates a new 'ColorSelectionDialog'. ---colorSelectionDialogNew :: - String -- ^ @title@ - a string containing the title text+colorSelectionDialogNew :: GlibString string+ => string -- ^ @title@ - a string containing the title text -- for the dialog. -> IO ColorSelectionDialog colorSelectionDialogNew title =
Graphics/UI/Gtk/Selectors/FileChooser.chs view
@@ -30,7 +30,7 @@ -- module Graphics.UI.Gtk.Selectors.FileChooser ( -- * Detail--- +-- -- | 'FileChooser' is an interface that can be implemented by file selection -- widgets. In Gtk+, the main objects that implement this interface are -- 'FileChooserWidget', 'FileChooserDialog', and 'FileChooserButton'. You do@@ -40,11 +40,11 @@ -- -- 'FileChooser' allows for shortcuts to various places in the filesystem. -- In the default implementation these are displayed in the left pane. It may--- be a bit confusing at first taht these shortcuts come from various sources+-- be a bit confusing at first that these shortcuts come from various sources -- and in various flavours, so lets explain the terminology here: -- ** File Names and Encodings--- +-- -- | When the user is finished selecting files in a 'FileChooser', your -- program can get the selected names either as filenames or as URIs. For URIs, -- the normal escaping rules are applied if the URI contains non-ASCII@@ -53,7 +53,7 @@ -- Glib documentation for more details about this variable. -- ** Adding a Preview Widget--- +-- -- | You can add a custom preview widget to a file chooser and then get -- notification about when the preview needs to be updated. To install a -- preview widget, use 'fileChooserSetPreviewWidget'. Then, connect to the@@ -66,14 +66,14 @@ -- that indicates whether your callback could successfully generate a preview. -- ** Adding Extra Widgets--- +-- -- | You can add extra widgets to a file chooser to provide options that are -- not present in the default design. For example, you can add a toggle button -- to give the user the option to open a file in read-only mode. You can use -- 'fileChooserSetExtraWidget' to insert additional widgets in a file chooser. -- ** Key Bindings--- +-- -- | Internally, Gtk+ implements a file chooser's graphical user interface -- with the private GtkFileChooserDefaultClass. This widget has several key -- bindings and their associated signals. This section describes the available@@ -81,7 +81,7 @@ -- -- * GtkFileChooser key binding example ----- The default keys that activate the key-binding signals in+-- The default keys that activate the 'keyBinding' signals in -- GtkFileChooserDefaultClass are as follows: -- -- [Signal name] Key@@ -98,23 +98,23 @@ -- following fragment in your .gtkrc-2.0 file: -- -- > binding "my-own-gtkfilechooser-bindings" {--- > bind "AltShiftl" {--- > "location-popup" ()--- > }--- > bind "AltShiftUp" {--- > "up-folder" ()--- > }--- > bind "AltShiftDown" {--- > "down-folder" ()--- > }--- > bind "AltShiftHome" {--- > "home-folder-folder" ()--- > }+-- > bind "AltShiftl" {+-- > "location-popup" ()+-- > }+-- > bind "AltShiftUp" {+-- > "up-folder" ()+-- > }+-- > bind "AltShiftDown" {+-- > "down-folder" ()+-- > }+-- > bind "AltShiftHome" {+-- > "home-folder-folder" ()+-- > } -- > }--- > +-- > -- > class "GtkFileChooserDefault" binding "my-own-gtkfilechooser-bindings"--- > --- +-- > +-- -- * Class Hierarchy -- |@@ -207,6 +207,16 @@ fileChooserAction, -- * Signals+ currentFolderChanged,+ fileActivated,+ fileSelectionChanged,+ updatePreview,+#if GTK_CHECK_VERSION(2,8,0)+ confirmOverwrite,+#endif++#ifndef DISABLE_DEPRECATED+-- * Deprecated onCurrentFolderChanged, afterCurrentFolderChanged, onFileActivated,@@ -218,8 +228,9 @@ #if GTK_CHECK_VERSION(2,8,0) onConfirmOverwrite, afterConfirmOverwrite,-#endif-#endif+#endif -- version 2.8+#endif -- deprecated+#endif -- version 2.4 ) where import Control.Monad (liftM)@@ -228,10 +239,10 @@ import System.Glib.UTFString import System.Glib.Attributes {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) import Graphics.UI.Gtk.Signals {#import System.Glib.GList#}-import System.Glib.GError (propagateGError, GErrorDomain, GErrorClass(..))+import System.Glib.GError (propagateGError, GErrorDomain, GErrorClass(..)) {# context lib="gtk" prefix="gtk" #} @@ -342,11 +353,11 @@ -- documentation for those functions for an example of using -- 'fileChooserSetCurrentName' as well. ---fileChooserSetCurrentName :: FileChooserClass self => self- -> FilePath -- ^ @name@ - the filename to use, as a Unicode string+fileChooserSetCurrentName :: (FileChooserClass self, GlibFilePath fp) => self+ -> fp -- ^ @name@ - the filename to use, as a Unicode string -> IO () fileChooserSetCurrentName self name =- withUTFString name $ \namePtr ->+ withUTFFilePath name $ \namePtr -> {# call gtk_file_chooser_set_current_name #} (toFileChooser self) namePtr@@ -358,18 +369,18 @@ -- If the file chooser is in folder mode, this function returns the selected -- folder. ---fileChooserGetFilename :: FileChooserClass self => self- -> IO (Maybe FilePath) -- ^ returns The currently selected filename, or+fileChooserGetFilename :: (FileChooserClass self, GlibFilePath fp) => self+ -> IO (Maybe fp) -- ^ returns The currently selected filename, or -- @Nothing@ if no file is selected, or the selected -- file can't be represented with a local filename. fileChooserGetFilename self =-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_get_filename_utf8 #} #else {# call gtk_file_chooser_get_filename #} #endif (toFileChooser self)- >>= maybePeek readCString+ >>= maybePeek peekUTFFilePath -- | Sets @filename@ as the current filename for the file chooser, by changing -- to the file's parent folder and actually selecting the file in list. If the@@ -405,7 +416,7 @@ fileChooserSetFilename self filename = liftM toBool $ withCString filename $ \filenamePtr ->-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_set_filename_utf8 #} #else {# call gtk_file_chooser_set_filename #}@@ -424,7 +435,7 @@ fileChooserSelectFilename self filename = liftM toBool $ withCString filename $ \filenamePtr ->-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_select_filename_utf8 #} #else {# call gtk_file_chooser_select_filename #}@@ -441,7 +452,7 @@ -> IO () fileChooserUnselectFilename self filename = withCString filename $ \filenamePtr ->-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_unselect_filename_utf8 #} #else {# call gtk_file_chooser_unselect_filename #}@@ -470,7 +481,7 @@ -- fileChooserGetFilenames :: FileChooserClass self => self -> IO [FilePath] fileChooserGetFilenames self =-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_get_filenames_utf8 #} #else {# call gtk_file_chooser_get_filenames #}@@ -489,7 +500,7 @@ fileChooserSetCurrentFolder self filename = liftM toBool $ withCString filename $ \filenamePtr ->-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_set_current_folder_utf8 #} #else {# call gtk_file_chooser_set_current_folder #}@@ -505,7 +516,7 @@ -- @Nothing@ if the current path cannot be represented -- as a local filename. fileChooserGetCurrentFolder self =-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_get_current_folder_utf8 #} #else {# call gtk_file_chooser_get_current_folder #}@@ -717,7 +728,7 @@ -- no file is selected, or if the selected file cannot -- be represented as a local filename. fileChooserGetPreviewFilename self =-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_get_preview_filename_utf8 #} #else {# call gtk_file_chooser_get_preview_filename #}@@ -818,7 +829,7 @@ fileChooserAddShortcutFolder self folder = propagateGError $ \errorPtr -> withCString folder $ \folderPtr -> do-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_add_shortcut_folder_utf8 #} #else {# call gtk_file_chooser_add_shortcut_folder #}@@ -838,7 +849,7 @@ fileChooserRemoveShortcutFolder self folder = propagateGError $ \errorPtr -> withCString folder $ \folderPtr -> do-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_remove_shortcut_folder_utf8 #} #else {# call gtk_file_chooser_remove_shortcut_folder #}@@ -853,7 +864,7 @@ -- fileChooserListShortcutFolders :: FileChooserClass self => self -> IO [String] fileChooserListShortcutFolders self =-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_file_chooser_list_shortcut_folders_utf8 #} #else {# call gtk_file_chooser_list_shortcut_folders #}@@ -1072,11 +1083,8 @@ -- See also: 'fileChooserSetCurrentFolder', 'fileChooserGetCurrentFolder', -- 'fileChooserSetCurrentFolderURI', 'fileChooserGetCurrentFolderURI'. ---onCurrentFolderChanged, afterCurrentFolderChanged :: FileChooserClass self => self- -> IO ()- -> IO (ConnectId self)-onCurrentFolderChanged = connect_NONE__NONE "current-folder-changed" False-afterCurrentFolderChanged = connect_NONE__NONE "current-folder-changed" True+currentFolderChanged :: FileChooserClass self => Signal self (IO ())+currentFolderChanged = Signal (connect_NONE__NONE "current-folder-changed") -- | This signal is emitted when there is a change in the set of selected -- files in a 'FileChooser'. This can happen when the user modifies the@@ -1091,11 +1099,8 @@ -- 'fileChooserGetFilename', 'fileChooserGetFilenames', 'fileChooserSelectURI', -- 'fileChooserUnselectURI', 'fileChooserGetURI', 'fileChooserGetURIs'. -----onSelectionChanged, afterSelectionChanged :: FileChooserClass self => self--- -> IO ()--- -> IO (ConnectId self)---onSelectionChanged = connect_NONE__NONE "selection-changed" False---afterSelectionChanged = connect_NONE__NONE "selection-changed" True+fileSelectionChanged :: FileChooserClass self => Signal self (IO ())+fileSelectionChanged = Signal (connect_NONE__NONE "selection-changed") -- | This signal is emitted when the preview in a file chooser should be -- regenerated. For example, this can happen when the currently selected file@@ -1114,11 +1119,8 @@ -- 'fileChooserSetPreviewWidgetActive', 'fileChooserSetUsePreviewLabel', -- 'fileChooserGetPreviewFilename', 'fileChooserGetPreviewURI'. ---onUpdatePreview, afterUpdatePreview :: FileChooserClass self => self- -> IO ()- -> IO (ConnectId self)-onUpdatePreview = connect_NONE__NONE "update-preview" False-afterUpdatePreview = connect_NONE__NONE "update-preview" True+updatePreview :: FileChooserClass self => Signal self (IO ())+updatePreview = Signal (connect_NONE__NONE "update-preview") -- | This signal is emitted when the user \"activates\" a file in the file -- chooser. This can happen by double-clicking on a file in the file list, or@@ -1131,11 +1133,8 @@ -- See also: 'fileChooserGetFilename', 'fileChooserGetFilenames', -- 'fileChooserGetURI', 'fileChooserGetURIs'. ---onFileActivated, afterFileActivated :: FileChooserClass self => self- -> IO ()- -> IO (ConnectId self)-onFileActivated = connect_NONE__NONE "file-activated" False-afterFileActivated = connect_NONE__NONE "file-activated" True+fileActivated :: FileChooserClass self => Signal self (IO ())+fileActivated = Signal (connect_NONE__NONE "file-activated") #if GTK_CHECK_VERSION(2,8,0) -- | This signal gets emitted whenever it is appropriate to present a@@ -1147,7 +1146,7 @@ -- property (or call the 'fileChooserSetDoOverwriteConfirmation' function), and -- they will automatically get a stock confirmation dialog. Applications which -- need to customize this behavior should do that, and also connect to the--- confirm-overwrite signal.+-- 'confirmOverwrite' signal. -- -- A signal handler for this signal must return a 'FileChooserConfirmation' -- value, which indicates the action to take. If the handler determines that@@ -1160,11 +1159,54 @@ -- -- Since Gtk 2.8. --+confirmOverwrite :: FileChooserClass self => Signal self (IO FileChooserConfirmation)+confirmOverwrite = Signal (connect_NONE__ENUM "confirm-overwrite")+#endif++#ifndef DISABLE_DEPRECATED++-- * Deprecated++onCurrentFolderChanged, afterCurrentFolderChanged :: FileChooserClass self => self+ -> IO ()+ -> IO (ConnectId self)+onCurrentFolderChanged = connect_NONE__NONE "current-folder-changed" False+afterCurrentFolderChanged = connect_NONE__NONE "current-folder-changed" True+{-# DEPRECATED onCurrentFolderChanged "use currentFolderChanged instead" #-}+{-# DEPRECATED afterCurrentFolderChanged "use currentFolderChanged instead" #-}++--onSelectionChanged, afterSelectionChanged :: FileChooserClass self => self+-- -> IO ()+-- -> IO (ConnectId self)+--onSelectionChanged = connect_NONE__NONE "selection-changed" False+--afterSelectionChanged = connect_NONE__NONE "selection-changed" True++onUpdatePreview, afterUpdatePreview :: FileChooserClass self => self+ -> IO ()+ -> IO (ConnectId self)+onUpdatePreview = connect_NONE__NONE "update-preview" False+afterUpdatePreview = connect_NONE__NONE "update-preview" True+{-# DEPRECATED onUpdatePreview "use updatePreview instead" #-}+{-# DEPRECATED afterUpdatePreview "use updatePreview instead" #-}++onFileActivated, afterFileActivated :: FileChooserClass self => self+ -> IO ()+ -> IO (ConnectId self)+onFileActivated = connect_NONE__NONE "file-activated" False+afterFileActivated = connect_NONE__NONE "file-activated" True+{-# DEPRECATED onFileActivated "use fileActivated instead" #-}+{-# DEPRECATED afterFileActivated "use fileActivated instead" #-}++#if GTK_CHECK_VERSION(2,8,0) onConfirmOverwrite, afterConfirmOverwrite :: FileChooserClass self => self -> IO FileChooserConfirmation -> IO (ConnectId self) onConfirmOverwrite = connect_NONE__ENUM "confirm-overwrite" False afterConfirmOverwrite = connect_NONE__ENUM "confirm-overwrite" True+{-# DEPRECATED onConfirmOverwrite "use confirmOverwrite instead" #-}+{-# DEPRECATED afterConfirmOverwrite "use confirmOverwrite instead" #-}+#endif+ #endif #endif
Graphics/UI/Gtk/Selectors/FileChooserButton.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Selectors.FileChooserButton ( -- * Detail--- +-- -- | The 'FileChooserButton' is a widget that lets the user select a file. It -- implements the 'FileChooser' interface. Visually, it is a file name with a -- button to bring up a 'FileChooserDialog'. The user can then use that dialog@@ -60,7 +60,9 @@ -- * Constructors fileChooserButtonNew,+#if GTK_MAJOR_VERSION < 3 fileChooserButtonNewWithBackend,+#endif fileChooserButtonNewWithDialog, -- * Methods@@ -73,17 +75,21 @@ fileChooserButtonDialog, fileChooserButtonTitle, fileChooserButtonWidthChars,++-- * Signals+ fileChooserButtonFileSet #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#} #if GTK_CHECK_VERSION(2,6,0) {#import Graphics.UI.Gtk.Selectors.FileChooser#} (FileChooserAction)@@ -100,8 +106,8 @@ -- | Creates a new file-selecting button widget. ---fileChooserButtonNew :: - String -- ^ @title@ - the title of the browse dialog.+fileChooserButtonNew :: GlibString string+ => string -- ^ @title@ - the title of the browse dialog. -> FileChooserAction -- ^ @action@ - the open mode for the widget. -> IO FileChooserButton fileChooserButtonNew title action =@@ -112,12 +118,14 @@ titlePtr ((fromIntegral . fromEnum) action) +#if GTK_MAJOR_VERSION < 3 -- | Creates a new file-selecting button widget using @backend@. ---fileChooserButtonNewWithBackend :: - String -- ^ @title@ - the title of the browse dialog.+-- Removed in Gtk3.+fileChooserButtonNewWithBackend :: GlibString string+ => string -- ^ @title@ - the title of the browse dialog. -> FileChooserAction -- ^ @action@ - the open mode for the widget.- -> String -- ^ @backend@ - the name of the file system backend+ -> string -- ^ @backend@ - the name of the file system backend -- to use. -> IO FileChooserButton fileChooserButtonNewWithBackend title action backend =@@ -129,11 +137,12 @@ titlePtr ((fromIntegral . fromEnum) action) backendPtr+#endif -- | Creates a 'FileChooserButton' widget which uses @dialog@ as it's -- file-picking window. ---fileChooserButtonNewWithDialog :: FileChooserDialogClass dialog => +fileChooserButtonNewWithDialog :: FileChooserDialogClass dialog => dialog -- ^ @dialog@ - the 'FileChooserDialog' widget to -- use. -> IO FileChooserButton@@ -148,8 +157,8 @@ -- | Retrieves the title of the browse dialog used by the button. ---fileChooserButtonGetTitle :: FileChooserButtonClass self => self- -> IO String -- ^ returns a pointer to the browse dialog's title.+fileChooserButtonGetTitle :: (FileChooserButtonClass self, GlibString string) => self+ -> IO string -- ^ returns a pointer to the browse dialog's title. fileChooserButtonGetTitle self = {# call gtk_file_chooser_button_get_title #} (toFileChooserButton self)@@ -157,8 +166,8 @@ -- | Modifies the @title@ of the browse dialog used by the button. ---fileChooserButtonSetTitle :: FileChooserButtonClass self => self- -> String -- ^ @title@ - the new browse dialog title.+fileChooserButtonSetTitle :: (FileChooserButtonClass self, GlibString string) => self+ -> string -- ^ @title@ - the new browse dialog title. -> IO () fileChooserButtonSetTitle self title = withUTFString title $ \titlePtr ->@@ -200,15 +209,25 @@ -- -- Default value: \"Select A File\" ---fileChooserButtonTitle :: FileChooserButtonClass self => Attr self String+fileChooserButtonTitle :: (FileChooserButtonClass self, GlibString string) => Attr self string fileChooserButtonTitle = newAttr fileChooserButtonGetTitle fileChooserButtonSetTitle --- | +-- | -- fileChooserButtonWidthChars :: FileChooserButtonClass self => Attr self Int fileChooserButtonWidthChars = newAttr fileChooserButtonGetWidthChars fileChooserButtonSetWidthChars++--------------------+-- Signals++-- %hash c:b660 d:ab72+-- | Emitted when the user selects a file.+--+fileChooserButtonFileSet :: FileChooserButtonClass self => Signal self (IO ())+fileChooserButtonFileSet = Signal (connect_NONE__NONE "file-set")+ #endif
Graphics/UI/Gtk/Selectors/FileChooserDialog.chs view
@@ -30,7 +30,7 @@ -- module Graphics.UI.Gtk.Selectors.FileChooserDialog ( -- * Detail--- +-- -- | 'FileChooserDialog' is a dialog box suitable for use with \"File\/Open\" -- or \"File\/Save as\" commands. This widget works by putting a -- 'FileChooserWidget' inside a 'Dialog'. It exposes the 'FileChooser',@@ -42,7 +42,7 @@ -- Instead, you should use the functions that work on a 'FileChooser'. -- ** Response Codes--- +-- -- | 'FileChooserDialog' inherits from 'Dialog', so buttons that go in its -- action area have response codes such as 'ResponseAccept' and -- 'ResponseCancel'.@@ -77,14 +77,14 @@ import Data.Maybe (isJust, fromJust) import System.Glib.FFI+import System.Glib.UTFString {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Selectors.FileChooser#}-import System.Glib.GObject (objectNew) import Graphics.UI.Gtk.Abstract.Object (makeNewObject) import Graphics.UI.Gtk.Windows.Window import Graphics.UI.Gtk.Windows.Dialog-import System.Glib.GValue (allocaGValue)-import System.Glib.GValueTypes (valueSetMaybeString)+import System.Glib.GValue (allocaGValue)+import System.Glib.GValueTypes (valueSetMaybeString) import System.Glib.Attributes {# context lib="gtk" prefix="gtk" #}@@ -101,10 +101,11 @@ -- | Creates a new 'FileChooserDialog'. -- fileChooserDialogNew- :: Maybe String -- ^ Title of the dialog (or default)+ :: GlibString string+ => Maybe string -- ^ Title of the dialog (or default) -> Maybe Window -- ^ Transient parent of the dialog (or none) -> FileChooserAction -- ^ Open or save mode for the dialog- -> [(String, ResponseId)] -- ^ Buttons and their response codes+ -> [(string, ResponseId)] -- ^ Buttons and their response codes -> IO FileChooserDialog fileChooserDialogNew title parent action buttons = internalFileChooserDialogNew title parent action buttons Nothing@@ -114,11 +115,12 @@ -- files and you use a more expressive vfs, such as gnome-vfs, to load files. -- fileChooserDialogNewWithBackend- :: Maybe String -- ^ Title of the dialog (or default)+ :: GlibString string+ => Maybe string -- ^ Title of the dialog (or default) -> Maybe Window -- ^ Transient parent of the dialog (or none) -> FileChooserAction -- ^ Open or save mode for the dialog- -> [(String, ResponseId)] -- ^ Buttons and their response codes- -> String -- ^ The name of the filesystem backend to use+ -> [(string, ResponseId)] -- ^ Buttons and their response codes+ -> string -- ^ The name of the filesystem backend to use -> IO FileChooserDialog fileChooserDialogNewWithBackend title parent action buttons backend = internalFileChooserDialogNew title parent action buttons (Just backend)@@ -128,12 +130,12 @@ -- bug, see <http://bugzilla.gnome.org/show_bug.cgi?id=141004> -- The solution is to call objectNew and add the buttons manually. -internalFileChooserDialogNew ::- Maybe String -> -- Title of the dialog (or default)+internalFileChooserDialogNew :: GlibString string =>+ Maybe string -> -- Title of the dialog (or default) Maybe Window -> -- Transient parent of the dialog (or none) FileChooserAction -> -- Open or save mode for the dialog- [(String, ResponseId)] -> -- Buttons and their response codes- Maybe String -> -- The name of the backend to use (optional)+ [(string, ResponseId)] -> -- Buttons and their response codes+ Maybe string -> -- The name of the backend to use (optional) IO FileChooserDialog internalFileChooserDialogNew title parent action buttons backend = do objType <- {# call unsafe gtk_file_chooser_dialog_get_type #}
Graphics/UI/Gtk/Selectors/FileChooserWidget.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Selectors.FileChooserWidget ( -- * Detail--- +-- -- | 'FileChooserWidget' is a widget suitable for selecting files. It is the -- main building block of a 'FileChooserDialog'. Most applications will only -- need to use the latter; you can use 'FileChooserWidget' as part of a larger@@ -60,8 +60,10 @@ -- * Constructors FileChooserAction, fileChooserWidgetNew,+#if GTK_MAJOR_VERSION < 3 fileChooserWidgetNewWithBackend, #endif+#endif ) where import Control.Monad (liftM)@@ -87,7 +89,7 @@ -- be embedded in custom windows, and it is the same widget that is used by -- 'FileChooserDialog'. ---fileChooserWidgetNew :: +fileChooserWidgetNew :: FileChooserAction -- ^ @action@ - Open or save mode for the widget -> IO FileChooserWidget fileChooserWidgetNew action =@@ -96,12 +98,14 @@ {# call unsafe gtk_file_chooser_widget_new #} ((fromIntegral . fromEnum) action) +#if GTK_MAJOR_VERSION < 3 -- | Creates a new 'FileChooserWidget' with a specified backend. This is -- especially useful if you use 'fileChooserSetLocalOnly' to allow non-local -- files. This is a file chooser widget that can be embedded in custom windows -- and it is the same widget that is used by 'FileChooserDialog'. ---fileChooserWidgetNewWithBackend :: +-- Removed in Gtk3.+fileChooserWidgetNewWithBackend :: FileChooserAction -- ^ @action@ - Open or save mode for the widget -> String -- ^ @backend@ - The name of the specific filesystem -- backend to use.@@ -113,4 +117,5 @@ {# call unsafe gtk_file_chooser_widget_new_with_backend #} ((fromIntegral . fromEnum) action) backendPtr+#endif #endif
Graphics/UI/Gtk/Selectors/FileFilter.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Selectors.FileFilter ( -- * Detail--- +-- -- | A 'FileFilter' can be used to restrict the files being shown in a -- 'FileChooser'. Files can be filtered based on their name (with -- 'fileFilterAddPattern'), on their mime type (with 'fileFilterAddMimeType'),@@ -78,15 +78,14 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.Flags (Flags, fromFlags)+import System.Glib.Flags (Flags, fromFlags) import System.Glib.UTFString import System.Glib.Attributes-import System.Glib.GObject (DestroyNotify, destroyFunPtr) {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {# context lib="gtk" prefix="gtk" #} @@ -115,8 +114,9 @@ -- be displayed in the file selector user interface if there is a selectable -- list of filters. ---fileFilterSetName :: FileFilter- -> String -- ^ @name@ - the human-readable-name for the filter+fileFilterSetName :: GlibString string+ => FileFilter+ -> string -- ^ @name@ - the human-readable-name for the filter -> IO () fileFilterSetName self name = withUTFString name $ \namePtr ->@@ -126,8 +126,9 @@ -- | Gets the human-readable name for the filter. See 'fileFilterSetName'. ---fileFilterGetName :: FileFilter- -> IO String -- ^ returns The human-readable name of the filter+fileFilterGetName :: GlibString string+ => FileFilter+ -> IO string -- ^ returns The human-readable name of the filter fileFilterGetName self = {# call gtk_file_filter_get_name #} self@@ -135,8 +136,9 @@ -- | Adds a rule allowing a given mime type to @filter@. ---fileFilterAddMimeType :: FileFilter- -> String -- ^ @mimeType@ - name of a MIME type+fileFilterAddMimeType :: GlibString string+ => FileFilter+ -> string -- ^ @mimeType@ - name of a MIME type -> IO () fileFilterAddMimeType self mimeType = withUTFString mimeType $ \mimeTypePtr ->@@ -146,8 +148,9 @@ -- | Adds a rule allowing a shell style glob to a filter. ---fileFilterAddPattern :: FileFilter- -> String -- ^ @pattern@ - a shell style glob+fileFilterAddPattern :: GlibString string+ => FileFilter+ -> string -- ^ @pattern@ - a shell style glob -> IO () fileFilterAddPattern self pattern = withUTFString pattern $ \patternPtr ->@@ -161,13 +164,13 @@ -- Gtk+ to avoid retrieving expensive information when it isn't needed by the -- filter. ---fileFilterAddCustom :: FileFilter+fileFilterAddCustom :: GlibString string => FileFilter -> [FileFilterFlags] -- ^ @needed@ - list of flags indicating the -- information that the custom filter function needs.- -> ( Maybe String -- filename- -> Maybe String -- uri- -> Maybe String -- display name- -> Maybe String -- mime type+ -> ( Maybe string -- filename+ -> Maybe string -- uri+ -> Maybe string -- display name+ -> Maybe string -- mime type -> IO Bool) -- ^ @(\filename uri displayName mimeType -> ...)@ - -- filter function; if the function -- returns @True@, then the file will be displayed.@@ -199,7 +202,7 @@ IO CInt foreign import ccall "wrapper" mkHandler_GtkFileFilterFunc ::- GtkFileFilterFunc -> + GtkFileFilterFunc -> IO (FunPtr GtkFileFilterFunc) #if GTK_CHECK_VERSION(2,6,0)@@ -218,7 +221,7 @@ -- | \'name\' property. See 'fileFilterGetName' and 'fileFilterSetName' ---fileFilterName :: Attr FileFilter String+fileFilterName :: GlibString string => Attr FileFilter string fileFilterName = newAttr fileFilterGetName fileFilterSetName
Graphics/UI/Gtk/Selectors/FileSelection.chs view
@@ -18,10 +18,6 @@ -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. ----- TODO------ Fix fileSelectionQueryButtons--- -- | -- Maintainer : gtk2hs-users@lists.sourceforge.net -- Stability : provisional@@ -31,9 +27,10 @@ -- -- * As of Gtk+ 2.4 this module has been deprecated in favour of 'FileChooser' --+-- This module is empty in Gtk3. module Graphics.UI.Gtk.Selectors.FileSelection ( -- * Detail--- +-- -- | 'FileSelection' should be used to retrieve file or directory names from -- the user. It will create a new dialog window containing a directory list, -- and a file list corresponding to the current working directory. The@@ -68,7 +65,7 @@ -- | +----'Dialog' -- | +----FileSelection -- @-+#if GTK_MAJOR_VERSION < 3 -- * Types FileSelection, FileSelectionClass,@@ -93,8 +90,9 @@ fileSelectionFilename, fileSelectionShowFileops, fileSelectionSelectMultiple,+#endif ) where-+#if GTK_MAJOR_VERSION < 3 import Control.Monad (liftM) import System.Glib.FFI@@ -102,8 +100,8 @@ import System.Glib.Attributes import System.Glib.Properties {#import Graphics.UI.Gtk.Types#}-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import Graphics.UI.Gtk.General.Structs (fileSelectionGetButtons)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.General.Structs (fileSelectionGetButtons) {# context lib="libgtk" prefix="gtk" #} @@ -115,8 +113,8 @@ -- listing. Operation buttons that allow the user to create a directory, delete -- files and rename files, are also present. ---fileSelectionNew :: - String -- ^ @title@ - a message that will be placed in the file+fileSelectionNew :: GlibString string+ => string -- ^ @title@ - a message that will be placed in the file -- requestor's titlebar. -> IO FileSelection fileSelectionNew title =@@ -137,8 +135,8 @@ -- working directory and an empty filename, @filename@ must have a trailing -- directory separator. ---fileSelectionSetFilename :: FileSelectionClass self => self- -> String -- ^ @filename@ - a string to set as the default file name.+fileSelectionSetFilename :: (FileSelectionClass self, GlibString string) => self+ -> string -- ^ @filename@ - a string to set as the default file name. -> IO () fileSelectionSetFilename self filename = withUTFString filename $ \filenamePtr ->@@ -154,8 +152,8 @@ -- -- If no file is selected then the selected directory path is returned. ---fileSelectionGetFilename :: FileSelectionClass self => self- -> IO String -- ^ returns currently-selected filename+fileSelectionGetFilename :: (FileSelectionClass self, GlibString string) => self+ -> IO string -- ^ returns currently-selected filename fileSelectionGetFilename self = #if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) {# call unsafe gtk_file_selection_get_filename_utf8 #}@@ -182,22 +180,6 @@ {# call file_selection_hide_fileop_buttons #} (toFileSelection self) --- currently broken--- -- query the widgets of the file selectors buttons--- ----- -- * this is useful to attach signals handlers to these buttons--- ----- -- * the buttons are OK & Cancel (in this order)--- ----- fileSelectionQueryButtons :: FileSelectionClass fsel --- => fsel--- -> IO (Button, Button)--- fileSelectionQueryButtons fsel =--- withForeignPtr (unFileSelection $ toFileSelection fsel) $ \ ptr -> do--- ok <- {#get FileSelection.ok_button #} ptr--- cancel <- {#get FileSelection.cancel_button#} ptr--- return (castToButton ok, castToButton cancel)- -- | Will attempt to match @pattern@ to a valid filenames or subdirectories in -- the current directory. If a match can be made, the matched filename will -- appear in the text entry field of the file selection dialog. If a partial@@ -205,8 +187,8 @@ -- have been partially matched, and the \"Folders\" list those directories -- which have been partially matched. ---fileSelectionComplete :: FileSelectionClass self => self- -> String -- ^ @pattern@ - a string of characters which may or may not match+fileSelectionComplete :: (FileSelectionClass self, GlibString string) => self+ -> string -- ^ @pattern@ - a string of characters which may or may not match -- any filenames in the current directory. -> IO () fileSelectionComplete self pattern =@@ -219,7 +201,7 @@ -- box. This function is intended for use when the user can select multiple -- files in the file list. ---fileSelectionGetSelections :: FileSelectionClass self => self -> IO [String]+fileSelectionGetSelections :: (FileSelectionClass self, GlibString string) => self -> IO [string] fileSelectionGetSelections self = do cStrArr <- #if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)@@ -262,7 +244,7 @@ -- | The currently selected filename. -- ---fileSelectionFilename :: FileSelectionClass self => Attr self String+fileSelectionFilename :: (FileSelectionClass self, GlibString string) => Attr self string fileSelectionFilename = newAttr fileSelectionGetFilename fileSelectionSetFilename@@ -282,3 +264,4 @@ fileSelectionSelectMultiple = newAttr fileSelectionGetSelectMultiple fileSelectionSetSelectMultiple+#endif
Graphics/UI/Gtk/Selectors/FontButton.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Selectors.FontButton ( -- * Detail--- +-- -- | The 'FontButton' is a button which displays the currently selected font -- an allows to open a font selection dialog to change the font. It is suitable -- widget for selecting a font in a preference dialog.@@ -85,13 +85,13 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} @@ -111,8 +111,8 @@ -- | Creates a new font picker widget. ---fontButtonNewWithFont :: - String -- ^ @fontname@ - Name of font to display in font selection+fontButtonNewWithFont :: GlibString string+ => string -- ^ @fontname@ - Name of font to display in font selection -- dialog -> IO FontButton fontButtonNewWithFont fontname =@@ -127,8 +127,8 @@ -- | Sets or updates the currently-displayed font in font picker dialog. ---fontButtonSetFontName :: FontButtonClass self => self- -> String -- ^ @fontname@ - Name of font to display in font selection dialog+fontButtonSetFontName :: (FontButtonClass self, GlibString string) => self+ -> string -- ^ @fontname@ - Name of font to display in font selection dialog -> IO Bool -- ^ returns Return value of 'Graphics.UI.Gtk.Selectors.FontSelectionDialog.fontSelectionDialogSetFontName' if -- the font selection dialog exists, otherwise @False@. fontButtonSetFontName self fontname =@@ -140,8 +140,8 @@ -- | Retrieves the name of the currently selected font. ---fontButtonGetFontName :: FontButtonClass self => self- -> IO String -- ^ returns an internal copy of the font name which must not be+fontButtonGetFontName :: (FontButtonClass self, GlibString string) => self+ -> IO string -- ^ returns an internal copy of the font name which must not be -- freed. fontButtonGetFontName self = {# call gtk_font_button_get_font_name #}@@ -233,8 +233,8 @@ -- | Sets the title for the font selection dialog. ---fontButtonSetTitle :: FontButtonClass self => self- -> String -- ^ @title@ - a string containing the font selection dialog title+fontButtonSetTitle :: (FontButtonClass self, GlibString string) => self+ -> string -- ^ @title@ - a string containing the font selection dialog title -> IO () fontButtonSetTitle self title = withUTFString title $ \titlePtr ->@@ -244,8 +244,8 @@ -- | Retrieves the title of the font selection dialog. ---fontButtonGetTitle :: FontButtonClass self => self- -> IO String -- ^ returns an internal copy of the title string which must not+fontButtonGetTitle :: (FontButtonClass self, GlibString string) => self+ -> IO string -- ^ returns an internal copy of the title string which must not -- be freed. fontButtonGetTitle self = {# call gtk_font_button_get_title #}@@ -259,7 +259,7 @@ -- -- Default value: \"Pick a Font\" ---fontButtonTitle :: FontButtonClass self => Attr self String+fontButtonTitle :: (FontButtonClass self, GlibString string) => Attr self string fontButtonTitle = newAttr fontButtonGetTitle fontButtonSetTitle@@ -268,7 +268,7 @@ -- -- Default value: \"Sans 12\" ---fontButtonFontName :: FontButtonClass self => Attr self String+fontButtonFontName :: (FontButtonClass self, GlibString string) => Attr self string fontButtonFontName = newAttrFromStringProperty "font-name" -- | If this property is set to @True@, the label will be drawn in the@@ -316,7 +316,7 @@ -------------------- -- Signals --- | The ::font-set signal is emitted when the user selects a font. When+-- | The 'fontSet' signal is emitted when the user selects a font. When -- handling this signal, use 'fontButtonGetFontName' to find out which font was -- just selected. --
Graphics/UI/Gtk/Selectors/FontSelection.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget FontSelection --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Selectors.FontSelection ( -- * Detail--- +-- -- | The 'FontSelection' widget lists the available fonts, styles and sizes, -- allowing the user to select a font. It is used in the 'FontSelectionDialog' -- widget to provide a dialog box for selecting fonts.@@ -71,13 +72,13 @@ fontSelectionPreviewText, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -98,8 +99,8 @@ -- | Gets the currently-selected font name. ---fontSelectionGetFontName :: FontSelectionClass self => self- -> IO (Maybe String) -- ^ returns the name of the currently selected font, or+fontSelectionGetFontName :: (FontSelectionClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns the name of the currently selected font, or -- @Nothing@ if no font is selected. fontSelectionGetFontName self = {# call unsafe font_selection_get_font_name #}@@ -108,8 +109,8 @@ -- | Sets the currently-selected font. ---fontSelectionSetFontName :: FontSelectionClass self => self- -> String -- ^ @fontname@ - a fontname.+fontSelectionSetFontName :: (FontSelectionClass self, GlibString string) => self+ -> string -- ^ @fontname@ - a fontname. -> IO Bool -- ^ returns @True@ if the font was found. fontSelectionSetFontName self fontname = liftM toBool $@@ -120,7 +121,7 @@ -- | Gets the text displayed in the preview area. ---fontSelectionGetPreviewText :: FontSelectionClass self => self -> IO String+fontSelectionGetPreviewText :: (FontSelectionClass self, GlibString string) => self -> IO string fontSelectionGetPreviewText self = {# call unsafe font_selection_get_preview_text #} (toFontSelection self)@@ -128,7 +129,7 @@ -- | Sets the text displayed in the preview area. ---fontSelectionSetPreviewText :: FontSelectionClass self => self -> String -> IO ()+fontSelectionSetPreviewText :: (FontSelectionClass self, GlibString string) => self -> string -> IO () fontSelectionSetPreviewText self text = withUTFString text $ \textPtr -> {# call font_selection_set_preview_text #}@@ -142,14 +143,14 @@ -- -- Default value: \"\" ---fontSelectionFontName :: FontSelectionClass self => Attr self String+fontSelectionFontName :: (FontSelectionClass self, GlibString string) => Attr self string fontSelectionFontName = newAttrFromStringProperty "font_name" -- | The text to display in order to demonstrate the selected font. -- -- Default value: \"abcdefghijk ABCDEFGHIJK\" ---fontSelectionPreviewText :: FontSelectionClass self => Attr self String+fontSelectionPreviewText :: (FontSelectionClass self, GlibString string) => Attr self string fontSelectionPreviewText = newAttr fontSelectionGetPreviewText fontSelectionSetPreviewText
Graphics/UI/Gtk/Selectors/FontSelectionDialog.chs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget FontSelectionDialog --@@ -26,7 +27,7 @@ -- module Graphics.UI.Gtk.Selectors.FontSelectionDialog ( -- * Detail--- +-- -- | The 'FontSelectionDialog' widget is a dialog box for selecting a font. -- -- To set the font which is initially selected, use@@ -64,17 +65,24 @@ fontSelectionDialogSetFontName, fontSelectionDialogGetPreviewText, fontSelectionDialogSetPreviewText,+#if GTK_CHECK_VERSION(2,14,0)+ fontSelectionDialogGetCancelButton,+ fontSelectionDialogGetOkButton,+#endif+#if GTK_CHECK_VERSION(2,22,0)+ fontSelectionDialogGetFontSelection,+#endif -- * Attributes fontSelectionDialogPreviewText, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -84,8 +92,8 @@ -- | Creates a new 'FontSelectionDialog'. ---fontSelectionDialogNew :: - String -- ^ @title@ - the title of the dialog box.+fontSelectionDialogNew :: GlibString string+ => string -- ^ @title@ - the title of the dialog box. -> IO FontSelectionDialog fontSelectionDialogNew title = makeNewObject mkFontSelectionDialog $@@ -99,8 +107,8 @@ -- | Gets the currently-selected font name. ---fontSelectionDialogGetFontName :: FontSelectionDialogClass self => self- -> IO (Maybe String) -- ^ returns the currently-selected font name, or+fontSelectionDialogGetFontName :: (FontSelectionDialogClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns the currently-selected font name, or -- @Nothing@ if no font is selected. fontSelectionDialogGetFontName self = {# call font_selection_dialog_get_font_name #}@@ -109,8 +117,8 @@ -- | Sets the currently-selected font. ---fontSelectionDialogSetFontName :: FontSelectionDialogClass self => self- -> String -- ^ @fontname@ - a fontname.+fontSelectionDialogSetFontName :: (FontSelectionDialogClass self, GlibString string) => self+ -> string -- ^ @fontname@ - a fontname. -> IO Bool -- ^ returns @True@ if the font was found. fontSelectionDialogSetFontName self fontname = liftM toBool $@@ -121,7 +129,7 @@ -- | Gets the text displayed in the preview area. ---fontSelectionDialogGetPreviewText :: FontSelectionDialogClass self => self -> IO String+fontSelectionDialogGetPreviewText :: (FontSelectionDialogClass self, GlibString string) => self -> IO string fontSelectionDialogGetPreviewText self = {# call unsafe font_selection_dialog_get_preview_text #} (toFontSelectionDialog self)@@ -129,20 +137,59 @@ -- | Sets the text displayed in the preview area. ---fontSelectionDialogSetPreviewText :: FontSelectionDialogClass self => self -> String -> IO ()+fontSelectionDialogSetPreviewText :: (FontSelectionDialogClass self, GlibString string) => self -> string -> IO () fontSelectionDialogSetPreviewText self text = withUTFString text $ \textPtr -> {# call font_selection_dialog_set_preview_text #} (toFontSelectionDialog self) textPtr +#if GTK_CHECK_VERSION(2,14,0)+-- | Gets the 'Cancel' button.+--+-- * Available since Gtk+ version 2.14+--+fontSelectionDialogGetCancelButton :: FontSelectionDialogClass self => self+ -> IO Widget -- ^ returns the 'Widget' used in the dialog for the 'Cancel' button.+fontSelectionDialogGetCancelButton self =+ makeNewObject mkWidget $+ {#call gtk_font_selection_dialog_get_cancel_button #}+ (toFontSelectionDialog self)++-- | Gets the 'OK' button.+--+-- * Available since Gtk+ version 2.14+--+fontSelectionDialogGetOkButton :: FontSelectionDialogClass self => self+ -> IO Widget -- ^ returns the 'Widget' used in the dialog for the 'OK' button.+fontSelectionDialogGetOkButton self =+ makeNewObject mkWidget $+ {#call gtk_font_selection_dialog_get_ok_button #}+ (toFontSelectionDialog self)++#endif++#if GTK_CHECK_VERSION(2,22,0)+-- | Retrieves the 'FontSelection' widget embedded in the dialog.+--+-- * Available since Gtk+ version 2.22+--+fontSelectionDialogGetFontSelection :: FontSelectionDialogClass self => self+ -> IO FontSelection -- ^ returns the embedded 'FontSelection'+fontSelectionDialogGetFontSelection self =+ makeNewObject mkFontSelection $+ liftM (castPtr :: Ptr Widget -> Ptr FontSelection) $+ {#call gtk_font_selection_dialog_get_font_selection #}+ (toFontSelectionDialog self)+#endif+ -------------------- -- Attributes -- | \'previewText\' property. See 'fontSelectionDialogGetPreviewText' and -- 'fontSelectionDialogSetPreviewText' ---fontSelectionDialogPreviewText :: FontSelectionDialogClass self => Attr self String+fontSelectionDialogPreviewText :: (FontSelectionDialogClass self, GlibString string) => Attr self string fontSelectionDialogPreviewText = newAttr fontSelectionDialogGetPreviewText fontSelectionDialogSetPreviewText
+ Graphics/UI/Gtk/Selectors/HSV.chs view
@@ -0,0 +1,274 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget HSV+--+-- Author : Andy Stewart+--+-- Created: 25 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A \'color wheel\' widget+--+-- * Module available since Gtk+ version 2.14+--+module Graphics.UI.Gtk.Selectors.HSV (++-- * Detail+--+-- | 'HSV' is the \'color wheel\' part of a complete color selector widget. It+-- allows to select a color by determining its 'HSV' components in an intuitive+-- way. Moving the selection around the outer ring changes the hue, and moving+-- the selection point inside the inner triangle changes value and saturation.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----HSV+-- @++#if GTK_CHECK_VERSION(2,14,0)+-- * Types+ HSV,+ HSVClass,+ castToHSV,+ toHSV,++-- * Constructors+ hsvNew,++-- * Methods+ hsvIsAdjusting,+ hsvToRgb,+ rgbToHsv,++-- * Attributes+ hsvColor,+ hsvMetrics,++-- * Signals+ hsvChanged,+ hsvMove,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.Attributes+import Graphics.UI.Gtk.General.Enums (DirectionType (..))+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Signals#}+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,14,0)+--------------------+-- Constructors++-- | Creates a new 'HSV' color selector.+--+-- * Available since 2.14+--+hsvNew :: IO HSV+hsvNew =+ makeNewObject mkHSV $+ liftM (castPtr :: Ptr Widget -> Ptr HSV) $+ {# call gtk_hsv_new #}++--------------------+-- Methods++-- | Sets the current color in an 'HSV' color selector. Color component values+-- must be in the [0.0, 1.0] range.+--+-- * Available since 2.14+--+hsvSetColor :: HSVClass self => self+ -> (Double, Double, Double)+ -- ^ @(h, s, v)@+ -- @h@ - value for the hue+ -- @s@ value for the saturation+ -- @v@ value for the value+ -> IO ()+hsvSetColor self (h, s, v) =+ {# call gtk_hsv_set_color #}+ (toHSV self)+ (realToFrac h)+ (realToFrac s)+ (realToFrac v)++-- | Queries the current color in an 'HSV' color selector. Returned values will+-- be in the [0.0, 1.0] range.+--+hsvGetColor :: HSVClass self => self+ -> IO (Double, Double, Double) -- ^ @(h, s, v)@ @h@ - Return value for the hue @s@ -+ -- Return value for the saturation @v@ - Return+ -- value for the value+hsvGetColor self =+ alloca $ \hPtr ->+ alloca $ \sPtr ->+ alloca $ \vPtr -> do+ {# call gtk_hsv_get_color #}+ (toHSV self)+ hPtr+ sPtr+ vPtr+ h <- peek hPtr+ s <- peek sPtr+ v <- peek vPtr+ return (realToFrac h, realToFrac s, realToFrac v)++-- | Sets the size and ring width of an 'HSV' color selector.+--+hsvSetMetrics :: HSVClass self => self+ -> (Int, Int)+ -- ^ @(size, ringWidth)@+ -- ^ @size@ - Diameter for the hue ring+ -- ^ @ringWidth@ - Width of the hue ring+ -> IO ()+hsvSetMetrics self (size, ringWidth) =+ {# call gtk_hsv_set_metrics #}+ (toHSV self)+ (fromIntegral size)+ (fromIntegral ringWidth)++-- | Queries the size and ring width of an 'HSV' color selector.+--+hsvGetMetrics :: HSVClass self => self+ -> IO (Int, Int) -- ^ @(size, ringWidth)@+ -- @size@ - Return value for the diameter of the hue ring+ -- @ringWidth@ - Return value for the width of the hue ring+hsvGetMetrics self =+ alloca $ \sizePtr ->+ alloca $ \ringWidthPtr -> do+ {# call gtk_hsv_get_metrics #}+ (toHSV self)+ sizePtr+ ringWidthPtr+ size <- peek sizePtr+ ringWidth <- peek ringWidthPtr+ return (fromIntegral size, fromIntegral ringWidth)++-- | An 'HSV' color selector can be said to be adjusting if multiple rapid+-- changes are being made to its value, for example, when the user is adjusting+-- the value with the mouse. This function queries whether the 'HSV' color+-- selector is being adjusted or not.+--+hsvIsAdjusting :: HSVClass self => self+ -> IO Bool -- ^ returns @True@ if clients can ignore changes to the color+ -- value, since they may be transitory, or @False@ if they should+ -- consider the color value status to be final.+hsvIsAdjusting self =+ liftM toBool $+ {# call gtk_hsv_is_adjusting #}+ (toHSV self)++-- | Converts a color from 'HSV' space to RGB. Input values must be in the [0.0,+-- 1.0] range; output values will be in the same range.+--+hsvToRgb ::+ (Double, Double, Double)+ -- ^ @(h, s, v)@+ -- @h@ - value for the hue+ -- @s@ value for the saturation+ -- @v@ value for the value+ -> (Double, Double, Double) -- ^ @(r, g, b)@ @r@ - Return value for the red+ -- component @g@ - Return value for the green+ -- component @b@ - Return value for the blue+ -- component+hsvToRgb (h, s, v) =+ unsafePerformIO $+ alloca $ \rPtr ->+ alloca $ \gPtr ->+ alloca $ \bPtr -> do+ {# call gtk_hsv_to_rgb #}+ (realToFrac h)+ (realToFrac s)+ (realToFrac v)+ rPtr+ gPtr+ bPtr+ r <- peek rPtr+ g <- peek gPtr+ b <- peek bPtr+ return (realToFrac r, realToFrac g, realToFrac b)++-- | Converts a color from RGB space to 'HSV'. Input values must be in the [0.0, 1.0] range; output values+-- will be in the same range.+rgbToHsv ::+ (Double, Double, Double)+ -- ^ @(r, g, b)@ @r@ value for the red component+ -- @g@ value for the green component+ -- @b@ value for the blue component+ -> (Double, Double, Double)+ -- ^ @(h, s, v)@+ -- @h@ - Return value for the hue+ -- @s@ - Return value for the saturation+ -- @v@ - Return value for the value+rgbToHsv (r, g, b) =+ unsafePerformIO $+ alloca $ \hPtr ->+ alloca $ \sPtr ->+ alloca $ \vPtr -> do+ {# call rgb_to_hsv #}+ (realToFrac r)+ (realToFrac g)+ (realToFrac b)+ hPtr+ sPtr+ vPtr+ h <- peek hPtr+ s <- peek sPtr+ v <- peek vPtr+ return (realToFrac h, realToFrac s, realToFrac v)++--------------------+-- Attributes+-- | Color in an 'HSV' color selector.+-- Color component values must be in the [0.0, 1.0] range.+hsvColor :: HSVClass self => Attr self (Double, Double, Double)+hsvColor = newAttr+ hsvGetColor+ hsvSetColor++-- | The size and ring width of an 'HSV' color selector.+hsvMetrics :: HSVClass self => Attr self (Int, Int)+hsvMetrics = newAttr+ hsvGetMetrics+ hsvSetMetrics++--------------------+-- Signals++-- |+--+hsvChanged :: HSVClass self => Signal self (IO ())+hsvChanged = Signal (connect_NONE__NONE "changed")++-- |+--+hsvMove :: HSVClass self => Signal self (DirectionType -> IO ())+hsvMove = Signal (connect_ENUM__NONE "move")++#endif
− Graphics/UI/Gtk/Signals.chs
@@ -1,850 +0,0 @@-{-# OPTIONS_HADDOCK hide #-}--- -*-haskell-*---- -------------------- automatically generated file - do not edit --------------- Callback installers for the GIMP Toolkit (GTK) Binding for Haskell------ Author : Axel Simon------ Created: 1 July 2000------ Copyright (C) 2000-2005 Axel Simon------ This library is free software; you can redistribute it and/or--- modify it under the terms of the GNU Lesser General Public--- License as published by the Free Software Foundation; either--- version 2.1 of the License, or (at your option) any later version.------ This library is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU--- Lesser General Public License for more details.------ #hide---- These functions are used to connect signals to widgets. They are auto---- matically created through HookGenerator.hs which takes a list of possible--- function signatures that are included in the GTK sources (gtkmarshal.list).------ The object system in the second version of GTK is based on GObject from--- GLIB. This base class is rather primitive in that it only implements--- ref and unref methods (and others that are not interesting to us). If--- the marshall list mentions OBJECT it refers to an instance of this --- GObject which is automatically wrapped with a ref and unref call.--- Structures which are not derived from GObject have to be passed as--- BOXED which gives the signal connect function a possibility to do the--- conversion into a proper ForeignPtr type. In special cases the signal--- connect function use a PTR type which will then be mangled in the--- user function directly. The latter is needed if a signal delivers a--- pointer to a string and its length in a separate integer.----module Graphics.UI.Gtk.Signals (- module System.Glib.Signals,-- connect_BOXED__BOOL,- connect_PTR__BOOL,- connect_BOXED_BOXED__BOOL,- connect_ENUM__BOOL,- connect_ENUM_DOUBLE__BOOL,- connect_INT__BOOL,- connect_OBJECT_BOXED__BOOL,- connect_INT_INT__BOOL,- connect_INT_INT_INT__BOOL,- connect_WORD__BOOL,- connect_NONE__BOOL,- connect_BOOL__BOOL,- connect_NONE__ENUM,- connect_ENUM__ENUM,- connect_PTR__INT,- connect_BOOL__NONE,- connect_INT__NONE,- connect_INT_INT__NONE,- connect_NONE__NONE,- connect_DOUBLE__NONE,- connect_BOXED__NONE,- connect_BOXED_BOXED__NONE,- connect_BOXED_BOXED_PTR__NONE,- connect_BOXED_OBJECT__NONE,- connect_BOXED_WORD__NONE,- connect_ENUM__NONE,- connect_ENUM_INT__NONE,- connect_ENUM_INT_BOOL__NONE,- connect_OBJECT__NONE,- connect_MOBJECT__NONE,- connect_OBJECT_BOXED_BOXED__NONE,- connect_OBJECT_OBJECT__NONE,- connect_PTR__NONE,- connect_PTR_WORD__NONE,- connect_STRING__NONE,- connect_STRING_STRING__NONE,- connect_WORD_WORD__NONE,- connect_WORD_STRING__NONE,- connect_BOXED_PTR_INT__NONE,- connect_INT_BOOL__NONE,- connect_OBJECT_STRING__NONE,- connect_STRING__BOOL,- connect_OBJECT_PTR_BOXED__BOOL,- connect_PTR_BOXED_BOXED__BOOL,- connect_PTR_INT_PTR__NONE,- connect_PTR_WORD_WORD__NONE,- connect_OBJECT_PTR_WORD_WORD__NONE,- connect_OBJECT_INT_INT_PTR_WORD_WORD__NONE,- connect_OBJECT_INT_INT_WORD__BOOL,- connect_OBJECT_WORD__NONE,- connect_OBJECT_ENUM__BOOL,- connect_BOXED_STRING__NONE,- connect_OBJECT_INT__NONE,- connect_ENUM_BOOL__BOOL,- connect_BOXED_INT__NONE,- connect_OBJECT_INT_INT_BOOL_OBJECT__BOOL,- - ) where--import Control.Monad (liftM)--import System.Glib.FFI-import System.Glib.UTFString (peekUTFString)-import System.Glib.GError (failOnGError)-{#import System.Glib.Signals#}-{#import System.Glib.GObject#} -import Graphics.UI.Gtk.General.Threading---{#context lib="gtk" prefix="gtk" #}----- Here are the generators that turn a Haskell function into--- a C function pointer. The fist Argument is always the widget,--- the last one is the user g_pointer. Both are ignored.---connect_BOXED__BOOL :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> - ConnectAfter -> obj ->- (a -> IO Bool) ->- IO (ConnectId obj)-connect_BOXED__BOOL signal boxedPre1 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> IO Bool- action _ box1 =- failOnGError $- boxedPre1 (castPtr box1) >>= \box1' ->- user box1'--connect_PTR__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Ptr a -> IO Bool) ->- IO (ConnectId obj)-connect_PTR__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> IO Bool- action _ ptr1 =- failOnGError $- user (castPtr ptr1)--connect_BOXED_BOXED__BOOL :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> (Ptr b' -> IO b) -> - ConnectAfter -> obj ->- (a -> b -> IO Bool) ->- IO (ConnectId obj)-connect_BOXED_BOXED__BOOL signal boxedPre1 boxedPre2 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Ptr () -> IO Bool- action _ box1 box2 =- failOnGError $- boxedPre2 (castPtr box2) >>= \box2' ->- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' box2'--connect_ENUM__BOOL :: - (Enum a, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a -> IO Bool) ->- IO (ConnectId obj)-connect_ENUM__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> IO Bool- action _ enum1 =- failOnGError $- user (toEnum enum1)--connect_ENUM_DOUBLE__BOOL :: - (Enum a, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a -> Double -> IO Bool) ->- IO (ConnectId obj)-connect_ENUM_DOUBLE__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Double -> IO Bool- action _ enum1 double2 =- failOnGError $- user (toEnum enum1) double2--connect_INT__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Int -> IO Bool) ->- IO (ConnectId obj)-connect_INT__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> IO Bool- action _ int1 =- failOnGError $- user int1--connect_OBJECT_BOXED__BOOL :: - (GObjectClass a', GObjectClass obj) => SignalName ->- (Ptr b' -> IO b) -> - ConnectAfter -> obj ->- (a' -> b -> IO Bool) ->- IO (ConnectId obj)-connect_OBJECT_BOXED__BOOL signal boxedPre2 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Ptr () -> IO Bool- action _ obj1 box2 =- failOnGError $- boxedPre2 (castPtr box2) >>= \box2' ->- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') box2'--connect_INT_INT__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Int -> Int -> IO Bool) ->- IO (ConnectId obj)-connect_INT_INT__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Int -> IO Bool- action _ int1 int2 =- failOnGError $- user int1 int2--connect_INT_INT_INT__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Int -> Int -> Int -> IO Bool) ->- IO (ConnectId obj)-connect_INT_INT_INT__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Int -> Int -> IO Bool- action _ int1 int2 int3 =- failOnGError $- user int1 int2 int3--connect_WORD__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Word -> IO Bool) ->- IO (ConnectId obj)-connect_WORD__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Word -> IO Bool- action _ int1 =- failOnGError $- user int1--connect_NONE__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (IO Bool) ->- IO (ConnectId obj)-connect_NONE__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> IO Bool- action _ =- failOnGError $- user--connect_BOOL__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Bool -> IO Bool) ->- IO (ConnectId obj)-connect_BOOL__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Bool -> IO Bool- action _ bool1 =- failOnGError $- user bool1--connect_NONE__ENUM :: - (Enum a, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (IO a) ->- IO (ConnectId obj)-connect_NONE__ENUM signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> IO Int- action _ =- failOnGError $- liftM fromEnum $ - user--connect_ENUM__ENUM :: - (Enum a, Enum b, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a -> IO b) ->- IO (ConnectId obj)-connect_ENUM__ENUM signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> IO Int- action _ enum1 =- failOnGError $- liftM fromEnum $ - user (toEnum enum1)--connect_PTR__INT :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Ptr a -> IO Int) ->- IO (ConnectId obj)-connect_PTR__INT signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> IO Int- action _ ptr1 =- failOnGError $- user (castPtr ptr1)--connect_BOOL__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Bool -> IO ()) ->- IO (ConnectId obj)-connect_BOOL__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Bool -> IO ()- action _ bool1 =- failOnGError $- user bool1--connect_INT__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Int -> IO ()) ->- IO (ConnectId obj)-connect_INT__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> IO ()- action _ int1 =- failOnGError $- user int1--connect_INT_INT__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Int -> Int -> IO ()) ->- IO (ConnectId obj)-connect_INT_INT__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Int -> IO ()- action _ int1 int2 =- failOnGError $- user int1 int2--connect_NONE__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (IO ()) ->- IO (ConnectId obj)-connect_NONE__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> IO ()- action _ =- failOnGError $- user--connect_DOUBLE__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Double -> IO ()) ->- IO (ConnectId obj)-connect_DOUBLE__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Double -> IO ()- action _ double1 =- failOnGError $- user double1--connect_BOXED__NONE :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> - ConnectAfter -> obj ->- (a -> IO ()) ->- IO (ConnectId obj)-connect_BOXED__NONE signal boxedPre1 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> IO ()- action _ box1 =- failOnGError $- boxedPre1 (castPtr box1) >>= \box1' ->- user box1'--connect_BOXED_BOXED__NONE :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> (Ptr b' -> IO b) -> - ConnectAfter -> obj ->- (a -> b -> IO ()) ->- IO (ConnectId obj)-connect_BOXED_BOXED__NONE signal boxedPre1 boxedPre2 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Ptr () -> IO ()- action _ box1 box2 =- failOnGError $- boxedPre2 (castPtr box2) >>= \box2' ->- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' box2'--connect_BOXED_BOXED_PTR__NONE :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> (Ptr b' -> IO b) -> - ConnectAfter -> obj ->- (a -> b -> Ptr c -> IO ()) ->- IO (ConnectId obj)-connect_BOXED_BOXED_PTR__NONE signal boxedPre1 boxedPre2 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Ptr () -> Ptr () -> IO ()- action _ box1 box2 ptr3 =- failOnGError $- boxedPre2 (castPtr box2) >>= \box2' ->- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' box2' (castPtr ptr3)--connect_BOXED_OBJECT__NONE :: - (GObjectClass b', GObjectClass obj) => SignalName ->- (Ptr a' -> IO a) -> - ConnectAfter -> obj ->- (a -> b' -> IO ()) ->- IO (ConnectId obj)-connect_BOXED_OBJECT__NONE signal boxedPre1 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Ptr GObject -> IO ()- action _ box1 obj2 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj2) >>= \obj2' ->- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' (unsafeCastGObject obj2')--connect_BOXED_WORD__NONE :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> - ConnectAfter -> obj ->- (a -> Word -> IO ()) ->- IO (ConnectId obj)-connect_BOXED_WORD__NONE signal boxedPre1 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Word -> IO ()- action _ box1 int2 =- failOnGError $- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' int2--connect_ENUM__NONE :: - (Enum a, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a -> IO ()) ->- IO (ConnectId obj)-connect_ENUM__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> IO ()- action _ enum1 =- failOnGError $- user (toEnum enum1)--connect_ENUM_INT__NONE :: - (Enum a, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a -> Int -> IO ()) ->- IO (ConnectId obj)-connect_ENUM_INT__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Int -> IO ()- action _ enum1 int2 =- failOnGError $- user (toEnum enum1) int2--connect_ENUM_INT_BOOL__NONE :: - (Enum a, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a -> Int -> Bool -> IO ()) ->- IO (ConnectId obj)-connect_ENUM_INT_BOOL__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Int -> Bool -> IO ()- action _ enum1 int2 bool3 =- failOnGError $- user (toEnum enum1) int2 bool3--connect_OBJECT__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> IO ()- action _ obj1 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1')--connect_MOBJECT__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (Maybe a' -> IO ()) ->- IO (ConnectId obj)-connect_MOBJECT__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> IO ()- action _ obj1 =- failOnGError $- maybeNull (makeNewGObject (GObject, objectUnrefFromMainloop)) (return obj1) >>= \obj1' ->- user (liftM unsafeCastGObject obj1')--connect_OBJECT_BOXED_BOXED__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- (Ptr b' -> IO b) -> (Ptr c' -> IO c) -> - ConnectAfter -> obj ->- (a' -> b -> c -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT_BOXED_BOXED__NONE signal boxedPre2 boxedPre3 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Ptr () -> IO ()- action _ obj1 box2 box3 =- failOnGError $- boxedPre3 (castPtr box3) >>= \box3' ->- boxedPre2 (castPtr box2) >>= \box2' ->- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') box2' box3'--connect_OBJECT_OBJECT__NONE :: - (GObjectClass a', GObjectClass b', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> b' -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT_OBJECT__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Ptr GObject -> IO ()- action _ obj1 obj2 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj2) >>= \obj2' ->- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') (unsafeCastGObject obj2')--connect_PTR__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Ptr a -> IO ()) ->- IO (ConnectId obj)-connect_PTR__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> IO ()- action _ ptr1 =- failOnGError $- user (castPtr ptr1)--connect_PTR_WORD__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Ptr a -> Word -> IO ()) ->- IO (ConnectId obj)-connect_PTR_WORD__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Word -> IO ()- action _ ptr1 int2 =- failOnGError $- user (castPtr ptr1) int2--connect_STRING__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (String -> IO ()) ->- IO (ConnectId obj)-connect_STRING__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> CString -> IO ()- action _ str1 =- failOnGError $- peekUTFString str1 >>= \str1' ->- user str1'--connect_STRING_STRING__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (String -> String -> IO ()) ->- IO (ConnectId obj)-connect_STRING_STRING__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> CString -> CString -> IO ()- action _ str1 str2 =- failOnGError $- peekUTFString str2 >>= \str2' ->- peekUTFString str1 >>= \str1' ->- user str1' str2'--connect_WORD_WORD__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Word -> Word -> IO ()) ->- IO (ConnectId obj)-connect_WORD_WORD__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Word -> Word -> IO ()- action _ int1 int2 =- failOnGError $- user int1 int2--connect_WORD_STRING__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Word -> String -> IO ()) ->- IO (ConnectId obj)-connect_WORD_STRING__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Word -> CString -> IO ()- action _ int1 str2 =- failOnGError $- peekUTFString str2 >>= \str2' ->- user int1 str2'--connect_BOXED_PTR_INT__NONE :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> - ConnectAfter -> obj ->- (a -> Ptr b -> Int -> IO ()) ->- IO (ConnectId obj)-connect_BOXED_PTR_INT__NONE signal boxedPre1 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Ptr () -> Int -> IO ()- action _ box1 ptr2 int3 =- failOnGError $- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' (castPtr ptr2) int3--connect_INT_BOOL__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Int -> Bool -> IO ()) ->- IO (ConnectId obj)-connect_INT_BOOL__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Bool -> IO ()- action _ int1 bool2 =- failOnGError $- user int1 bool2--connect_OBJECT_STRING__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> String -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT_STRING__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> CString -> IO ()- action _ obj1 str2 =- failOnGError $- peekUTFString str2 >>= \str2' ->- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') str2'--connect_STRING__BOOL :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (String -> IO Bool) ->- IO (ConnectId obj)-connect_STRING__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> CString -> IO Bool- action _ str1 =- failOnGError $- peekUTFString str1 >>= \str1' ->- user str1'--connect_OBJECT_PTR_BOXED__BOOL :: - (GObjectClass a', GObjectClass obj) => SignalName ->- (Ptr c' -> IO c) -> - ConnectAfter -> obj ->- (a' -> Ptr b -> c -> IO Bool) ->- IO (ConnectId obj)-connect_OBJECT_PTR_BOXED__BOOL signal boxedPre3 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Ptr () -> IO Bool- action _ obj1 ptr2 box3 =- failOnGError $- boxedPre3 (castPtr box3) >>= \box3' ->- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') (castPtr ptr2) box3'--connect_PTR_BOXED_BOXED__BOOL :: - GObjectClass obj => SignalName ->- (Ptr b' -> IO b) -> (Ptr c' -> IO c) -> - ConnectAfter -> obj ->- (Ptr a -> b -> c -> IO Bool) ->- IO (ConnectId obj)-connect_PTR_BOXED_BOXED__BOOL signal boxedPre2 boxedPre3 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Ptr () -> Ptr () -> IO Bool- action _ ptr1 box2 box3 =- failOnGError $- boxedPre3 (castPtr box3) >>= \box3' ->- boxedPre2 (castPtr box2) >>= \box2' ->- user (castPtr ptr1) box2' box3'--connect_PTR_INT_PTR__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Ptr a -> Int -> Ptr c -> IO ()) ->- IO (ConnectId obj)-connect_PTR_INT_PTR__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Int -> Ptr () -> IO ()- action _ ptr1 int2 ptr3 =- failOnGError $- user (castPtr ptr1) int2 (castPtr ptr3)--connect_PTR_WORD_WORD__NONE :: - GObjectClass obj => SignalName ->- ConnectAfter -> obj ->- (Ptr a -> Word -> Word -> IO ()) ->- IO (ConnectId obj)-connect_PTR_WORD_WORD__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Word -> Word -> IO ()- action _ ptr1 int2 int3 =- failOnGError $- user (castPtr ptr1) int2 int3--connect_OBJECT_PTR_WORD_WORD__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> Ptr b -> Word -> Word -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT_PTR_WORD_WORD__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Ptr () -> Word -> Word -> IO ()- action _ obj1 ptr2 int3 int4 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') (castPtr ptr2) int3 int4--connect_OBJECT_INT_INT_PTR_WORD_WORD__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> Int -> Int -> Ptr d -> Word -> Word -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT_INT_INT_PTR_WORD_WORD__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Int -> Int -> Ptr () -> Word -> Word -> IO ()- action _ obj1 int2 int3 ptr4 int5 int6 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') int2 int3 (castPtr ptr4) int5 int6--connect_OBJECT_INT_INT_WORD__BOOL :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> Int -> Int -> Word -> IO Bool) ->- IO (ConnectId obj)-connect_OBJECT_INT_INT_WORD__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Int -> Int -> Word -> IO Bool- action _ obj1 int2 int3 int4 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') int2 int3 int4--connect_OBJECT_WORD__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> Word -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT_WORD__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Word -> IO ()- action _ obj1 int2 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') int2--connect_OBJECT_ENUM__BOOL :: - (GObjectClass a', Enum b, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> b -> IO Bool) ->- IO (ConnectId obj)-connect_OBJECT_ENUM__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Int -> IO Bool- action _ obj1 enum2 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') (toEnum enum2)--connect_BOXED_STRING__NONE :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> - ConnectAfter -> obj ->- (a -> String -> IO ()) ->- IO (ConnectId obj)-connect_BOXED_STRING__NONE signal boxedPre1 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> CString -> IO ()- action _ box1 str2 =- failOnGError $- peekUTFString str2 >>= \str2' ->- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' str2'--connect_OBJECT_INT__NONE :: - (GObjectClass a', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> Int -> IO ()) ->- IO (ConnectId obj)-connect_OBJECT_INT__NONE signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Int -> IO ()- action _ obj1 int2 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') int2--connect_ENUM_BOOL__BOOL :: - (Enum a, GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a -> Bool -> IO Bool) ->- IO (ConnectId obj)-connect_ENUM_BOOL__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Int -> Bool -> IO Bool- action _ enum1 bool2 =- failOnGError $- user (toEnum enum1) bool2--connect_BOXED_INT__NONE :: - GObjectClass obj => SignalName ->- (Ptr a' -> IO a) -> - ConnectAfter -> obj ->- (a -> Int -> IO ()) ->- IO (ConnectId obj)-connect_BOXED_INT__NONE signal boxedPre1 after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr () -> Int -> IO ()- action _ box1 int2 =- failOnGError $- boxedPre1 (castPtr box1) >>= \box1' ->- user box1' int2--connect_OBJECT_INT_INT_BOOL_OBJECT__BOOL :: - (GObjectClass a', GObjectClass e', GObjectClass obj) => SignalName ->- ConnectAfter -> obj ->- (a' -> Int -> Int -> Bool -> e' -> IO Bool) ->- IO (ConnectId obj)-connect_OBJECT_INT_INT_BOOL_OBJECT__BOOL signal after obj user =- connectGeneric signal after obj action- where action :: Ptr GObject -> Ptr GObject -> Int -> Int -> Bool -> Ptr GObject -> IO Bool- action _ obj1 int2 int3 bool4 obj5 =- failOnGError $- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj5) >>= \obj5' ->- makeNewGObject (GObject, objectUnrefFromMainloop) (return obj1) >>= \obj1' ->- user (unsafeCastGObject obj1') int2 int3 bool4 (unsafeCastGObject obj5')-
+ Graphics/UI/Gtk/Special/HRuler.chs view
@@ -0,0 +1,80 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget HRuler+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A horizontal ruler+--+-- * Rulers are removed in Gtk3 and thus this module is blank. There is no+-- replacement+module Graphics.UI.Gtk.Special.HRuler (++-- * Detail+--+-- | The 'HRuler' widget is a widget arranged horizontally creating a ruler that+-- is utilized around other widgets such as a text widget. The ruler is used to+-- show the location of the mouse on the window and to show the size of the+-- window in specified units. The available units of measurement are 'Pixels',+-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Ruler'+-- | +----HRuler+-- @+#if GTK_MAJOR_VERSION < 3+-- * Types+ HRuler,+ HRulerClass,+ castToHRuler,+ toHRuler,++-- * Constructors+ hRulerNew,+#endif+ ) where+#if GTK_MAJOR_VERSION < 3+import Control.Monad (liftM)++import System.Glib.FFI+{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Constructors++-- | Creates a new horizontal ruler.+--+hRulerNew :: IO HRuler+hRulerNew =+ makeNewObject mkHRuler $+ liftM (castPtr :: Ptr Widget -> Ptr HRuler) $+ {# call gtk_hruler_new #}+#endif
+ Graphics/UI/Gtk/Special/Ruler.chs view
@@ -0,0 +1,177 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget Ruler+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- Base class for horizontal or vertical rulers+--+module Graphics.UI.Gtk.Special.Ruler (++-- * Detail+--+-- | The 'Ruler' widget is a base class for horizontal and vertical rulers.+-- Rulers are used to show the mouse pointer's location in a window. The ruler+-- can either be horizontal or vertical on the window. Within the ruler a small+-- triangle indicates the location of the mouse relative to the horizontal or+-- vertical ruler. See 'HRuler' to learn how to create a new horizontal ruler.+-- See 'VRuler' to learn how to create a new vertical ruler.+--+-- * Rulers are removed in Gtk3 and thus this module is blank. There is no+-- replacement++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----Ruler+-- | +----'HRuler'+-- | +----'VRuler'+-- @+#if GTK_MAJOR_VERSION < 3+-- * Types+ Ruler,+ RulerClass,+ castToRuler,+ toRuler,++-- * Enums+ MetricType (..),++-- * Attributes+ rulerRange,+ rulerLower,+ rulerUpper,+ rulerPosition,+ rulerMaxSize,+#if GTK_CHECK_VERSION(2,8,0)+ rulerMetric,+#endif+#endif+ ) where+#if GTK_MAJOR_VERSION < 3+import System.Glib.FFI+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.General.Enums+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Methods++-- | This sets the range of the ruler.+--+rulerSetRange :: RulerClass self => self+ -> (Double+ ,Double+ ,Double+ ,Double)+ -- ^ @lower@ - the lower limit of the ruler+ -- ^ @upper@ - the upper limit of the ruler+ -- ^ @position@ - the mark on the ruler+ -- ^ @maxSize@ - the maximum size of the ruler used when calculating the space to leave for the text+ -> IO ()+rulerSetRange self (lower, upper, position, maxSize) =+ {# call gtk_ruler_set_range #}+ (toRuler self)+ (realToFrac lower)+ (realToFrac upper)+ (realToFrac position)+ (realToFrac maxSize)++-- | Retrieves values indicating the range and current position of a 'Ruler'.+-- See 'rulerSetRange'.+--+rulerGetRange :: RulerClass self => self+ -> IO (Double, Double, Double, Double)+rulerGetRange self =+ alloca $ \lowerPtr ->+ alloca $ \upperPtr ->+ alloca $ \positionPtr ->+ alloca $ \maxSizePtr -> do+ {# call gtk_ruler_get_range #}+ (toRuler self)+ lowerPtr+ upperPtr+ positionPtr+ maxSizePtr+ lower <- peek lowerPtr+ upper <- peek upperPtr+ position <- peek positionPtr+ maxSize <- peek maxSizePtr+ return (realToFrac lower, realToFrac upper, realToFrac position, realToFrac maxSize)++--------------------+-- Attributes++-- | Range of ruler+--+rulerRange :: RulerClass self => Attr self (Double, Double, Double, Double)+rulerRange = newAttr+ rulerGetRange+ rulerSetRange++-- | Lower limit of ruler.+--+-- Default value: 0+--+rulerLower :: RulerClass self => Attr self Double+rulerLower = newAttrFromDoubleProperty "lower"++-- | Upper limit of ruler.+--+-- Default value: 0+--+rulerUpper :: RulerClass self => Attr self Double+rulerUpper = newAttrFromDoubleProperty "upper"++-- | Position of mark on the ruler.+--+-- Default value: 0+--+rulerPosition :: RulerClass self => Attr self Double+rulerPosition = newAttrFromDoubleProperty "position"++-- | Maximum size of the ruler.+--+-- Default value: 0+--+rulerMaxSize :: RulerClass self => Attr self Double+rulerMaxSize = newAttrFromDoubleProperty "max-size"++#if GTK_CHECK_VERSION(2,8,0)+-- | The metric used for the ruler.+--+-- Default value: ''Pixels''+--+-- Since 2.8+--+rulerMetric :: RulerClass self => Attr self MetricType+rulerMetric = newAttrFromEnumProperty "metric"+ {# call pure unsafe gtk_metric_type_get_type #}+#endif+#endif
+ Graphics/UI/Gtk/Special/VRuler.chs view
@@ -0,0 +1,81 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget VRuler+--+-- Author : Andy Stewart+--+-- Created: 28 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A vertical ruler+--+module Graphics.UI.Gtk.Special.VRuler (++-- * Detail+--+-- | The 'VRuler' widget is a widget arranged vertically creating a ruler that+-- is utilized around other widgets such as a text widget. The ruler is used to+-- show the location of the mouse on the window and to show the size of the+-- window in specified units. The available units of measurement are 'Pixels',+-- 'Inches' and 'Centimeters'. 'Pixels' is the default. rulers.+--+-- * Rulers are removed in Gtk3 and thus this module is blank. There is no+-- replacement++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Ruler'+-- | +----VRuler+-- @+#if GTK_MAJOR_VERSION < 3+-- * Types+ VRuler,+ VRulerClass,+ castToVRuler,+ toVRuler,++-- * Constructors+ vRulerNew,+#endif+ ) where+#if GTK_MAJOR_VERSION < 3+import Control.Monad (liftM)++import System.Glib.FFI+{#import Graphics.UI.Gtk.Abstract.Object#} (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++--------------------+-- Constructors++-- | Creates a new vertical ruler+--+vRulerNew :: IO VRuler+vRulerNew =+ makeNewObject mkVRuler $+ liftM (castPtr :: Ptr Widget -> Ptr VRuler) $+ {# call gtk_vruler_new #}+#endif
− Graphics/UI/Gtk/Types.chs
@@ -1,4901 +0,0 @@-{-# OPTIONS_HADDOCK hide #-}--- -*-haskell-*---- -------------------- automatically generated file - do not edit ------------- Object hierarchy for the GIMP Toolkit (GTK) Binding for Haskell------ Author : Axel Simon------ Copyright (C) 2001-2005 Axel Simon------ This library is free software; you can redistribute it and/or--- modify it under the terms of the GNU Lesser General Public--- License as published by the Free Software Foundation; either--- version 2.1 of the License, or (at your option) any later version.------ This library is distributed in the hope that it will be useful,--- but WITHOUT ANY WARRANTY; without even the implied warranty of--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU--- Lesser General Public License for more details.------ #hide---- |--- Maintainer : gtk2hs-users@lists.sourceforge.net--- Stability : provisional--- Portability : portable (depends on GHC)------ This file reflects the Gtk+ object hierarchy in terms of Haskell classes.------ Note: the mk... functions were originally meant to simply be an alias--- for the constructor. However, in order to communicate the destructor--- of an object to objectNew, the mk... functions are now a tuple containing--- Haskell constructor and the destructor function pointer. This hack avoids--- changing all modules that simply pass mk... to objectNew.----module Graphics.UI.Gtk.Types (-- module System.Glib.GObject,- module Graphics.UI.Gtk.General.Threading,- Drawable(Drawable), DrawableClass,- toDrawable, - mkDrawable, unDrawable,- castToDrawable, gTypeDrawable,- DrawWindow(DrawWindow), DrawWindowClass,- toDrawWindow, - mkDrawWindow, unDrawWindow,- castToDrawWindow, gTypeDrawWindow,- Pixmap(Pixmap), PixmapClass,- toPixmap, - mkPixmap, unPixmap,- castToPixmap, gTypePixmap,- Colormap(Colormap), ColormapClass,- toColormap, - mkColormap, unColormap,- castToColormap, gTypeColormap,- Screen(Screen), ScreenClass,- toScreen, - mkScreen, unScreen,- castToScreen, gTypeScreen,- Display(Display), DisplayClass,- toDisplay, - mkDisplay, unDisplay,- castToDisplay, gTypeDisplay,- Visual(Visual), VisualClass,- toVisual, - mkVisual, unVisual,- castToVisual, gTypeVisual,- Device(Device), DeviceClass,- toDevice, - mkDevice, unDevice,- castToDevice, gTypeDevice,- Settings(Settings), SettingsClass,- toSettings, - mkSettings, unSettings,- castToSettings, gTypeSettings,- TextBuffer(TextBuffer), TextBufferClass,- toTextBuffer, - mkTextBuffer, unTextBuffer,- castToTextBuffer, gTypeTextBuffer,- TextTag(TextTag), TextTagClass,- toTextTag, - mkTextTag, unTextTag,- castToTextTag, gTypeTextTag,- TextTagTable(TextTagTable), TextTagTableClass,- toTextTagTable, - mkTextTagTable, unTextTagTable,- castToTextTagTable, gTypeTextTagTable,- Style(Style), StyleClass,- toStyle, - mkStyle, unStyle,- castToStyle, gTypeStyle,- RcStyle(RcStyle), RcStyleClass,- toRcStyle, - mkRcStyle, unRcStyle,- castToRcStyle, gTypeRcStyle,- DragContext(DragContext), DragContextClass,- toDragContext, - mkDragContext, unDragContext,- castToDragContext, gTypeDragContext,- Pixbuf(Pixbuf), PixbufClass,- toPixbuf, - mkPixbuf, unPixbuf,- castToPixbuf, gTypePixbuf,- PixbufAnimation(PixbufAnimation), PixbufAnimationClass,- toPixbufAnimation, - mkPixbufAnimation, unPixbufAnimation,- castToPixbufAnimation, gTypePixbufAnimation,- PixbufSimpleAnim(PixbufSimpleAnim), PixbufSimpleAnimClass,- toPixbufSimpleAnim, - mkPixbufSimpleAnim, unPixbufSimpleAnim,- castToPixbufSimpleAnim, gTypePixbufSimpleAnim,- PixbufAnimationIter(PixbufAnimationIter), PixbufAnimationIterClass,- toPixbufAnimationIter, - mkPixbufAnimationIter, unPixbufAnimationIter,- castToPixbufAnimationIter, gTypePixbufAnimationIter,- TextChildAnchor(TextChildAnchor), TextChildAnchorClass,- toTextChildAnchor, - mkTextChildAnchor, unTextChildAnchor,- castToTextChildAnchor, gTypeTextChildAnchor,- TextMark(TextMark), TextMarkClass,- toTextMark, - mkTextMark, unTextMark,- castToTextMark, gTypeTextMark,- Object(Object), ObjectClass,- toObject, - mkObject, unObject,- castToObject, gTypeObject,- Widget(Widget), WidgetClass,- toWidget, - mkWidget, unWidget,- castToWidget, gTypeWidget,- Misc(Misc), MiscClass,- toMisc, - mkMisc, unMisc,- castToMisc, gTypeMisc,- Label(Label), LabelClass,- toLabel, - mkLabel, unLabel,- castToLabel, gTypeLabel,- AccelLabel(AccelLabel), AccelLabelClass,- toAccelLabel, - mkAccelLabel, unAccelLabel,- castToAccelLabel, gTypeAccelLabel,- TipsQuery(TipsQuery), TipsQueryClass,- toTipsQuery, - mkTipsQuery, unTipsQuery,- castToTipsQuery, gTypeTipsQuery,- Arrow(Arrow), ArrowClass,- toArrow, - mkArrow, unArrow,- castToArrow, gTypeArrow,- Image(Image), ImageClass,- toImage, - mkImage, unImage,- castToImage, gTypeImage,- Container(Container), ContainerClass,- toContainer, - mkContainer, unContainer,- castToContainer, gTypeContainer,- Bin(Bin), BinClass,- toBin, - mkBin, unBin,- castToBin, gTypeBin,- Alignment(Alignment), AlignmentClass,- toAlignment, - mkAlignment, unAlignment,- castToAlignment, gTypeAlignment,- Frame(Frame), FrameClass,- toFrame, - mkFrame, unFrame,- castToFrame, gTypeFrame,- AspectFrame(AspectFrame), AspectFrameClass,- toAspectFrame, - mkAspectFrame, unAspectFrame,- castToAspectFrame, gTypeAspectFrame,- Button(Button), ButtonClass,- toButton, - mkButton, unButton,- castToButton, gTypeButton,- ToggleButton(ToggleButton), ToggleButtonClass,- toToggleButton, - mkToggleButton, unToggleButton,- castToToggleButton, gTypeToggleButton,- CheckButton(CheckButton), CheckButtonClass,- toCheckButton, - mkCheckButton, unCheckButton,- castToCheckButton, gTypeCheckButton,- RadioButton(RadioButton), RadioButtonClass,- toRadioButton, - mkRadioButton, unRadioButton,- castToRadioButton, gTypeRadioButton,- ColorButton(ColorButton), ColorButtonClass,- toColorButton, - mkColorButton, unColorButton,- castToColorButton, gTypeColorButton,- FontButton(FontButton), FontButtonClass,- toFontButton, - mkFontButton, unFontButton,- castToFontButton, gTypeFontButton,- OptionMenu(OptionMenu), OptionMenuClass,- toOptionMenu, - mkOptionMenu, unOptionMenu,- castToOptionMenu, gTypeOptionMenu,- Item(Item), ItemClass,- toItem, - mkItem, unItem,- castToItem, gTypeItem,- MenuItem(MenuItem), MenuItemClass,- toMenuItem, - mkMenuItem, unMenuItem,- castToMenuItem, gTypeMenuItem,- CheckMenuItem(CheckMenuItem), CheckMenuItemClass,- toCheckMenuItem, - mkCheckMenuItem, unCheckMenuItem,- castToCheckMenuItem, gTypeCheckMenuItem,- RadioMenuItem(RadioMenuItem), RadioMenuItemClass,- toRadioMenuItem, - mkRadioMenuItem, unRadioMenuItem,- castToRadioMenuItem, gTypeRadioMenuItem,- TearoffMenuItem(TearoffMenuItem), TearoffMenuItemClass,- toTearoffMenuItem, - mkTearoffMenuItem, unTearoffMenuItem,- castToTearoffMenuItem, gTypeTearoffMenuItem,- ImageMenuItem(ImageMenuItem), ImageMenuItemClass,- toImageMenuItem, - mkImageMenuItem, unImageMenuItem,- castToImageMenuItem, gTypeImageMenuItem,- SeparatorMenuItem(SeparatorMenuItem), SeparatorMenuItemClass,- toSeparatorMenuItem, - mkSeparatorMenuItem, unSeparatorMenuItem,- castToSeparatorMenuItem, gTypeSeparatorMenuItem,- ListItem(ListItem), ListItemClass,- toListItem, - mkListItem, unListItem,- castToListItem, gTypeListItem,- Window(Window), WindowClass,- toWindow, - mkWindow, unWindow,- castToWindow, gTypeWindow,- Dialog(Dialog), DialogClass,- toDialog, - mkDialog, unDialog,- castToDialog, gTypeDialog,- AboutDialog(AboutDialog), AboutDialogClass,- toAboutDialog, - mkAboutDialog, unAboutDialog,- castToAboutDialog, gTypeAboutDialog,- ColorSelectionDialog(ColorSelectionDialog), ColorSelectionDialogClass,- toColorSelectionDialog, - mkColorSelectionDialog, unColorSelectionDialog,- castToColorSelectionDialog, gTypeColorSelectionDialog,- FileSelection(FileSelection), FileSelectionClass,- toFileSelection, - mkFileSelection, unFileSelection,- castToFileSelection, gTypeFileSelection,- FileChooserDialog(FileChooserDialog), FileChooserDialogClass,- toFileChooserDialog, - mkFileChooserDialog, unFileChooserDialog,- castToFileChooserDialog, gTypeFileChooserDialog,- FontSelectionDialog(FontSelectionDialog), FontSelectionDialogClass,- toFontSelectionDialog, - mkFontSelectionDialog, unFontSelectionDialog,- castToFontSelectionDialog, gTypeFontSelectionDialog,- InputDialog(InputDialog), InputDialogClass,- toInputDialog, - mkInputDialog, unInputDialog,- castToInputDialog, gTypeInputDialog,- MessageDialog(MessageDialog), MessageDialogClass,- toMessageDialog, - mkMessageDialog, unMessageDialog,- castToMessageDialog, gTypeMessageDialog,- Plug(Plug), PlugClass,- toPlug, - mkPlug, unPlug,- castToPlug, gTypePlug,- EventBox(EventBox), EventBoxClass,- toEventBox, - mkEventBox, unEventBox,- castToEventBox, gTypeEventBox,- HandleBox(HandleBox), HandleBoxClass,- toHandleBox, - mkHandleBox, unHandleBox,- castToHandleBox, gTypeHandleBox,- ScrolledWindow(ScrolledWindow), ScrolledWindowClass,- toScrolledWindow, - mkScrolledWindow, unScrolledWindow,- castToScrolledWindow, gTypeScrolledWindow,- Viewport(Viewport), ViewportClass,- toViewport, - mkViewport, unViewport,- castToViewport, gTypeViewport,- Expander(Expander), ExpanderClass,- toExpander, - mkExpander, unExpander,- castToExpander, gTypeExpander,- ComboBox(ComboBox), ComboBoxClass,- toComboBox, - mkComboBox, unComboBox,- castToComboBox, gTypeComboBox,- ComboBoxEntry(ComboBoxEntry), ComboBoxEntryClass,- toComboBoxEntry, - mkComboBoxEntry, unComboBoxEntry,- castToComboBoxEntry, gTypeComboBoxEntry,- ToolItem(ToolItem), ToolItemClass,- toToolItem, - mkToolItem, unToolItem,- castToToolItem, gTypeToolItem,- ToolButton(ToolButton), ToolButtonClass,- toToolButton, - mkToolButton, unToolButton,- castToToolButton, gTypeToolButton,- MenuToolButton(MenuToolButton), MenuToolButtonClass,- toMenuToolButton, - mkMenuToolButton, unMenuToolButton,- castToMenuToolButton, gTypeMenuToolButton,- ToggleToolButton(ToggleToolButton), ToggleToolButtonClass,- toToggleToolButton, - mkToggleToolButton, unToggleToolButton,- castToToggleToolButton, gTypeToggleToolButton,- RadioToolButton(RadioToolButton), RadioToolButtonClass,- toRadioToolButton, - mkRadioToolButton, unRadioToolButton,- castToRadioToolButton, gTypeRadioToolButton,- SeparatorToolItem(SeparatorToolItem), SeparatorToolItemClass,- toSeparatorToolItem, - mkSeparatorToolItem, unSeparatorToolItem,- castToSeparatorToolItem, gTypeSeparatorToolItem,- Box(Box), BoxClass,- toBox, - mkBox, unBox,- castToBox, gTypeBox,- ButtonBox(ButtonBox), ButtonBoxClass,- toButtonBox, - mkButtonBox, unButtonBox,- castToButtonBox, gTypeButtonBox,- HButtonBox(HButtonBox), HButtonBoxClass,- toHButtonBox, - mkHButtonBox, unHButtonBox,- castToHButtonBox, gTypeHButtonBox,- VButtonBox(VButtonBox), VButtonBoxClass,- toVButtonBox, - mkVButtonBox, unVButtonBox,- castToVButtonBox, gTypeVButtonBox,- VBox(VBox), VBoxClass,- toVBox, - mkVBox, unVBox,- castToVBox, gTypeVBox,- ColorSelection(ColorSelection), ColorSelectionClass,- toColorSelection, - mkColorSelection, unColorSelection,- castToColorSelection, gTypeColorSelection,- FontSelection(FontSelection), FontSelectionClass,- toFontSelection, - mkFontSelection, unFontSelection,- castToFontSelection, gTypeFontSelection,- FileChooserWidget(FileChooserWidget), FileChooserWidgetClass,- toFileChooserWidget, - mkFileChooserWidget, unFileChooserWidget,- castToFileChooserWidget, gTypeFileChooserWidget,- HBox(HBox), HBoxClass,- toHBox, - mkHBox, unHBox,- castToHBox, gTypeHBox,- Combo(Combo), ComboClass,- toCombo, - mkCombo, unCombo,- castToCombo, gTypeCombo,- FileChooserButton(FileChooserButton), FileChooserButtonClass,- toFileChooserButton, - mkFileChooserButton, unFileChooserButton,- castToFileChooserButton, gTypeFileChooserButton,- Statusbar(Statusbar), StatusbarClass,- toStatusbar, - mkStatusbar, unStatusbar,- castToStatusbar, gTypeStatusbar,- CList(CList), CListClass,- toCList, - mkCList, unCList,- castToCList, gTypeCList,- CTree(CTree), CTreeClass,- toCTree, - mkCTree, unCTree,- castToCTree, gTypeCTree,- Fixed(Fixed), FixedClass,- toFixed, - mkFixed, unFixed,- castToFixed, gTypeFixed,- Paned(Paned), PanedClass,- toPaned, - mkPaned, unPaned,- castToPaned, gTypePaned,- HPaned(HPaned), HPanedClass,- toHPaned, - mkHPaned, unHPaned,- castToHPaned, gTypeHPaned,- VPaned(VPaned), VPanedClass,- toVPaned, - mkVPaned, unVPaned,- castToVPaned, gTypeVPaned,- IconView(IconView), IconViewClass,- toIconView, - mkIconView, unIconView,- castToIconView, gTypeIconView,- Layout(Layout), LayoutClass,- toLayout, - mkLayout, unLayout,- castToLayout, gTypeLayout,- List(List), ListClass,- toList, - mkList, unList,- castToList, gTypeList,- MenuShell(MenuShell), MenuShellClass,- toMenuShell, - mkMenuShell, unMenuShell,- castToMenuShell, gTypeMenuShell,- Menu(Menu), MenuClass,- toMenu, - mkMenu, unMenu,- castToMenu, gTypeMenu,- MenuBar(MenuBar), MenuBarClass,- toMenuBar, - mkMenuBar, unMenuBar,- castToMenuBar, gTypeMenuBar,- Notebook(Notebook), NotebookClass,- toNotebook, - mkNotebook, unNotebook,- castToNotebook, gTypeNotebook,- Socket(Socket), SocketClass,- toSocket, - mkSocket, unSocket,- castToSocket, gTypeSocket,- Table(Table), TableClass,- toTable, - mkTable, unTable,- castToTable, gTypeTable,- TextView(TextView), TextViewClass,- toTextView, - mkTextView, unTextView,- castToTextView, gTypeTextView,- Toolbar(Toolbar), ToolbarClass,- toToolbar, - mkToolbar, unToolbar,- castToToolbar, gTypeToolbar,- TreeView(TreeView), TreeViewClass,- toTreeView, - mkTreeView, unTreeView,- castToTreeView, gTypeTreeView,- Calendar(Calendar), CalendarClass,- toCalendar, - mkCalendar, unCalendar,- castToCalendar, gTypeCalendar,- CellView(CellView), CellViewClass,- toCellView, - mkCellView, unCellView,- castToCellView, gTypeCellView,- DrawingArea(DrawingArea), DrawingAreaClass,- toDrawingArea, - mkDrawingArea, unDrawingArea,- castToDrawingArea, gTypeDrawingArea,- Entry(Entry), EntryClass,- toEntry, - mkEntry, unEntry,- castToEntry, gTypeEntry,- SpinButton(SpinButton), SpinButtonClass,- toSpinButton, - mkSpinButton, unSpinButton,- castToSpinButton, gTypeSpinButton,- Ruler(Ruler), RulerClass,- toRuler, - mkRuler, unRuler,- castToRuler, gTypeRuler,- HRuler(HRuler), HRulerClass,- toHRuler, - mkHRuler, unHRuler,- castToHRuler, gTypeHRuler,- VRuler(VRuler), VRulerClass,- toVRuler, - mkVRuler, unVRuler,- castToVRuler, gTypeVRuler,- Range(Range), RangeClass,- toRange, - mkRange, unRange,- castToRange, gTypeRange,- Scale(Scale), ScaleClass,- toScale, - mkScale, unScale,- castToScale, gTypeScale,- HScale(HScale), HScaleClass,- toHScale, - mkHScale, unHScale,- castToHScale, gTypeHScale,- VScale(VScale), VScaleClass,- toVScale, - mkVScale, unVScale,- castToVScale, gTypeVScale,- Scrollbar(Scrollbar), ScrollbarClass,- toScrollbar, - mkScrollbar, unScrollbar,- castToScrollbar, gTypeScrollbar,- HScrollbar(HScrollbar), HScrollbarClass,- toHScrollbar, - mkHScrollbar, unHScrollbar,- castToHScrollbar, gTypeHScrollbar,- VScrollbar(VScrollbar), VScrollbarClass,- toVScrollbar, - mkVScrollbar, unVScrollbar,- castToVScrollbar, gTypeVScrollbar,- Separator(Separator), SeparatorClass,- toSeparator, - mkSeparator, unSeparator,- castToSeparator, gTypeSeparator,- HSeparator(HSeparator), HSeparatorClass,- toHSeparator, - mkHSeparator, unHSeparator,- castToHSeparator, gTypeHSeparator,- VSeparator(VSeparator), VSeparatorClass,- toVSeparator, - mkVSeparator, unVSeparator,- castToVSeparator, gTypeVSeparator,- Invisible(Invisible), InvisibleClass,- toInvisible, - mkInvisible, unInvisible,- castToInvisible, gTypeInvisible,- Preview(Preview), PreviewClass,- toPreview, - mkPreview, unPreview,- castToPreview, gTypePreview,- ProgressBar(ProgressBar), ProgressBarClass,- toProgressBar, - mkProgressBar, unProgressBar,- castToProgressBar, gTypeProgressBar,- Adjustment(Adjustment), AdjustmentClass,- toAdjustment, - mkAdjustment, unAdjustment,- castToAdjustment, gTypeAdjustment,- IMContext(IMContext), IMContextClass,- toIMContext, - mkIMContext, unIMContext,- castToIMContext, gTypeIMContext,- IMMulticontext(IMMulticontext), IMMulticontextClass,- toIMMulticontext, - mkIMMulticontext, unIMMulticontext,- castToIMMulticontext, gTypeIMMulticontext,- ItemFactory(ItemFactory), ItemFactoryClass,- toItemFactory, - mkItemFactory, unItemFactory,- castToItemFactory, gTypeItemFactory,- Tooltips(Tooltips), TooltipsClass,- toTooltips, - mkTooltips, unTooltips,- castToTooltips, gTypeTooltips,- TreeViewColumn(TreeViewColumn), TreeViewColumnClass,- toTreeViewColumn, - mkTreeViewColumn, unTreeViewColumn,- castToTreeViewColumn, gTypeTreeViewColumn,- CellRenderer(CellRenderer), CellRendererClass,- toCellRenderer, - mkCellRenderer, unCellRenderer,- castToCellRenderer, gTypeCellRenderer,- CellRendererPixbuf(CellRendererPixbuf), CellRendererPixbufClass,- toCellRendererPixbuf, - mkCellRendererPixbuf, unCellRendererPixbuf,- castToCellRendererPixbuf, gTypeCellRendererPixbuf,- CellRendererText(CellRendererText), CellRendererTextClass,- toCellRendererText, - mkCellRendererText, unCellRendererText,- castToCellRendererText, gTypeCellRendererText,- CellRendererCombo(CellRendererCombo), CellRendererComboClass,- toCellRendererCombo, - mkCellRendererCombo, unCellRendererCombo,- castToCellRendererCombo, gTypeCellRendererCombo,- CellRendererToggle(CellRendererToggle), CellRendererToggleClass,- toCellRendererToggle, - mkCellRendererToggle, unCellRendererToggle,- castToCellRendererToggle, gTypeCellRendererToggle,- CellRendererProgress(CellRendererProgress), CellRendererProgressClass,- toCellRendererProgress, - mkCellRendererProgress, unCellRendererProgress,- castToCellRendererProgress, gTypeCellRendererProgress,- FileFilter(FileFilter), FileFilterClass,- toFileFilter, - mkFileFilter, unFileFilter,- castToFileFilter, gTypeFileFilter,- Builder(Builder), BuilderClass,- toBuilder, - mkBuilder, unBuilder,- castToBuilder, gTypeBuilder,- CellLayout(CellLayout), CellLayoutClass,- toCellLayout, - mkCellLayout, unCellLayout,- castToCellLayout, gTypeCellLayout,- TreeSortable(TreeSortable), TreeSortableClass,- toTreeSortable, - mkTreeSortable, unTreeSortable,- castToTreeSortable, gTypeTreeSortable,- Tooltip(Tooltip), TooltipClass,- toTooltip, - mkTooltip, unTooltip,- castToTooltip, gTypeTooltip,- StatusIcon(StatusIcon), StatusIconClass,- toStatusIcon, - mkStatusIcon, unStatusIcon,- castToStatusIcon, gTypeStatusIcon,- TreeSelection(TreeSelection), TreeSelectionClass,- toTreeSelection, - mkTreeSelection, unTreeSelection,- castToTreeSelection, gTypeTreeSelection,- TreeModel(TreeModel), TreeModelClass,- toTreeModel, - mkTreeModel, unTreeModel,- castToTreeModel, gTypeTreeModel,- TreeStore(TreeStore), TreeStoreClass,- toTreeStore, - mkTreeStore, unTreeStore,- castToTreeStore, gTypeTreeStore,- ListStore(ListStore), ListStoreClass,- toListStore, - mkListStore, unListStore,- castToListStore, gTypeListStore,- TreeModelSort(TreeModelSort), TreeModelSortClass,- toTreeModelSort, - mkTreeModelSort, unTreeModelSort,- castToTreeModelSort, gTypeTreeModelSort,- TreeModelFilter(TreeModelFilter), TreeModelFilterClass,- toTreeModelFilter, - mkTreeModelFilter, unTreeModelFilter,- castToTreeModelFilter, gTypeTreeModelFilter,- IconFactory(IconFactory), IconFactoryClass,- toIconFactory, - mkIconFactory, unIconFactory,- castToIconFactory, gTypeIconFactory,- IconTheme(IconTheme), IconThemeClass,- toIconTheme, - mkIconTheme, unIconTheme,- castToIconTheme, gTypeIconTheme,- SizeGroup(SizeGroup), SizeGroupClass,- toSizeGroup, - mkSizeGroup, unSizeGroup,- castToSizeGroup, gTypeSizeGroup,- Clipboard(Clipboard), ClipboardClass,- toClipboard, - mkClipboard, unClipboard,- castToClipboard, gTypeClipboard,- AccelGroup(AccelGroup), AccelGroupClass,- toAccelGroup, - mkAccelGroup, unAccelGroup,- castToAccelGroup, gTypeAccelGroup,- AccelMap(AccelMap), AccelMapClass,- toAccelMap, - mkAccelMap, unAccelMap,- castToAccelMap, gTypeAccelMap,- EntryCompletion(EntryCompletion), EntryCompletionClass,- toEntryCompletion, - mkEntryCompletion, unEntryCompletion,- castToEntryCompletion, gTypeEntryCompletion,- Action(Action), ActionClass,- toAction, - mkAction, unAction,- castToAction, gTypeAction,- ToggleAction(ToggleAction), ToggleActionClass,- toToggleAction, - mkToggleAction, unToggleAction,- castToToggleAction, gTypeToggleAction,- RadioAction(RadioAction), RadioActionClass,- toRadioAction, - mkRadioAction, unRadioAction,- castToRadioAction, gTypeRadioAction,- ActionGroup(ActionGroup), ActionGroupClass,- toActionGroup, - mkActionGroup, unActionGroup,- castToActionGroup, gTypeActionGroup,- UIManager(UIManager), UIManagerClass,- toUIManager, - mkUIManager, unUIManager,- castToUIManager, gTypeUIManager,- WindowGroup(WindowGroup), WindowGroupClass,- toWindowGroup, - mkWindowGroup, unWindowGroup,- castToWindowGroup, gTypeWindowGroup,- Editable(Editable), EditableClass,- toEditable, - mkEditable, unEditable,- castToEditable, gTypeEditable,- FileChooser(FileChooser), FileChooserClass,- toFileChooser, - mkFileChooser, unFileChooser,- castToFileChooser, gTypeFileChooser,- GC(GC), GCClass,- toGC, - mkGC, unGC,- castToGC, gTypeGC- ) where--import Foreign.ForeignPtr (ForeignPtr, castForeignPtr, unsafeForeignPtrToPtr)-import Foreign.C.Types (CULong, CUInt)-import System.Glib.GType (GType, typeInstanceIsA)-{#import System.Glib.GObject#}-import Graphics.UI.Gtk.General.Threading--{# context lib="gtk" prefix="gtk" #}---- The usage of foreignPtrToPtr should be safe as the evaluation will only be--- forced if the object is used afterwards----castTo :: (GObjectClass obj, GObjectClass obj') => GType -> String- -> (obj -> obj')-castTo gtype objTypeName obj =- case toGObject obj of- gobj@(GObject objFPtr)- | typeInstanceIsA ((unsafeForeignPtrToPtr.castForeignPtr) objFPtr) gtype- -> unsafeCastGObject gobj- | otherwise -> error $ "Cannot cast object to " ++ objTypeName----- ******************************************************************* Drawable--{#pointer *GdkDrawable as Drawable foreign newtype #} deriving (Eq,Ord)--mkDrawable = (Drawable, objectUnrefFromMainloop)-unDrawable (Drawable o) = o--class GObjectClass o => DrawableClass o-toDrawable :: DrawableClass o => o -> Drawable-toDrawable = unsafeCastGObject . toGObject--instance DrawableClass Drawable-instance GObjectClass Drawable where- toGObject = GObject . castForeignPtr . unDrawable- unsafeCastGObject = Drawable . castForeignPtr . unGObject--castToDrawable :: GObjectClass obj => obj -> Drawable-castToDrawable = castTo gTypeDrawable "Drawable"--gTypeDrawable :: GType-gTypeDrawable =- {# call fun unsafe gdk_drawable_get_type #}---- ***************************************************************** DrawWindow--{#pointer *GdkWindow as DrawWindow foreign newtype #} deriving (Eq,Ord)--mkDrawWindow = (DrawWindow, objectUnrefFromMainloop)-unDrawWindow (DrawWindow o) = o--class DrawableClass o => DrawWindowClass o-toDrawWindow :: DrawWindowClass o => o -> DrawWindow-toDrawWindow = unsafeCastGObject . toGObject--instance DrawWindowClass DrawWindow-instance DrawableClass DrawWindow-instance GObjectClass DrawWindow where- toGObject = GObject . castForeignPtr . unDrawWindow- unsafeCastGObject = DrawWindow . castForeignPtr . unGObject--castToDrawWindow :: GObjectClass obj => obj -> DrawWindow-castToDrawWindow = castTo gTypeDrawWindow "DrawWindow"--gTypeDrawWindow :: GType-gTypeDrawWindow =- {# call fun unsafe gdk_window_object_get_type #}---- ********************************************************************* Pixmap--{#pointer *GdkPixmap as Pixmap foreign newtype #} deriving (Eq,Ord)--mkPixmap = (Pixmap, objectUnrefFromMainloop)-unPixmap (Pixmap o) = o--class DrawableClass o => PixmapClass o-toPixmap :: PixmapClass o => o -> Pixmap-toPixmap = unsafeCastGObject . toGObject--instance PixmapClass Pixmap-instance DrawableClass Pixmap-instance GObjectClass Pixmap where- toGObject = GObject . castForeignPtr . unPixmap- unsafeCastGObject = Pixmap . castForeignPtr . unGObject--castToPixmap :: GObjectClass obj => obj -> Pixmap-castToPixmap = castTo gTypePixmap "Pixmap"--gTypePixmap :: GType-gTypePixmap =- {# call fun unsafe gdk_pixmap_get_type #}---- ******************************************************************* Colormap--{#pointer *GdkColormap as Colormap foreign newtype #} deriving (Eq,Ord)--mkColormap = (Colormap, objectUnrefFromMainloop)-unColormap (Colormap o) = o--class GObjectClass o => ColormapClass o-toColormap :: ColormapClass o => o -> Colormap-toColormap = unsafeCastGObject . toGObject--instance ColormapClass Colormap-instance GObjectClass Colormap where- toGObject = GObject . castForeignPtr . unColormap- unsafeCastGObject = Colormap . castForeignPtr . unGObject--castToColormap :: GObjectClass obj => obj -> Colormap-castToColormap = castTo gTypeColormap "Colormap"--gTypeColormap :: GType-gTypeColormap =- {# call fun unsafe gdk_colormap_get_type #}---- ********************************************************************* Screen--{#pointer *GdkScreen as Screen foreign newtype #} deriving (Eq,Ord)--mkScreen = (Screen, objectUnrefFromMainloop)-unScreen (Screen o) = o--class GObjectClass o => ScreenClass o-toScreen :: ScreenClass o => o -> Screen-toScreen = unsafeCastGObject . toGObject--instance ScreenClass Screen-instance GObjectClass Screen where- toGObject = GObject . castForeignPtr . unScreen- unsafeCastGObject = Screen . castForeignPtr . unGObject--castToScreen :: GObjectClass obj => obj -> Screen-castToScreen = castTo gTypeScreen "Screen"--gTypeScreen :: GType-gTypeScreen =- {# call fun unsafe gdk_screen_get_type #}---- ******************************************************************** Display--{#pointer *GdkDisplay as Display foreign newtype #} deriving (Eq,Ord)--mkDisplay = (Display, objectUnrefFromMainloop)-unDisplay (Display o) = o--class GObjectClass o => DisplayClass o-toDisplay :: DisplayClass o => o -> Display-toDisplay = unsafeCastGObject . toGObject--instance DisplayClass Display-instance GObjectClass Display where- toGObject = GObject . castForeignPtr . unDisplay- unsafeCastGObject = Display . castForeignPtr . unGObject--castToDisplay :: GObjectClass obj => obj -> Display-castToDisplay = castTo gTypeDisplay "Display"--gTypeDisplay :: GType-gTypeDisplay =- {# call fun unsafe gdk_display_get_type #}---- ********************************************************************* Visual--{#pointer *GdkVisual as Visual foreign newtype #} deriving (Eq,Ord)--mkVisual = (Visual, objectUnrefFromMainloop)-unVisual (Visual o) = o--class GObjectClass o => VisualClass o-toVisual :: VisualClass o => o -> Visual-toVisual = unsafeCastGObject . toGObject--instance VisualClass Visual-instance GObjectClass Visual where- toGObject = GObject . castForeignPtr . unVisual- unsafeCastGObject = Visual . castForeignPtr . unGObject--castToVisual :: GObjectClass obj => obj -> Visual-castToVisual = castTo gTypeVisual "Visual"--gTypeVisual :: GType-gTypeVisual =- {# call fun unsafe gdk_visual_get_type #}---- ********************************************************************* Device--{#pointer *GdkDevice as Device foreign newtype #} deriving (Eq,Ord)--mkDevice = (Device, objectUnrefFromMainloop)-unDevice (Device o) = o--class GObjectClass o => DeviceClass o-toDevice :: DeviceClass o => o -> Device-toDevice = unsafeCastGObject . toGObject--instance DeviceClass Device-instance GObjectClass Device where- toGObject = GObject . castForeignPtr . unDevice- unsafeCastGObject = Device . castForeignPtr . unGObject--castToDevice :: GObjectClass obj => obj -> Device-castToDevice = castTo gTypeDevice "Device"--gTypeDevice :: GType-gTypeDevice =- {# call fun unsafe gdk_device_get_type #}---- ******************************************************************* Settings--{#pointer *Settings foreign newtype #} deriving (Eq,Ord)--mkSettings = (Settings, objectUnrefFromMainloop)-unSettings (Settings o) = o--class GObjectClass o => SettingsClass o-toSettings :: SettingsClass o => o -> Settings-toSettings = unsafeCastGObject . toGObject--instance SettingsClass Settings-instance GObjectClass Settings where- toGObject = GObject . castForeignPtr . unSettings- unsafeCastGObject = Settings . castForeignPtr . unGObject--castToSettings :: GObjectClass obj => obj -> Settings-castToSettings = castTo gTypeSettings "Settings"--gTypeSettings :: GType-gTypeSettings =- {# call fun unsafe gtk_settings_get_type #}---- ***************************************************************** TextBuffer--{#pointer *TextBuffer foreign newtype #} deriving (Eq,Ord)--mkTextBuffer = (TextBuffer, objectUnrefFromMainloop)-unTextBuffer (TextBuffer o) = o--class GObjectClass o => TextBufferClass o-toTextBuffer :: TextBufferClass o => o -> TextBuffer-toTextBuffer = unsafeCastGObject . toGObject--instance TextBufferClass TextBuffer-instance GObjectClass TextBuffer where- toGObject = GObject . castForeignPtr . unTextBuffer- unsafeCastGObject = TextBuffer . castForeignPtr . unGObject--castToTextBuffer :: GObjectClass obj => obj -> TextBuffer-castToTextBuffer = castTo gTypeTextBuffer "TextBuffer"--gTypeTextBuffer :: GType-gTypeTextBuffer =- {# call fun unsafe gtk_text_buffer_get_type #}---- ******************************************************************** TextTag--{#pointer *TextTag foreign newtype #} deriving (Eq,Ord)--mkTextTag = (TextTag, objectUnrefFromMainloop)-unTextTag (TextTag o) = o--class GObjectClass o => TextTagClass o-toTextTag :: TextTagClass o => o -> TextTag-toTextTag = unsafeCastGObject . toGObject--instance TextTagClass TextTag-instance GObjectClass TextTag where- toGObject = GObject . castForeignPtr . unTextTag- unsafeCastGObject = TextTag . castForeignPtr . unGObject--castToTextTag :: GObjectClass obj => obj -> TextTag-castToTextTag = castTo gTypeTextTag "TextTag"--gTypeTextTag :: GType-gTypeTextTag =- {# call fun unsafe gtk_text_tag_get_type #}---- *************************************************************** TextTagTable--{#pointer *TextTagTable foreign newtype #} deriving (Eq,Ord)--mkTextTagTable = (TextTagTable, objectUnrefFromMainloop)-unTextTagTable (TextTagTable o) = o--class GObjectClass o => TextTagTableClass o-toTextTagTable :: TextTagTableClass o => o -> TextTagTable-toTextTagTable = unsafeCastGObject . toGObject--instance TextTagTableClass TextTagTable-instance GObjectClass TextTagTable where- toGObject = GObject . castForeignPtr . unTextTagTable- unsafeCastGObject = TextTagTable . castForeignPtr . unGObject--castToTextTagTable :: GObjectClass obj => obj -> TextTagTable-castToTextTagTable = castTo gTypeTextTagTable "TextTagTable"--gTypeTextTagTable :: GType-gTypeTextTagTable =- {# call fun unsafe gtk_text_tag_table_get_type #}---- ********************************************************************** Style--{#pointer *Style foreign newtype #} deriving (Eq,Ord)--mkStyle = (Style, objectUnrefFromMainloop)-unStyle (Style o) = o--class GObjectClass o => StyleClass o-toStyle :: StyleClass o => o -> Style-toStyle = unsafeCastGObject . toGObject--instance StyleClass Style-instance GObjectClass Style where- toGObject = GObject . castForeignPtr . unStyle- unsafeCastGObject = Style . castForeignPtr . unGObject--castToStyle :: GObjectClass obj => obj -> Style-castToStyle = castTo gTypeStyle "Style"--gTypeStyle :: GType-gTypeStyle =- {# call fun unsafe gtk_style_get_type #}---- ******************************************************************** RcStyle--{#pointer *RcStyle foreign newtype #} deriving (Eq,Ord)--mkRcStyle = (RcStyle, objectUnrefFromMainloop)-unRcStyle (RcStyle o) = o--class GObjectClass o => RcStyleClass o-toRcStyle :: RcStyleClass o => o -> RcStyle-toRcStyle = unsafeCastGObject . toGObject--instance RcStyleClass RcStyle-instance GObjectClass RcStyle where- toGObject = GObject . castForeignPtr . unRcStyle- unsafeCastGObject = RcStyle . castForeignPtr . unGObject--castToRcStyle :: GObjectClass obj => obj -> RcStyle-castToRcStyle = castTo gTypeRcStyle "RcStyle"--gTypeRcStyle :: GType-gTypeRcStyle =- {# call fun unsafe gtk_rc_style_get_type #}---- **************************************************************** DragContext--{#pointer *GdkDragContext as DragContext foreign newtype #} deriving (Eq,Ord)--mkDragContext = (DragContext, objectUnrefFromMainloop)-unDragContext (DragContext o) = o--class GObjectClass o => DragContextClass o-toDragContext :: DragContextClass o => o -> DragContext-toDragContext = unsafeCastGObject . toGObject--instance DragContextClass DragContext-instance GObjectClass DragContext where- toGObject = GObject . castForeignPtr . unDragContext- unsafeCastGObject = DragContext . castForeignPtr . unGObject--castToDragContext :: GObjectClass obj => obj -> DragContext-castToDragContext = castTo gTypeDragContext "DragContext"--gTypeDragContext :: GType-gTypeDragContext =- {# call fun unsafe gdk_drag_context_get_type #}---- ********************************************************************* Pixbuf--{#pointer *GdkPixbuf as Pixbuf foreign newtype #} deriving (Eq,Ord)--mkPixbuf = (Pixbuf, objectUnref)-unPixbuf (Pixbuf o) = o--class GObjectClass o => PixbufClass o-toPixbuf :: PixbufClass o => o -> Pixbuf-toPixbuf = unsafeCastGObject . toGObject--instance PixbufClass Pixbuf-instance GObjectClass Pixbuf where- toGObject = GObject . castForeignPtr . unPixbuf- unsafeCastGObject = Pixbuf . castForeignPtr . unGObject--castToPixbuf :: GObjectClass obj => obj -> Pixbuf-castToPixbuf = castTo gTypePixbuf "Pixbuf"--gTypePixbuf :: GType-gTypePixbuf =- {# call fun unsafe gdk_pixbuf_get_type #}---- ************************************************************ PixbufAnimation--{#pointer *GdkPixbufAnimation as PixbufAnimation foreign newtype #} deriving (Eq,Ord)--mkPixbufAnimation = (PixbufAnimation, objectUnref)-unPixbufAnimation (PixbufAnimation o) = o--class GObjectClass o => PixbufAnimationClass o-toPixbufAnimation :: PixbufAnimationClass o => o -> PixbufAnimation-toPixbufAnimation = unsafeCastGObject . toGObject--instance PixbufAnimationClass PixbufAnimation-instance GObjectClass PixbufAnimation where- toGObject = GObject . castForeignPtr . unPixbufAnimation- unsafeCastGObject = PixbufAnimation . castForeignPtr . unGObject--castToPixbufAnimation :: GObjectClass obj => obj -> PixbufAnimation-castToPixbufAnimation = castTo gTypePixbufAnimation "PixbufAnimation"--gTypePixbufAnimation :: GType-gTypePixbufAnimation =- {# call fun unsafe gdk_pixbuf_animation_get_type #}---- *********************************************************** PixbufSimpleAnim--{#pointer *GdkPixbufSimpleAnim as PixbufSimpleAnim foreign newtype #} deriving (Eq,Ord)--mkPixbufSimpleAnim = (PixbufSimpleAnim, objectUnref)-unPixbufSimpleAnim (PixbufSimpleAnim o) = o--class PixbufAnimationClass o => PixbufSimpleAnimClass o-toPixbufSimpleAnim :: PixbufSimpleAnimClass o => o -> PixbufSimpleAnim-toPixbufSimpleAnim = unsafeCastGObject . toGObject--instance PixbufSimpleAnimClass PixbufSimpleAnim-instance PixbufAnimationClass PixbufSimpleAnim-instance GObjectClass PixbufSimpleAnim where- toGObject = GObject . castForeignPtr . unPixbufSimpleAnim- unsafeCastGObject = PixbufSimpleAnim . castForeignPtr . unGObject--castToPixbufSimpleAnim :: GObjectClass obj => obj -> PixbufSimpleAnim-castToPixbufSimpleAnim = castTo gTypePixbufSimpleAnim "PixbufSimpleAnim"--gTypePixbufSimpleAnim :: GType-gTypePixbufSimpleAnim =- {# call fun unsafe gdk_pixbuf_simple_anim_get_type #}---- ******************************************************** PixbufAnimationIter--{#pointer *GdkPixbufAnimationIter as PixbufAnimationIter foreign newtype #} deriving (Eq,Ord)--mkPixbufAnimationIter = (PixbufAnimationIter, objectUnref)-unPixbufAnimationIter (PixbufAnimationIter o) = o--class GObjectClass o => PixbufAnimationIterClass o-toPixbufAnimationIter :: PixbufAnimationIterClass o => o -> PixbufAnimationIter-toPixbufAnimationIter = unsafeCastGObject . toGObject--instance PixbufAnimationIterClass PixbufAnimationIter-instance GObjectClass PixbufAnimationIter where- toGObject = GObject . castForeignPtr . unPixbufAnimationIter- unsafeCastGObject = PixbufAnimationIter . castForeignPtr . unGObject--castToPixbufAnimationIter :: GObjectClass obj => obj -> PixbufAnimationIter-castToPixbufAnimationIter = castTo gTypePixbufAnimationIter "PixbufAnimationIter"--gTypePixbufAnimationIter :: GType-gTypePixbufAnimationIter =- {# call fun unsafe gdk_pixbuf_animation_iter_get_type #}---- ************************************************************ TextChildAnchor--{#pointer *TextChildAnchor foreign newtype #} deriving (Eq,Ord)--mkTextChildAnchor = (TextChildAnchor, objectUnrefFromMainloop)-unTextChildAnchor (TextChildAnchor o) = o--class GObjectClass o => TextChildAnchorClass o-toTextChildAnchor :: TextChildAnchorClass o => o -> TextChildAnchor-toTextChildAnchor = unsafeCastGObject . toGObject--instance TextChildAnchorClass TextChildAnchor-instance GObjectClass TextChildAnchor where- toGObject = GObject . castForeignPtr . unTextChildAnchor- unsafeCastGObject = TextChildAnchor . castForeignPtr . unGObject--castToTextChildAnchor :: GObjectClass obj => obj -> TextChildAnchor-castToTextChildAnchor = castTo gTypeTextChildAnchor "TextChildAnchor"--gTypeTextChildAnchor :: GType-gTypeTextChildAnchor =- {# call fun unsafe gtk_text_child_anchor_get_type #}---- ******************************************************************* TextMark--{#pointer *TextMark foreign newtype #} deriving (Eq,Ord)--mkTextMark = (TextMark, objectUnrefFromMainloop)-unTextMark (TextMark o) = o--class GObjectClass o => TextMarkClass o-toTextMark :: TextMarkClass o => o -> TextMark-toTextMark = unsafeCastGObject . toGObject--instance TextMarkClass TextMark-instance GObjectClass TextMark where- toGObject = GObject . castForeignPtr . unTextMark- unsafeCastGObject = TextMark . castForeignPtr . unGObject--castToTextMark :: GObjectClass obj => obj -> TextMark-castToTextMark = castTo gTypeTextMark "TextMark"--gTypeTextMark :: GType-gTypeTextMark =- {# call fun unsafe gtk_text_mark_get_type #}---- ********************************************************************* Object--{#pointer *Object foreign newtype #} deriving (Eq,Ord)--mkObject = (Object, objectUnrefFromMainloop)-unObject (Object o) = o--class GObjectClass o => ObjectClass o-toObject :: ObjectClass o => o -> Object-toObject = unsafeCastGObject . toGObject--instance ObjectClass Object-instance GObjectClass Object where- toGObject = GObject . castForeignPtr . unObject- unsafeCastGObject = Object . castForeignPtr . unGObject--castToObject :: GObjectClass obj => obj -> Object-castToObject = castTo gTypeObject "Object"--gTypeObject :: GType-gTypeObject =- {# call fun unsafe gtk_object_get_type #}---- ********************************************************************* Widget--{#pointer *Widget foreign newtype #} deriving (Eq,Ord)--mkWidget = (Widget, objectUnrefFromMainloop)-unWidget (Widget o) = o--class ObjectClass o => WidgetClass o-toWidget :: WidgetClass o => o -> Widget-toWidget = unsafeCastGObject . toGObject--instance WidgetClass Widget-instance ObjectClass Widget-instance GObjectClass Widget where- toGObject = GObject . castForeignPtr . unWidget- unsafeCastGObject = Widget . castForeignPtr . unGObject--castToWidget :: GObjectClass obj => obj -> Widget-castToWidget = castTo gTypeWidget "Widget"--gTypeWidget :: GType-gTypeWidget =- {# call fun unsafe gtk_widget_get_type #}---- *********************************************************************** Misc--{#pointer *Misc foreign newtype #} deriving (Eq,Ord)--mkMisc = (Misc, objectUnrefFromMainloop)-unMisc (Misc o) = o--class WidgetClass o => MiscClass o-toMisc :: MiscClass o => o -> Misc-toMisc = unsafeCastGObject . toGObject--instance MiscClass Misc-instance WidgetClass Misc-instance ObjectClass Misc-instance GObjectClass Misc where- toGObject = GObject . castForeignPtr . unMisc- unsafeCastGObject = Misc . castForeignPtr . unGObject--castToMisc :: GObjectClass obj => obj -> Misc-castToMisc = castTo gTypeMisc "Misc"--gTypeMisc :: GType-gTypeMisc =- {# call fun unsafe gtk_misc_get_type #}---- ********************************************************************** Label--{#pointer *Label foreign newtype #} deriving (Eq,Ord)--mkLabel = (Label, objectUnrefFromMainloop)-unLabel (Label o) = o--class MiscClass o => LabelClass o-toLabel :: LabelClass o => o -> Label-toLabel = unsafeCastGObject . toGObject--instance LabelClass Label-instance MiscClass Label-instance WidgetClass Label-instance ObjectClass Label-instance GObjectClass Label where- toGObject = GObject . castForeignPtr . unLabel- unsafeCastGObject = Label . castForeignPtr . unGObject--castToLabel :: GObjectClass obj => obj -> Label-castToLabel = castTo gTypeLabel "Label"--gTypeLabel :: GType-gTypeLabel =- {# call fun unsafe gtk_label_get_type #}---- ***************************************************************** AccelLabel--{#pointer *AccelLabel foreign newtype #} deriving (Eq,Ord)--mkAccelLabel = (AccelLabel, objectUnrefFromMainloop)-unAccelLabel (AccelLabel o) = o--class LabelClass o => AccelLabelClass o-toAccelLabel :: AccelLabelClass o => o -> AccelLabel-toAccelLabel = unsafeCastGObject . toGObject--instance AccelLabelClass AccelLabel-instance LabelClass AccelLabel-instance MiscClass AccelLabel-instance WidgetClass AccelLabel-instance ObjectClass AccelLabel-instance GObjectClass AccelLabel where- toGObject = GObject . castForeignPtr . unAccelLabel- unsafeCastGObject = AccelLabel . castForeignPtr . unGObject--castToAccelLabel :: GObjectClass obj => obj -> AccelLabel-castToAccelLabel = castTo gTypeAccelLabel "AccelLabel"--gTypeAccelLabel :: GType-gTypeAccelLabel =- {# call fun unsafe gtk_accel_label_get_type #}---- ****************************************************************** TipsQuery--{#pointer *TipsQuery foreign newtype #} deriving (Eq,Ord)--mkTipsQuery = (TipsQuery, objectUnrefFromMainloop)-unTipsQuery (TipsQuery o) = o--class LabelClass o => TipsQueryClass o-toTipsQuery :: TipsQueryClass o => o -> TipsQuery-toTipsQuery = unsafeCastGObject . toGObject--instance TipsQueryClass TipsQuery-instance LabelClass TipsQuery-instance MiscClass TipsQuery-instance WidgetClass TipsQuery-instance ObjectClass TipsQuery-instance GObjectClass TipsQuery where- toGObject = GObject . castForeignPtr . unTipsQuery- unsafeCastGObject = TipsQuery . castForeignPtr . unGObject--castToTipsQuery :: GObjectClass obj => obj -> TipsQuery-castToTipsQuery = castTo gTypeTipsQuery "TipsQuery"--gTypeTipsQuery :: GType-gTypeTipsQuery =- {# call fun unsafe gtk_tips_query_get_type #}---- ********************************************************************** Arrow--{#pointer *Arrow foreign newtype #} deriving (Eq,Ord)--mkArrow = (Arrow, objectUnrefFromMainloop)-unArrow (Arrow o) = o--class MiscClass o => ArrowClass o-toArrow :: ArrowClass o => o -> Arrow-toArrow = unsafeCastGObject . toGObject--instance ArrowClass Arrow-instance MiscClass Arrow-instance WidgetClass Arrow-instance ObjectClass Arrow-instance GObjectClass Arrow where- toGObject = GObject . castForeignPtr . unArrow- unsafeCastGObject = Arrow . castForeignPtr . unGObject--castToArrow :: GObjectClass obj => obj -> Arrow-castToArrow = castTo gTypeArrow "Arrow"--gTypeArrow :: GType-gTypeArrow =- {# call fun unsafe gtk_arrow_get_type #}---- ********************************************************************** Image--{#pointer *Image foreign newtype #} deriving (Eq,Ord)--mkImage = (Image, objectUnrefFromMainloop)-unImage (Image o) = o--class MiscClass o => ImageClass o-toImage :: ImageClass o => o -> Image-toImage = unsafeCastGObject . toGObject--instance ImageClass Image-instance MiscClass Image-instance WidgetClass Image-instance ObjectClass Image-instance GObjectClass Image where- toGObject = GObject . castForeignPtr . unImage- unsafeCastGObject = Image . castForeignPtr . unGObject--castToImage :: GObjectClass obj => obj -> Image-castToImage = castTo gTypeImage "Image"--gTypeImage :: GType-gTypeImage =- {# call fun unsafe gtk_image_get_type #}---- ****************************************************************** Container--{#pointer *Container foreign newtype #} deriving (Eq,Ord)--mkContainer = (Container, objectUnrefFromMainloop)-unContainer (Container o) = o--class WidgetClass o => ContainerClass o-toContainer :: ContainerClass o => o -> Container-toContainer = unsafeCastGObject . toGObject--instance ContainerClass Container-instance WidgetClass Container-instance ObjectClass Container-instance GObjectClass Container where- toGObject = GObject . castForeignPtr . unContainer- unsafeCastGObject = Container . castForeignPtr . unGObject--castToContainer :: GObjectClass obj => obj -> Container-castToContainer = castTo gTypeContainer "Container"--gTypeContainer :: GType-gTypeContainer =- {# call fun unsafe gtk_container_get_type #}---- ************************************************************************ Bin--{#pointer *Bin foreign newtype #} deriving (Eq,Ord)--mkBin = (Bin, objectUnrefFromMainloop)-unBin (Bin o) = o--class ContainerClass o => BinClass o-toBin :: BinClass o => o -> Bin-toBin = unsafeCastGObject . toGObject--instance BinClass Bin-instance ContainerClass Bin-instance WidgetClass Bin-instance ObjectClass Bin-instance GObjectClass Bin where- toGObject = GObject . castForeignPtr . unBin- unsafeCastGObject = Bin . castForeignPtr . unGObject--castToBin :: GObjectClass obj => obj -> Bin-castToBin = castTo gTypeBin "Bin"--gTypeBin :: GType-gTypeBin =- {# call fun unsafe gtk_bin_get_type #}---- ****************************************************************** Alignment--{#pointer *Alignment foreign newtype #} deriving (Eq,Ord)--mkAlignment = (Alignment, objectUnrefFromMainloop)-unAlignment (Alignment o) = o--class BinClass o => AlignmentClass o-toAlignment :: AlignmentClass o => o -> Alignment-toAlignment = unsafeCastGObject . toGObject--instance AlignmentClass Alignment-instance BinClass Alignment-instance ContainerClass Alignment-instance WidgetClass Alignment-instance ObjectClass Alignment-instance GObjectClass Alignment where- toGObject = GObject . castForeignPtr . unAlignment- unsafeCastGObject = Alignment . castForeignPtr . unGObject--castToAlignment :: GObjectClass obj => obj -> Alignment-castToAlignment = castTo gTypeAlignment "Alignment"--gTypeAlignment :: GType-gTypeAlignment =- {# call fun unsafe gtk_alignment_get_type #}---- ********************************************************************** Frame--{#pointer *Frame foreign newtype #} deriving (Eq,Ord)--mkFrame = (Frame, objectUnrefFromMainloop)-unFrame (Frame o) = o--class BinClass o => FrameClass o-toFrame :: FrameClass o => o -> Frame-toFrame = unsafeCastGObject . toGObject--instance FrameClass Frame-instance BinClass Frame-instance ContainerClass Frame-instance WidgetClass Frame-instance ObjectClass Frame-instance GObjectClass Frame where- toGObject = GObject . castForeignPtr . unFrame- unsafeCastGObject = Frame . castForeignPtr . unGObject--castToFrame :: GObjectClass obj => obj -> Frame-castToFrame = castTo gTypeFrame "Frame"--gTypeFrame :: GType-gTypeFrame =- {# call fun unsafe gtk_frame_get_type #}---- **************************************************************** AspectFrame--{#pointer *AspectFrame foreign newtype #} deriving (Eq,Ord)--mkAspectFrame = (AspectFrame, objectUnrefFromMainloop)-unAspectFrame (AspectFrame o) = o--class FrameClass o => AspectFrameClass o-toAspectFrame :: AspectFrameClass o => o -> AspectFrame-toAspectFrame = unsafeCastGObject . toGObject--instance AspectFrameClass AspectFrame-instance FrameClass AspectFrame-instance BinClass AspectFrame-instance ContainerClass AspectFrame-instance WidgetClass AspectFrame-instance ObjectClass AspectFrame-instance GObjectClass AspectFrame where- toGObject = GObject . castForeignPtr . unAspectFrame- unsafeCastGObject = AspectFrame . castForeignPtr . unGObject--castToAspectFrame :: GObjectClass obj => obj -> AspectFrame-castToAspectFrame = castTo gTypeAspectFrame "AspectFrame"--gTypeAspectFrame :: GType-gTypeAspectFrame =- {# call fun unsafe gtk_aspect_frame_get_type #}---- ********************************************************************* Button--{#pointer *Button foreign newtype #} deriving (Eq,Ord)--mkButton = (Button, objectUnrefFromMainloop)-unButton (Button o) = o--class BinClass o => ButtonClass o-toButton :: ButtonClass o => o -> Button-toButton = unsafeCastGObject . toGObject--instance ButtonClass Button-instance BinClass Button-instance ContainerClass Button-instance WidgetClass Button-instance ObjectClass Button-instance GObjectClass Button where- toGObject = GObject . castForeignPtr . unButton- unsafeCastGObject = Button . castForeignPtr . unGObject--castToButton :: GObjectClass obj => obj -> Button-castToButton = castTo gTypeButton "Button"--gTypeButton :: GType-gTypeButton =- {# call fun unsafe gtk_button_get_type #}---- *************************************************************** ToggleButton--{#pointer *ToggleButton foreign newtype #} deriving (Eq,Ord)--mkToggleButton = (ToggleButton, objectUnrefFromMainloop)-unToggleButton (ToggleButton o) = o--class ButtonClass o => ToggleButtonClass o-toToggleButton :: ToggleButtonClass o => o -> ToggleButton-toToggleButton = unsafeCastGObject . toGObject--instance ToggleButtonClass ToggleButton-instance ButtonClass ToggleButton-instance BinClass ToggleButton-instance ContainerClass ToggleButton-instance WidgetClass ToggleButton-instance ObjectClass ToggleButton-instance GObjectClass ToggleButton where- toGObject = GObject . castForeignPtr . unToggleButton- unsafeCastGObject = ToggleButton . castForeignPtr . unGObject--castToToggleButton :: GObjectClass obj => obj -> ToggleButton-castToToggleButton = castTo gTypeToggleButton "ToggleButton"--gTypeToggleButton :: GType-gTypeToggleButton =- {# call fun unsafe gtk_toggle_button_get_type #}---- **************************************************************** CheckButton--{#pointer *CheckButton foreign newtype #} deriving (Eq,Ord)--mkCheckButton = (CheckButton, objectUnrefFromMainloop)-unCheckButton (CheckButton o) = o--class ToggleButtonClass o => CheckButtonClass o-toCheckButton :: CheckButtonClass o => o -> CheckButton-toCheckButton = unsafeCastGObject . toGObject--instance CheckButtonClass CheckButton-instance ToggleButtonClass CheckButton-instance ButtonClass CheckButton-instance BinClass CheckButton-instance ContainerClass CheckButton-instance WidgetClass CheckButton-instance ObjectClass CheckButton-instance GObjectClass CheckButton where- toGObject = GObject . castForeignPtr . unCheckButton- unsafeCastGObject = CheckButton . castForeignPtr . unGObject--castToCheckButton :: GObjectClass obj => obj -> CheckButton-castToCheckButton = castTo gTypeCheckButton "CheckButton"--gTypeCheckButton :: GType-gTypeCheckButton =- {# call fun unsafe gtk_check_button_get_type #}---- **************************************************************** RadioButton--{#pointer *RadioButton foreign newtype #} deriving (Eq,Ord)--mkRadioButton = (RadioButton, objectUnrefFromMainloop)-unRadioButton (RadioButton o) = o--class CheckButtonClass o => RadioButtonClass o-toRadioButton :: RadioButtonClass o => o -> RadioButton-toRadioButton = unsafeCastGObject . toGObject--instance RadioButtonClass RadioButton-instance CheckButtonClass RadioButton-instance ToggleButtonClass RadioButton-instance ButtonClass RadioButton-instance BinClass RadioButton-instance ContainerClass RadioButton-instance WidgetClass RadioButton-instance ObjectClass RadioButton-instance GObjectClass RadioButton where- toGObject = GObject . castForeignPtr . unRadioButton- unsafeCastGObject = RadioButton . castForeignPtr . unGObject--castToRadioButton :: GObjectClass obj => obj -> RadioButton-castToRadioButton = castTo gTypeRadioButton "RadioButton"--gTypeRadioButton :: GType-gTypeRadioButton =- {# call fun unsafe gtk_radio_button_get_type #}---- **************************************************************** ColorButton--{#pointer *ColorButton foreign newtype #} deriving (Eq,Ord)--mkColorButton = (ColorButton, objectUnrefFromMainloop)-unColorButton (ColorButton o) = o--class ButtonClass o => ColorButtonClass o-toColorButton :: ColorButtonClass o => o -> ColorButton-toColorButton = unsafeCastGObject . toGObject--instance ColorButtonClass ColorButton-instance ButtonClass ColorButton-instance BinClass ColorButton-instance ContainerClass ColorButton-instance WidgetClass ColorButton-instance ObjectClass ColorButton-instance GObjectClass ColorButton where- toGObject = GObject . castForeignPtr . unColorButton- unsafeCastGObject = ColorButton . castForeignPtr . unGObject--castToColorButton :: GObjectClass obj => obj -> ColorButton-castToColorButton = castTo gTypeColorButton "ColorButton"--gTypeColorButton :: GType-gTypeColorButton =- {# call fun unsafe gtk_color_button_get_type #}---- ***************************************************************** FontButton--{#pointer *FontButton foreign newtype #} deriving (Eq,Ord)--mkFontButton = (FontButton, objectUnrefFromMainloop)-unFontButton (FontButton o) = o--class ButtonClass o => FontButtonClass o-toFontButton :: FontButtonClass o => o -> FontButton-toFontButton = unsafeCastGObject . toGObject--instance FontButtonClass FontButton-instance ButtonClass FontButton-instance BinClass FontButton-instance ContainerClass FontButton-instance WidgetClass FontButton-instance ObjectClass FontButton-instance GObjectClass FontButton where- toGObject = GObject . castForeignPtr . unFontButton- unsafeCastGObject = FontButton . castForeignPtr . unGObject--castToFontButton :: GObjectClass obj => obj -> FontButton-castToFontButton = castTo gTypeFontButton "FontButton"--gTypeFontButton :: GType-gTypeFontButton =- {# call fun unsafe gtk_font_button_get_type #}---- ***************************************************************** OptionMenu--{#pointer *OptionMenu foreign newtype #} deriving (Eq,Ord)--mkOptionMenu = (OptionMenu, objectUnrefFromMainloop)-unOptionMenu (OptionMenu o) = o--class ButtonClass o => OptionMenuClass o-toOptionMenu :: OptionMenuClass o => o -> OptionMenu-toOptionMenu = unsafeCastGObject . toGObject--instance OptionMenuClass OptionMenu-instance ButtonClass OptionMenu-instance BinClass OptionMenu-instance ContainerClass OptionMenu-instance WidgetClass OptionMenu-instance ObjectClass OptionMenu-instance GObjectClass OptionMenu where- toGObject = GObject . castForeignPtr . unOptionMenu- unsafeCastGObject = OptionMenu . castForeignPtr . unGObject--castToOptionMenu :: GObjectClass obj => obj -> OptionMenu-castToOptionMenu = castTo gTypeOptionMenu "OptionMenu"--gTypeOptionMenu :: GType-gTypeOptionMenu =- {# call fun unsafe gtk_option_menu_get_type #}---- *********************************************************************** Item--{#pointer *Item foreign newtype #} deriving (Eq,Ord)--mkItem = (Item, objectUnrefFromMainloop)-unItem (Item o) = o--class BinClass o => ItemClass o-toItem :: ItemClass o => o -> Item-toItem = unsafeCastGObject . toGObject--instance ItemClass Item-instance BinClass Item-instance ContainerClass Item-instance WidgetClass Item-instance ObjectClass Item-instance GObjectClass Item where- toGObject = GObject . castForeignPtr . unItem- unsafeCastGObject = Item . castForeignPtr . unGObject--castToItem :: GObjectClass obj => obj -> Item-castToItem = castTo gTypeItem "Item"--gTypeItem :: GType-gTypeItem =- {# call fun unsafe gtk_item_get_type #}---- ******************************************************************* MenuItem--{#pointer *MenuItem foreign newtype #} deriving (Eq,Ord)--mkMenuItem = (MenuItem, objectUnrefFromMainloop)-unMenuItem (MenuItem o) = o--class ItemClass o => MenuItemClass o-toMenuItem :: MenuItemClass o => o -> MenuItem-toMenuItem = unsafeCastGObject . toGObject--instance MenuItemClass MenuItem-instance ItemClass MenuItem-instance BinClass MenuItem-instance ContainerClass MenuItem-instance WidgetClass MenuItem-instance ObjectClass MenuItem-instance GObjectClass MenuItem where- toGObject = GObject . castForeignPtr . unMenuItem- unsafeCastGObject = MenuItem . castForeignPtr . unGObject--castToMenuItem :: GObjectClass obj => obj -> MenuItem-castToMenuItem = castTo gTypeMenuItem "MenuItem"--gTypeMenuItem :: GType-gTypeMenuItem =- {# call fun unsafe gtk_menu_item_get_type #}---- ************************************************************** CheckMenuItem--{#pointer *CheckMenuItem foreign newtype #} deriving (Eq,Ord)--mkCheckMenuItem = (CheckMenuItem, objectUnrefFromMainloop)-unCheckMenuItem (CheckMenuItem o) = o--class MenuItemClass o => CheckMenuItemClass o-toCheckMenuItem :: CheckMenuItemClass o => o -> CheckMenuItem-toCheckMenuItem = unsafeCastGObject . toGObject--instance CheckMenuItemClass CheckMenuItem-instance MenuItemClass CheckMenuItem-instance ItemClass CheckMenuItem-instance BinClass CheckMenuItem-instance ContainerClass CheckMenuItem-instance WidgetClass CheckMenuItem-instance ObjectClass CheckMenuItem-instance GObjectClass CheckMenuItem where- toGObject = GObject . castForeignPtr . unCheckMenuItem- unsafeCastGObject = CheckMenuItem . castForeignPtr . unGObject--castToCheckMenuItem :: GObjectClass obj => obj -> CheckMenuItem-castToCheckMenuItem = castTo gTypeCheckMenuItem "CheckMenuItem"--gTypeCheckMenuItem :: GType-gTypeCheckMenuItem =- {# call fun unsafe gtk_check_menu_item_get_type #}---- ************************************************************** RadioMenuItem--{#pointer *RadioMenuItem foreign newtype #} deriving (Eq,Ord)--mkRadioMenuItem = (RadioMenuItem, objectUnrefFromMainloop)-unRadioMenuItem (RadioMenuItem o) = o--class CheckMenuItemClass o => RadioMenuItemClass o-toRadioMenuItem :: RadioMenuItemClass o => o -> RadioMenuItem-toRadioMenuItem = unsafeCastGObject . toGObject--instance RadioMenuItemClass RadioMenuItem-instance CheckMenuItemClass RadioMenuItem-instance MenuItemClass RadioMenuItem-instance ItemClass RadioMenuItem-instance BinClass RadioMenuItem-instance ContainerClass RadioMenuItem-instance WidgetClass RadioMenuItem-instance ObjectClass RadioMenuItem-instance GObjectClass RadioMenuItem where- toGObject = GObject . castForeignPtr . unRadioMenuItem- unsafeCastGObject = RadioMenuItem . castForeignPtr . unGObject--castToRadioMenuItem :: GObjectClass obj => obj -> RadioMenuItem-castToRadioMenuItem = castTo gTypeRadioMenuItem "RadioMenuItem"--gTypeRadioMenuItem :: GType-gTypeRadioMenuItem =- {# call fun unsafe gtk_radio_menu_item_get_type #}---- ************************************************************ TearoffMenuItem--{#pointer *TearoffMenuItem foreign newtype #} deriving (Eq,Ord)--mkTearoffMenuItem = (TearoffMenuItem, objectUnrefFromMainloop)-unTearoffMenuItem (TearoffMenuItem o) = o--class MenuItemClass o => TearoffMenuItemClass o-toTearoffMenuItem :: TearoffMenuItemClass o => o -> TearoffMenuItem-toTearoffMenuItem = unsafeCastGObject . toGObject--instance TearoffMenuItemClass TearoffMenuItem-instance MenuItemClass TearoffMenuItem-instance ItemClass TearoffMenuItem-instance BinClass TearoffMenuItem-instance ContainerClass TearoffMenuItem-instance WidgetClass TearoffMenuItem-instance ObjectClass TearoffMenuItem-instance GObjectClass TearoffMenuItem where- toGObject = GObject . castForeignPtr . unTearoffMenuItem- unsafeCastGObject = TearoffMenuItem . castForeignPtr . unGObject--castToTearoffMenuItem :: GObjectClass obj => obj -> TearoffMenuItem-castToTearoffMenuItem = castTo gTypeTearoffMenuItem "TearoffMenuItem"--gTypeTearoffMenuItem :: GType-gTypeTearoffMenuItem =- {# call fun unsafe gtk_tearoff_menu_item_get_type #}---- ************************************************************** ImageMenuItem--{#pointer *ImageMenuItem foreign newtype #} deriving (Eq,Ord)--mkImageMenuItem = (ImageMenuItem, objectUnrefFromMainloop)-unImageMenuItem (ImageMenuItem o) = o--class MenuItemClass o => ImageMenuItemClass o-toImageMenuItem :: ImageMenuItemClass o => o -> ImageMenuItem-toImageMenuItem = unsafeCastGObject . toGObject--instance ImageMenuItemClass ImageMenuItem-instance MenuItemClass ImageMenuItem-instance ItemClass ImageMenuItem-instance BinClass ImageMenuItem-instance ContainerClass ImageMenuItem-instance WidgetClass ImageMenuItem-instance ObjectClass ImageMenuItem-instance GObjectClass ImageMenuItem where- toGObject = GObject . castForeignPtr . unImageMenuItem- unsafeCastGObject = ImageMenuItem . castForeignPtr . unGObject--castToImageMenuItem :: GObjectClass obj => obj -> ImageMenuItem-castToImageMenuItem = castTo gTypeImageMenuItem "ImageMenuItem"--gTypeImageMenuItem :: GType-gTypeImageMenuItem =- {# call fun unsafe gtk_image_menu_item_get_type #}---- ********************************************************** SeparatorMenuItem--{#pointer *SeparatorMenuItem foreign newtype #} deriving (Eq,Ord)--mkSeparatorMenuItem = (SeparatorMenuItem, objectUnrefFromMainloop)-unSeparatorMenuItem (SeparatorMenuItem o) = o--class MenuItemClass o => SeparatorMenuItemClass o-toSeparatorMenuItem :: SeparatorMenuItemClass o => o -> SeparatorMenuItem-toSeparatorMenuItem = unsafeCastGObject . toGObject--instance SeparatorMenuItemClass SeparatorMenuItem-instance MenuItemClass SeparatorMenuItem-instance ItemClass SeparatorMenuItem-instance BinClass SeparatorMenuItem-instance ContainerClass SeparatorMenuItem-instance WidgetClass SeparatorMenuItem-instance ObjectClass SeparatorMenuItem-instance GObjectClass SeparatorMenuItem where- toGObject = GObject . castForeignPtr . unSeparatorMenuItem- unsafeCastGObject = SeparatorMenuItem . castForeignPtr . unGObject--castToSeparatorMenuItem :: GObjectClass obj => obj -> SeparatorMenuItem-castToSeparatorMenuItem = castTo gTypeSeparatorMenuItem "SeparatorMenuItem"--gTypeSeparatorMenuItem :: GType-gTypeSeparatorMenuItem =- {# call fun unsafe gtk_separator_menu_item_get_type #}---- ******************************************************************* ListItem--{#pointer *ListItem foreign newtype #} deriving (Eq,Ord)--mkListItem = (ListItem, objectUnrefFromMainloop)-unListItem (ListItem o) = o--class ItemClass o => ListItemClass o-toListItem :: ListItemClass o => o -> ListItem-toListItem = unsafeCastGObject . toGObject--instance ListItemClass ListItem-instance ItemClass ListItem-instance BinClass ListItem-instance ContainerClass ListItem-instance WidgetClass ListItem-instance ObjectClass ListItem-instance GObjectClass ListItem where- toGObject = GObject . castForeignPtr . unListItem- unsafeCastGObject = ListItem . castForeignPtr . unGObject--castToListItem :: GObjectClass obj => obj -> ListItem-castToListItem = castTo gTypeListItem "ListItem"--gTypeListItem :: GType-gTypeListItem =- {# call fun unsafe gtk_list_item_get_type #}---- ********************************************************************* Window--{#pointer *Window foreign newtype #} deriving (Eq,Ord)--mkWindow = (Window, objectUnrefFromMainloop)-unWindow (Window o) = o--class BinClass o => WindowClass o-toWindow :: WindowClass o => o -> Window-toWindow = unsafeCastGObject . toGObject--instance WindowClass Window-instance BinClass Window-instance ContainerClass Window-instance WidgetClass Window-instance ObjectClass Window-instance GObjectClass Window where- toGObject = GObject . castForeignPtr . unWindow- unsafeCastGObject = Window . castForeignPtr . unGObject--castToWindow :: GObjectClass obj => obj -> Window-castToWindow = castTo gTypeWindow "Window"--gTypeWindow :: GType-gTypeWindow =- {# call fun unsafe gtk_window_get_type #}---- ********************************************************************* Dialog--{#pointer *Dialog foreign newtype #} deriving (Eq,Ord)--mkDialog = (Dialog, objectUnrefFromMainloop)-unDialog (Dialog o) = o--class WindowClass o => DialogClass o-toDialog :: DialogClass o => o -> Dialog-toDialog = unsafeCastGObject . toGObject--instance DialogClass Dialog-instance WindowClass Dialog-instance BinClass Dialog-instance ContainerClass Dialog-instance WidgetClass Dialog-instance ObjectClass Dialog-instance GObjectClass Dialog where- toGObject = GObject . castForeignPtr . unDialog- unsafeCastGObject = Dialog . castForeignPtr . unGObject--castToDialog :: GObjectClass obj => obj -> Dialog-castToDialog = castTo gTypeDialog "Dialog"--gTypeDialog :: GType-gTypeDialog =- {# call fun unsafe gtk_dialog_get_type #}---- **************************************************************** AboutDialog--{#pointer *AboutDialog foreign newtype #} deriving (Eq,Ord)--mkAboutDialog = (AboutDialog, objectUnrefFromMainloop)-unAboutDialog (AboutDialog o) = o--class DialogClass o => AboutDialogClass o-toAboutDialog :: AboutDialogClass o => o -> AboutDialog-toAboutDialog = unsafeCastGObject . toGObject--instance AboutDialogClass AboutDialog-instance DialogClass AboutDialog-instance WindowClass AboutDialog-instance BinClass AboutDialog-instance ContainerClass AboutDialog-instance WidgetClass AboutDialog-instance ObjectClass AboutDialog-instance GObjectClass AboutDialog where- toGObject = GObject . castForeignPtr . unAboutDialog- unsafeCastGObject = AboutDialog . castForeignPtr . unGObject--castToAboutDialog :: GObjectClass obj => obj -> AboutDialog-castToAboutDialog = castTo gTypeAboutDialog "AboutDialog"--gTypeAboutDialog :: GType-gTypeAboutDialog =- {# call fun unsafe gtk_about_dialog_get_type #}---- ******************************************************* ColorSelectionDialog--{#pointer *ColorSelectionDialog foreign newtype #} deriving (Eq,Ord)--mkColorSelectionDialog = (ColorSelectionDialog, objectUnrefFromMainloop)-unColorSelectionDialog (ColorSelectionDialog o) = o--class DialogClass o => ColorSelectionDialogClass o-toColorSelectionDialog :: ColorSelectionDialogClass o => o -> ColorSelectionDialog-toColorSelectionDialog = unsafeCastGObject . toGObject--instance ColorSelectionDialogClass ColorSelectionDialog-instance DialogClass ColorSelectionDialog-instance WindowClass ColorSelectionDialog-instance BinClass ColorSelectionDialog-instance ContainerClass ColorSelectionDialog-instance WidgetClass ColorSelectionDialog-instance ObjectClass ColorSelectionDialog-instance GObjectClass ColorSelectionDialog where- toGObject = GObject . castForeignPtr . unColorSelectionDialog- unsafeCastGObject = ColorSelectionDialog . castForeignPtr . unGObject--castToColorSelectionDialog :: GObjectClass obj => obj -> ColorSelectionDialog-castToColorSelectionDialog = castTo gTypeColorSelectionDialog "ColorSelectionDialog"--gTypeColorSelectionDialog :: GType-gTypeColorSelectionDialog =- {# call fun unsafe gtk_color_selection_dialog_get_type #}---- ************************************************************** FileSelection--{#pointer *FileSelection foreign newtype #} deriving (Eq,Ord)--mkFileSelection = (FileSelection, objectUnrefFromMainloop)-unFileSelection (FileSelection o) = o--class DialogClass o => FileSelectionClass o-toFileSelection :: FileSelectionClass o => o -> FileSelection-toFileSelection = unsafeCastGObject . toGObject--instance FileSelectionClass FileSelection-instance DialogClass FileSelection-instance WindowClass FileSelection-instance BinClass FileSelection-instance ContainerClass FileSelection-instance WidgetClass FileSelection-instance ObjectClass FileSelection-instance GObjectClass FileSelection where- toGObject = GObject . castForeignPtr . unFileSelection- unsafeCastGObject = FileSelection . castForeignPtr . unGObject--castToFileSelection :: GObjectClass obj => obj -> FileSelection-castToFileSelection = castTo gTypeFileSelection "FileSelection"--gTypeFileSelection :: GType-gTypeFileSelection =- {# call fun unsafe gtk_file_selection_get_type #}---- ********************************************************** FileChooserDialog--{#pointer *FileChooserDialog foreign newtype #} deriving (Eq,Ord)--mkFileChooserDialog = (FileChooserDialog, objectUnrefFromMainloop)-unFileChooserDialog (FileChooserDialog o) = o--class DialogClass o => FileChooserDialogClass o-toFileChooserDialog :: FileChooserDialogClass o => o -> FileChooserDialog-toFileChooserDialog = unsafeCastGObject . toGObject--instance FileChooserDialogClass FileChooserDialog-instance DialogClass FileChooserDialog-instance WindowClass FileChooserDialog-instance BinClass FileChooserDialog-instance ContainerClass FileChooserDialog-instance WidgetClass FileChooserDialog-instance ObjectClass FileChooserDialog-instance GObjectClass FileChooserDialog where- toGObject = GObject . castForeignPtr . unFileChooserDialog- unsafeCastGObject = FileChooserDialog . castForeignPtr . unGObject--castToFileChooserDialog :: GObjectClass obj => obj -> FileChooserDialog-castToFileChooserDialog = castTo gTypeFileChooserDialog "FileChooserDialog"--gTypeFileChooserDialog :: GType-gTypeFileChooserDialog =- {# call fun unsafe gtk_file_chooser_dialog_get_type #}---- ******************************************************** FontSelectionDialog--{#pointer *FontSelectionDialog foreign newtype #} deriving (Eq,Ord)--mkFontSelectionDialog = (FontSelectionDialog, objectUnrefFromMainloop)-unFontSelectionDialog (FontSelectionDialog o) = o--class DialogClass o => FontSelectionDialogClass o-toFontSelectionDialog :: FontSelectionDialogClass o => o -> FontSelectionDialog-toFontSelectionDialog = unsafeCastGObject . toGObject--instance FontSelectionDialogClass FontSelectionDialog-instance DialogClass FontSelectionDialog-instance WindowClass FontSelectionDialog-instance BinClass FontSelectionDialog-instance ContainerClass FontSelectionDialog-instance WidgetClass FontSelectionDialog-instance ObjectClass FontSelectionDialog-instance GObjectClass FontSelectionDialog where- toGObject = GObject . castForeignPtr . unFontSelectionDialog- unsafeCastGObject = FontSelectionDialog . castForeignPtr . unGObject--castToFontSelectionDialog :: GObjectClass obj => obj -> FontSelectionDialog-castToFontSelectionDialog = castTo gTypeFontSelectionDialog "FontSelectionDialog"--gTypeFontSelectionDialog :: GType-gTypeFontSelectionDialog =- {# call fun unsafe gtk_font_selection_dialog_get_type #}---- **************************************************************** InputDialog--{#pointer *InputDialog foreign newtype #} deriving (Eq,Ord)--mkInputDialog = (InputDialog, objectUnrefFromMainloop)-unInputDialog (InputDialog o) = o--class DialogClass o => InputDialogClass o-toInputDialog :: InputDialogClass o => o -> InputDialog-toInputDialog = unsafeCastGObject . toGObject--instance InputDialogClass InputDialog-instance DialogClass InputDialog-instance WindowClass InputDialog-instance BinClass InputDialog-instance ContainerClass InputDialog-instance WidgetClass InputDialog-instance ObjectClass InputDialog-instance GObjectClass InputDialog where- toGObject = GObject . castForeignPtr . unInputDialog- unsafeCastGObject = InputDialog . castForeignPtr . unGObject--castToInputDialog :: GObjectClass obj => obj -> InputDialog-castToInputDialog = castTo gTypeInputDialog "InputDialog"--gTypeInputDialog :: GType-gTypeInputDialog =- {# call fun unsafe gtk_input_dialog_get_type #}---- ************************************************************** MessageDialog--{#pointer *MessageDialog foreign newtype #} deriving (Eq,Ord)--mkMessageDialog = (MessageDialog, objectUnrefFromMainloop)-unMessageDialog (MessageDialog o) = o--class DialogClass o => MessageDialogClass o-toMessageDialog :: MessageDialogClass o => o -> MessageDialog-toMessageDialog = unsafeCastGObject . toGObject--instance MessageDialogClass MessageDialog-instance DialogClass MessageDialog-instance WindowClass MessageDialog-instance BinClass MessageDialog-instance ContainerClass MessageDialog-instance WidgetClass MessageDialog-instance ObjectClass MessageDialog-instance GObjectClass MessageDialog where- toGObject = GObject . castForeignPtr . unMessageDialog- unsafeCastGObject = MessageDialog . castForeignPtr . unGObject--castToMessageDialog :: GObjectClass obj => obj -> MessageDialog-castToMessageDialog = castTo gTypeMessageDialog "MessageDialog"--gTypeMessageDialog :: GType-gTypeMessageDialog =- {# call fun unsafe gtk_message_dialog_get_type #}---- *********************************************************************** Plug--{#pointer *Plug foreign newtype #} deriving (Eq,Ord)--mkPlug = (Plug, objectUnrefFromMainloop)-unPlug (Plug o) = o--class WindowClass o => PlugClass o-toPlug :: PlugClass o => o -> Plug-toPlug = unsafeCastGObject . toGObject--instance PlugClass Plug-instance WindowClass Plug-instance BinClass Plug-instance ContainerClass Plug-instance WidgetClass Plug-instance ObjectClass Plug-instance GObjectClass Plug where- toGObject = GObject . castForeignPtr . unPlug- unsafeCastGObject = Plug . castForeignPtr . unGObject--castToPlug :: GObjectClass obj => obj -> Plug-castToPlug = castTo gTypePlug "Plug"--gTypePlug :: GType-gTypePlug =- {# call fun unsafe gtk_plug_get_type #}---- ******************************************************************* EventBox--{#pointer *EventBox foreign newtype #} deriving (Eq,Ord)--mkEventBox = (EventBox, objectUnrefFromMainloop)-unEventBox (EventBox o) = o--class BinClass o => EventBoxClass o-toEventBox :: EventBoxClass o => o -> EventBox-toEventBox = unsafeCastGObject . toGObject--instance EventBoxClass EventBox-instance BinClass EventBox-instance ContainerClass EventBox-instance WidgetClass EventBox-instance ObjectClass EventBox-instance GObjectClass EventBox where- toGObject = GObject . castForeignPtr . unEventBox- unsafeCastGObject = EventBox . castForeignPtr . unGObject--castToEventBox :: GObjectClass obj => obj -> EventBox-castToEventBox = castTo gTypeEventBox "EventBox"--gTypeEventBox :: GType-gTypeEventBox =- {# call fun unsafe gtk_event_box_get_type #}---- ****************************************************************** HandleBox--{#pointer *HandleBox foreign newtype #} deriving (Eq,Ord)--mkHandleBox = (HandleBox, objectUnrefFromMainloop)-unHandleBox (HandleBox o) = o--class BinClass o => HandleBoxClass o-toHandleBox :: HandleBoxClass o => o -> HandleBox-toHandleBox = unsafeCastGObject . toGObject--instance HandleBoxClass HandleBox-instance BinClass HandleBox-instance ContainerClass HandleBox-instance WidgetClass HandleBox-instance ObjectClass HandleBox-instance GObjectClass HandleBox where- toGObject = GObject . castForeignPtr . unHandleBox- unsafeCastGObject = HandleBox . castForeignPtr . unGObject--castToHandleBox :: GObjectClass obj => obj -> HandleBox-castToHandleBox = castTo gTypeHandleBox "HandleBox"--gTypeHandleBox :: GType-gTypeHandleBox =- {# call fun unsafe gtk_handle_box_get_type #}---- ************************************************************* ScrolledWindow--{#pointer *ScrolledWindow foreign newtype #} deriving (Eq,Ord)--mkScrolledWindow = (ScrolledWindow, objectUnrefFromMainloop)-unScrolledWindow (ScrolledWindow o) = o--class BinClass o => ScrolledWindowClass o-toScrolledWindow :: ScrolledWindowClass o => o -> ScrolledWindow-toScrolledWindow = unsafeCastGObject . toGObject--instance ScrolledWindowClass ScrolledWindow-instance BinClass ScrolledWindow-instance ContainerClass ScrolledWindow-instance WidgetClass ScrolledWindow-instance ObjectClass ScrolledWindow-instance GObjectClass ScrolledWindow where- toGObject = GObject . castForeignPtr . unScrolledWindow- unsafeCastGObject = ScrolledWindow . castForeignPtr . unGObject--castToScrolledWindow :: GObjectClass obj => obj -> ScrolledWindow-castToScrolledWindow = castTo gTypeScrolledWindow "ScrolledWindow"--gTypeScrolledWindow :: GType-gTypeScrolledWindow =- {# call fun unsafe gtk_scrolled_window_get_type #}---- ******************************************************************* Viewport--{#pointer *Viewport foreign newtype #} deriving (Eq,Ord)--mkViewport = (Viewport, objectUnrefFromMainloop)-unViewport (Viewport o) = o--class BinClass o => ViewportClass o-toViewport :: ViewportClass o => o -> Viewport-toViewport = unsafeCastGObject . toGObject--instance ViewportClass Viewport-instance BinClass Viewport-instance ContainerClass Viewport-instance WidgetClass Viewport-instance ObjectClass Viewport-instance GObjectClass Viewport where- toGObject = GObject . castForeignPtr . unViewport- unsafeCastGObject = Viewport . castForeignPtr . unGObject--castToViewport :: GObjectClass obj => obj -> Viewport-castToViewport = castTo gTypeViewport "Viewport"--gTypeViewport :: GType-gTypeViewport =- {# call fun unsafe gtk_viewport_get_type #}---- ******************************************************************* Expander--{#pointer *Expander foreign newtype #} deriving (Eq,Ord)--mkExpander = (Expander, objectUnrefFromMainloop)-unExpander (Expander o) = o--class BinClass o => ExpanderClass o-toExpander :: ExpanderClass o => o -> Expander-toExpander = unsafeCastGObject . toGObject--instance ExpanderClass Expander-instance BinClass Expander-instance ContainerClass Expander-instance WidgetClass Expander-instance ObjectClass Expander-instance GObjectClass Expander where- toGObject = GObject . castForeignPtr . unExpander- unsafeCastGObject = Expander . castForeignPtr . unGObject--castToExpander :: GObjectClass obj => obj -> Expander-castToExpander = castTo gTypeExpander "Expander"--gTypeExpander :: GType-gTypeExpander =- {# call fun unsafe gtk_expander_get_type #}---- ******************************************************************* ComboBox--{#pointer *ComboBox foreign newtype #} deriving (Eq,Ord)--mkComboBox = (ComboBox, objectUnrefFromMainloop)-unComboBox (ComboBox o) = o--class BinClass o => ComboBoxClass o-toComboBox :: ComboBoxClass o => o -> ComboBox-toComboBox = unsafeCastGObject . toGObject--instance ComboBoxClass ComboBox-instance BinClass ComboBox-instance ContainerClass ComboBox-instance WidgetClass ComboBox-instance ObjectClass ComboBox-instance GObjectClass ComboBox where- toGObject = GObject . castForeignPtr . unComboBox- unsafeCastGObject = ComboBox . castForeignPtr . unGObject--castToComboBox :: GObjectClass obj => obj -> ComboBox-castToComboBox = castTo gTypeComboBox "ComboBox"--gTypeComboBox :: GType-gTypeComboBox =- {# call fun unsafe gtk_combo_box_get_type #}---- ************************************************************** ComboBoxEntry--{#pointer *ComboBoxEntry foreign newtype #} deriving (Eq,Ord)--mkComboBoxEntry = (ComboBoxEntry, objectUnrefFromMainloop)-unComboBoxEntry (ComboBoxEntry o) = o--class ComboBoxClass o => ComboBoxEntryClass o-toComboBoxEntry :: ComboBoxEntryClass o => o -> ComboBoxEntry-toComboBoxEntry = unsafeCastGObject . toGObject--instance ComboBoxEntryClass ComboBoxEntry-instance ComboBoxClass ComboBoxEntry-instance BinClass ComboBoxEntry-instance ContainerClass ComboBoxEntry-instance WidgetClass ComboBoxEntry-instance ObjectClass ComboBoxEntry-instance GObjectClass ComboBoxEntry where- toGObject = GObject . castForeignPtr . unComboBoxEntry- unsafeCastGObject = ComboBoxEntry . castForeignPtr . unGObject--castToComboBoxEntry :: GObjectClass obj => obj -> ComboBoxEntry-castToComboBoxEntry = castTo gTypeComboBoxEntry "ComboBoxEntry"--gTypeComboBoxEntry :: GType-gTypeComboBoxEntry =- {# call fun unsafe gtk_combo_box_entry_get_type #}---- ******************************************************************* ToolItem--{#pointer *ToolItem foreign newtype #} deriving (Eq,Ord)--mkToolItem = (ToolItem, objectUnrefFromMainloop)-unToolItem (ToolItem o) = o--class BinClass o => ToolItemClass o-toToolItem :: ToolItemClass o => o -> ToolItem-toToolItem = unsafeCastGObject . toGObject--instance ToolItemClass ToolItem-instance BinClass ToolItem-instance ContainerClass ToolItem-instance WidgetClass ToolItem-instance ObjectClass ToolItem-instance GObjectClass ToolItem where- toGObject = GObject . castForeignPtr . unToolItem- unsafeCastGObject = ToolItem . castForeignPtr . unGObject--castToToolItem :: GObjectClass obj => obj -> ToolItem-castToToolItem = castTo gTypeToolItem "ToolItem"--gTypeToolItem :: GType-gTypeToolItem =- {# call fun unsafe gtk_tool_item_get_type #}---- ***************************************************************** ToolButton--{#pointer *ToolButton foreign newtype #} deriving (Eq,Ord)--mkToolButton = (ToolButton, objectUnrefFromMainloop)-unToolButton (ToolButton o) = o--class ToolItemClass o => ToolButtonClass o-toToolButton :: ToolButtonClass o => o -> ToolButton-toToolButton = unsafeCastGObject . toGObject--instance ToolButtonClass ToolButton-instance ToolItemClass ToolButton-instance BinClass ToolButton-instance ContainerClass ToolButton-instance WidgetClass ToolButton-instance ObjectClass ToolButton-instance GObjectClass ToolButton where- toGObject = GObject . castForeignPtr . unToolButton- unsafeCastGObject = ToolButton . castForeignPtr . unGObject--castToToolButton :: GObjectClass obj => obj -> ToolButton-castToToolButton = castTo gTypeToolButton "ToolButton"--gTypeToolButton :: GType-gTypeToolButton =- {# call fun unsafe gtk_tool_button_get_type #}---- ************************************************************* MenuToolButton--{#pointer *MenuToolButton foreign newtype #} deriving (Eq,Ord)--mkMenuToolButton = (MenuToolButton, objectUnrefFromMainloop)-unMenuToolButton (MenuToolButton o) = o--class ToolButtonClass o => MenuToolButtonClass o-toMenuToolButton :: MenuToolButtonClass o => o -> MenuToolButton-toMenuToolButton = unsafeCastGObject . toGObject--instance MenuToolButtonClass MenuToolButton-instance ToolButtonClass MenuToolButton-instance ToolItemClass MenuToolButton-instance BinClass MenuToolButton-instance ContainerClass MenuToolButton-instance WidgetClass MenuToolButton-instance ObjectClass MenuToolButton-instance GObjectClass MenuToolButton where- toGObject = GObject . castForeignPtr . unMenuToolButton- unsafeCastGObject = MenuToolButton . castForeignPtr . unGObject--castToMenuToolButton :: GObjectClass obj => obj -> MenuToolButton-castToMenuToolButton = castTo gTypeMenuToolButton "MenuToolButton"--gTypeMenuToolButton :: GType-gTypeMenuToolButton =- {# call fun unsafe gtk_menu_tool_button_get_type #}---- *********************************************************** ToggleToolButton--{#pointer *ToggleToolButton foreign newtype #} deriving (Eq,Ord)--mkToggleToolButton = (ToggleToolButton, objectUnrefFromMainloop)-unToggleToolButton (ToggleToolButton o) = o--class ToolButtonClass o => ToggleToolButtonClass o-toToggleToolButton :: ToggleToolButtonClass o => o -> ToggleToolButton-toToggleToolButton = unsafeCastGObject . toGObject--instance ToggleToolButtonClass ToggleToolButton-instance ToolButtonClass ToggleToolButton-instance ToolItemClass ToggleToolButton-instance BinClass ToggleToolButton-instance ContainerClass ToggleToolButton-instance WidgetClass ToggleToolButton-instance ObjectClass ToggleToolButton-instance GObjectClass ToggleToolButton where- toGObject = GObject . castForeignPtr . unToggleToolButton- unsafeCastGObject = ToggleToolButton . castForeignPtr . unGObject--castToToggleToolButton :: GObjectClass obj => obj -> ToggleToolButton-castToToggleToolButton = castTo gTypeToggleToolButton "ToggleToolButton"--gTypeToggleToolButton :: GType-gTypeToggleToolButton =- {# call fun unsafe gtk_toggle_tool_button_get_type #}---- ************************************************************ RadioToolButton--{#pointer *RadioToolButton foreign newtype #} deriving (Eq,Ord)--mkRadioToolButton = (RadioToolButton, objectUnrefFromMainloop)-unRadioToolButton (RadioToolButton o) = o--class ToggleToolButtonClass o => RadioToolButtonClass o-toRadioToolButton :: RadioToolButtonClass o => o -> RadioToolButton-toRadioToolButton = unsafeCastGObject . toGObject--instance RadioToolButtonClass RadioToolButton-instance ToggleToolButtonClass RadioToolButton-instance ToolButtonClass RadioToolButton-instance ToolItemClass RadioToolButton-instance BinClass RadioToolButton-instance ContainerClass RadioToolButton-instance WidgetClass RadioToolButton-instance ObjectClass RadioToolButton-instance GObjectClass RadioToolButton where- toGObject = GObject . castForeignPtr . unRadioToolButton- unsafeCastGObject = RadioToolButton . castForeignPtr . unGObject--castToRadioToolButton :: GObjectClass obj => obj -> RadioToolButton-castToRadioToolButton = castTo gTypeRadioToolButton "RadioToolButton"--gTypeRadioToolButton :: GType-gTypeRadioToolButton =- {# call fun unsafe gtk_radio_tool_button_get_type #}---- ********************************************************** SeparatorToolItem--{#pointer *SeparatorToolItem foreign newtype #} deriving (Eq,Ord)--mkSeparatorToolItem = (SeparatorToolItem, objectUnrefFromMainloop)-unSeparatorToolItem (SeparatorToolItem o) = o--class ToolItemClass o => SeparatorToolItemClass o-toSeparatorToolItem :: SeparatorToolItemClass o => o -> SeparatorToolItem-toSeparatorToolItem = unsafeCastGObject . toGObject--instance SeparatorToolItemClass SeparatorToolItem-instance ToolItemClass SeparatorToolItem-instance BinClass SeparatorToolItem-instance ContainerClass SeparatorToolItem-instance WidgetClass SeparatorToolItem-instance ObjectClass SeparatorToolItem-instance GObjectClass SeparatorToolItem where- toGObject = GObject . castForeignPtr . unSeparatorToolItem- unsafeCastGObject = SeparatorToolItem . castForeignPtr . unGObject--castToSeparatorToolItem :: GObjectClass obj => obj -> SeparatorToolItem-castToSeparatorToolItem = castTo gTypeSeparatorToolItem "SeparatorToolItem"--gTypeSeparatorToolItem :: GType-gTypeSeparatorToolItem =- {# call fun unsafe gtk_separator_tool_item_get_type #}---- ************************************************************************ Box--{#pointer *Box foreign newtype #} deriving (Eq,Ord)--mkBox = (Box, objectUnrefFromMainloop)-unBox (Box o) = o--class ContainerClass o => BoxClass o-toBox :: BoxClass o => o -> Box-toBox = unsafeCastGObject . toGObject--instance BoxClass Box-instance ContainerClass Box-instance WidgetClass Box-instance ObjectClass Box-instance GObjectClass Box where- toGObject = GObject . castForeignPtr . unBox- unsafeCastGObject = Box . castForeignPtr . unGObject--castToBox :: GObjectClass obj => obj -> Box-castToBox = castTo gTypeBox "Box"--gTypeBox :: GType-gTypeBox =- {# call fun unsafe gtk_box_get_type #}---- ****************************************************************** ButtonBox--{#pointer *ButtonBox foreign newtype #} deriving (Eq,Ord)--mkButtonBox = (ButtonBox, objectUnrefFromMainloop)-unButtonBox (ButtonBox o) = o--class BoxClass o => ButtonBoxClass o-toButtonBox :: ButtonBoxClass o => o -> ButtonBox-toButtonBox = unsafeCastGObject . toGObject--instance ButtonBoxClass ButtonBox-instance BoxClass ButtonBox-instance ContainerClass ButtonBox-instance WidgetClass ButtonBox-instance ObjectClass ButtonBox-instance GObjectClass ButtonBox where- toGObject = GObject . castForeignPtr . unButtonBox- unsafeCastGObject = ButtonBox . castForeignPtr . unGObject--castToButtonBox :: GObjectClass obj => obj -> ButtonBox-castToButtonBox = castTo gTypeButtonBox "ButtonBox"--gTypeButtonBox :: GType-gTypeButtonBox =- {# call fun unsafe gtk_button_box_get_type #}---- ***************************************************************** HButtonBox--{#pointer *HButtonBox foreign newtype #} deriving (Eq,Ord)--mkHButtonBox = (HButtonBox, objectUnrefFromMainloop)-unHButtonBox (HButtonBox o) = o--class ButtonBoxClass o => HButtonBoxClass o-toHButtonBox :: HButtonBoxClass o => o -> HButtonBox-toHButtonBox = unsafeCastGObject . toGObject--instance HButtonBoxClass HButtonBox-instance ButtonBoxClass HButtonBox-instance BoxClass HButtonBox-instance ContainerClass HButtonBox-instance WidgetClass HButtonBox-instance ObjectClass HButtonBox-instance GObjectClass HButtonBox where- toGObject = GObject . castForeignPtr . unHButtonBox- unsafeCastGObject = HButtonBox . castForeignPtr . unGObject--castToHButtonBox :: GObjectClass obj => obj -> HButtonBox-castToHButtonBox = castTo gTypeHButtonBox "HButtonBox"--gTypeHButtonBox :: GType-gTypeHButtonBox =- {# call fun unsafe gtk_hbutton_box_get_type #}---- ***************************************************************** VButtonBox--{#pointer *VButtonBox foreign newtype #} deriving (Eq,Ord)--mkVButtonBox = (VButtonBox, objectUnrefFromMainloop)-unVButtonBox (VButtonBox o) = o--class ButtonBoxClass o => VButtonBoxClass o-toVButtonBox :: VButtonBoxClass o => o -> VButtonBox-toVButtonBox = unsafeCastGObject . toGObject--instance VButtonBoxClass VButtonBox-instance ButtonBoxClass VButtonBox-instance BoxClass VButtonBox-instance ContainerClass VButtonBox-instance WidgetClass VButtonBox-instance ObjectClass VButtonBox-instance GObjectClass VButtonBox where- toGObject = GObject . castForeignPtr . unVButtonBox- unsafeCastGObject = VButtonBox . castForeignPtr . unGObject--castToVButtonBox :: GObjectClass obj => obj -> VButtonBox-castToVButtonBox = castTo gTypeVButtonBox "VButtonBox"--gTypeVButtonBox :: GType-gTypeVButtonBox =- {# call fun unsafe gtk_vbutton_box_get_type #}---- *********************************************************************** VBox--{#pointer *VBox foreign newtype #} deriving (Eq,Ord)--mkVBox = (VBox, objectUnrefFromMainloop)-unVBox (VBox o) = o--class BoxClass o => VBoxClass o-toVBox :: VBoxClass o => o -> VBox-toVBox = unsafeCastGObject . toGObject--instance VBoxClass VBox-instance BoxClass VBox-instance ContainerClass VBox-instance WidgetClass VBox-instance ObjectClass VBox-instance GObjectClass VBox where- toGObject = GObject . castForeignPtr . unVBox- unsafeCastGObject = VBox . castForeignPtr . unGObject--castToVBox :: GObjectClass obj => obj -> VBox-castToVBox = castTo gTypeVBox "VBox"--gTypeVBox :: GType-gTypeVBox =- {# call fun unsafe gtk_vbox_get_type #}---- ************************************************************* ColorSelection--{#pointer *ColorSelection foreign newtype #} deriving (Eq,Ord)--mkColorSelection = (ColorSelection, objectUnrefFromMainloop)-unColorSelection (ColorSelection o) = o--class VBoxClass o => ColorSelectionClass o-toColorSelection :: ColorSelectionClass o => o -> ColorSelection-toColorSelection = unsafeCastGObject . toGObject--instance ColorSelectionClass ColorSelection-instance VBoxClass ColorSelection-instance BoxClass ColorSelection-instance ContainerClass ColorSelection-instance WidgetClass ColorSelection-instance ObjectClass ColorSelection-instance GObjectClass ColorSelection where- toGObject = GObject . castForeignPtr . unColorSelection- unsafeCastGObject = ColorSelection . castForeignPtr . unGObject--castToColorSelection :: GObjectClass obj => obj -> ColorSelection-castToColorSelection = castTo gTypeColorSelection "ColorSelection"--gTypeColorSelection :: GType-gTypeColorSelection =- {# call fun unsafe gtk_color_selection_get_type #}---- ************************************************************** FontSelection--{#pointer *FontSelection foreign newtype #} deriving (Eq,Ord)--mkFontSelection = (FontSelection, objectUnrefFromMainloop)-unFontSelection (FontSelection o) = o--class VBoxClass o => FontSelectionClass o-toFontSelection :: FontSelectionClass o => o -> FontSelection-toFontSelection = unsafeCastGObject . toGObject--instance FontSelectionClass FontSelection-instance VBoxClass FontSelection-instance BoxClass FontSelection-instance ContainerClass FontSelection-instance WidgetClass FontSelection-instance ObjectClass FontSelection-instance GObjectClass FontSelection where- toGObject = GObject . castForeignPtr . unFontSelection- unsafeCastGObject = FontSelection . castForeignPtr . unGObject--castToFontSelection :: GObjectClass obj => obj -> FontSelection-castToFontSelection = castTo gTypeFontSelection "FontSelection"--gTypeFontSelection :: GType-gTypeFontSelection =- {# call fun unsafe gtk_font_selection_get_type #}---- ********************************************************** FileChooserWidget--{#pointer *FileChooserWidget foreign newtype #} deriving (Eq,Ord)--mkFileChooserWidget = (FileChooserWidget, objectUnrefFromMainloop)-unFileChooserWidget (FileChooserWidget o) = o--class VBoxClass o => FileChooserWidgetClass o-toFileChooserWidget :: FileChooserWidgetClass o => o -> FileChooserWidget-toFileChooserWidget = unsafeCastGObject . toGObject--instance FileChooserWidgetClass FileChooserWidget-instance VBoxClass FileChooserWidget-instance BoxClass FileChooserWidget-instance ContainerClass FileChooserWidget-instance WidgetClass FileChooserWidget-instance ObjectClass FileChooserWidget-instance GObjectClass FileChooserWidget where- toGObject = GObject . castForeignPtr . unFileChooserWidget- unsafeCastGObject = FileChooserWidget . castForeignPtr . unGObject--castToFileChooserWidget :: GObjectClass obj => obj -> FileChooserWidget-castToFileChooserWidget = castTo gTypeFileChooserWidget "FileChooserWidget"--gTypeFileChooserWidget :: GType-gTypeFileChooserWidget =- {# call fun unsafe gtk_file_chooser_widget_get_type #}---- *********************************************************************** HBox--{#pointer *HBox foreign newtype #} deriving (Eq,Ord)--mkHBox = (HBox, objectUnrefFromMainloop)-unHBox (HBox o) = o--class BoxClass o => HBoxClass o-toHBox :: HBoxClass o => o -> HBox-toHBox = unsafeCastGObject . toGObject--instance HBoxClass HBox-instance BoxClass HBox-instance ContainerClass HBox-instance WidgetClass HBox-instance ObjectClass HBox-instance GObjectClass HBox where- toGObject = GObject . castForeignPtr . unHBox- unsafeCastGObject = HBox . castForeignPtr . unGObject--castToHBox :: GObjectClass obj => obj -> HBox-castToHBox = castTo gTypeHBox "HBox"--gTypeHBox :: GType-gTypeHBox =- {# call fun unsafe gtk_hbox_get_type #}---- ********************************************************************** Combo--{#pointer *Combo foreign newtype #} deriving (Eq,Ord)--mkCombo = (Combo, objectUnrefFromMainloop)-unCombo (Combo o) = o--class HBoxClass o => ComboClass o-toCombo :: ComboClass o => o -> Combo-toCombo = unsafeCastGObject . toGObject--instance ComboClass Combo-instance HBoxClass Combo-instance BoxClass Combo-instance ContainerClass Combo-instance WidgetClass Combo-instance ObjectClass Combo-instance GObjectClass Combo where- toGObject = GObject . castForeignPtr . unCombo- unsafeCastGObject = Combo . castForeignPtr . unGObject--castToCombo :: GObjectClass obj => obj -> Combo-castToCombo = castTo gTypeCombo "Combo"--gTypeCombo :: GType-gTypeCombo =- {# call fun unsafe gtk_combo_get_type #}---- ********************************************************** FileChooserButton--{#pointer *FileChooserButton foreign newtype #} deriving (Eq,Ord)--mkFileChooserButton = (FileChooserButton, objectUnrefFromMainloop)-unFileChooserButton (FileChooserButton o) = o--class HBoxClass o => FileChooserButtonClass o-toFileChooserButton :: FileChooserButtonClass o => o -> FileChooserButton-toFileChooserButton = unsafeCastGObject . toGObject--instance FileChooserButtonClass FileChooserButton-instance HBoxClass FileChooserButton-instance BoxClass FileChooserButton-instance ContainerClass FileChooserButton-instance WidgetClass FileChooserButton-instance ObjectClass FileChooserButton-instance GObjectClass FileChooserButton where- toGObject = GObject . castForeignPtr . unFileChooserButton- unsafeCastGObject = FileChooserButton . castForeignPtr . unGObject--castToFileChooserButton :: GObjectClass obj => obj -> FileChooserButton-castToFileChooserButton = castTo gTypeFileChooserButton "FileChooserButton"--gTypeFileChooserButton :: GType-gTypeFileChooserButton =- {# call fun unsafe gtk_file_chooser_button_get_type #}---- ****************************************************************** Statusbar--{#pointer *Statusbar foreign newtype #} deriving (Eq,Ord)--mkStatusbar = (Statusbar, objectUnrefFromMainloop)-unStatusbar (Statusbar o) = o--class HBoxClass o => StatusbarClass o-toStatusbar :: StatusbarClass o => o -> Statusbar-toStatusbar = unsafeCastGObject . toGObject--instance StatusbarClass Statusbar-instance HBoxClass Statusbar-instance BoxClass Statusbar-instance ContainerClass Statusbar-instance WidgetClass Statusbar-instance ObjectClass Statusbar-instance GObjectClass Statusbar where- toGObject = GObject . castForeignPtr . unStatusbar- unsafeCastGObject = Statusbar . castForeignPtr . unGObject--castToStatusbar :: GObjectClass obj => obj -> Statusbar-castToStatusbar = castTo gTypeStatusbar "Statusbar"--gTypeStatusbar :: GType-gTypeStatusbar =- {# call fun unsafe gtk_statusbar_get_type #}---- ********************************************************************** CList--{#pointer *CList foreign newtype #} deriving (Eq,Ord)--mkCList = (CList, objectUnrefFromMainloop)-unCList (CList o) = o--class ContainerClass o => CListClass o-toCList :: CListClass o => o -> CList-toCList = unsafeCastGObject . toGObject--instance CListClass CList-instance ContainerClass CList-instance WidgetClass CList-instance ObjectClass CList-instance GObjectClass CList where- toGObject = GObject . castForeignPtr . unCList- unsafeCastGObject = CList . castForeignPtr . unGObject--castToCList :: GObjectClass obj => obj -> CList-castToCList = castTo gTypeCList "CList"--gTypeCList :: GType-gTypeCList =- {# call fun unsafe gtk_clist_get_type #}---- ********************************************************************** CTree--{#pointer *CTree foreign newtype #} deriving (Eq,Ord)--mkCTree = (CTree, objectUnrefFromMainloop)-unCTree (CTree o) = o--class CListClass o => CTreeClass o-toCTree :: CTreeClass o => o -> CTree-toCTree = unsafeCastGObject . toGObject--instance CTreeClass CTree-instance CListClass CTree-instance ContainerClass CTree-instance WidgetClass CTree-instance ObjectClass CTree-instance GObjectClass CTree where- toGObject = GObject . castForeignPtr . unCTree- unsafeCastGObject = CTree . castForeignPtr . unGObject--castToCTree :: GObjectClass obj => obj -> CTree-castToCTree = castTo gTypeCTree "CTree"--gTypeCTree :: GType-gTypeCTree =- {# call fun unsafe gtk_ctree_get_type #}---- ********************************************************************** Fixed--{#pointer *Fixed foreign newtype #} deriving (Eq,Ord)--mkFixed = (Fixed, objectUnrefFromMainloop)-unFixed (Fixed o) = o--class ContainerClass o => FixedClass o-toFixed :: FixedClass o => o -> Fixed-toFixed = unsafeCastGObject . toGObject--instance FixedClass Fixed-instance ContainerClass Fixed-instance WidgetClass Fixed-instance ObjectClass Fixed-instance GObjectClass Fixed where- toGObject = GObject . castForeignPtr . unFixed- unsafeCastGObject = Fixed . castForeignPtr . unGObject--castToFixed :: GObjectClass obj => obj -> Fixed-castToFixed = castTo gTypeFixed "Fixed"--gTypeFixed :: GType-gTypeFixed =- {# call fun unsafe gtk_fixed_get_type #}---- ********************************************************************** Paned--{#pointer *Paned foreign newtype #} deriving (Eq,Ord)--mkPaned = (Paned, objectUnrefFromMainloop)-unPaned (Paned o) = o--class ContainerClass o => PanedClass o-toPaned :: PanedClass o => o -> Paned-toPaned = unsafeCastGObject . toGObject--instance PanedClass Paned-instance ContainerClass Paned-instance WidgetClass Paned-instance ObjectClass Paned-instance GObjectClass Paned where- toGObject = GObject . castForeignPtr . unPaned- unsafeCastGObject = Paned . castForeignPtr . unGObject--castToPaned :: GObjectClass obj => obj -> Paned-castToPaned = castTo gTypePaned "Paned"--gTypePaned :: GType-gTypePaned =- {# call fun unsafe gtk_paned_get_type #}---- ********************************************************************* HPaned--{#pointer *HPaned foreign newtype #} deriving (Eq,Ord)--mkHPaned = (HPaned, objectUnrefFromMainloop)-unHPaned (HPaned o) = o--class PanedClass o => HPanedClass o-toHPaned :: HPanedClass o => o -> HPaned-toHPaned = unsafeCastGObject . toGObject--instance HPanedClass HPaned-instance PanedClass HPaned-instance ContainerClass HPaned-instance WidgetClass HPaned-instance ObjectClass HPaned-instance GObjectClass HPaned where- toGObject = GObject . castForeignPtr . unHPaned- unsafeCastGObject = HPaned . castForeignPtr . unGObject--castToHPaned :: GObjectClass obj => obj -> HPaned-castToHPaned = castTo gTypeHPaned "HPaned"--gTypeHPaned :: GType-gTypeHPaned =- {# call fun unsafe gtk_hpaned_get_type #}---- ********************************************************************* VPaned--{#pointer *VPaned foreign newtype #} deriving (Eq,Ord)--mkVPaned = (VPaned, objectUnrefFromMainloop)-unVPaned (VPaned o) = o--class PanedClass o => VPanedClass o-toVPaned :: VPanedClass o => o -> VPaned-toVPaned = unsafeCastGObject . toGObject--instance VPanedClass VPaned-instance PanedClass VPaned-instance ContainerClass VPaned-instance WidgetClass VPaned-instance ObjectClass VPaned-instance GObjectClass VPaned where- toGObject = GObject . castForeignPtr . unVPaned- unsafeCastGObject = VPaned . castForeignPtr . unGObject--castToVPaned :: GObjectClass obj => obj -> VPaned-castToVPaned = castTo gTypeVPaned "VPaned"--gTypeVPaned :: GType-gTypeVPaned =- {# call fun unsafe gtk_vpaned_get_type #}---- ******************************************************************* IconView--{#pointer *IconView foreign newtype #} deriving (Eq,Ord)--mkIconView = (IconView, objectUnrefFromMainloop)-unIconView (IconView o) = o--class ContainerClass o => IconViewClass o-toIconView :: IconViewClass o => o -> IconView-toIconView = unsafeCastGObject . toGObject--instance IconViewClass IconView-instance ContainerClass IconView-instance WidgetClass IconView-instance ObjectClass IconView-instance GObjectClass IconView where- toGObject = GObject . castForeignPtr . unIconView- unsafeCastGObject = IconView . castForeignPtr . unGObject--castToIconView :: GObjectClass obj => obj -> IconView-castToIconView = castTo gTypeIconView "IconView"--gTypeIconView :: GType-gTypeIconView =- {# call fun unsafe gtk_icon_view_get_type #}---- ********************************************************************* Layout--{#pointer *Layout foreign newtype #} deriving (Eq,Ord)--mkLayout = (Layout, objectUnrefFromMainloop)-unLayout (Layout o) = o--class ContainerClass o => LayoutClass o-toLayout :: LayoutClass o => o -> Layout-toLayout = unsafeCastGObject . toGObject--instance LayoutClass Layout-instance ContainerClass Layout-instance WidgetClass Layout-instance ObjectClass Layout-instance GObjectClass Layout where- toGObject = GObject . castForeignPtr . unLayout- unsafeCastGObject = Layout . castForeignPtr . unGObject--castToLayout :: GObjectClass obj => obj -> Layout-castToLayout = castTo gTypeLayout "Layout"--gTypeLayout :: GType-gTypeLayout =- {# call fun unsafe gtk_layout_get_type #}---- *********************************************************************** List--{#pointer *List foreign newtype #} deriving (Eq,Ord)--mkList = (List, objectUnrefFromMainloop)-unList (List o) = o--class ContainerClass o => ListClass o-toList :: ListClass o => o -> List-toList = unsafeCastGObject . toGObject--instance ListClass List-instance ContainerClass List-instance WidgetClass List-instance ObjectClass List-instance GObjectClass List where- toGObject = GObject . castForeignPtr . unList- unsafeCastGObject = List . castForeignPtr . unGObject--castToList :: GObjectClass obj => obj -> List-castToList = castTo gTypeList "List"--gTypeList :: GType-gTypeList =- {# call fun unsafe gtk_list_get_type #}---- ****************************************************************** MenuShell--{#pointer *MenuShell foreign newtype #} deriving (Eq,Ord)--mkMenuShell = (MenuShell, objectUnrefFromMainloop)-unMenuShell (MenuShell o) = o--class ContainerClass o => MenuShellClass o-toMenuShell :: MenuShellClass o => o -> MenuShell-toMenuShell = unsafeCastGObject . toGObject--instance MenuShellClass MenuShell-instance ContainerClass MenuShell-instance WidgetClass MenuShell-instance ObjectClass MenuShell-instance GObjectClass MenuShell where- toGObject = GObject . castForeignPtr . unMenuShell- unsafeCastGObject = MenuShell . castForeignPtr . unGObject--castToMenuShell :: GObjectClass obj => obj -> MenuShell-castToMenuShell = castTo gTypeMenuShell "MenuShell"--gTypeMenuShell :: GType-gTypeMenuShell =- {# call fun unsafe gtk_menu_shell_get_type #}---- *********************************************************************** Menu--{#pointer *Menu foreign newtype #} deriving (Eq,Ord)--mkMenu = (Menu, objectUnrefFromMainloop)-unMenu (Menu o) = o--class MenuShellClass o => MenuClass o-toMenu :: MenuClass o => o -> Menu-toMenu = unsafeCastGObject . toGObject--instance MenuClass Menu-instance MenuShellClass Menu-instance ContainerClass Menu-instance WidgetClass Menu-instance ObjectClass Menu-instance GObjectClass Menu where- toGObject = GObject . castForeignPtr . unMenu- unsafeCastGObject = Menu . castForeignPtr . unGObject--castToMenu :: GObjectClass obj => obj -> Menu-castToMenu = castTo gTypeMenu "Menu"--gTypeMenu :: GType-gTypeMenu =- {# call fun unsafe gtk_menu_get_type #}---- ******************************************************************** MenuBar--{#pointer *MenuBar foreign newtype #} deriving (Eq,Ord)--mkMenuBar = (MenuBar, objectUnrefFromMainloop)-unMenuBar (MenuBar o) = o--class MenuShellClass o => MenuBarClass o-toMenuBar :: MenuBarClass o => o -> MenuBar-toMenuBar = unsafeCastGObject . toGObject--instance MenuBarClass MenuBar-instance MenuShellClass MenuBar-instance ContainerClass MenuBar-instance WidgetClass MenuBar-instance ObjectClass MenuBar-instance GObjectClass MenuBar where- toGObject = GObject . castForeignPtr . unMenuBar- unsafeCastGObject = MenuBar . castForeignPtr . unGObject--castToMenuBar :: GObjectClass obj => obj -> MenuBar-castToMenuBar = castTo gTypeMenuBar "MenuBar"--gTypeMenuBar :: GType-gTypeMenuBar =- {# call fun unsafe gtk_menu_bar_get_type #}---- ******************************************************************* Notebook--{#pointer *Notebook foreign newtype #} deriving (Eq,Ord)--mkNotebook = (Notebook, objectUnrefFromMainloop)-unNotebook (Notebook o) = o--class ContainerClass o => NotebookClass o-toNotebook :: NotebookClass o => o -> Notebook-toNotebook = unsafeCastGObject . toGObject--instance NotebookClass Notebook-instance ContainerClass Notebook-instance WidgetClass Notebook-instance ObjectClass Notebook-instance GObjectClass Notebook where- toGObject = GObject . castForeignPtr . unNotebook- unsafeCastGObject = Notebook . castForeignPtr . unGObject--castToNotebook :: GObjectClass obj => obj -> Notebook-castToNotebook = castTo gTypeNotebook "Notebook"--gTypeNotebook :: GType-gTypeNotebook =- {# call fun unsafe gtk_notebook_get_type #}---- ********************************************************************* Socket--{#pointer *Socket foreign newtype #} deriving (Eq,Ord)--mkSocket = (Socket, objectUnrefFromMainloop)-unSocket (Socket o) = o--class ContainerClass o => SocketClass o-toSocket :: SocketClass o => o -> Socket-toSocket = unsafeCastGObject . toGObject--instance SocketClass Socket-instance ContainerClass Socket-instance WidgetClass Socket-instance ObjectClass Socket-instance GObjectClass Socket where- toGObject = GObject . castForeignPtr . unSocket- unsafeCastGObject = Socket . castForeignPtr . unGObject--castToSocket :: GObjectClass obj => obj -> Socket-castToSocket = castTo gTypeSocket "Socket"--gTypeSocket :: GType-gTypeSocket =- {# call fun unsafe gtk_socket_get_type #}---- ********************************************************************** Table--{#pointer *Table foreign newtype #} deriving (Eq,Ord)--mkTable = (Table, objectUnrefFromMainloop)-unTable (Table o) = o--class ContainerClass o => TableClass o-toTable :: TableClass o => o -> Table-toTable = unsafeCastGObject . toGObject--instance TableClass Table-instance ContainerClass Table-instance WidgetClass Table-instance ObjectClass Table-instance GObjectClass Table where- toGObject = GObject . castForeignPtr . unTable- unsafeCastGObject = Table . castForeignPtr . unGObject--castToTable :: GObjectClass obj => obj -> Table-castToTable = castTo gTypeTable "Table"--gTypeTable :: GType-gTypeTable =- {# call fun unsafe gtk_table_get_type #}---- ******************************************************************* TextView--{#pointer *TextView foreign newtype #} deriving (Eq,Ord)--mkTextView = (TextView, objectUnrefFromMainloop)-unTextView (TextView o) = o--class ContainerClass o => TextViewClass o-toTextView :: TextViewClass o => o -> TextView-toTextView = unsafeCastGObject . toGObject--instance TextViewClass TextView-instance ContainerClass TextView-instance WidgetClass TextView-instance ObjectClass TextView-instance GObjectClass TextView where- toGObject = GObject . castForeignPtr . unTextView- unsafeCastGObject = TextView . castForeignPtr . unGObject--castToTextView :: GObjectClass obj => obj -> TextView-castToTextView = castTo gTypeTextView "TextView"--gTypeTextView :: GType-gTypeTextView =- {# call fun unsafe gtk_text_view_get_type #}---- ******************************************************************** Toolbar--{#pointer *Toolbar foreign newtype #} deriving (Eq,Ord)--mkToolbar = (Toolbar, objectUnrefFromMainloop)-unToolbar (Toolbar o) = o--class ContainerClass o => ToolbarClass o-toToolbar :: ToolbarClass o => o -> Toolbar-toToolbar = unsafeCastGObject . toGObject--instance ToolbarClass Toolbar-instance ContainerClass Toolbar-instance WidgetClass Toolbar-instance ObjectClass Toolbar-instance GObjectClass Toolbar where- toGObject = GObject . castForeignPtr . unToolbar- unsafeCastGObject = Toolbar . castForeignPtr . unGObject--castToToolbar :: GObjectClass obj => obj -> Toolbar-castToToolbar = castTo gTypeToolbar "Toolbar"--gTypeToolbar :: GType-gTypeToolbar =- {# call fun unsafe gtk_toolbar_get_type #}---- ******************************************************************* TreeView--{#pointer *TreeView foreign newtype #} deriving (Eq,Ord)--mkTreeView = (TreeView, objectUnrefFromMainloop)-unTreeView (TreeView o) = o--class ContainerClass o => TreeViewClass o-toTreeView :: TreeViewClass o => o -> TreeView-toTreeView = unsafeCastGObject . toGObject--instance TreeViewClass TreeView-instance ContainerClass TreeView-instance WidgetClass TreeView-instance ObjectClass TreeView-instance GObjectClass TreeView where- toGObject = GObject . castForeignPtr . unTreeView- unsafeCastGObject = TreeView . castForeignPtr . unGObject--castToTreeView :: GObjectClass obj => obj -> TreeView-castToTreeView = castTo gTypeTreeView "TreeView"--gTypeTreeView :: GType-gTypeTreeView =- {# call fun unsafe gtk_tree_view_get_type #}---- ******************************************************************* Calendar--{#pointer *Calendar foreign newtype #} deriving (Eq,Ord)--mkCalendar = (Calendar, objectUnrefFromMainloop)-unCalendar (Calendar o) = o--class WidgetClass o => CalendarClass o-toCalendar :: CalendarClass o => o -> Calendar-toCalendar = unsafeCastGObject . toGObject--instance CalendarClass Calendar-instance WidgetClass Calendar-instance ObjectClass Calendar-instance GObjectClass Calendar where- toGObject = GObject . castForeignPtr . unCalendar- unsafeCastGObject = Calendar . castForeignPtr . unGObject--castToCalendar :: GObjectClass obj => obj -> Calendar-castToCalendar = castTo gTypeCalendar "Calendar"--gTypeCalendar :: GType-gTypeCalendar =- {# call fun unsafe gtk_calendar_get_type #}---- ******************************************************************* CellView--{#pointer *CellView foreign newtype #} deriving (Eq,Ord)--mkCellView = (CellView, objectUnrefFromMainloop)-unCellView (CellView o) = o--class WidgetClass o => CellViewClass o-toCellView :: CellViewClass o => o -> CellView-toCellView = unsafeCastGObject . toGObject--instance CellViewClass CellView-instance WidgetClass CellView-instance ObjectClass CellView-instance GObjectClass CellView where- toGObject = GObject . castForeignPtr . unCellView- unsafeCastGObject = CellView . castForeignPtr . unGObject--castToCellView :: GObjectClass obj => obj -> CellView-castToCellView = castTo gTypeCellView "CellView"--gTypeCellView :: GType-gTypeCellView =- {# call fun unsafe gtk_cell_view_get_type #}---- **************************************************************** DrawingArea--{#pointer *DrawingArea foreign newtype #} deriving (Eq,Ord)--mkDrawingArea = (DrawingArea, objectUnrefFromMainloop)-unDrawingArea (DrawingArea o) = o--class WidgetClass o => DrawingAreaClass o-toDrawingArea :: DrawingAreaClass o => o -> DrawingArea-toDrawingArea = unsafeCastGObject . toGObject--instance DrawingAreaClass DrawingArea-instance WidgetClass DrawingArea-instance ObjectClass DrawingArea-instance GObjectClass DrawingArea where- toGObject = GObject . castForeignPtr . unDrawingArea- unsafeCastGObject = DrawingArea . castForeignPtr . unGObject--castToDrawingArea :: GObjectClass obj => obj -> DrawingArea-castToDrawingArea = castTo gTypeDrawingArea "DrawingArea"--gTypeDrawingArea :: GType-gTypeDrawingArea =- {# call fun unsafe gtk_drawing_area_get_type #}---- ********************************************************************** Entry--{#pointer *Entry foreign newtype #} deriving (Eq,Ord)--mkEntry = (Entry, objectUnrefFromMainloop)-unEntry (Entry o) = o--class WidgetClass o => EntryClass o-toEntry :: EntryClass o => o -> Entry-toEntry = unsafeCastGObject . toGObject--instance EntryClass Entry-instance WidgetClass Entry-instance ObjectClass Entry-instance GObjectClass Entry where- toGObject = GObject . castForeignPtr . unEntry- unsafeCastGObject = Entry . castForeignPtr . unGObject--castToEntry :: GObjectClass obj => obj -> Entry-castToEntry = castTo gTypeEntry "Entry"--gTypeEntry :: GType-gTypeEntry =- {# call fun unsafe gtk_entry_get_type #}---- ***************************************************************** SpinButton--{#pointer *SpinButton foreign newtype #} deriving (Eq,Ord)--mkSpinButton = (SpinButton, objectUnrefFromMainloop)-unSpinButton (SpinButton o) = o--class EntryClass o => SpinButtonClass o-toSpinButton :: SpinButtonClass o => o -> SpinButton-toSpinButton = unsafeCastGObject . toGObject--instance SpinButtonClass SpinButton-instance EntryClass SpinButton-instance WidgetClass SpinButton-instance ObjectClass SpinButton-instance GObjectClass SpinButton where- toGObject = GObject . castForeignPtr . unSpinButton- unsafeCastGObject = SpinButton . castForeignPtr . unGObject--castToSpinButton :: GObjectClass obj => obj -> SpinButton-castToSpinButton = castTo gTypeSpinButton "SpinButton"--gTypeSpinButton :: GType-gTypeSpinButton =- {# call fun unsafe gtk_spin_button_get_type #}---- ********************************************************************** Ruler--{#pointer *Ruler foreign newtype #} deriving (Eq,Ord)--mkRuler = (Ruler, objectUnrefFromMainloop)-unRuler (Ruler o) = o--class WidgetClass o => RulerClass o-toRuler :: RulerClass o => o -> Ruler-toRuler = unsafeCastGObject . toGObject--instance RulerClass Ruler-instance WidgetClass Ruler-instance ObjectClass Ruler-instance GObjectClass Ruler where- toGObject = GObject . castForeignPtr . unRuler- unsafeCastGObject = Ruler . castForeignPtr . unGObject--castToRuler :: GObjectClass obj => obj -> Ruler-castToRuler = castTo gTypeRuler "Ruler"--gTypeRuler :: GType-gTypeRuler =- {# call fun unsafe gtk_ruler_get_type #}---- ********************************************************************* HRuler--{#pointer *HRuler foreign newtype #} deriving (Eq,Ord)--mkHRuler = (HRuler, objectUnrefFromMainloop)-unHRuler (HRuler o) = o--class RulerClass o => HRulerClass o-toHRuler :: HRulerClass o => o -> HRuler-toHRuler = unsafeCastGObject . toGObject--instance HRulerClass HRuler-instance RulerClass HRuler-instance WidgetClass HRuler-instance ObjectClass HRuler-instance GObjectClass HRuler where- toGObject = GObject . castForeignPtr . unHRuler- unsafeCastGObject = HRuler . castForeignPtr . unGObject--castToHRuler :: GObjectClass obj => obj -> HRuler-castToHRuler = castTo gTypeHRuler "HRuler"--gTypeHRuler :: GType-gTypeHRuler =- {# call fun unsafe gtk_hruler_get_type #}---- ********************************************************************* VRuler--{#pointer *VRuler foreign newtype #} deriving (Eq,Ord)--mkVRuler = (VRuler, objectUnrefFromMainloop)-unVRuler (VRuler o) = o--class RulerClass o => VRulerClass o-toVRuler :: VRulerClass o => o -> VRuler-toVRuler = unsafeCastGObject . toGObject--instance VRulerClass VRuler-instance RulerClass VRuler-instance WidgetClass VRuler-instance ObjectClass VRuler-instance GObjectClass VRuler where- toGObject = GObject . castForeignPtr . unVRuler- unsafeCastGObject = VRuler . castForeignPtr . unGObject--castToVRuler :: GObjectClass obj => obj -> VRuler-castToVRuler = castTo gTypeVRuler "VRuler"--gTypeVRuler :: GType-gTypeVRuler =- {# call fun unsafe gtk_vruler_get_type #}---- ********************************************************************** Range--{#pointer *Range foreign newtype #} deriving (Eq,Ord)--mkRange = (Range, objectUnrefFromMainloop)-unRange (Range o) = o--class WidgetClass o => RangeClass o-toRange :: RangeClass o => o -> Range-toRange = unsafeCastGObject . toGObject--instance RangeClass Range-instance WidgetClass Range-instance ObjectClass Range-instance GObjectClass Range where- toGObject = GObject . castForeignPtr . unRange- unsafeCastGObject = Range . castForeignPtr . unGObject--castToRange :: GObjectClass obj => obj -> Range-castToRange = castTo gTypeRange "Range"--gTypeRange :: GType-gTypeRange =- {# call fun unsafe gtk_range_get_type #}---- ********************************************************************** Scale--{#pointer *Scale foreign newtype #} deriving (Eq,Ord)--mkScale = (Scale, objectUnrefFromMainloop)-unScale (Scale o) = o--class RangeClass o => ScaleClass o-toScale :: ScaleClass o => o -> Scale-toScale = unsafeCastGObject . toGObject--instance ScaleClass Scale-instance RangeClass Scale-instance WidgetClass Scale-instance ObjectClass Scale-instance GObjectClass Scale where- toGObject = GObject . castForeignPtr . unScale- unsafeCastGObject = Scale . castForeignPtr . unGObject--castToScale :: GObjectClass obj => obj -> Scale-castToScale = castTo gTypeScale "Scale"--gTypeScale :: GType-gTypeScale =- {# call fun unsafe gtk_scale_get_type #}---- ********************************************************************* HScale--{#pointer *HScale foreign newtype #} deriving (Eq,Ord)--mkHScale = (HScale, objectUnrefFromMainloop)-unHScale (HScale o) = o--class ScaleClass o => HScaleClass o-toHScale :: HScaleClass o => o -> HScale-toHScale = unsafeCastGObject . toGObject--instance HScaleClass HScale-instance ScaleClass HScale-instance RangeClass HScale-instance WidgetClass HScale-instance ObjectClass HScale-instance GObjectClass HScale where- toGObject = GObject . castForeignPtr . unHScale- unsafeCastGObject = HScale . castForeignPtr . unGObject--castToHScale :: GObjectClass obj => obj -> HScale-castToHScale = castTo gTypeHScale "HScale"--gTypeHScale :: GType-gTypeHScale =- {# call fun unsafe gtk_hscale_get_type #}---- ********************************************************************* VScale--{#pointer *VScale foreign newtype #} deriving (Eq,Ord)--mkVScale = (VScale, objectUnrefFromMainloop)-unVScale (VScale o) = o--class ScaleClass o => VScaleClass o-toVScale :: VScaleClass o => o -> VScale-toVScale = unsafeCastGObject . toGObject--instance VScaleClass VScale-instance ScaleClass VScale-instance RangeClass VScale-instance WidgetClass VScale-instance ObjectClass VScale-instance GObjectClass VScale where- toGObject = GObject . castForeignPtr . unVScale- unsafeCastGObject = VScale . castForeignPtr . unGObject--castToVScale :: GObjectClass obj => obj -> VScale-castToVScale = castTo gTypeVScale "VScale"--gTypeVScale :: GType-gTypeVScale =- {# call fun unsafe gtk_vscale_get_type #}---- ****************************************************************** Scrollbar--{#pointer *Scrollbar foreign newtype #} deriving (Eq,Ord)--mkScrollbar = (Scrollbar, objectUnrefFromMainloop)-unScrollbar (Scrollbar o) = o--class RangeClass o => ScrollbarClass o-toScrollbar :: ScrollbarClass o => o -> Scrollbar-toScrollbar = unsafeCastGObject . toGObject--instance ScrollbarClass Scrollbar-instance RangeClass Scrollbar-instance WidgetClass Scrollbar-instance ObjectClass Scrollbar-instance GObjectClass Scrollbar where- toGObject = GObject . castForeignPtr . unScrollbar- unsafeCastGObject = Scrollbar . castForeignPtr . unGObject--castToScrollbar :: GObjectClass obj => obj -> Scrollbar-castToScrollbar = castTo gTypeScrollbar "Scrollbar"--gTypeScrollbar :: GType-gTypeScrollbar =- {# call fun unsafe gtk_scrollbar_get_type #}---- ***************************************************************** HScrollbar--{#pointer *HScrollbar foreign newtype #} deriving (Eq,Ord)--mkHScrollbar = (HScrollbar, objectUnrefFromMainloop)-unHScrollbar (HScrollbar o) = o--class ScrollbarClass o => HScrollbarClass o-toHScrollbar :: HScrollbarClass o => o -> HScrollbar-toHScrollbar = unsafeCastGObject . toGObject--instance HScrollbarClass HScrollbar-instance ScrollbarClass HScrollbar-instance RangeClass HScrollbar-instance WidgetClass HScrollbar-instance ObjectClass HScrollbar-instance GObjectClass HScrollbar where- toGObject = GObject . castForeignPtr . unHScrollbar- unsafeCastGObject = HScrollbar . castForeignPtr . unGObject--castToHScrollbar :: GObjectClass obj => obj -> HScrollbar-castToHScrollbar = castTo gTypeHScrollbar "HScrollbar"--gTypeHScrollbar :: GType-gTypeHScrollbar =- {# call fun unsafe gtk_hscrollbar_get_type #}---- ***************************************************************** VScrollbar--{#pointer *VScrollbar foreign newtype #} deriving (Eq,Ord)--mkVScrollbar = (VScrollbar, objectUnrefFromMainloop)-unVScrollbar (VScrollbar o) = o--class ScrollbarClass o => VScrollbarClass o-toVScrollbar :: VScrollbarClass o => o -> VScrollbar-toVScrollbar = unsafeCastGObject . toGObject--instance VScrollbarClass VScrollbar-instance ScrollbarClass VScrollbar-instance RangeClass VScrollbar-instance WidgetClass VScrollbar-instance ObjectClass VScrollbar-instance GObjectClass VScrollbar where- toGObject = GObject . castForeignPtr . unVScrollbar- unsafeCastGObject = VScrollbar . castForeignPtr . unGObject--castToVScrollbar :: GObjectClass obj => obj -> VScrollbar-castToVScrollbar = castTo gTypeVScrollbar "VScrollbar"--gTypeVScrollbar :: GType-gTypeVScrollbar =- {# call fun unsafe gtk_vscrollbar_get_type #}---- ****************************************************************** Separator--{#pointer *Separator foreign newtype #} deriving (Eq,Ord)--mkSeparator = (Separator, objectUnrefFromMainloop)-unSeparator (Separator o) = o--class WidgetClass o => SeparatorClass o-toSeparator :: SeparatorClass o => o -> Separator-toSeparator = unsafeCastGObject . toGObject--instance SeparatorClass Separator-instance WidgetClass Separator-instance ObjectClass Separator-instance GObjectClass Separator where- toGObject = GObject . castForeignPtr . unSeparator- unsafeCastGObject = Separator . castForeignPtr . unGObject--castToSeparator :: GObjectClass obj => obj -> Separator-castToSeparator = castTo gTypeSeparator "Separator"--gTypeSeparator :: GType-gTypeSeparator =- {# call fun unsafe gtk_separator_get_type #}---- ***************************************************************** HSeparator--{#pointer *HSeparator foreign newtype #} deriving (Eq,Ord)--mkHSeparator = (HSeparator, objectUnrefFromMainloop)-unHSeparator (HSeparator o) = o--class SeparatorClass o => HSeparatorClass o-toHSeparator :: HSeparatorClass o => o -> HSeparator-toHSeparator = unsafeCastGObject . toGObject--instance HSeparatorClass HSeparator-instance SeparatorClass HSeparator-instance WidgetClass HSeparator-instance ObjectClass HSeparator-instance GObjectClass HSeparator where- toGObject = GObject . castForeignPtr . unHSeparator- unsafeCastGObject = HSeparator . castForeignPtr . unGObject--castToHSeparator :: GObjectClass obj => obj -> HSeparator-castToHSeparator = castTo gTypeHSeparator "HSeparator"--gTypeHSeparator :: GType-gTypeHSeparator =- {# call fun unsafe gtk_hseparator_get_type #}---- ***************************************************************** VSeparator--{#pointer *VSeparator foreign newtype #} deriving (Eq,Ord)--mkVSeparator = (VSeparator, objectUnrefFromMainloop)-unVSeparator (VSeparator o) = o--class SeparatorClass o => VSeparatorClass o-toVSeparator :: VSeparatorClass o => o -> VSeparator-toVSeparator = unsafeCastGObject . toGObject--instance VSeparatorClass VSeparator-instance SeparatorClass VSeparator-instance WidgetClass VSeparator-instance ObjectClass VSeparator-instance GObjectClass VSeparator where- toGObject = GObject . castForeignPtr . unVSeparator- unsafeCastGObject = VSeparator . castForeignPtr . unGObject--castToVSeparator :: GObjectClass obj => obj -> VSeparator-castToVSeparator = castTo gTypeVSeparator "VSeparator"--gTypeVSeparator :: GType-gTypeVSeparator =- {# call fun unsafe gtk_vseparator_get_type #}---- ****************************************************************** Invisible--{#pointer *Invisible foreign newtype #} deriving (Eq,Ord)--mkInvisible = (Invisible, objectUnrefFromMainloop)-unInvisible (Invisible o) = o--class WidgetClass o => InvisibleClass o-toInvisible :: InvisibleClass o => o -> Invisible-toInvisible = unsafeCastGObject . toGObject--instance InvisibleClass Invisible-instance WidgetClass Invisible-instance ObjectClass Invisible-instance GObjectClass Invisible where- toGObject = GObject . castForeignPtr . unInvisible- unsafeCastGObject = Invisible . castForeignPtr . unGObject--castToInvisible :: GObjectClass obj => obj -> Invisible-castToInvisible = castTo gTypeInvisible "Invisible"--gTypeInvisible :: GType-gTypeInvisible =- {# call fun unsafe gtk_invisible_get_type #}---- ******************************************************************** Preview--{#pointer *Preview foreign newtype #} deriving (Eq,Ord)--mkPreview = (Preview, objectUnrefFromMainloop)-unPreview (Preview o) = o--class WidgetClass o => PreviewClass o-toPreview :: PreviewClass o => o -> Preview-toPreview = unsafeCastGObject . toGObject--instance PreviewClass Preview-instance WidgetClass Preview-instance ObjectClass Preview-instance GObjectClass Preview where- toGObject = GObject . castForeignPtr . unPreview- unsafeCastGObject = Preview . castForeignPtr . unGObject--castToPreview :: GObjectClass obj => obj -> Preview-castToPreview = castTo gTypePreview "Preview"--gTypePreview :: GType-gTypePreview =- {# call fun unsafe gtk_preview_get_type #}---- **************************************************************** ProgressBar--{#pointer *ProgressBar foreign newtype #} deriving (Eq,Ord)--mkProgressBar = (ProgressBar, objectUnrefFromMainloop)-unProgressBar (ProgressBar o) = o--class WidgetClass o => ProgressBarClass o-toProgressBar :: ProgressBarClass o => o -> ProgressBar-toProgressBar = unsafeCastGObject . toGObject--instance ProgressBarClass ProgressBar-instance WidgetClass ProgressBar-instance ObjectClass ProgressBar-instance GObjectClass ProgressBar where- toGObject = GObject . castForeignPtr . unProgressBar- unsafeCastGObject = ProgressBar . castForeignPtr . unGObject--castToProgressBar :: GObjectClass obj => obj -> ProgressBar-castToProgressBar = castTo gTypeProgressBar "ProgressBar"--gTypeProgressBar :: GType-gTypeProgressBar =- {# call fun unsafe gtk_progress_bar_get_type #}---- ***************************************************************** Adjustment--{#pointer *Adjustment foreign newtype #} deriving (Eq,Ord)--mkAdjustment = (Adjustment, objectUnrefFromMainloop)-unAdjustment (Adjustment o) = o--class ObjectClass o => AdjustmentClass o-toAdjustment :: AdjustmentClass o => o -> Adjustment-toAdjustment = unsafeCastGObject . toGObject--instance AdjustmentClass Adjustment-instance ObjectClass Adjustment-instance GObjectClass Adjustment where- toGObject = GObject . castForeignPtr . unAdjustment- unsafeCastGObject = Adjustment . castForeignPtr . unGObject--castToAdjustment :: GObjectClass obj => obj -> Adjustment-castToAdjustment = castTo gTypeAdjustment "Adjustment"--gTypeAdjustment :: GType-gTypeAdjustment =- {# call fun unsafe gtk_adjustment_get_type #}---- ****************************************************************** IMContext--{#pointer *IMContext foreign newtype #} deriving (Eq,Ord)--mkIMContext = (IMContext, objectUnrefFromMainloop)-unIMContext (IMContext o) = o--class ObjectClass o => IMContextClass o-toIMContext :: IMContextClass o => o -> IMContext-toIMContext = unsafeCastGObject . toGObject--instance IMContextClass IMContext-instance ObjectClass IMContext-instance GObjectClass IMContext where- toGObject = GObject . castForeignPtr . unIMContext- unsafeCastGObject = IMContext . castForeignPtr . unGObject--castToIMContext :: GObjectClass obj => obj -> IMContext-castToIMContext = castTo gTypeIMContext "IMContext"--gTypeIMContext :: GType-gTypeIMContext =- {# call fun unsafe gtk_im_context_get_type #}---- ************************************************************* IMMulticontext--{#pointer *IMMulticontext foreign newtype #} deriving (Eq,Ord)--mkIMMulticontext = (IMMulticontext, objectUnrefFromMainloop)-unIMMulticontext (IMMulticontext o) = o--class IMContextClass o => IMMulticontextClass o-toIMMulticontext :: IMMulticontextClass o => o -> IMMulticontext-toIMMulticontext = unsafeCastGObject . toGObject--instance IMMulticontextClass IMMulticontext-instance IMContextClass IMMulticontext-instance ObjectClass IMMulticontext-instance GObjectClass IMMulticontext where- toGObject = GObject . castForeignPtr . unIMMulticontext- unsafeCastGObject = IMMulticontext . castForeignPtr . unGObject--castToIMMulticontext :: GObjectClass obj => obj -> IMMulticontext-castToIMMulticontext = castTo gTypeIMMulticontext "IMMulticontext"--gTypeIMMulticontext :: GType-gTypeIMMulticontext =- {# call fun unsafe gtk_im_multicontext_get_type #}---- **************************************************************** ItemFactory--{#pointer *ItemFactory foreign newtype #} deriving (Eq,Ord)--mkItemFactory = (ItemFactory, objectUnrefFromMainloop)-unItemFactory (ItemFactory o) = o--class ObjectClass o => ItemFactoryClass o-toItemFactory :: ItemFactoryClass o => o -> ItemFactory-toItemFactory = unsafeCastGObject . toGObject--instance ItemFactoryClass ItemFactory-instance ObjectClass ItemFactory-instance GObjectClass ItemFactory where- toGObject = GObject . castForeignPtr . unItemFactory- unsafeCastGObject = ItemFactory . castForeignPtr . unGObject--castToItemFactory :: GObjectClass obj => obj -> ItemFactory-castToItemFactory = castTo gTypeItemFactory "ItemFactory"--gTypeItemFactory :: GType-gTypeItemFactory =- {# call fun unsafe gtk_item_factory_get_type #}---- ******************************************************************* Tooltips--{#pointer *Tooltips foreign newtype #} deriving (Eq,Ord)--mkTooltips = (Tooltips, objectUnrefFromMainloop)-unTooltips (Tooltips o) = o--class ObjectClass o => TooltipsClass o-toTooltips :: TooltipsClass o => o -> Tooltips-toTooltips = unsafeCastGObject . toGObject--instance TooltipsClass Tooltips-instance ObjectClass Tooltips-instance GObjectClass Tooltips where- toGObject = GObject . castForeignPtr . unTooltips- unsafeCastGObject = Tooltips . castForeignPtr . unGObject--castToTooltips :: GObjectClass obj => obj -> Tooltips-castToTooltips = castTo gTypeTooltips "Tooltips"--gTypeTooltips :: GType-gTypeTooltips =- {# call fun unsafe gtk_tooltips_get_type #}---- ************************************************************* TreeViewColumn--{#pointer *TreeViewColumn foreign newtype #} deriving (Eq,Ord)--mkTreeViewColumn = (TreeViewColumn, objectUnrefFromMainloop)-unTreeViewColumn (TreeViewColumn o) = o--class ObjectClass o => TreeViewColumnClass o-toTreeViewColumn :: TreeViewColumnClass o => o -> TreeViewColumn-toTreeViewColumn = unsafeCastGObject . toGObject--instance TreeViewColumnClass TreeViewColumn-instance ObjectClass TreeViewColumn-instance GObjectClass TreeViewColumn where- toGObject = GObject . castForeignPtr . unTreeViewColumn- unsafeCastGObject = TreeViewColumn . castForeignPtr . unGObject--castToTreeViewColumn :: GObjectClass obj => obj -> TreeViewColumn-castToTreeViewColumn = castTo gTypeTreeViewColumn "TreeViewColumn"--gTypeTreeViewColumn :: GType-gTypeTreeViewColumn =- {# call fun unsafe gtk_tree_view_column_get_type #}---- *************************************************************** CellRenderer--{#pointer *CellRenderer foreign newtype #} deriving (Eq,Ord)--mkCellRenderer = (CellRenderer, objectUnrefFromMainloop)-unCellRenderer (CellRenderer o) = o--class ObjectClass o => CellRendererClass o-toCellRenderer :: CellRendererClass o => o -> CellRenderer-toCellRenderer = unsafeCastGObject . toGObject--instance CellRendererClass CellRenderer-instance ObjectClass CellRenderer-instance GObjectClass CellRenderer where- toGObject = GObject . castForeignPtr . unCellRenderer- unsafeCastGObject = CellRenderer . castForeignPtr . unGObject--castToCellRenderer :: GObjectClass obj => obj -> CellRenderer-castToCellRenderer = castTo gTypeCellRenderer "CellRenderer"--gTypeCellRenderer :: GType-gTypeCellRenderer =- {# call fun unsafe gtk_cell_renderer_get_type #}---- ********************************************************* CellRendererPixbuf--{#pointer *CellRendererPixbuf foreign newtype #} deriving (Eq,Ord)--mkCellRendererPixbuf = (CellRendererPixbuf, objectUnrefFromMainloop)-unCellRendererPixbuf (CellRendererPixbuf o) = o--class CellRendererClass o => CellRendererPixbufClass o-toCellRendererPixbuf :: CellRendererPixbufClass o => o -> CellRendererPixbuf-toCellRendererPixbuf = unsafeCastGObject . toGObject--instance CellRendererPixbufClass CellRendererPixbuf-instance CellRendererClass CellRendererPixbuf-instance ObjectClass CellRendererPixbuf-instance GObjectClass CellRendererPixbuf where- toGObject = GObject . castForeignPtr . unCellRendererPixbuf- unsafeCastGObject = CellRendererPixbuf . castForeignPtr . unGObject--castToCellRendererPixbuf :: GObjectClass obj => obj -> CellRendererPixbuf-castToCellRendererPixbuf = castTo gTypeCellRendererPixbuf "CellRendererPixbuf"--gTypeCellRendererPixbuf :: GType-gTypeCellRendererPixbuf =- {# call fun unsafe gtk_cell_renderer_pixbuf_get_type #}---- *********************************************************** CellRendererText--{#pointer *CellRendererText foreign newtype #} deriving (Eq,Ord)--mkCellRendererText = (CellRendererText, objectUnrefFromMainloop)-unCellRendererText (CellRendererText o) = o--class CellRendererClass o => CellRendererTextClass o-toCellRendererText :: CellRendererTextClass o => o -> CellRendererText-toCellRendererText = unsafeCastGObject . toGObject--instance CellRendererTextClass CellRendererText-instance CellRendererClass CellRendererText-instance ObjectClass CellRendererText-instance GObjectClass CellRendererText where- toGObject = GObject . castForeignPtr . unCellRendererText- unsafeCastGObject = CellRendererText . castForeignPtr . unGObject--castToCellRendererText :: GObjectClass obj => obj -> CellRendererText-castToCellRendererText = castTo gTypeCellRendererText "CellRendererText"--gTypeCellRendererText :: GType-gTypeCellRendererText =- {# call fun unsafe gtk_cell_renderer_text_get_type #}---- ********************************************************** CellRendererCombo--{#pointer *CellRendererCombo foreign newtype #} deriving (Eq,Ord)--mkCellRendererCombo = (CellRendererCombo, objectUnrefFromMainloop)-unCellRendererCombo (CellRendererCombo o) = o--class CellRendererTextClass o => CellRendererComboClass o-toCellRendererCombo :: CellRendererComboClass o => o -> CellRendererCombo-toCellRendererCombo = unsafeCastGObject . toGObject--instance CellRendererComboClass CellRendererCombo-instance CellRendererTextClass CellRendererCombo-instance CellRendererClass CellRendererCombo-instance ObjectClass CellRendererCombo-instance GObjectClass CellRendererCombo where- toGObject = GObject . castForeignPtr . unCellRendererCombo- unsafeCastGObject = CellRendererCombo . castForeignPtr . unGObject--castToCellRendererCombo :: GObjectClass obj => obj -> CellRendererCombo-castToCellRendererCombo = castTo gTypeCellRendererCombo "CellRendererCombo"--gTypeCellRendererCombo :: GType-gTypeCellRendererCombo =- {# call fun unsafe gtk_cell_renderer_combo_get_type #}---- ********************************************************* CellRendererToggle--{#pointer *CellRendererToggle foreign newtype #} deriving (Eq,Ord)--mkCellRendererToggle = (CellRendererToggle, objectUnrefFromMainloop)-unCellRendererToggle (CellRendererToggle o) = o--class CellRendererClass o => CellRendererToggleClass o-toCellRendererToggle :: CellRendererToggleClass o => o -> CellRendererToggle-toCellRendererToggle = unsafeCastGObject . toGObject--instance CellRendererToggleClass CellRendererToggle-instance CellRendererClass CellRendererToggle-instance ObjectClass CellRendererToggle-instance GObjectClass CellRendererToggle where- toGObject = GObject . castForeignPtr . unCellRendererToggle- unsafeCastGObject = CellRendererToggle . castForeignPtr . unGObject--castToCellRendererToggle :: GObjectClass obj => obj -> CellRendererToggle-castToCellRendererToggle = castTo gTypeCellRendererToggle "CellRendererToggle"--gTypeCellRendererToggle :: GType-gTypeCellRendererToggle =- {# call fun unsafe gtk_cell_renderer_toggle_get_type #}---- ******************************************************* CellRendererProgress--{#pointer *CellRendererProgress foreign newtype #} deriving (Eq,Ord)--mkCellRendererProgress = (CellRendererProgress, objectUnrefFromMainloop)-unCellRendererProgress (CellRendererProgress o) = o--class CellRendererClass o => CellRendererProgressClass o-toCellRendererProgress :: CellRendererProgressClass o => o -> CellRendererProgress-toCellRendererProgress = unsafeCastGObject . toGObject--instance CellRendererProgressClass CellRendererProgress-instance CellRendererClass CellRendererProgress-instance ObjectClass CellRendererProgress-instance GObjectClass CellRendererProgress where- toGObject = GObject . castForeignPtr . unCellRendererProgress- unsafeCastGObject = CellRendererProgress . castForeignPtr . unGObject--castToCellRendererProgress :: GObjectClass obj => obj -> CellRendererProgress-castToCellRendererProgress = castTo gTypeCellRendererProgress "CellRendererProgress"--gTypeCellRendererProgress :: GType-gTypeCellRendererProgress =- {# call fun unsafe gtk_cell_renderer_progress_get_type #}---- ***************************************************************** FileFilter--{#pointer *FileFilter foreign newtype #} deriving (Eq,Ord)--mkFileFilter = (FileFilter, objectUnrefFromMainloop)-unFileFilter (FileFilter o) = o--class ObjectClass o => FileFilterClass o-toFileFilter :: FileFilterClass o => o -> FileFilter-toFileFilter = unsafeCastGObject . toGObject--instance FileFilterClass FileFilter-instance ObjectClass FileFilter-instance GObjectClass FileFilter where- toGObject = GObject . castForeignPtr . unFileFilter- unsafeCastGObject = FileFilter . castForeignPtr . unGObject--castToFileFilter :: GObjectClass obj => obj -> FileFilter-castToFileFilter = castTo gTypeFileFilter "FileFilter"--gTypeFileFilter :: GType-gTypeFileFilter =- {# call fun unsafe gtk_file_filter_get_type #}---- ******************************************************************** Builder--{#pointer *Builder foreign newtype #} deriving (Eq,Ord)--mkBuilder = (Builder, objectUnrefFromMainloop)-unBuilder (Builder o) = o--class ObjectClass o => BuilderClass o-toBuilder :: BuilderClass o => o -> Builder-toBuilder = unsafeCastGObject . toGObject--instance BuilderClass Builder-instance ObjectClass Builder-instance GObjectClass Builder where- toGObject = GObject . castForeignPtr . unBuilder- unsafeCastGObject = Builder . castForeignPtr . unGObject--castToBuilder :: GObjectClass obj => obj -> Builder-castToBuilder = castTo gTypeBuilder "Builder"--gTypeBuilder :: GType-gTypeBuilder =- {# call fun unsafe gtk_builder_get_type #}---- ***************************************************************** CellLayout--{#pointer *CellLayout foreign newtype #} deriving (Eq,Ord)--mkCellLayout = (CellLayout, objectUnrefFromMainloop)-unCellLayout (CellLayout o) = o--class GObjectClass o => CellLayoutClass o-toCellLayout :: CellLayoutClass o => o -> CellLayout-toCellLayout = unsafeCastGObject . toGObject--instance CellLayoutClass CellLayout-instance GObjectClass CellLayout where- toGObject = GObject . castForeignPtr . unCellLayout- unsafeCastGObject = CellLayout . castForeignPtr . unGObject--castToCellLayout :: GObjectClass obj => obj -> CellLayout-castToCellLayout = castTo gTypeCellLayout "CellLayout"--gTypeCellLayout :: GType-gTypeCellLayout =- {# call fun unsafe gtk_cell_layout_get_type #}---- *************************************************************** TreeSortable--{#pointer *TreeSortable foreign newtype #} deriving (Eq,Ord)--mkTreeSortable = (TreeSortable, objectUnrefFromMainloop)-unTreeSortable (TreeSortable o) = o--class GObjectClass o => TreeSortableClass o-toTreeSortable :: TreeSortableClass o => o -> TreeSortable-toTreeSortable = unsafeCastGObject . toGObject--instance TreeSortableClass TreeSortable-instance GObjectClass TreeSortable where- toGObject = GObject . castForeignPtr . unTreeSortable- unsafeCastGObject = TreeSortable . castForeignPtr . unGObject--castToTreeSortable :: GObjectClass obj => obj -> TreeSortable-castToTreeSortable = castTo gTypeTreeSortable "TreeSortable"--gTypeTreeSortable :: GType-gTypeTreeSortable =- {# call fun unsafe gtk_tree_sortable_get_type #}---- ******************************************************************** Tooltip--{#pointer *Tooltip foreign newtype #} deriving (Eq,Ord)--mkTooltip = (Tooltip, objectUnrefFromMainloop)-unTooltip (Tooltip o) = o--class GObjectClass o => TooltipClass o-toTooltip :: TooltipClass o => o -> Tooltip-toTooltip = unsafeCastGObject . toGObject--instance TooltipClass Tooltip-instance GObjectClass Tooltip where- toGObject = GObject . castForeignPtr . unTooltip- unsafeCastGObject = Tooltip . castForeignPtr . unGObject--castToTooltip :: GObjectClass obj => obj -> Tooltip-castToTooltip = castTo gTypeTooltip "Tooltip"--gTypeTooltip :: GType-gTypeTooltip =- {# call fun unsafe gtk_tooltip_get_type #}---- ***************************************************************** StatusIcon--{#pointer *StatusIcon foreign newtype #} deriving (Eq,Ord)--mkStatusIcon = (StatusIcon, objectUnrefFromMainloop)-unStatusIcon (StatusIcon o) = o--class TooltipClass o => StatusIconClass o-toStatusIcon :: StatusIconClass o => o -> StatusIcon-toStatusIcon = unsafeCastGObject . toGObject--instance StatusIconClass StatusIcon-instance TooltipClass StatusIcon-instance GObjectClass StatusIcon where- toGObject = GObject . castForeignPtr . unStatusIcon- unsafeCastGObject = StatusIcon . castForeignPtr . unGObject--castToStatusIcon :: GObjectClass obj => obj -> StatusIcon-castToStatusIcon = castTo gTypeStatusIcon "StatusIcon"--gTypeStatusIcon :: GType-gTypeStatusIcon =- {# call fun unsafe gtk_status_icon_get_type #}---- ************************************************************** TreeSelection--{#pointer *TreeSelection foreign newtype #} deriving (Eq,Ord)--mkTreeSelection = (TreeSelection, objectUnrefFromMainloop)-unTreeSelection (TreeSelection o) = o--class GObjectClass o => TreeSelectionClass o-toTreeSelection :: TreeSelectionClass o => o -> TreeSelection-toTreeSelection = unsafeCastGObject . toGObject--instance TreeSelectionClass TreeSelection-instance GObjectClass TreeSelection where- toGObject = GObject . castForeignPtr . unTreeSelection- unsafeCastGObject = TreeSelection . castForeignPtr . unGObject--castToTreeSelection :: GObjectClass obj => obj -> TreeSelection-castToTreeSelection = castTo gTypeTreeSelection "TreeSelection"--gTypeTreeSelection :: GType-gTypeTreeSelection =- {# call fun unsafe gtk_tree_selection_get_type #}---- ****************************************************************** TreeModel--{#pointer *TreeModel foreign newtype #} deriving (Eq,Ord)--mkTreeModel = (TreeModel, objectUnrefFromMainloop)-unTreeModel (TreeModel o) = o--class GObjectClass o => TreeModelClass o-toTreeModel :: TreeModelClass o => o -> TreeModel-toTreeModel = unsafeCastGObject . toGObject--instance TreeModelClass TreeModel-instance GObjectClass TreeModel where- toGObject = GObject . castForeignPtr . unTreeModel- unsafeCastGObject = TreeModel . castForeignPtr . unGObject--castToTreeModel :: GObjectClass obj => obj -> TreeModel-castToTreeModel = castTo gTypeTreeModel "TreeModel"--gTypeTreeModel :: GType-gTypeTreeModel =- {# call fun unsafe gtk_tree_model_get_type #}---- ****************************************************************** TreeStore--{#pointer *TreeStore foreign newtype #} deriving (Eq,Ord)--mkTreeStore = (TreeStore, objectUnrefFromMainloop)-unTreeStore (TreeStore o) = o--class TreeModelClass o => TreeStoreClass o-toTreeStore :: TreeStoreClass o => o -> TreeStore-toTreeStore = unsafeCastGObject . toGObject--instance TreeStoreClass TreeStore-instance TreeModelClass TreeStore-instance GObjectClass TreeStore where- toGObject = GObject . castForeignPtr . unTreeStore- unsafeCastGObject = TreeStore . castForeignPtr . unGObject--castToTreeStore :: GObjectClass obj => obj -> TreeStore-castToTreeStore = castTo gTypeTreeStore "TreeStore"--gTypeTreeStore :: GType-gTypeTreeStore =- {# call fun unsafe gtk_tree_store_get_type #}---- ****************************************************************** ListStore--{#pointer *ListStore foreign newtype #} deriving (Eq,Ord)--mkListStore = (ListStore, objectUnrefFromMainloop)-unListStore (ListStore o) = o--class TreeModelClass o => ListStoreClass o-toListStore :: ListStoreClass o => o -> ListStore-toListStore = unsafeCastGObject . toGObject--instance ListStoreClass ListStore-instance TreeModelClass ListStore-instance GObjectClass ListStore where- toGObject = GObject . castForeignPtr . unListStore- unsafeCastGObject = ListStore . castForeignPtr . unGObject--castToListStore :: GObjectClass obj => obj -> ListStore-castToListStore = castTo gTypeListStore "ListStore"--gTypeListStore :: GType-gTypeListStore =- {# call fun unsafe gtk_list_store_get_type #}---- ************************************************************** TreeModelSort--{#pointer *TreeModelSort foreign newtype #} deriving (Eq,Ord)--mkTreeModelSort = (TreeModelSort, objectUnrefFromMainloop)-unTreeModelSort (TreeModelSort o) = o--class GObjectClass o => TreeModelSortClass o-toTreeModelSort :: TreeModelSortClass o => o -> TreeModelSort-toTreeModelSort = unsafeCastGObject . toGObject--instance TreeModelSortClass TreeModelSort-instance GObjectClass TreeModelSort where- toGObject = GObject . castForeignPtr . unTreeModelSort- unsafeCastGObject = TreeModelSort . castForeignPtr . unGObject--castToTreeModelSort :: GObjectClass obj => obj -> TreeModelSort-castToTreeModelSort = castTo gTypeTreeModelSort "TreeModelSort"--gTypeTreeModelSort :: GType-gTypeTreeModelSort =- {# call fun unsafe gtk_tree_model_sort_get_type #}---- ************************************************************ TreeModelFilter--{#pointer *TreeModelFilter foreign newtype #} deriving (Eq,Ord)--mkTreeModelFilter = (TreeModelFilter, objectUnrefFromMainloop)-unTreeModelFilter (TreeModelFilter o) = o--class GObjectClass o => TreeModelFilterClass o-toTreeModelFilter :: TreeModelFilterClass o => o -> TreeModelFilter-toTreeModelFilter = unsafeCastGObject . toGObject--instance TreeModelFilterClass TreeModelFilter-instance GObjectClass TreeModelFilter where- toGObject = GObject . castForeignPtr . unTreeModelFilter- unsafeCastGObject = TreeModelFilter . castForeignPtr . unGObject--castToTreeModelFilter :: GObjectClass obj => obj -> TreeModelFilter-castToTreeModelFilter = castTo gTypeTreeModelFilter "TreeModelFilter"--gTypeTreeModelFilter :: GType-gTypeTreeModelFilter =- {# call fun unsafe gtk_tree_model_filter_get_type #}---- **************************************************************** IconFactory--{#pointer *IconFactory foreign newtype #} deriving (Eq,Ord)--mkIconFactory = (IconFactory, objectUnrefFromMainloop)-unIconFactory (IconFactory o) = o--class GObjectClass o => IconFactoryClass o-toIconFactory :: IconFactoryClass o => o -> IconFactory-toIconFactory = unsafeCastGObject . toGObject--instance IconFactoryClass IconFactory-instance GObjectClass IconFactory where- toGObject = GObject . castForeignPtr . unIconFactory- unsafeCastGObject = IconFactory . castForeignPtr . unGObject--castToIconFactory :: GObjectClass obj => obj -> IconFactory-castToIconFactory = castTo gTypeIconFactory "IconFactory"--gTypeIconFactory :: GType-gTypeIconFactory =- {# call fun unsafe gtk_icon_factory_get_type #}---- ****************************************************************** IconTheme--{#pointer *IconTheme foreign newtype #} deriving (Eq,Ord)--mkIconTheme = (IconTheme, objectUnrefFromMainloop)-unIconTheme (IconTheme o) = o--class GObjectClass o => IconThemeClass o-toIconTheme :: IconThemeClass o => o -> IconTheme-toIconTheme = unsafeCastGObject . toGObject--instance IconThemeClass IconTheme-instance GObjectClass IconTheme where- toGObject = GObject . castForeignPtr . unIconTheme- unsafeCastGObject = IconTheme . castForeignPtr . unGObject--castToIconTheme :: GObjectClass obj => obj -> IconTheme-castToIconTheme = castTo gTypeIconTheme "IconTheme"--gTypeIconTheme :: GType-gTypeIconTheme =- {# call fun unsafe gtk_icon_theme_get_type #}---- ****************************************************************** SizeGroup--{#pointer *SizeGroup foreign newtype #} deriving (Eq,Ord)--mkSizeGroup = (SizeGroup, objectUnrefFromMainloop)-unSizeGroup (SizeGroup o) = o--class GObjectClass o => SizeGroupClass o-toSizeGroup :: SizeGroupClass o => o -> SizeGroup-toSizeGroup = unsafeCastGObject . toGObject--instance SizeGroupClass SizeGroup-instance GObjectClass SizeGroup where- toGObject = GObject . castForeignPtr . unSizeGroup- unsafeCastGObject = SizeGroup . castForeignPtr . unGObject--castToSizeGroup :: GObjectClass obj => obj -> SizeGroup-castToSizeGroup = castTo gTypeSizeGroup "SizeGroup"--gTypeSizeGroup :: GType-gTypeSizeGroup =- {# call fun unsafe gtk_size_group_get_type #}---- ****************************************************************** Clipboard--{#pointer *Clipboard foreign newtype #} deriving (Eq,Ord)--mkClipboard = (Clipboard, objectUnrefFromMainloop)-unClipboard (Clipboard o) = o--class GObjectClass o => ClipboardClass o-toClipboard :: ClipboardClass o => o -> Clipboard-toClipboard = unsafeCastGObject . toGObject--instance ClipboardClass Clipboard-instance GObjectClass Clipboard where- toGObject = GObject . castForeignPtr . unClipboard- unsafeCastGObject = Clipboard . castForeignPtr . unGObject--castToClipboard :: GObjectClass obj => obj -> Clipboard-castToClipboard = castTo gTypeClipboard "Clipboard"--gTypeClipboard :: GType-gTypeClipboard =- {# call fun unsafe gtk_clipboard_get_type #}---- ***************************************************************** AccelGroup--{#pointer *AccelGroup foreign newtype #} deriving (Eq,Ord)--mkAccelGroup = (AccelGroup, objectUnrefFromMainloop)-unAccelGroup (AccelGroup o) = o--class GObjectClass o => AccelGroupClass o-toAccelGroup :: AccelGroupClass o => o -> AccelGroup-toAccelGroup = unsafeCastGObject . toGObject--instance AccelGroupClass AccelGroup-instance GObjectClass AccelGroup where- toGObject = GObject . castForeignPtr . unAccelGroup- unsafeCastGObject = AccelGroup . castForeignPtr . unGObject--castToAccelGroup :: GObjectClass obj => obj -> AccelGroup-castToAccelGroup = castTo gTypeAccelGroup "AccelGroup"--gTypeAccelGroup :: GType-gTypeAccelGroup =- {# call fun unsafe gtk_accel_group_get_type #}---- ******************************************************************* AccelMap--{#pointer *AccelMap foreign newtype #} deriving (Eq,Ord)--mkAccelMap = (AccelMap, objectUnrefFromMainloop)-unAccelMap (AccelMap o) = o--class GObjectClass o => AccelMapClass o-toAccelMap :: AccelMapClass o => o -> AccelMap-toAccelMap = unsafeCastGObject . toGObject--instance AccelMapClass AccelMap-instance GObjectClass AccelMap where- toGObject = GObject . castForeignPtr . unAccelMap- unsafeCastGObject = AccelMap . castForeignPtr . unGObject--castToAccelMap :: GObjectClass obj => obj -> AccelMap-castToAccelMap = castTo gTypeAccelMap "AccelMap"--gTypeAccelMap :: GType-gTypeAccelMap =- {# call fun unsafe gtk_accel_map_get_type #}---- ************************************************************ EntryCompletion--{#pointer *EntryCompletion foreign newtype #} deriving (Eq,Ord)--mkEntryCompletion = (EntryCompletion, objectUnrefFromMainloop)-unEntryCompletion (EntryCompletion o) = o--class GObjectClass o => EntryCompletionClass o-toEntryCompletion :: EntryCompletionClass o => o -> EntryCompletion-toEntryCompletion = unsafeCastGObject . toGObject--instance EntryCompletionClass EntryCompletion-instance GObjectClass EntryCompletion where- toGObject = GObject . castForeignPtr . unEntryCompletion- unsafeCastGObject = EntryCompletion . castForeignPtr . unGObject--castToEntryCompletion :: GObjectClass obj => obj -> EntryCompletion-castToEntryCompletion = castTo gTypeEntryCompletion "EntryCompletion"--gTypeEntryCompletion :: GType-gTypeEntryCompletion =- {# call fun unsafe gtk_entry_completion_get_type #}---- ********************************************************************* Action--{#pointer *Action foreign newtype #} deriving (Eq,Ord)--mkAction = (Action, objectUnrefFromMainloop)-unAction (Action o) = o--class GObjectClass o => ActionClass o-toAction :: ActionClass o => o -> Action-toAction = unsafeCastGObject . toGObject--instance ActionClass Action-instance GObjectClass Action where- toGObject = GObject . castForeignPtr . unAction- unsafeCastGObject = Action . castForeignPtr . unGObject--castToAction :: GObjectClass obj => obj -> Action-castToAction = castTo gTypeAction "Action"--gTypeAction :: GType-gTypeAction =- {# call fun unsafe gtk_action_get_type #}---- *************************************************************** ToggleAction--{#pointer *ToggleAction foreign newtype #} deriving (Eq,Ord)--mkToggleAction = (ToggleAction, objectUnrefFromMainloop)-unToggleAction (ToggleAction o) = o--class ActionClass o => ToggleActionClass o-toToggleAction :: ToggleActionClass o => o -> ToggleAction-toToggleAction = unsafeCastGObject . toGObject--instance ToggleActionClass ToggleAction-instance ActionClass ToggleAction-instance GObjectClass ToggleAction where- toGObject = GObject . castForeignPtr . unToggleAction- unsafeCastGObject = ToggleAction . castForeignPtr . unGObject--castToToggleAction :: GObjectClass obj => obj -> ToggleAction-castToToggleAction = castTo gTypeToggleAction "ToggleAction"--gTypeToggleAction :: GType-gTypeToggleAction =- {# call fun unsafe gtk_toggle_action_get_type #}---- **************************************************************** RadioAction--{#pointer *RadioAction foreign newtype #} deriving (Eq,Ord)--mkRadioAction = (RadioAction, objectUnrefFromMainloop)-unRadioAction (RadioAction o) = o--class ToggleActionClass o => RadioActionClass o-toRadioAction :: RadioActionClass o => o -> RadioAction-toRadioAction = unsafeCastGObject . toGObject--instance RadioActionClass RadioAction-instance ToggleActionClass RadioAction-instance ActionClass RadioAction-instance GObjectClass RadioAction where- toGObject = GObject . castForeignPtr . unRadioAction- unsafeCastGObject = RadioAction . castForeignPtr . unGObject--castToRadioAction :: GObjectClass obj => obj -> RadioAction-castToRadioAction = castTo gTypeRadioAction "RadioAction"--gTypeRadioAction :: GType-gTypeRadioAction =- {# call fun unsafe gtk_radio_action_get_type #}---- **************************************************************** ActionGroup--{#pointer *ActionGroup foreign newtype #} deriving (Eq,Ord)--mkActionGroup = (ActionGroup, objectUnrefFromMainloop)-unActionGroup (ActionGroup o) = o--class GObjectClass o => ActionGroupClass o-toActionGroup :: ActionGroupClass o => o -> ActionGroup-toActionGroup = unsafeCastGObject . toGObject--instance ActionGroupClass ActionGroup-instance GObjectClass ActionGroup where- toGObject = GObject . castForeignPtr . unActionGroup- unsafeCastGObject = ActionGroup . castForeignPtr . unGObject--castToActionGroup :: GObjectClass obj => obj -> ActionGroup-castToActionGroup = castTo gTypeActionGroup "ActionGroup"--gTypeActionGroup :: GType-gTypeActionGroup =- {# call fun unsafe gtk_action_group_get_type #}---- ****************************************************************** UIManager--{#pointer *UIManager foreign newtype #} deriving (Eq,Ord)--mkUIManager = (UIManager, objectUnrefFromMainloop)-unUIManager (UIManager o) = o--class GObjectClass o => UIManagerClass o-toUIManager :: UIManagerClass o => o -> UIManager-toUIManager = unsafeCastGObject . toGObject--instance UIManagerClass UIManager-instance GObjectClass UIManager where- toGObject = GObject . castForeignPtr . unUIManager- unsafeCastGObject = UIManager . castForeignPtr . unGObject--castToUIManager :: GObjectClass obj => obj -> UIManager-castToUIManager = castTo gTypeUIManager "UIManager"--gTypeUIManager :: GType-gTypeUIManager =- {# call fun unsafe gtk_ui_manager_get_type #}---- **************************************************************** WindowGroup--{#pointer *WindowGroup foreign newtype #} deriving (Eq,Ord)--mkWindowGroup = (WindowGroup, objectUnrefFromMainloop)-unWindowGroup (WindowGroup o) = o--class GObjectClass o => WindowGroupClass o-toWindowGroup :: WindowGroupClass o => o -> WindowGroup-toWindowGroup = unsafeCastGObject . toGObject--instance WindowGroupClass WindowGroup-instance GObjectClass WindowGroup where- toGObject = GObject . castForeignPtr . unWindowGroup- unsafeCastGObject = WindowGroup . castForeignPtr . unGObject--castToWindowGroup :: GObjectClass obj => obj -> WindowGroup-castToWindowGroup = castTo gTypeWindowGroup "WindowGroup"--gTypeWindowGroup :: GType-gTypeWindowGroup =- {# call fun unsafe gtk_window_group_get_type #}---- ******************************************************************* Editable--{#pointer *Editable foreign newtype #} deriving (Eq,Ord)--mkEditable = (Editable, objectUnrefFromMainloop)-unEditable (Editable o) = o--class GObjectClass o => EditableClass o-toEditable :: EditableClass o => o -> Editable-toEditable = unsafeCastGObject . toGObject--instance EditableClass Editable-instance GObjectClass Editable where- toGObject = GObject . castForeignPtr . unEditable- unsafeCastGObject = Editable . castForeignPtr . unGObject--castToEditable :: GObjectClass obj => obj -> Editable-castToEditable = castTo gTypeEditable "Editable"--gTypeEditable :: GType-gTypeEditable =- {# call fun unsafe gtk_editable_get_type #}---- **************************************************************** FileChooser--{#pointer *FileChooser foreign newtype #} deriving (Eq,Ord)--mkFileChooser = (FileChooser, objectUnrefFromMainloop)-unFileChooser (FileChooser o) = o--class GObjectClass o => FileChooserClass o-toFileChooser :: FileChooserClass o => o -> FileChooser-toFileChooser = unsafeCastGObject . toGObject--instance FileChooserClass FileChooser-instance GObjectClass FileChooser where- toGObject = GObject . castForeignPtr . unFileChooser- unsafeCastGObject = FileChooser . castForeignPtr . unGObject--castToFileChooser :: GObjectClass obj => obj -> FileChooser-castToFileChooser = castTo gTypeFileChooser "FileChooser"--gTypeFileChooser :: GType-gTypeFileChooser =- {# call fun unsafe gtk_file_chooser_get_type #}---- ************************************************************************* GC--{#pointer *GdkGC as GC foreign newtype #} deriving (Eq,Ord)--mkGC = (GC, objectUnrefFromMainloop)-unGC (GC o) = o--class GObjectClass o => GCClass o-toGC :: GCClass o => o -> GC-toGC = unsafeCastGObject . toGObject--instance GCClass GC-instance GObjectClass GC where- toGObject = GObject . castForeignPtr . unGC- unsafeCastGObject = GC . castForeignPtr . unGObject--castToGC :: GObjectClass obj => obj -> GC-castToGC = castTo gTypeGC "GC"--gTypeGC :: GType-gTypeGC =- {# call fun unsafe gdk_gc_get_type #}-
Graphics/UI/Gtk/Windows/AboutDialog.chs view
@@ -29,7 +29,7 @@ -- module Graphics.UI.Gtk.Windows.AboutDialog ( -- * Detail--- +-- -- | The 'AboutDialog' offers a simple way to display information about a -- program like its logo, name, copyright, website and license. It is also -- possible to give credits to the authors, documenters, translators and@@ -80,8 +80,10 @@ aboutDialogNew, -- * Methods+#if GTK_MAJOR_VERSION < 3 aboutDialogSetEmailHook, aboutDialogSetUrlHook,+#endif -- * Attributes aboutDialogProgramName,@@ -138,15 +140,14 @@ #endif ) where -import Control.Monad (liftM)-import Data.Maybe (fromMaybe)+import Control.Monad (liftM)+import Data.Maybe (fromMaybe) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import System.Glib.GObject (makeNewGObject, destroyFunPtr)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {# context lib="gtk" prefix="gtk" #}@@ -166,10 +167,11 @@ -------------------- -- Methods +#ifndef DISABLE_DEPRECATED -- | Returns the program name displayed in the about dialog. ---aboutDialogGetName :: AboutDialogClass self => self- -> IO String -- ^ returns The program name.+aboutDialogGetName :: (AboutDialogClass self, GlibString string) => self+ -> IO string -- ^ returns The program name. aboutDialogGetName self = #if GTK_CHECK_VERSION(2,12,0) {# call gtk_about_dialog_get_program_name #}@@ -182,8 +184,8 @@ -- | Sets the name to display in the about dialog. If this is not set, it -- defaults to the program executable name. ---aboutDialogSetName :: AboutDialogClass self => self- -> String -- ^ @name@ - the program name+aboutDialogSetName :: (AboutDialogClass self, GlibString string) => self+ -> string -- ^ @name@ - the program name -> IO () aboutDialogSetName self name = withUTFString name $ \namePtr ->@@ -197,7 +199,7 @@ -- | Returns the version string. ---aboutDialogGetVersion :: AboutDialogClass self => self -> IO String+aboutDialogGetVersion :: (AboutDialogClass self, GlibString string) => self -> IO string aboutDialogGetVersion self = {# call gtk_about_dialog_get_version #} (toAboutDialog self)@@ -205,7 +207,7 @@ -- | Sets the version string to display in the about dialog. ---aboutDialogSetVersion :: AboutDialogClass self => self -> String -> IO ()+aboutDialogSetVersion :: (AboutDialogClass self, GlibString string) => self -> string -> IO () aboutDialogSetVersion self version = withUTFString version $ \versionPtr -> {# call gtk_about_dialog_set_version #}@@ -214,7 +216,7 @@ -- | Returns the copyright string. ---aboutDialogGetCopyright :: AboutDialogClass self => self -> IO String+aboutDialogGetCopyright :: (AboutDialogClass self, GlibString string) => self -> IO string aboutDialogGetCopyright self = {# call gtk_about_dialog_get_copyright #} (toAboutDialog self)@@ -223,7 +225,7 @@ -- | Sets the copyright string to display in the about dialog. This should be -- a short string of one or two lines. ---aboutDialogSetCopyright :: AboutDialogClass self => self -> String -> IO ()+aboutDialogSetCopyright :: (AboutDialogClass self, GlibString string) => self -> string -> IO () aboutDialogSetCopyright self copyright = withUTFString copyright $ \copyrightPtr -> {# call gtk_about_dialog_set_copyright #}@@ -232,7 +234,7 @@ -- | Returns the comments string. ---aboutDialogGetComments :: AboutDialogClass self => self -> IO String+aboutDialogGetComments :: (AboutDialogClass self, GlibString string) => self -> IO string aboutDialogGetComments self = {# call gtk_about_dialog_get_comments #} (toAboutDialog self)@@ -241,7 +243,7 @@ -- | Sets the comments string to display in the about dialog. This should be a -- short string of one or two lines. ---aboutDialogSetComments :: AboutDialogClass self => self -> String -> IO ()+aboutDialogSetComments :: (AboutDialogClass self, GlibString string) => self -> string -> IO () aboutDialogSetComments self comments = withUTFString comments $ \commentsPtr -> {# call gtk_about_dialog_set_comments #}@@ -250,7 +252,7 @@ -- | Returns the license information. ---aboutDialogGetLicense :: AboutDialogClass self => self -> IO (Maybe String)+aboutDialogGetLicense :: (AboutDialogClass self, GlibString string) => self -> IO (Maybe string) aboutDialogGetLicense self = {# call gtk_about_dialog_get_license #} (toAboutDialog self)@@ -259,8 +261,8 @@ -- | Sets the license information to be displayed in the secondary license -- dialog. If @license@ is @Nothing@, the license button is hidden. ---aboutDialogSetLicense :: AboutDialogClass self => self- -> Maybe String -- ^ @license@ - the license information or @Nothing@+aboutDialogSetLicense :: (AboutDialogClass self, GlibString string) => self+ -> Maybe string -- ^ @license@ - the license information or @Nothing@ -> IO () aboutDialogSetLicense self license = maybeWith withUTFString license $ \licensePtr ->@@ -270,7 +272,7 @@ -- | Returns the website URL. ---aboutDialogGetWebsite :: AboutDialogClass self => self -> IO String+aboutDialogGetWebsite :: (AboutDialogClass self, GlibString string) => self -> IO string aboutDialogGetWebsite self = {# call gtk_about_dialog_get_website #} (toAboutDialog self)@@ -278,8 +280,8 @@ -- | Sets the URL to use for the website link. ---aboutDialogSetWebsite :: AboutDialogClass self => self- -> String -- ^ @website@ - a URL string starting with \"http:\/\/\"+aboutDialogSetWebsite :: (AboutDialogClass self, GlibString string) => self+ -> string -- ^ @website@ - a URL string starting with \"http:\/\/\" -> IO () aboutDialogSetWebsite self website = withUTFString website $ \websitePtr ->@@ -289,7 +291,7 @@ -- | Returns the label used for the website link. ---aboutDialogGetWebsiteLabel :: AboutDialogClass self => self -> IO String+aboutDialogGetWebsiteLabel :: (AboutDialogClass self, GlibString string) => self -> IO string aboutDialogGetWebsiteLabel self = {# call gtk_about_dialog_get_website_label #} (toAboutDialog self)@@ -298,18 +300,19 @@ -- | Sets the label to be used for the website link. It defaults to the -- website URL. ---aboutDialogSetWebsiteLabel :: AboutDialogClass self => self -> String -> IO ()+aboutDialogSetWebsiteLabel :: (AboutDialogClass self, GlibString string) => self -> string -> IO () aboutDialogSetWebsiteLabel self websiteLabel = withUTFString websiteLabel $ \websiteLabelPtr -> {# call gtk_about_dialog_set_website_label #} (toAboutDialog self) websiteLabelPtr+#endif -- | Sets the strings which are displayed in the authors tab of the secondary -- credits dialog. ---aboutDialogSetAuthors :: AboutDialogClass self => self- -> [String] -- ^ @authors@ - a list of author names+aboutDialogSetAuthors :: (AboutDialogClass self, GlibString string) => self+ -> [string] -- ^ @authors@ - a list of author names -> IO () aboutDialogSetAuthors self authors = withUTFStringArray0 authors $ \authorsPtr ->@@ -320,7 +323,7 @@ -- | Returns the string which are displayed in the authors tab of the -- secondary credits dialog. ---aboutDialogGetAuthors :: AboutDialogClass self => self -> IO [String]+aboutDialogGetAuthors :: (AboutDialogClass self, GlibString string) => self -> IO [string] aboutDialogGetAuthors self = {# call gtk_about_dialog_get_authors #} (toAboutDialog self)@@ -329,8 +332,8 @@ -- | Sets the strings which are displayed in the artists tab of the secondary -- credits dialog. ---aboutDialogSetArtists :: AboutDialogClass self => self- -> [String] -- ^ @artists@ - a list of artist names+aboutDialogSetArtists :: (AboutDialogClass self, GlibString string) => self+ -> [string] -- ^ @artists@ - a list of artist names -> IO () aboutDialogSetArtists self artists = withUTFStringArray0 artists $ \artistsPtr ->@@ -341,7 +344,7 @@ -- | Returns the string which are displayed in the artists tab of the -- secondary credits dialog. ---aboutDialogGetArtists :: AboutDialogClass self => self -> IO [String]+aboutDialogGetArtists :: (AboutDialogClass self, GlibString string) => self -> IO [string] aboutDialogGetArtists self = {# call gtk_about_dialog_get_artists #} (toAboutDialog self)@@ -350,8 +353,8 @@ -- | Sets the strings which are displayed in the documenters tab of the -- secondary credits dialog. ---aboutDialogSetDocumenters :: AboutDialogClass self => self- -> [String] -- ^ @artists@ - a list of documenter names+aboutDialogSetDocumenters :: (AboutDialogClass self, GlibString string) => self+ -> [string] -- ^ @artists@ - a list of documenter names -> IO () aboutDialogSetDocumenters self documenters = withUTFStringArray0 documenters $ \documentersPtr ->@@ -362,16 +365,17 @@ -- | Returns the string which are displayed in the documenters tab of the -- secondary credits dialog. ---aboutDialogGetDocumenters :: AboutDialogClass self => self -> IO [String]+aboutDialogGetDocumenters :: (AboutDialogClass self, GlibString string) => self -> IO [string] aboutDialogGetDocumenters self = {# call gtk_about_dialog_get_documenters #} (toAboutDialog self) >>= peekUTFStringArray0 +#ifndef DISABLE_DEPRECATED -- | Returns the translator credits string which is displayed in the -- translators tab of the secondary credits dialog. ---aboutDialogGetTranslatorCredits :: AboutDialogClass self => self -> IO String+aboutDialogGetTranslatorCredits :: (AboutDialogClass self, GlibString string) => self -> IO string aboutDialogGetTranslatorCredits self = {# call gtk_about_dialog_get_translator_credits #} (toAboutDialog self)@@ -383,12 +387,13 @@ -- The intended use for this string is to display the translator of the -- language which is currently used in the user interface. ---aboutDialogSetTranslatorCredits :: AboutDialogClass self => self -> String -> IO ()+aboutDialogSetTranslatorCredits :: (AboutDialogClass self, GlibString string) => self -> string -> IO () aboutDialogSetTranslatorCredits self translatorCredits = withUTFString translatorCredits $ \translatorCreditsPtr -> {# call gtk_about_dialog_set_translator_credits #} (toAboutDialog self) translatorCreditsPtr+#endif -- | Returns the pixbuf displayed as logo in the about dialog. --@@ -412,7 +417,7 @@ -- | Returns the icon name displayed as logo in the about dialog. ---aboutDialogGetLogoIconName :: AboutDialogClass self => self -> IO String+aboutDialogGetLogoIconName :: (AboutDialogClass self, GlibString string) => self -> IO string aboutDialogGetLogoIconName self = {# call gtk_about_dialog_get_logo_icon_name #} (toAboutDialog self)@@ -422,8 +427,8 @@ -- @Nothing@, the default window icon set with 'windowSetDefaultIcon' will be -- used. ---aboutDialogSetLogoIconName :: AboutDialogClass self => self- -> Maybe String -- ^ @iconName@ - an icon name, or @Nothing@+aboutDialogSetLogoIconName :: (AboutDialogClass self, GlibString string) => self+ -> Maybe string -- ^ @iconName@ - an icon name, or @Nothing@ -> IO () aboutDialogSetLogoIconName self iconName = maybeWith withUTFString iconName $ \iconNamePtr ->@@ -431,11 +436,13 @@ (toAboutDialog self) iconNamePtr +#if GTK_MAJOR_VERSION < 3 -- | Installs a global function to be called whenever the user activates an -- email link in an about dialog. ---aboutDialogSetEmailHook :: - (String -> IO ()) -- ^ @(\url -> ...)@ - a function to call when an email+-- Removed in Gtk3.+aboutDialogSetEmailHook :: GlibString string+ => (string -> IO ()) -- ^ @(\url -> ...)@ - a function to call when an email -- link is activated. -> IO () aboutDialogSetEmailHook func = do@@ -452,8 +459,9 @@ -- | Installs a global function to be called whenever the user activates a URL -- link in an about dialog. ---aboutDialogSetUrlHook :: - (String -> IO ()) -- ^ @(\url -> ...)@ - a function to call when a URL link+-- Removed in Gtk3.+aboutDialogSetUrlHook ::GlibString string+ => (string -> IO ()) -- ^ @(\url -> ...)@ - a function to call when a URL link -- is activated. -> IO () aboutDialogSetUrlHook func = do@@ -471,7 +479,9 @@ foreign import ccall "wrapper" mkAboutDialogActivateLinkFunc :: (Ptr AboutDialog -> CString -> Ptr () -> IO ()) -> IO AboutDialogActivateLinkFunc+#endif +#ifndef DISABLE_DEPRECATED #if GTK_CHECK_VERSION(2,8,0) -- | Returns whether the license text in @about@ is automatically wrapped. --@@ -496,6 +506,7 @@ (toAboutDialog self) (fromBool wrapLicense) #endif+#endif -------------------- -- Attributes@@ -503,35 +514,35 @@ -- | The name of the program. If this is not set, it defaults to -- 'gGetApplicationName'. ---aboutDialogName :: AboutDialogClass self => Attr self String+aboutDialogName :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogName = newAttrFromStringProperty "name" -- | The name of the program. If this is not set, it defaults to -- 'gGetApplicationName'. -- #if GTK_CHECK_VERSION(2,12,0)-aboutDialogProgramName :: AboutDialogClass self => Attr self String+aboutDialogProgramName :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogProgramName = newAttrFromStringProperty "program-name" #else-aboutDialogProgramName :: AboutDialogClass self => Attr self String+aboutDialogProgramName :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogProgramName = newAttrFromStringProperty "name" #endif -- | The version of the program. ---aboutDialogVersion :: AboutDialogClass self => Attr self String+aboutDialogVersion :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogVersion = newAttrFromStringProperty "version" -- | Copyright information for the program. ---aboutDialogCopyright :: AboutDialogClass self => Attr self String+aboutDialogCopyright :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogCopyright = newAttrFromStringProperty "copyright" -- | Comments about the program. This string is displayed in a label in the -- main dialog, thus it should be a short explanation of the main purpose of -- the program, not a detailed list of features. ---aboutDialogComments :: AboutDialogClass self => Attr self String+aboutDialogComments :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogComments = newAttrFromStringProperty "comments" -- | The license of the program. This string is displayed in a text view in a@@ -542,26 +553,26 @@ -- -- Default value: @Nothing@ ---aboutDialogLicense :: AboutDialogClass self => Attr self (Maybe String)+aboutDialogLicense :: (AboutDialogClass self, GlibString string) => Attr self (Maybe string) aboutDialogLicense = newAttrFromMaybeStringProperty "license" -- | The URL for the link to the website of the program. This should be a -- string starting with \"http:\/\/. ---aboutDialogWebsite :: AboutDialogClass self => Attr self String+aboutDialogWebsite :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogWebsite = newAttrFromStringProperty "website" -- | The label for the link to the website of the program. If this is not set, -- it defaults to the URL specified in the website property. ---aboutDialogWebsiteLabel :: AboutDialogClass self => Attr self String+aboutDialogWebsiteLabel :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogWebsiteLabel = newAttrFromStringProperty "website-label" -- | The authors of the program. Each string may -- contain email addresses and URLs, which will be displayed as links, see the -- introduction for more details. ---aboutDialogAuthors :: AboutDialogClass self => Attr self [String]+aboutDialogAuthors :: (AboutDialogClass self, GlibString string) => Attr self [string] aboutDialogAuthors = newAttr aboutDialogGetAuthors aboutDialogSetAuthors@@ -570,7 +581,7 @@ -- Each string may contain email addresses and URLs, which will be displayed as -- links, see the introduction for more details. ---aboutDialogDocumenters :: AboutDialogClass self => Attr self [String]+aboutDialogDocumenters :: (AboutDialogClass self, GlibString string) => Attr self [string] aboutDialogDocumenters = newAttr aboutDialogGetDocumenters aboutDialogSetDocumenters@@ -579,7 +590,7 @@ -- Each string may contain email addresses and URLs, which will be -- displayed as links, see the introduction for more details. ---aboutDialogArtists :: AboutDialogClass self => Attr self [String]+aboutDialogArtists :: (AboutDialogClass self, GlibString string) => Attr self [string] aboutDialogArtists = newAttr aboutDialogGetArtists aboutDialogSetArtists@@ -588,7 +599,7 @@ -- The string may contain email addresses and URLs, which will be displayed as -- links, see the introduction for more details. ---aboutDialogTranslatorCredits :: AboutDialogClass self => Attr self String+aboutDialogTranslatorCredits :: (AboutDialogClass self, GlibString string) => Attr self string aboutDialogTranslatorCredits = newAttrFromStringProperty "translator-credits" -- | A logo for the about box. If this is not set, it defaults to@@ -604,7 +615,7 @@ -- -- Default value: @Nothing@ ---aboutDialogLogoIconName :: AboutDialogClass self => ReadWriteAttr self String (Maybe String)+aboutDialogLogoIconName :: (AboutDialogClass self, GlibString string) => ReadWriteAttr self string (Maybe string) aboutDialogLogoIconName = newAttr aboutDialogGetLogoIconName aboutDialogSetLogoIconName
+ Graphics/UI/Gtk/Windows/Assistant.chs view
@@ -0,0 +1,603 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget Assistant+--+-- Author : Andy Stewart+--+-- Created: 22 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A widget used to guide users through multi-step operations+--+-- * Module available since Gtk+ version 2.10+--+module Graphics.UI.Gtk.Windows.Assistant (++-- * Detail+--+-- | A 'Assistant' is a widget used to represent a generally complex operation+-- split in several steps, guiding the user through its pages and+-- controlling the page flow to collect the necessary data.++-- ** GtkAssistant as GtkBuildable+--+-- | The 'Assistant' implementation of the 'Buildable' interface exposes the+-- @actionArea@ as internal children with the name \"action_area\".+--+-- To add pages to an assistant in 'Builder', simply add it as a \<child> to+-- the 'Assistant' object, and set its child properties as necessary.++-- * Class Hierarchy+--+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'Bin'+-- | +----'Window'+-- | +----Assistant+-- @++#if GTK_CHECK_VERSION(2,10,0)+-- * Types+ Assistant,+ AssistantClass,+ castToAssistant,+ toAssistant,++-- * Enums.+ AssistantPageType(..),++-- * Constructors+ assistantNew,++-- * Methods+ assistantGetNPages,+ assistantGetNthPage,+ assistantPrependPage,+ assistantAppendPage,+ assistantInsertPage,+ assistantSetForwardPageFunc,+ assistantAddActionWidget,+ assistantRemoveActionWidget,+ assistantUpdateButtonsState,+ assistantSetPageType,+ assistantGetPageType,+ assistantSetPageTitle,+ assistantGetPageTitle,+ assistantSetPageHeaderImage,+ assistantGetPageHeaderImage,+ assistantSetPageSideImage,+ assistantGetPageSideImage,+ assistantSetPageComplete,+ assistantGetPageComplete,+#if GTK_CHECK_VERSION(2,22,0)+ assistantCommit,+#endif++-- * Attributes+ assistantCurrentPage,++-- * Child Attributes+ assistantChildPageType,+ assistantChildTitle,+ assistantChildHeaderImage,+ assistantChildSidebarImage,+ assistantChildComplete,++-- * Signals+ assistantCancel,+ assistantPrepare,+ assistantApply,+ assistantClose,+#endif+ ) where++import Control.Monad (liftM)++import System.Glib.FFI+import System.Glib.UTFString+import System.Glib.Attributes+import System.Glib.Properties+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}+{#import Graphics.UI.Gtk.Signals#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,10,0)+--------------------+-- Enum+{#enum GtkAssistantPageType as AssistantPageType {underscoreToCase} deriving (Bounded,Eq,Show)#}++--------------------+-- Constructors++-- | Creates a new 'Assistant'.+--+-- * Available since Gtk+ version 2.10+--+assistantNew :: IO Assistant+assistantNew =+ makeNewObject mkAssistant $+ liftM (castPtr :: Ptr Widget -> Ptr Assistant) $+ {# call gtk_assistant_new #}++--------------------+-- Methods++-- | Returns the page number of the current page+--+-- * Available since Gtk+ version 2.10+--+assistantGetCurrentPage :: AssistantClass self => self+ -> IO Int -- ^ returns The index (starting from 0) of the current page in the+ -- @assistant@, if the @assistant@ has no pages, -1 will be returned+assistantGetCurrentPage self =+ liftM fromIntegral $+ {# call gtk_assistant_get_current_page #}+ (toAssistant self)++-- | Switches the page to @pageNum@. Note that this will only be necessary in custom buttons, as the+-- assistant flow can be set with 'assistantSetForwardPageFunc'.+--+-- * Available since Gtk+ version 2.10+--+assistantSetCurrentPage :: AssistantClass self => self+ -> Int -- ^ @pageNum@ - index of the page to switch to, starting from 0. If+ -- negative, the last page will be used. If greater than the number of+ -- pages in the @assistant@, nothing will be done.+ -> IO ()+assistantSetCurrentPage self pageNum =+ {# call gtk_assistant_set_current_page #}+ (toAssistant self)+ (fromIntegral pageNum)++-- | Returns the number of pages in the @assistant@+--+--+-- * Available since Gtk+ version 2.10+--+assistantGetNPages :: AssistantClass self => self+ -> IO Int -- ^ returns The number of pages in the @assistant@.+assistantGetNPages self =+ liftM fromIntegral $+ {# call gtk_assistant_get_n_pages #}+ (toAssistant self)++-- | Returns the child widget contained in page number @pageNum@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantGetNthPage :: AssistantClass self => self+ -> Int -- ^ @pageNum@ - The index of a page in the @assistant@, or -1+ -- to get the last page;+ -> IO (Maybe Widget) -- ^ returns The child widget, or 'Nothing' if @pageNum@ is out of bounds.+assistantGetNthPage self pageNum =+ maybeNull (makeNewObject mkWidget) $+ {# call gtk_assistant_get_nth_page #}+ (toAssistant self)+ (fromIntegral pageNum)++-- | Prepends a page to the @assistant@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantPrependPage :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a 'Widget'+ -> IO Int -- ^ returns the index (starting at 0) of the inserted page+assistantPrependPage self page =+ liftM fromIntegral $+ {# call gtk_assistant_prepend_page #}+ (toAssistant self)+ (toWidget page)++-- | Appends a page to the @assistant@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantAppendPage :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a 'Widget'+ -> IO Int -- ^ returns the index (starting at 0) of the inserted page+assistantAppendPage self page =+ liftM fromIntegral $+ {# call gtk_assistant_append_page #}+ (toAssistant self)+ (toWidget page)++-- | Inserts a page in the @assistant@ at a given position.+--+--+-- * Available since Gtk+ version 2.10+--+assistantInsertPage :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a 'Widget'+ -> Int -- ^ @position@ - the index (starting at 0) at which to insert the+ -- page, or -1 to append the page to the @assistant@+ -> IO Int -- ^ returns the index (starting from 0) of the inserted page+assistantInsertPage self page position =+ liftM fromIntegral $+ {# call gtk_assistant_insert_page #}+ (toAssistant self)+ (toWidget page)+ (fromIntegral position)++-- | Sets the page forwarding function to be @pageFunc@, this function will be+-- used to determine what will be the next page when the user presses the+-- forward button. Setting @pageFunc@ to 'Nothing' will make the assistant to use the+-- default forward function, which just goes to the next visible page.+--+--+-- * Available since Gtk+ version 2.10+--+assistantSetForwardPageFunc :: AssistantClass self => self+ -> Maybe (Int -> IO Int) -- ^ @pageFunc@ - the 'AssistantPage', or 'Nothing' to use the default one.+ -> IO ()+assistantSetForwardPageFunc self Nothing = do+ {# call gtk_assistant_set_forward_page_func #}+ (toAssistant self)+ nullFunPtr+ (castFunPtrToPtr nullFunPtr)+ destroyFunPtr++assistantSetForwardPageFunc self (Just pageFunc) = do+ pfPtr <- mkAssistantPageFunc $ \ c _ -> do+ result <- pageFunc (fromIntegral c)+ return $ fromIntegral result+ {# call gtk_assistant_set_forward_page_func #}+ (toAssistant self)+ pfPtr+ (castFunPtrToPtr pfPtr)+ destroyFunPtr++{#pointer AssistantPageFunc#}++foreign import ccall "wrapper" mkAssistantPageFunc ::+ ({#type gint#} -> Ptr () -> IO {#type gint#})+ -> IO AssistantPageFunc++-- | Sets the page type for @page@. The page type determines the page behavior+-- in the @assistant@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantSetPageType :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> AssistantPageType -- ^ @type@ - the new type for @page@+ -> IO ()+assistantSetPageType self page type_ =+ {# call gtk_assistant_set_page_type #}+ (toAssistant self)+ (toWidget page)+ ((fromIntegral . fromEnum) type_)++-- | Gets the page type of @page@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantGetPageType :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> IO AssistantPageType -- ^ returns the page type of @page@.+assistantGetPageType self page =+ liftM (toEnum . fromIntegral) $+ {# call gtk_assistant_get_page_type #}+ (toAssistant self)+ (toWidget page)++-- | Sets a title for @page@. The title is displayed in the header area of the+-- assistant when @page@ is the current page.+--+--+-- * Available since Gtk+ version 2.10+--+assistantSetPageTitle :: (AssistantClass self, WidgetClass page, GlibString string) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> string -- ^ @title@ - the new title for @page@+ -> IO ()+assistantSetPageTitle self page title =+ withUTFString title $ \titlePtr ->+ {# call gtk_assistant_set_page_title #}+ (toAssistant self)+ (toWidget page)+ titlePtr++-- | Gets the title for @page@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantGetPageTitle :: (AssistantClass self, WidgetClass page, GlibString string) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> IO string -- ^ returns the title for @page@.+assistantGetPageTitle self page =+ {# call gtk_assistant_get_page_title #}+ (toAssistant self)+ (toWidget page)+ >>= peekUTFString++-- | Sets a header image for @page@. This image is displayed in the header+-- area of the assistant when @page@ is the current page.+--+--+-- * Available since Gtk+ version 2.10+--+assistantSetPageHeaderImage :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> Pixbuf -- ^ @pixbuf@ - the new header image @page@+ -> IO ()+assistantSetPageHeaderImage self page pixbuf =+ {# call gtk_assistant_set_page_header_image #}+ (toAssistant self)+ (toWidget page)+ pixbuf++-- | Gets the header image for @page@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantGetPageHeaderImage :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> IO (Maybe Pixbuf) -- ^ returns the header image for @page@, or 'Nothing' if there's no header image for the page.+assistantGetPageHeaderImage self page =+ maybeNull (makeNewGObject mkPixbuf) $+ {# call gtk_assistant_get_page_header_image #}+ (toAssistant self)+ (toWidget page)++-- | Sets a header image for @page@. This image is displayed in the side area+-- of the assistant when @page@ is the current page.+--+--+-- * Available since Gtk+ version 2.10+--+assistantSetPageSideImage :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> Pixbuf -- ^ @pixbuf@ - the new header image @page@+ -> IO ()+assistantSetPageSideImage self page pixbuf =+ {# call gtk_assistant_set_page_side_image #}+ (toAssistant self)+ (toWidget page)+ pixbuf++-- | Gets the header image for @page@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantGetPageSideImage :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> IO (Maybe Pixbuf) -- ^ returns the side image for @page@, or 'Nothing' if there's no side image for the page.+assistantGetPageSideImage self page =+ maybeNull (makeNewGObject mkPixbuf) $+ {# call gtk_assistant_get_page_side_image #}+ (toAssistant self)+ (toWidget page)++-- | Sets whether @page@ contents are complete. This will make @assistant@+-- update the buttons state to be able to continue the task.+--+--+-- * Available since Gtk+ version 2.10+--+assistantSetPageComplete :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> Bool -- ^ @complete@ - the completeness status of the page+ -> IO ()+assistantSetPageComplete self page complete =+ {# call gtk_assistant_set_page_complete #}+ (toAssistant self)+ (toWidget page)+ (fromBool complete)++-- | Gets whether @page@ is complete.+--+--+-- * Available since Gtk+ version 2.10+--+assistantGetPageComplete :: (AssistantClass self, WidgetClass page) => self+ -> page -- ^ @page@ - a page of @assistant@+ -> IO Bool -- ^ returns @True@ if @page@ is complete.+assistantGetPageComplete self page =+ liftM toBool $+ {# call gtk_assistant_get_page_complete #}+ (toAssistant self)+ (toWidget page)++#if GTK_CHECK_VERSION(2,22,0)+-- | Erases the visited page history so the back button is not shown on the current page, and removes the+-- cancel button from subsequent pages.+--+-- Use this when the information provided up to the current page is hereafter deemed permanent and+-- cannot be modified or undone. For example, showing a progress page to track a long-running,+-- unreversible operation after the user has clicked apply on a confirmation page.+--+-- * Available since Gtk+ version 2.22+--+assistantCommit :: AssistantClass self => self -> IO ()+assistantCommit self =+ {#call gtk_assistant_commit#} (toAssistant self)+#endif++-- | Adds a widget to the action area of a 'Assistant'.+--+--+-- * Available since Gtk+ version 2.10+--+assistantAddActionWidget :: (AssistantClass self, WidgetClass child) => self+ -> child -- ^ @child@ - a 'Widget'+ -> IO ()+assistantAddActionWidget self child =+ {# call gtk_assistant_add_action_widget #}+ (toAssistant self)+ (toWidget child)++-- | Removes a widget from the action area of a 'Assistant'.+--+--+-- * Available since Gtk+ version 2.10+--+assistantRemoveActionWidget :: (AssistantClass self, WidgetClass child) => self+ -> child -- ^ @child@ - a 'Widget'+ -> IO ()+assistantRemoveActionWidget self child =+ {# call gtk_assistant_remove_action_widget #}+ (toAssistant self)+ (toWidget child)++-- | Forces @assistant@ to recompute the buttons state.+--+-- Gtk+ automatically takes care of this in most situations, e.g. when the+-- user goes to a different page, or when the visibility or completeness of a+-- page changes.+--+-- One situation where it can be necessary to call this function is when+-- changing a value on the current page affects the future page flow of the+-- assistant.+--+--+-- * Available since Gtk+ version 2.10+--+assistantUpdateButtonsState :: AssistantClass self => self -> IO ()+assistantUpdateButtonsState self =+ {# call gtk_assistant_update_buttons_state #}+ (toAssistant self)++--------------------+-- Attributes++-- | Switches the page to @pageNum@. Note that this will only be necessary in+-- custom buttons, as the @assistant@ flow can be set with+-- 'assistantSetForwardPageFunc'.+--+-- Returns the page number of the current page+--+--+-- * Available since Gtk+ version 2.10+--+assistantCurrentPage :: AssistantClass self => Attr self Int+assistantCurrentPage = newAttr+ assistantGetCurrentPage+ assistantSetCurrentPage++--------------------+-- Child Attributes++-- | The type of the assistant page.+--+-- Default value: 'AssistantPageContent'+--+--+-- * Available since Gtk+ version 2.10+--+assistantChildPageType :: AssistantClass self => Attr self AssistantPageType+assistantChildPageType =+ newAttrFromEnumProperty "page-type" {#call pure unsafe assistant_page_type_get_type#}++-- | The title that is displayed in the page header.+--+-- If title and header-image are both, no header is displayed.+--+--+-- * Available since Gtk+ version 2.10+--+assistantChildTitle :: (AssistantClass self, GlibString string) => Attr self string+assistantChildTitle = newAttrFromStringProperty "title"++-- | The image that is displayed next to the page.+--+--+-- * Available since Gtk+ version 2.10+--+assistantChildHeaderImage :: AssistantClass self => Attr self Pixbuf+assistantChildHeaderImage = newAttrFromObjectProperty "header-image"+ {# call pure unsafe gdk_pixbuf_get_type #}++-- | Sidebar image for the assistant page.+--+--+-- * Available since Gtk+ version 2.10+--+assistantChildSidebarImage :: AssistantClass self => Attr self Pixbuf+assistantChildSidebarImage = newAttrFromObjectProperty "sidebar-image"+ {# call pure unsafe gdk_pixbuf_get_type #}++-- | Setting the \"complete\" child property to @True@ marks a page as+-- complete (i.e.: all the required fields are filled out). Gtk+ uses this+-- information to control the sensitivity of the navigation buttons.+--+-- Default value: @False@+--+--+-- * Available since Gtk+ version 2.10+--+assistantChildComplete :: AssistantClass self => Attr self Bool+assistantChildComplete = newAttrFromBoolProperty "complete"++--------------------+-- Signals++-- | The ::assistantCancel signal is emitted when then the assistantCancel button is clicked.+--+--+-- * Available since Gtk+ version 2.10+--+assistantCancel :: AssistantClass self => Signal self (IO ())+assistantCancel = Signal (connect_NONE__NONE "cancel")++-- | The ::assistantPrepare signal is emitted when a new page is set as the assistant's+-- current page, before making the new page visible. A handler for this signal+-- can do any preparation which are necessary before showing @page@.+--+--+-- * Available since Gtk+ version 2.10+--+assistantPrepare :: AssistantClass self => Signal self (Widget -> IO ())+assistantPrepare = Signal (connect_OBJECT__NONE "prepare")++-- | The ::assistantApply signal is emitted when the assistantApply button is clicked. The+-- default behavior of the 'Assistant' is to switch to the page after the+-- current page, unless the current page is the last one.+--+-- A handler for the ::assistantApply signal should carry out the actions for which+-- the wizard has collected data. If the action takes a long time to complete,+-- you might consider to put a page of type 'AssistantPageProgress' after the+-- confirmation page and handle this operation within the 'assistantPrepare' signal of the progress page.+--+--+-- * Available since Gtk+ version 2.10+--+assistantApply :: AssistantClass self => Signal self (IO ())+assistantApply = Signal (connect_NONE__NONE "apply")++-- | The ::assistantClose signal is emitted either when the assistantClose button of a summary+-- page is clicked, or when the apply button in the last page in the flow (of+-- type 'AssistantPageConfirm') is clicked.+--+assistantClose :: AssistantClass self => Signal self (IO ())+assistantClose = Signal (connect_NONE__NONE "close")+#endif
Graphics/UI/Gtk/Windows/Dialog.chs view
@@ -7,7 +7,7 @@ -- Created: 23 May 2001 -- -- Copyright (C) 1999-2005 Axel Simon--- Copyright (C) 2009 Andy Stewart+-- Copyright (C) 2009-2010 Andy Stewart -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public@@ -25,13 +25,13 @@ -- Portability : portable (depends on GHC) -- -- Create popup windows--- --- NOTE: +--+-- NOTE: -- Now FFI haven't support variadic function `gtk_dialog_set_alternative_button_order` -- module Graphics.UI.Gtk.Windows.Dialog ( -- * Detail--- +-- -- | Dialog boxes are a convenient way to prompt the user for a small amount -- of input, e.g. to display a message, ask a question, or anything else that -- does not require extensive effort on the user's part.@@ -56,7 +56,7 @@ -- pass the 'DialogModal' flag to make a dialog modal. -- -- If you add buttons to 'Dialog' using 'dialogNewWithButtons',--- 'dialogAddButton', 'dialogAddButtons', or 'dialogAddActionWidget', clicking+-- 'dialogAddButton', or 'dialogAddActionWidget', clicking -- the button will emit a signal called \"response\" with a response ID that -- you specified. Gtk+ will never assign a meaning to positive response IDs; -- these are entirely user-defined. But for convenience, you can use the@@ -69,7 +69,7 @@ -- recursive main loop and waits for the user to respond to the dialog, -- returning the response ID corresponding to the button the user clicked. ----- For a simple message box, you probably want to use +-- For a simple message box, you probably want to use -- 'Graphics.UI.Gtk.Windows.MessageDialog.MessageDialog' which provides -- convenience functions -- for creating standard dialogs containing simple messages to inform@@ -100,27 +100,39 @@ castToDialog, gTypeDialog, toDialog, +-- * Enums+ ResponseId(..),+ -- * Constructors dialogNew, -- * Methods+#if GTK_MAJOR_VERSION < 3 dialogGetUpper,+#endif+ dialogGetContentArea, dialogGetActionArea, dialogRun, dialogResponse,- ResponseId(..), dialogAddButton, dialogAddActionWidget,- dialogGetHasSeparator, dialogSetDefaultResponse,+#if GTK_MAJOR_VERSION < 3+ dialogGetHasSeparator, dialogSetHasSeparator,+#endif dialogSetResponseSensitive, dialogGetResponseForWidget, dialogAlternativeDialogButtonOrder, dialogSetAlternativeButtonOrderFromArray,+#if GTK_CHECK_VERSION(2,20,0)+ dialogGetWidgetForResponse,+#endif -- * Attributes+#if GTK_MAJOR_VERSION < 3 dialogHasSeparator,+#endif dialogActionAreaBorder, dialogButtonSpacing, dialogContentAreaBorder,@@ -136,17 +148,20 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#}-import Graphics.UI.Gtk.General.Structs (dialogGetUpper, dialogGetActionArea,- ResponseId(..), fromResponse, toResponse)+import Graphics.UI.Gtk.General.Structs (+#if GTK_MAJOR_VERSION < 3+ dialogGetUpper, dialogGetActionArea,+#endif+ ResponseId(..), fromResponse, toResponse) {# context lib="gtk" prefix="gtk" #} @@ -220,8 +235,8 @@ -- the end of the dialog's action area. The button widget is returned, but -- usually you don't need it. ---dialogAddButton :: DialogClass self => self- -> String -- ^ @buttonText@ - text of button, or stock ID+dialogAddButton :: (DialogClass self, GlibString string) => self+ -> string -- ^ @buttonText@ - text of button, or stock ID -> ResponseId -- ^ @responseId@ - response ID for the button -> IO Button -- ^ returns the button widget that was added dialogAddButton self buttonText responseId =@@ -248,14 +263,27 @@ (toWidget child) (fromResponse responseId) +#if GTK_MAJOR_VERSION < 3 -- | Query if the dialog has a visible horizontal separator. --+-- Removed in Gtk3. dialogGetHasSeparator :: DialogClass self => self -> IO Bool dialogGetHasSeparator self = liftM toBool $ {# call unsafe dialog_get_has_separator #} (toDialog self) +-- | Sets whether the dialog has a separator above the buttons. @True@ by+-- default.+--+-- Removed in Gtk3.+dialogSetHasSeparator :: DialogClass self => self -> Bool -> IO ()+dialogSetHasSeparator self setting =+ {# call dialog_set_has_separator #}+ (toDialog self)+ (fromBool setting)+#endif+ -- | Sets the last widget in the dialog's action area with the given -- 'ResponseId' as the default widget for the dialog. Pressing \"Enter\" -- normally activates the default widget.@@ -272,15 +300,6 @@ (toDialog self) (fromResponse responseId) --- | Sets whether the dialog has a separator above the buttons. @True@ by--- default.----dialogSetHasSeparator :: DialogClass self => self -> Bool -> IO ()-dialogSetHasSeparator self setting =- {# call dialog_set_has_separator #}- (toDialog self)- (fromBool setting)- -- | Calls @'widgetSetSensitive' widget setting@ for each widget in the -- dialog's action area with the given @responseId@. A convenient way to -- sensitize\/desensitize dialog buttons.@@ -297,30 +316,30 @@ -- | Gets the response id of a widget in the action area of a dialog. dialogGetResponseForWidget :: (DialogClass self, WidgetClass widget) => self- -> widget -- ^ @widget@ - a widget in the action area of dialog - -> IO ResponseId -- ^ return the response id of widget, or 'ResponseNone' if widget doesn't have a response id set. + -> widget -- ^ @widget@ - a widget in the action area of dialog+ -> IO ResponseId -- ^ return the response id of widget, or 'ResponseNone' if widget doesn't have a response id set. dialogGetResponseForWidget self widget = liftM toResponse $ {# call dialog_get_response_for_widget #} (toDialog self) (toWidget widget) --- | Returns @True@ if dialogs are expected to use an alternative button order on the screen screen. +-- | Returns @True@ if dialogs are expected to use an alternative button order on the screen screen. -- See 'dialogSetAlternativeButtonOrder' for more details about alternative button order. -- -- If you need to use this function, you should probably connect to the 'alternativeButtonOrder' signal on the GtkSettings object associated to screen, in order to be notified if the button order setting changes. -- -- * Available since Gtk+ version 2.6 ---dialogAlternativeDialogButtonOrder :: - Maybe Screen -- ^ @screen@ - a 'Screen', or @Nothing@ to use the default screen - -> IO Bool -- ^ returns whether the alternative button order should be used +dialogAlternativeDialogButtonOrder ::+ Maybe Screen -- ^ @screen@ - a 'Screen', or @Nothing@ to use the default screen+ -> IO Bool -- ^ returns whether the alternative button order should be used dialogAlternativeDialogButtonOrder (Just screen) = liftM toBool $ {# call alternative_dialog_button_order #} screen dialogAlternativeDialogButtonOrder Nothing = liftM toBool $ {# call alternative_dialog_button_order #} (Screen nullForeignPtr) -- | Sets an alternative button order.--- +-- -- If the 'alternativeButtonOrder' setting is set to @True@, the dialog -- buttons are reordered according to the order of the response ids in -- @newOrder@.@@ -332,26 +351,62 @@ -- * Available since Gtk+ version 2.6 -- dialogSetAlternativeButtonOrderFromArray :: DialogClass self => self- -> [ResponseId] -- ^ @newOrder@ - an array of response ids of dialog's buttons + -> [ResponseId] -- ^ @newOrder@ - an array of response ids of dialog's buttons -> IO ()-dialogSetAlternativeButtonOrderFromArray self newOrder = +dialogSetAlternativeButtonOrderFromArray self newOrder = withArray (map fromResponse newOrder) $ \newOrderPtr -> {# call dialog_set_alternative_button_order_from_array #} (toDialog self) (fromIntegral (length newOrder)) newOrderPtr +#if GTK_CHECK_VERSION(2,20,0)+-- | Gets the widget button that uses the given response ID in the action area of a dialog.+dialogGetWidgetForResponse :: DialogClass self => self+ -> ResponseId -- ^ @responseId@ the response ID used by the dialog widget+ -> IO (Maybe Widget) -- ^ returns the widget button that uses the given @responseId@, or 'Nothing'.+dialogGetWidgetForResponse self responseId =+ maybeNull (makeNewObject mkWidget) $+ {#call gtk_dialog_get_widget_for_response #}+ (toDialog self)+ (fromResponse responseId)+#endif++#if GTK_MAJOR_VERSION >= 3+-- | Returns the content area of dialog.+dialogGetContentArea :: DialogClass self => self -> IO Widget+dialogGetContentArea self =+ makeNewObject mkWidget $+ {#call gtk_dialog_get_content_area #}+ (toDialog self)++-- | Returns the action area of dialog.+--+-- * This is useful to add some special widgets that cannot be added with+-- dialogAddActionWidget.+--+dialogGetActionArea :: DialogClass self => self -> IO Widget+dialogGetActionArea self =+ makeNewObject mkWidget $+ {#call gtk_dialog_get_content_area #}+ (toDialog self)+#else+dialogGetContentArea self = liftM toWidget $ dialogGetUpper self+#endif+ -------------------- -- Attributes-+#if GTK_MAJOR_VERSION < 3 -- | The dialog has a separator bar above its buttons. -- -- Default value: @True@ --+-- Removed in Gtk3. dialogHasSeparator :: DialogClass self => Attr self Bool dialogHasSeparator = newAttr dialogGetHasSeparator dialogSetHasSeparator+#endif -- | Width of border around the button area at the bottom of the dialog. --@@ -380,7 +435,7 @@ dialogContentAreaBorder :: DialogClass self => ReadAttr self Int dialogContentAreaBorder = readAttrFromIntProperty "content-area-border" --- | The default spacing used between elements of the content area of the dialog, +-- | The default spacing used between elements of the content area of the dialog, -- as returned by 'dialogSetContentArea', unless 'boxSetSpacing' was called on that widget directly. -- -- Allowed values: >= 0@@ -417,3 +472,4 @@ onResponse dia act = connect_INT__NONE "response" False dia (act . toResponse) afterResponse dia act = connect_INT__NONE "response" True dia (act . toResponse) #endif+
Graphics/UI/Gtk/Windows/Invisible.chs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Window --@@ -23,7 +22,7 @@ -- Stability : provisional -- Portability : portable (depends on GHC) ----- A widget which is not displayed +-- A widget which is not displayed -- The 'Invisible' widget is used internally in GTK+, and is probably not very useful for application developers. -- It is used for reliable pointer grabs and selection handling in the code for drag-and-drop. --@@ -42,7 +41,7 @@ Invisible, -- * Constructors- invisibleNew, + invisibleNew, invisibleNewForScreen, -- * Methods@@ -50,19 +49,12 @@ invisibleGetScreen, ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.UTFString-import System.Glib.GError-import System.Glib.Attributes-import System.Glib.Properties-import System.Glib.GObject (makeNewGObject)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import Graphics.UI.Gtk.General.Enums+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) import Graphics.UI.Gtk.Gdk.Screen {#import Graphics.UI.Gtk.Types#}-{#import Graphics.UI.Gtk.Gdk.Enums#} (Modifier(..)) {# context lib="gtk" prefix="gtk" #} @@ -80,31 +72,31 @@ -- -- * Available since Gdk version 2.2 ---invisibleNewForScreen :: - Screen -- ^ @screen@ - a 'Screen' which identifies on which the new 'Invisible' will be created. +invisibleNewForScreen ::+ Screen -- ^ @screen@ - a 'Screen' which identifies on which the new 'Invisible' will be created. -> IO Invisible invisibleNewForScreen screen = makeNewObject mkInvisible $ liftM (castPtr :: Ptr Widget -> Ptr Invisible) $ {# call invisible_new_for_screen #} screen- + -- | Sets the 'Screen' where the 'Invisible' object will be displayed. -- -- * Available since Gdk version 2.2 ---invisibleSetScreen :: Invisible +invisibleSetScreen :: Invisible -> Screen -- ^ @screen@ - the 'Screen' to set -> IO () invisibleSetScreen invisible screen = {# call invisible_set_screen #} invisible screen- --- | Returns the 'Screen' object associated with invisible ++-- | Returns the 'Screen' object associated with invisible -- -- * Available since Gdk version 2.2 -- invisibleGetScreen :: Invisible -> IO Screen-invisibleGetScreen invisible = +invisibleGetScreen invisible = makeNewGObject mkScreen $ {# call invisible_get_screen #} invisible
Graphics/UI/Gtk/Windows/MessageDialog.chs view
@@ -1,4 +1,4 @@-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget MessageDialog --@@ -28,7 +28,7 @@ -- module Graphics.UI.Gtk.Windows.MessageDialog ( -- * Detail--- +-- -- | 'MessageDialog' presents a dialog with an image representing the type of -- message (Error, Question, etc.) alongside some message text. It's simply a -- convenience widget; you could construct the equivalent of 'MessageDialog'@@ -60,13 +60,13 @@ MessageType(..), ButtonsType(..), DialogFlags(..),- + -- * Constructors messageDialogNew, #if GTK_CHECK_VERSION(2,4,0) messageDialogNewWithMarkup, #endif- + -- * Methods #if GTK_CHECK_VERSION(2,4,0) messageDialogSetMarkup,@@ -89,18 +89,20 @@ messageDialogImage, #endif messageDialogButtons,+#if GTK_CHECK_VERSION(2,22,0)+ messageDialogMessageArea,+#endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI {#import Graphics.UI.Gtk.Types#} import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties-import System.Glib.Flags (Flags, fromFlags)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import Graphics.Rendering.Pango.Markup (Markup)+import System.Glib.Flags (Flags, fromFlags)+import Graphics.UI.Gtk.Abstract.Object (makeNewObject) {# context lib="gtk" prefix="gtk" #} @@ -120,7 +122,7 @@ -- | Specify what buttons this dialog should show. -- -- * Prebuilt sets of buttons for the dialog. If none of these choices--- are appropriate, simply use 'ButtonsNone' then call 'dialogAddButtons'.+-- are appropriate, simply use 'ButtonsNone' then call 'dialogAddButton'. -- {#enum ButtonsType {underscoreToCase} deriving(Show,Eq)#} @@ -141,29 +143,30 @@ -------------------- -- Constructors --- | Create a new message dialog, which is a simple dialog with an icon --- indicating the dialog type (error, warning, etc.) and some text the +-- | Create a new message dialog, which is a simple dialog with an icon+-- indicating the dialog type (error, warning, etc.) and some text the -- user may want to see. When the user clicks a button a \"response\" signal -- is emitted with response IDs from 'ResponseType'. See 'Dialog' for more -- details.--- +-- messageDialogNew- :: Maybe Window -- ^ Transient parent of the dialog (or none)+ :: GlibString string+ => Maybe Window -- ^ Transient parent of the dialog (or none) -> [DialogFlags] -> MessageType -> ButtonsType- -> String -- ^ The text of the message+ -> string -- ^ The text of the message -> IO MessageDialog messageDialogNew mWindow flags mType bType msg = withUTFString (unPrintf msg) $ \msgPtr -> makeNewObject mkMessageDialog $ liftM (castPtr :: Ptr Widget -> Ptr MessageDialog) $ call_message_dialog_new mWindow flags mType bType msgPtr- - + + call_message_dialog_new :: Maybe Window -> [DialogFlags] ->- MessageType -> ButtonsType -> Ptr CChar ->- IO (Ptr Widget)+ MessageType -> ButtonsType -> Ptr CChar ->+ IO (Ptr Widget) call_message_dialog_new (Just (Window fPtr)) flags mType bType msgPtr = withForeignPtr fPtr $ \ptr -> message_dialog_new ptr (fromIntegral (fromFlags flags))@@ -176,7 +179,7 @@ foreign import ccall unsafe "gtk_message_dialog_new" message_dialog_new :: Ptr Window -> CInt -> CInt -> CInt ->- Ptr CChar -> IO (Ptr Widget)+ Ptr CChar -> IO (Ptr Widget) #if GTK_CHECK_VERSION(2,4,0) -- | Creates a new message dialog, which is a simple dialog with an icon@@ -188,11 +191,12 @@ -- * Available since Gtk+ version 2.4 -- messageDialogNewWithMarkup- :: Maybe Window -- ^ Transient parent of the dialog (or none)+ :: GlibString string+ => Maybe Window -- ^ Transient parent of the dialog (or none) -> [DialogFlags] -> MessageType -> ButtonsType- -> Markup -- ^ The text of the message+ -> string -- ^ The text of the message -> IO MessageDialog messageDialogNewWithMarkup mWindow flags mType bType msg = do md <- makeNewObject mkMessageDialog $@@ -201,7 +205,7 @@ messageDialogSetMarkup md msg return md #endif- + -------------------- -- Methods @@ -211,8 +215,8 @@ -- -- * Available since Gtk+ version 2.4 ---messageDialogSetMarkup :: MessageDialogClass self => self- -> Markup -- ^ @str@ - markup string (see Pango markup format)+messageDialogSetMarkup :: (MessageDialogClass self, GlibString string) => self+ -> string -- ^ @str@ - markup string (see Pango markup format) -> IO () messageDialogSetMarkup self str = withUTFString (unPrintf str) $ \strPtr ->@@ -222,8 +226,8 @@ #endif #if GTK_CHECK_VERSION(2,6,0)-messageDialogSetSecondaryMarkup :: MessageDialogClass self => self- -> String -- ^ @str@ - markup string (see Pango markup format)+messageDialogSetSecondaryMarkup :: (MessageDialogClass self, GlibString string) => self+ -> string -- ^ @str@ - markup string (see Pango markup format) -> IO () messageDialogSetSecondaryMarkup self str = withUTFString (unPrintf str) $ \strPtr ->@@ -232,11 +236,11 @@ message_dialog_format_secondary_markup ptr strPtr foreign import ccall unsafe "gtk_message_dialog_format_secondary_markup"- message_dialog_format_secondary_markup :: Ptr MessageDialog -> - Ptr CChar -> IO ()- -messageDialogSetSecondaryText :: MessageDialogClass self => self- -> String -- ^ @str@ - text to be shown as second line+ message_dialog_format_secondary_markup :: Ptr MessageDialog ->+ Ptr CChar -> IO ()+ +messageDialogSetSecondaryText :: (MessageDialogClass self, GlibString string) => self+ -> string -- ^ @str@ - text to be shown as second line -> IO () messageDialogSetSecondaryText self str = withUTFString str $ \strPtr ->@@ -245,8 +249,8 @@ message_dialog_format_secondary_text ptr strPtr foreign import ccall unsafe "gtk_message_dialog_format_secondary_text"- message_dialog_format_secondary_text :: Ptr MessageDialog -> - Ptr CChar -> IO ()+ message_dialog_format_secondary_text :: Ptr MessageDialog ->+ Ptr CChar -> IO () #if GTK_CHECK_VERSION(2,10,0) -- %hash c:6cb7 d:ebdd@@ -285,7 +289,7 @@ -- -- * Available since Gtk+ version 2.10 ---messageDialogText :: MessageDialogClass self => Attr self (Maybe String)+messageDialogText :: (MessageDialogClass self, GlibString string) => Attr self (Maybe string) messageDialogText = newAttrFromMaybeStringProperty "text" -- %hash c:e1dd d:ca3@@ -305,7 +309,7 @@ -- -- * Available since Gtk+ version 2.10 ---messageDialogSecondaryText :: MessageDialogClass self => Attr self (Maybe String)+messageDialogSecondaryText :: (MessageDialogClass self, GlibString string) => Attr self (Maybe string) messageDialogSecondaryText = newAttrFromMaybeStringProperty "secondary-text" -- %hash c:1ce2 d:ca3@@ -334,11 +338,13 @@ messageDialogButtons = writeAttrFromEnumProperty "buttons" {#call pure unsafe gtk_buttons_type_get_type #} ------------------------ helpers+#if GTK_CHECK_VERSION(2,22,0)+-- | The 'VBox' that corresponds to the message area of this dialog.+--+-- * Available since Gtk+ version 2.22+--+messageDialogMessageArea :: MessageDialogClass self => ReadAttr self VBox+messageDialogMessageArea = readAttrFromObjectProperty "message-area"+ {# call pure unsafe gtk_vbox_get_type #}+#endif --- Escape percent signs-unPrintf :: String -> String-unPrintf [] = []-unPrintf ('%':xs) = '%':'%':unPrintf xs-unPrintf (x:xs) = x:unPrintf xs
+ Graphics/UI/Gtk/Windows/OffscreenWindow.chs view
@@ -0,0 +1,125 @@+{-# LANGUAGE CPP #-}+-- -*-haskell-*-+-- GIMP Toolkit (GTK) Widget OffscreenWindow+--+-- Author : Andy Stewart+--+-- Created: 25 Mar 2010+--+-- Copyright (C) 2010 Andy Stewart+--+-- This library is free software; you can redistribute it and/or+-- modify it under the terms of the GNU Lesser General Public+-- License as published by the Free Software Foundation; either+-- version 2.1 of the License, or (at your option) any later version.+--+-- This library is distributed in the hope that it will be useful,+-- but WITHOUT ANY WARRANTY; without even the implied warranty of+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+-- Lesser General Public License for more details.+--+-- |+-- Maintainer : gtk2hs-users@lists.sourceforge.net+-- Stability : provisional+-- Portability : portable (depends on GHC)+--+-- A toplevel container widget used to manage offscreen rendering of child widgets.+--+-- * Module available since Gtk+ version 2.20+--+module Graphics.UI.Gtk.Windows.OffscreenWindow (+-- * Detail+-- | 'OffscreenWindow' is strictly intended to be used for obtaining snapshots of widgets that are not+-- part of a normal widget hierarchy. It differs from 'widgetGetSnapshot' in that the widget you+-- want to get a snapshot of need not be displayed on the user's screen as a part of a widget+-- hierarchy. However, since 'OffscreenWindow' is a toplevel widget you cannot obtain snapshots of a+-- full window with it since you cannot pack a toplevel widget in another toplevel.+--+-- The idea is to take a widget and manually set the state of it, add it to a 'OffscreenWindow' and+-- then retrieve the snapshot as a 'Pixmap' or 'Pixbuf'.+--+-- 'OffscreenWindow' derives from 'Window' only as an implementation detail. Applications should not+-- use any API specific to 'Window' to operate on this object. It should be treated as a 'Bin' that+-- has no parent widget.+--+-- When contained offscreen widgets are redrawn, 'OffscreenWindow' will emit a 'damageEvent' signal.++-- * Class Hierarchy+-- |+-- @+-- | 'GObject'+-- | +----'Object'+-- | +----'Widget'+-- | +----'Container'+-- | +----'Bin'+-- | +----Window+-- | +----'OffscreenWindow'+-- @++#if GTK_CHECK_VERSION(2,20,0)+-- * Types+ OffscreenWindow,+ OffscreenWindowClass,+ castToOffscreenWindow, gTypeOffscreenWindow,+ toOffscreenWindow,++-- * Constructors+ offscreenWindowNew,++-- * Methods+#if GTK_MAJOR_VERSION < 3+ offscreenWindowGetPixmap,+#endif+ offscreenWindowGetPixbuf,+#endif+) where++import Control.Monad (liftM)++import System.Glib.FFI+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+{#import Graphics.UI.Gtk.Types#}++{# context lib="gtk" prefix="gtk" #}++#if GTK_CHECK_VERSION(2,20,0)+-- | Creates a toplevel container widget that is used to retrieve snapshots of widgets without showing+-- them on the screen. For widgets that are on the screen and part of a normal widget hierarchy,+-- 'widgetGetSnapshot' can be used instead.+--+-- * Available since Gtk+ version 2.20+--+offscreenWindowNew :: IO OffscreenWindow+offscreenWindowNew =+ makeNewObject mkOffscreenWindow $+ liftM (castPtr :: Ptr Widget -> Ptr OffscreenWindow) $+ {#call gtk_offscreen_window_new #}++#if GTK_MAJOR_VERSION < 3+-- | Retrieves a snapshot of the contained widget in the form of a 'Pixmap'. If you need to keep this+-- around over window resizes then you should add a reference to it.+--+-- * Available since Gtk+ version 2.20+--+offscreenWindowGetPixmap :: OffscreenWindowClass self+ => self -- ^ @offscreen@ the 'OffscreenWindow' contained widget.+ -> IO (Maybe Pixmap) -- ^ returns A 'Pixmap' pointer to the offscreen pixmap, or 'Nothing'.+offscreenWindowGetPixmap offscreen =+ maybeNull (makeNewGObject mkPixmap) $+ {#call gtk_offscreen_window_get_pixmap #}+ (toOffscreenWindow offscreen)+#endif++-- | Retrieves a snapshot of the contained widget in the form of a 'Pixbuf'.+--+-- * Available since Gtk+ version 2.20+--+offscreenWindowGetPixbuf :: OffscreenWindowClass self+ => self -- ^ @offscreen@ the 'OffscreenWindow' contained widget.+ -> IO (Maybe Pixbuf) -- ^ returns A 'Pixbuf' pointer to the offscreen pixbuf, or 'Nothing'.+offscreenWindowGetPixbuf offscreen =+ maybeNull (wrapNewGObject mkPixbuf) $+ {#call gtk_offscreen_window_get_pixbuf #}+ (toOffscreenWindow offscreen)++#endif
Graphics/UI/Gtk/Windows/Window.chs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Window --@@ -92,9 +93,11 @@ #if GTK_CHECK_VERSION(2,12,0) windowSetStartupId, #endif+#if GTK_MAJOR_VERSION < 3 windowGetFrame, windowSetFrameDimensions, windowGetFrameDimensions,+#endif windowStick, windowUnstick, windowAddAccelGroup,@@ -139,6 +142,9 @@ #if GTK_CHECK_VERSION(2,10,0) windowGetGroup, #endif+#if GTK_CHECK_VERSION(2,20,0)+ windowGetWindowType,+#endif -- * Attributes windowTitle,@@ -146,6 +152,9 @@ windowAllowShrink, windowAllowGrow, windowResizable,+#if GTK_MAJOR_VERSION >= 3+ windowHasResizeGrip,+#endif windowModal, #if GTK_CHECK_VERSION(2,12,0) windowOpacity,@@ -185,9 +194,14 @@ windowToplevelFocus, windowTransientFor, windowFocus,+#if GTK_MAJOR_VERSION < 3 windowHasFrame,+#endif windowIconList, windowMnemonicModifier,+#if GTK_CHECK_VERSION(2,20,0)+ windowMnemonicVisible,+#endif -- * Signals frameEvent,@@ -200,9 +214,15 @@ windowGetTitle, windowSetResizable, windowGetResizable,+#if GTK_MAJOR_VERSION >= 3+ windowSetHasResizeGrip,+ windowGetHasResizeGrip,+#endif windowSetModal, windowGetModal,+#if GTK_MAJOR_VERSION < 3 windowSetPolicy,+#endif windowSetTransientFor, windowGetTransientFor, windowSetDestroyWithParent,@@ -231,8 +251,10 @@ windowSetDeletable, windowGetDeletable, #endif+#if GTK_MAJOR_VERSION < 3 windowSetHasFrame, windowGetHasFrame,+#endif windowSetRole, windowGetRole, windowSetIcon,@@ -255,7 +277,7 @@ #endif ) where -import Control.Monad (liftM)+import Control.Monad (liftM) import System.Glib.FFI import System.Glib.UTFString@@ -264,19 +286,20 @@ import System.Glib.Attributes import System.Glib.Properties import System.Glib.GList (fromGList, withGList)-import System.Glib.GObject (makeNewGObject)-import Graphics.UI.Gtk.Abstract.Object (makeNewObject)-import Graphics.UI.Gtk.General.Enums (WindowType(..), WindowPosition(..))+import Graphics.UI.Gtk.Abstract.Object (makeNewObject)+import Graphics.UI.Gtk.General.Enums (WindowType(..), WindowPosition(..))+#if GTK_MAJOR_VERSION < 3 import Graphics.UI.Gtk.General.Structs (windowGetFrame)+#endif {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.Signals#} {#import Graphics.UI.Gtk.Gdk.Enums#} (Modifier(..)) {#import Graphics.UI.Gtk.Gdk.Keys#} (KeyVal)-import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny, EKey, MouseButton, TimeStamp)+import Graphics.UI.Gtk.Gdk.EventM (EventM, EAny, EKey, MouseButton, TimeStamp) import Control.Monad.Reader ( runReaderT, ask ) import Control.Monad.Trans ( liftIO )-import Graphics.UI.Gtk.Gdk.Enums (WindowEdge(..), WindowTypeHint(..),- Gravity(..))+import Graphics.UI.Gtk.Gdk.Enums (WindowEdge(..), WindowTypeHint(..),+ Gravity(..)) {# context lib="gtk" prefix="gtk" #} @@ -311,7 +334,7 @@ -- this window from other windows they may have open. A good title might -- include the application name and current document filename, for example. ---windowSetTitle :: WindowClass self => self -> String -> IO ()+windowSetTitle :: (WindowClass self, GlibString string) => self -> string -> IO () windowSetTitle self title = withUTFString title $ \titlePtr -> {# call gtk_window_set_title #}@@ -320,7 +343,7 @@ -- | Retrieves the title of the window. See 'windowSetTitle'. ---windowGetTitle :: WindowClass self => self -> IO String+windowGetTitle :: (WindowClass self, GlibString string) => self -> IO string windowGetTitle self = {# call gtk_window_get_title #} (toWindow self)@@ -346,6 +369,24 @@ {# call unsafe window_get_resizable #} (toWindow self) +#if GTK_MAJOR_VERSION >= 3+-- | Sets whether the window has a resize grip. @True@ by default.+--+windowSetHasResizeGrip :: WindowClass self => self -> Bool -> IO ()+windowSetHasResizeGrip self setting =+ {# call window_set_has_resize_grip #}+ (toWindow self)+ (fromBool setting)++-- | Returns whether the window has a resize grip.+--+windowGetHasResizeGrip :: WindowClass self => self -> IO Bool+windowGetHasResizeGrip self =+ liftM toBool $+ {# call unsafe window_get_has_resize_grip #}+ (toWindow self)+#endif+ -- | Activates the current focused widget within the window. -- windowActivateFocus :: WindowClass self => self@@ -367,6 +408,7 @@ {# call window_activate_default #} (toWindow self) +#if GTK_MAJOR_VERSION < 3 #ifndef DISABLE_DEPRECATED {-# DEPRECATED windowSetPolicy "Use windowSetResizable instead." #-} -- | Sets the window resizing policy.@@ -374,6 +416,7 @@ -- * Warning: this function is deprecated and should not be used in -- newly-written code. Use 'windowSetResizable' instead. --+-- Removed in Gtk3. windowSetPolicy :: WindowClass self => self -> Bool -> Bool -> Bool -> IO () windowSetPolicy self allowShrink allowGrow autoShrink = {# call window_set_policy #}@@ -382,6 +425,7 @@ (fromBool allowGrow) (fromBool autoShrink) #endif+#endif -- | Sets a window modal or non-modal. Modal windows prevent interaction with -- other windows in the same application. To keep modal dialogs on top of main@@ -449,7 +493,7 @@ -- windowAddMnemonic :: (WindowClass self, WidgetClass widget) => self -> KeyVal -- ^ @keyval@ - the mnemonic- -> widget -- ^ @target@ - the widget that gets activated by the mnemonic + -> widget -- ^ @target@ - the widget that gets activated by the mnemonic -> IO () windowAddMnemonic self keyval target = {# call window_add_mnemonic #}@@ -460,21 +504,21 @@ -- | Removes a mnemonic from this window. -- windowRemoveMnemonic :: (WindowClass self, WidgetClass widget) => self- -> KeyVal -- ^ @keyval@ - the mnemonic - -> widget -- ^ @target@ - the widget that gets activated by the mnemonic + -> KeyVal -- ^ @keyval@ - the mnemonic+ -> widget -- ^ @target@ - the widget that gets activated by the mnemonic -> IO () windowRemoveMnemonic self keyval target =- {# call window_remove_mnemonic #} + {# call window_remove_mnemonic #} (toWindow self) (fromIntegral keyval) (toWidget target) -- | Activates the targets associated with the mnemonic. windowMnemonicActivate :: WindowClass self => self- -> KeyVal -- ^ @keyval@ - the mnemonic - -> [Modifier] -- ^ @modifier@ - the modifiers - -> IO Bool -- ^ return @True@ if the activation is done. -windowMnemonicActivate self keyval modifier = liftM toBool $ + -> KeyVal -- ^ @keyval@ - the mnemonic+ -> [Modifier] -- ^ @modifier@ - the modifiers+ -> IO Bool -- ^ return @True@ if the activation is done.+windowMnemonicActivate self keyval modifier = liftM toBool $ {# call window_mnemonic_activate #} (toWindow self) (fromIntegral keyval)@@ -482,7 +526,7 @@ -- | Sets the mnemonic modifier for this window. windowSetMnemonicModifier :: WindowClass self => self- -> [Modifier] -- ^ @modifier@ - the modifier mask used to activate mnemonics on this window. + -> [Modifier] -- ^ @modifier@ - the modifier mask used to activate mnemonics on this window. -> IO () windowSetMnemonicModifier self modifier = {# call window_set_mnemonic_modifier #}@@ -491,17 +535,17 @@ -- | Returns the mnemonic modifier for this window. See 'windowSetMnemonicModifier'. windowGetMnemonicModifier :: WindowClass self => self- -> IO [Modifier] -- ^ return the modifier mask used to activate mnemonics on this window. + -> IO [Modifier] -- ^ return the modifier mask used to activate mnemonics on this window. windowGetMnemonicModifier self = liftM (toFlags . fromIntegral) $- {# call window_get_mnemonic_modifier #} + {# call window_get_mnemonic_modifier #} (toWindow self) --- | Activates mnemonics and accelerators for this 'Window'. --- This is normally called by the default 'keyPressEvent' handler for toplevel windows, +-- | Activates mnemonics and accelerators for this 'Window'.+-- This is normally called by the default 'keyPressEvent' handler for toplevel windows, -- however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window.--- +-- windowActivateKey :: WindowClass self => self -> EventM EKey Bool- -- ^ return @True@ if a mnemonic or accelerator was found and activated. + -- ^ return @True@ if a mnemonic or accelerator was found and activated. windowActivateKey self = do ptr <- ask liftIO $ liftM toBool $@@ -509,13 +553,13 @@ (toWindow self) (castPtr ptr) --- | Propagate a key press or release event to the focus widget and up the focus container chain until a widget handles event. --- This is normally called by the default 'keyPressEvent' and 'keyReleaseEvent' handlers for toplevel windows, +-- | Propagate a key press or release event to the focus widget and up the focus container chain until a widget handles event.+-- This is normally called by the default 'keyPressEvent' and 'keyReleaseEvent' handlers for toplevel windows, -- however in some cases it may be useful to call this directly when overriding the standard key handling for a toplevel window. -- windowPropagateKeyEvent :: WindowClass self => self -> EventM EKey Bool- -- ^ return @True@ if a widget in the focus chain handled the event. + -- ^ return @True@ if a widget in the focus chain handled the event. windowPropagateKeyEvent self = do ptr <- ask liftIO $ liftM toBool $@@ -560,7 +604,7 @@ -- parent, much as the window manager would have done on X. -- -- Note that if you want to show a window @self@ on top of a full-screen window @parent@, you need to--- turn the @self@ window into a dialog (using 'windowSetTypeHint' with 'WindowTypeHintDialog'). +-- turn the @self@ window into a dialog (using 'windowSetTypeHint' with 'WindowTypeHintDialog'). -- Otherwise the @parent@ window will always cover the @self@ window. -- windowSetTransientFor :: (WindowClass self, WindowClass parent) => self@@ -671,12 +715,12 @@ #if GTK_CHECK_VERSION(2,14,0) -- | Returns the default widget for window. See 'windowSetDefault' for more details.--- +-- -- * Available since Gtk+ version 2.14 -- windowGetDefaultWidget :: WindowClass self => self -> IO (Maybe Widget)-windowGetDefaultWidget self = +windowGetDefaultWidget self = maybeNull (makeNewObject mkWidget) $ {# call window_get_default_widget #} (toWindow self)@@ -976,16 +1020,16 @@ #endif #if GTK_CHECK_VERSION(2,12,0)--- | Startup notification identifiers are used by desktop environment to track application startup, --- to provide user feedback and other features. This function changes the corresponding property on the underlying GdkWindow. +-- | Startup notification identifiers are used by desktop environment to track application startup,+-- to provide user feedback and other features. This function changes the corresponding property on the underlying GdkWindow. -- Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling 'windowPresent' or any equivalent function generating a window map event. -- -- This function is only useful on X11, not with other GTK+ targets. -- -- * Available since Gtk+ version 2.12 ---windowSetStartupId :: WindowClass self => self- -> String+windowSetStartupId :: (WindowClass self, GlibString string) => self+ -> string -> IO () windowSetStartupId self startupId = withUTFString startupId $ \idPtr ->@@ -1022,10 +1066,11 @@ (toWindow self) #if GTK_CHECK_VERSION(2,10,0)--- | By default, windows have a close button in the window frame. --- Some window managers allow GTK+ to disable this button. --- If you set the deletable property to @False@ using this function, GTK+ will do its best to convince the window manager not to show a close button. --- Depending on the system, this function may not have any effect when called on a window that is already visible, +#ifndef DISABLE_DEPRECATED+-- | By default, windows have a close button in the window frame.+-- Some window managers allow GTK+ to disable this button.+-- If you set the deletable property to @False@ using this function, GTK+ will do its best to convince the window manager not to show a close button.+-- Depending on the system, this function may not have any effect when called on a window that is already visible, -- so you should call it before calling 'windowShow'. -- -- On Windows, this function always works, since there's no window manager policy involved.@@ -1033,7 +1078,7 @@ -- * Available since Gtk+ version 2.10 -- windowSetDeletable :: WindowClass self => self- -> Bool -- ^ @setting@ - @True@ to decorate the window as deletable + -> Bool -- ^ @setting@ - @True@ to decorate the window as deletable -> IO () windowSetDeletable self setting = {# call window_set_deletable #}@@ -1045,11 +1090,14 @@ -- * Available since Gtk+ version 2.10 -- windowGetDeletable :: WindowClass self => self- -> IO Bool -- ^ return @True@ if the window has been set to have a close button -windowGetDeletable self = liftM toBool $ + -> IO Bool -- ^ return @True@ if the window has been set to have a close button+windowGetDeletable self = liftM toBool $ {# call window_get_deletable #} (toWindow self) #endif+#endif++#if GTK_MAJOR_VERSION < 3 -- | (Note: this is a special-purpose function intended for the framebuffer -- port; see 'windowSetHasFrame'. It will have no effect on the window border -- drawn by the window manager, which is the normal case when using the X@@ -1058,6 +1106,7 @@ -- For windows with frames (see 'windowSetHasFrame') this function can be -- used to change the size of the frame border. --+-- Removed in Gtk3. windowSetFrameDimensions :: WindowClass self => self -> Int -- ^ @left@ - The width of the left border -> Int -- ^ @top@ - The height of the top border@@ -1072,23 +1121,22 @@ (fromIntegral right) (fromIntegral bottom) --- | Retrieves the dimensions of the frame window for this toplevel. See +-- | Retrieves the dimensions of the frame window for this toplevel. See -- 'windowSetHasFrame', 'windowSetFrameDimensions'. -- -- (Note: this is a special-purpose function intended for the framebuffer port;--- see 'windowSetHasFrame'. --- It will not return the size of the window border drawn by the window manager, --- which is the normal case when using a windowing system. +-- see 'windowSetHasFrame'.+-- It will not return the size of the window border drawn by the window manager,+-- which is the normal case when using a windowing system. -- See 'drawWindowGetFrameExtents' to get the standard window border extents.) --------+-- Removed in Gtk3. windowGetFrameDimensions :: WindowClass self => self -> IO (Int, Int, Int, Int) -- ^ returns @(left, top, right, bottom)@. @left@ is the -- width of the frame at the left, @top@ is the height of the frame at the top, @right@ -- is the width of the frame at the right, @bottom@ is the height of the frame at the bottom.-windowGetFrameDimensions self = +windowGetFrameDimensions self = alloca $ \lPtr -> alloca $ \tPtr -> alloca $ \rPtr -> alloca $ \bPtr -> do {# call window_get_frame_dimensions #} (toWindow self) lPtr tPtr rPtr bPtr lv <- peek lPtr@@ -1102,15 +1150,16 @@ -- accessible using 'windowGetFrame'. Using the signal 'windowFrameEvent' you can -- receive all events targeted at the frame. ----- (Note: this is a special-purpose function for the framebuffer port, that causes GTK+ to draw its own window border. +-- (Note: this is a special-purpose function for the framebuffer port, that causes GTK+ to draw its own window border. -- For most applications, you want 'windowSetDecorated' instead, which tells the window manager whether to draw the window border.) ----- This function is used by the linux-fb port to implement managed windows, +-- This function is used by the linux-fb port to implement managed windows, -- but it could conceivably be used by X-programs that want to do their own window -- decorations. ---windowSetHasFrame :: WindowClass self => self - -> Bool -- ^ @setting@ - a boolean +-- Removed in Gtk3.+windowSetHasFrame :: WindowClass self => self+ -> Bool -- ^ @setting@ - a boolean -> IO () windowSetHasFrame self setting = {# call window_set_has_frame #}@@ -1119,12 +1168,15 @@ -- | Accessor for whether the window has a frame window exterior to window->window. Gets the value set by 'windowSetHasFrame'. --+-- Removed in Gtk3. windowGetHasFrame :: WindowClass self => self -> IO Bool -- ^ return @True@ if a frame has been added to the window via 'windowSetHasFrame'. windowGetHasFrame self = liftM toBool $ {# call window_get_has_frame #} (toWindow self)+#endif +#ifndef DISABLE_DEPRECATED -- | This function is only useful on X11, not with other Gtk+ targets. -- -- In combination with the window title, the window role allows a window@@ -1137,8 +1189,8 @@ -- since the WM can use the title to identify the window when restoring the -- session. ---windowSetRole :: WindowClass self => self- -> String -- ^ @role@ - unique identifier for the window to be used when+windowSetRole :: (WindowClass self, GlibString string) => self+ -> string -- ^ @role@ - unique identifier for the window to be used when -- restoring a session -> IO () windowSetRole self role =@@ -1150,13 +1202,14 @@ -- | Returns the role of the window. See 'windowSetRole' for further -- explanation. ---windowGetRole :: WindowClass self => self- -> IO (Maybe String) -- ^ returns the role of the window if set, or+windowGetRole :: (WindowClass self, GlibString string) => self+ -> IO (Maybe string) -- ^ returns the role of the window if set, or -- @Nothing@. windowGetRole self = {# call gtk_window_get_role #} (toWindow self) >>= maybePeek peekUTFString+#endif -- | Asks to stick @window@, which means that it will appear on all user -- desktops. Note that you shouldn't assume the window is definitely stuck@@ -1252,11 +1305,11 @@ {# call gtk_window_get_icon #} (toWindow self) --- | Sets up the icon representing a 'Window'. The icon is used when the window is minimized (also known as iconified). +-- | Sets up the icon representing a 'Window'. The icon is used when the window is minimized (also known as iconified). -- Some window managers or desktop environments may also place it in the window frame, or display it in other contexts. ----- 'windowSetIconList' allows you to pass in the same icon in several hand-drawn sizes. --- The list should contain the natural sizes your icon is available in; that is, don't scale the image before passing it to GTK+. +-- 'windowSetIconList' allows you to pass in the same icon in several hand-drawn sizes.+-- The list should contain the natural sizes your icon is available in; that is, don't scale the image before passing it to GTK+. -- Scaling is postponed until the last minute, when the desired final size is known, to allow best quality. -- -- By passing several sizes, you may improve the final image quality of the icon, by reducing or eliminating automatic image scaling.@@ -1266,7 +1319,7 @@ -- See also 'windowSetDefaultIconList' to set the icon for all windows in your application in one go. -- -- Note that transient windows (those who have been set transient for another window using 'windowSetTransientFor' will inherit their icon from their--- transient parent. +-- transient parent. -- So there's no need to explicitly set the icon on transient windows. -- windowSetIconList :: WindowClass self => self@@ -1278,28 +1331,28 @@ {# call window_set_icon_list #} (toWindow self) glist- --- | Retrieves the list of icons set by 'windowSetIconList'. ++-- | Retrieves the list of icons set by 'windowSetIconList'. ---windowGetIconList :: WindowClass self => self +windowGetIconList :: WindowClass self => self -> IO [Pixbuf] windowGetIconList self = do glist <- {# call window_get_icon_list #} (toWindow self) ptrList <- fromGList glist mapM (makeNewGObject mkPixbuf . return) ptrList --- | Sets an icon list to be used as fallback for windows that haven't had 'windowSetIconList' called on them to set up a window-specific icon list. +-- | Sets an icon list to be used as fallback for windows that haven't had 'windowSetIconList' called on them to set up a window-specific icon list. -- This function allows you to set up the icon for all windows in your app at once. -- -- See 'windowSetIconList' for more details. -- windowSetDefaultIconList :: [Pixbuf] -> IO ()-windowSetDefaultIconList list = +windowSetDefaultIconList list = withForeignPtrs (map unPixbuf list) $ \ptrList -> withGList ptrList $ \glist -> {# call window_set_default_icon_list #} glist --- | Gets the value set by 'windowSetDefaultIconList'. +-- | Gets the value set by 'windowSetDefaultIconList'. -- windowGetDefaultIconList :: IO [Pixbuf] windowGetDefaultIconList = do@@ -1308,6 +1361,7 @@ mapM (makeNewGObject mkPixbuf . return) ptrList #if GTK_CHECK_VERSION(2,6,0)+#ifndef DISABLE_DEPRECATED -- | Sets the icon for the window from a named themed icon. See the docs for -- 'IconTheme' for more details. --@@ -1316,8 +1370,8 @@ -- -- * Available since Gtk+ version 2.6 ---windowSetIconName :: WindowClass self => self- -> String -- ^ @name@ - the name of the themed icon+windowSetIconName :: (WindowClass self, GlibString string) => self+ -> string -- ^ @name@ - the name of the themed icon -> IO () windowSetIconName self name = withUTFString name $ \namePtr ->@@ -1330,8 +1384,8 @@ -- -- * Available since Gtk+ version 2.6 ---windowGetIconName :: WindowClass self => self- -> IO String -- ^ returns the icon name or @\"\"@ if the window has no themed+windowGetIconName :: (WindowClass self, GlibString string) => self+ -> IO string -- ^ returns the icon name or @\"\"@ if the window has no themed -- icon. windowGetIconName self = {# call gtk_window_get_icon_name #}@@ -1339,6 +1393,7 @@ >>= \strPtr -> if strPtr == nullPtr then return "" else peekUTFString strPtr+#endif -- | Sets an icon to be used as fallback for windows that haven't had -- 'windowSetIconList' called on them from a named themed icon, see@@ -1346,8 +1401,8 @@ -- -- * Available since Gtk+ version 2.6 ---windowSetDefaultIconName :: - String -- ^ @name@ - the name of the themed icon+windowSetDefaultIconName :: GlibString string+ => string -- ^ @name@ - the name of the themed icon -> IO () windowSetDefaultIconName name = withUTFString name $ \namePtr ->@@ -1374,8 +1429,8 @@ -- -- * Available since Gtk+ version 2.2 ---windowSetDefaultIconFromFile ::- String -- ^ @filename@ - location of icon file+windowSetDefaultIconFromFile :: GlibString string+ => string -- ^ @filename@ - location of icon file -> IO Bool -- ^ returns @True@ if setting the icon succeeded. windowSetDefaultIconFromFile filename = liftM toBool $@@ -1392,8 +1447,8 @@ -- -- * Available since Gtk+ version 2.16 ---windowGetDefaultIconName ::- IO String -- ^ returns the fallback icon name for windows+windowGetDefaultIconName :: GlibString string+ => IO string -- ^ returns the fallback icon name for windows windowGetDefaultIconName = {# call window_get_default_icon_name #} >>= peekUTFString@@ -1433,13 +1488,13 @@ -- -- * Available since Gtk+ version 2.2 ---windowSetIconFromFile :: WindowClass self => self- -> FilePath -- ^ @filename@ - location of icon file+windowSetIconFromFile :: (WindowClass self, GlibFilePath fp) => self+ -> fp -- ^ @filename@ - location of icon file -> IO () windowSetIconFromFile self filename = propagateGError $ \errPtr ->- withUTFString filename $ \filenamePtr -> do-#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0)+ withUTFFilePath filename $ \filenamePtr -> do+#if defined (WIN32) && GTK_CHECK_VERSION(2,6,0) && GTK_MAJOR_VERSION < 3 {# call gtk_window_set_icon_from_file_utf8 #} #else {# call gtk_window_set_icon_from_file #}@@ -1461,7 +1516,7 @@ -- -- * Available since Gtk+ version 2.2 ---windowSetAutoStartupNotification :: +windowSetAutoStartupNotification :: Bool -- ^ @setting@ - @True@ to automatically do startup notification -> IO () windowSetAutoStartupNotification setting =@@ -1533,24 +1588,24 @@ (fromIntegral x) (fromIntegral y) --- | Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this. +-- | Parses a standard X Window System geometry string - see the manual page for X (type 'man X') for details on this. -- 'windowParseGeometry' does work on all GTK+ ports including Win32 but is primarily intended for an X environment. ----- If either a size or a position can be extracted from the geometry string, +-- If either a size or a position can be extracted from the geometry string, -- 'windowParseGeometry' returns @True@ and calls gtk_window_set_default_size() and/or gtk_window_move() to resize/move the window. ----- If 'windowParseGeometry' returns @True@, +-- If 'windowParseGeometry' returns @True@, -- it will also set the 'HintUserPos' and/or 'HintUserSize' hints indicating to the window manager that the size/position of the window was user-specified -- This causes most window managers to honor the geometry. ----- Note that for 'windowParseGeometry' to work as expected, it has to be called when the window has its "final" size, i.e. +-- Note that for 'windowParseGeometry' to work as expected, it has to be called when the window has its "final" size, i.e. -- after calling 'widgetShowAll' on the contents and 'windowSetGeometryHints' on the window. ---windowParseGeometry :: WindowClass self => self- -> String+windowParseGeometry :: (WindowClass self, GlibString string) => self+ -> string -> IO Bool windowParseGeometry self geometry = liftM toBool $- withUTFString geometry $ \geometryPtr -> + withUTFString geometry $ \geometryPtr -> {# call window_parse_geometry #} (toWindow self) geometryPtr@@ -1824,7 +1879,7 @@ -- windowSetGeometryHints :: (WindowClass self, WidgetClass widget) => self -- ^ @window@ - the top level window- -> Maybe widget -- ^ @geometryWidget@ - optionall a widget the geometry+ -> Maybe widget -- ^ @geometryWidget@ - optional a widget the geometry -- hints will be applied to rather than directly to the -- top level window -> Maybe (Int, Int) -- ^ @(minWidth, minHeight)@ - minimum width and height@@ -1885,18 +1940,19 @@ {# enum GdkWindowHints {underscoreToCase} #} #if GTK_CHECK_VERSION(2,12,0)--- | Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque. --- (Values of the opacity parameter are clamped to the [0,1] range.) +#ifndef DISABLE_DEPRECATED+-- | Request the windowing system to make window partially transparent, with opacity 0 being fully transparent and 1 fully opaque.+-- (Values of the opacity parameter are clamped to the [0,1] range.) -- On X11 this has any effect only on X screens with a compositing manager running. -- See 'widgetIsComposited'. On Windows it should work always. -- -- Note that setting a window's opacity after the window has been shown causes it to -- flicker once on Windows.--- +-- -- * Available since Gtk+ version 2.12 -- windowSetOpacity :: WindowClass self => self- -> Double -- ^ @opacity@ - desired opacity, between 0 and 1 + -> Double -- ^ @opacity@ - desired opacity, between 0 and 1 -> IO () windowSetOpacity self opacity = {#call window_set_opacity #} (toWindow self) (realToFrac opacity)@@ -1905,30 +1961,44 @@ -- -- * Available since Gtk+ version 2.12 ---windowGetOpacity :: WindowClass self => self - -> IO Double -- ^ return the requested opacity for this window. +windowGetOpacity :: WindowClass self => self+ -> IO Double -- ^ return the requested opacity for this window. windowGetOpacity self = liftM realToFrac $ {#call window_get_opacity#} (toWindow self) #endif+#endif #if GTK_CHECK_VERSION(2,10,0) -- | Returns the group for window or the default group, if window is @Nothing@ or if window does not have an explicit window group.--- +-- -- * Available since Gtk+ version 2.10 -- windowGetGroup :: WindowClass self => Maybe self- -> IO WindowGroup -- ^ return the 'WindowGroup' for a window or the default group -windowGetGroup self = + -> IO WindowGroup -- ^ return the 'WindowGroup' for a window or the default group+windowGetGroup self = makeNewGObject mkWindowGroup $ {# call window_get_group #} (maybe (Window nullForeignPtr) toWindow self)-#endif +#endif +#if GTK_CHECK_VERSION(2,20,0)+-- | Gets the type of the window. See 'WindowType'.+--+-- * Available since Gtk version 2.20+--+windowGetWindowType :: WindowClass self => self+ -> IO WindowType -- ^ returns the type of the window+windowGetWindowType self =+ liftM (toEnum . fromIntegral) $+ {#call gtk_window_get_window_type #}+ (toWindow self)+#endif+ -------------------- -- Attributes -- | The title of the window. ---windowTitle :: WindowClass self => Attr self String+windowTitle :: (WindowClass self, GlibString string) => Attr self string windowTitle = newAttr windowGetTitle windowSetTitle@@ -1941,7 +2011,7 @@ windowType = readAttrFromEnumProperty "type" {# call pure unsafe gtk_window_type_get_type #} --- | If @True@, the window has no mimimum size. Setting this to @True@ is 99%+-- | If @True@, the window has no minimum size. Setting this to @True@ is 99% -- of the time a bad idea. -- -- Default value: @False@@@ -1965,6 +2035,17 @@ windowGetResizable windowSetResizable +#if GTK_MAJOR_VERSION >= 3+-- | If @True@, window has a resize grip.+--+-- Default value: @True@+--+windowHasResizeGrip :: WindowClass self => Attr self Bool+windowHasResizeGrip = newAttr+ windowGetHasResizeGrip+ windowSetHasResizeGrip+#endif+ -- | If @True@, the window is modal (other windows are not usable while this -- one is up). --@@ -1998,6 +2079,7 @@ windowGetFocus windowSetFocus +#if GTK_MAJOR_VERSION < 3 -- | (Note: this is a special-purpose function for the framebuffer port, that -- causes Gtk+ to draw its own window border. For most applications, you want -- 'windowSetDecorated' instead, which tells the window manager whether to draw@@ -2012,10 +2094,12 @@ -- but it could conceivably be used by X-programs that want to do their own -- window decorations. --+-- Removed in Gtk3. windowHasFrame :: WindowClass self => Attr self Bool windowHasFrame = newAttr windowGetHasFrame windowSetHasFrame+#endif -- | Sets up the icon representing a 'Window'. The icon is used when the -- window is minimized (also known as iconified). Some window managers or@@ -2048,11 +2132,16 @@ windowGetMnemonicModifier windowSetMnemonicModifier +#if GTK_CHECK_VERSION(2,20,0)+windowMnemonicVisible :: WindowClass self => Attr self Bool+windowMnemonicVisible = newAttrFromBoolProperty "mnemonics-visible"+#endif+ -- | Unique identifier for the window to be used when restoring a session. -- -- Default value: "\\" ---windowRole :: WindowClass self => Attr self String+windowRole :: (WindowClass self, GlibString string) => Attr self string windowRole = newAttrFromStringProperty "role" #if GTK_CHECK_VERSION(2,12,0)@@ -2062,7 +2151,7 @@ -- -- * Available since Gtk+ version 2.12 ---windowStartupId :: WindowClass self => Attr self String+windowStartupId :: (WindowClass self, GlibString string) => Attr self string windowStartupId = newAttrFromStringProperty "startup-id" #endif @@ -2124,7 +2213,7 @@ -- * Available since Gtk+ version 2.6 -- ---windowIconName :: WindowClass self => Attr self String+windowIconName :: (WindowClass self, GlibString string) => Attr self string windowIconName = newAttrFromStringProperty "icon-name" #if GTK_CHECK_VERSION(2,2,0)@@ -2223,7 +2312,7 @@ -- | Whether the input focus is within this GtkWindow. -- -- Note: If add `window` before `HasToplevelFocus` (has-toplevel-focus attribute)--- will conflicts with fucntion `windowHasToplevelFocus`, so we named this attribute +-- will conflicts with function `windowHasToplevelFocus`, so we named this attribute -- to `windowToplevelFocus`. -- -- Default values: @False@@@ -2243,7 +2332,7 @@ -- Signals -- | Observe events that are emitted on the frame of this window.--- +-- frameEvent :: WindowClass self => Signal self (EventM EAny Bool) frameEvent = Signal (\after obj fun -> connect_PTR__BOOL "frame-event" after obj (runReaderT fun))
Graphics/UI/Gtk/Windows/WindowGroup.chs view
@@ -52,7 +52,6 @@ ) where import System.Glib.FFI-import System.Glib.GObject (constructNewGObject) import System.Glib.GList (fromGList) {#import Graphics.UI.Gtk.Types#} @@ -67,7 +66,7 @@ -- windowGroupNew :: IO WindowGroup windowGroupNew =- constructNewGObject mkWindowGroup $+ wrapNewGObject mkWindowGroup $ {# call gtk_window_group_new #} --------------------@@ -95,7 +94,7 @@ #if GTK_CHECK_VERSION(2,14,0) -- | Returns a list of the 'Window's that belong to @windowGroup@.--- +-- -- * Available since Gtk+ version 2.14 -- windowGroupListWindows :: WindowGroupClass self
Graphics/UI/GtkInternals.chs view
@@ -34,4 +34,4 @@ {#import Graphics.UI.Gtk.Types#} {#import Graphics.UI.Gtk.General.DNDTypes#} (mkTargetList)-{#import Graphics.UI.Gtk.Multiline.Types#} +{#import Graphics.UI.Gtk.Multiline.Types#}
− Gtk2HsSetup.hs
@@ -1,486 +0,0 @@-{-# LANGUAGE CPP #-}--#define CABAL_VERSION_ENCODE(major, minor, micro) ( \- ((major) * 10000) \- + ((minor) * 100) \- + ((micro) * 1))--#define CABAL_VERSION_CHECK(major,minor,micro) \- (CABAL_VERSION >= CABAL_VERSION_ENCODE(major,minor,micro))---- now, this is bad, but Cabal doesn't seem to actually pass any information about--- its version to CPP, so guess the version depending on the version of GHC-#ifdef CABAL_VERSION_MINOR-#ifndef CABAL_VERSION_MAJOR-#define CABAL_VERSION_MAJOR 1-#endif-#ifndef CABAL_VERSION_MICRO-#define CABAL_VERSION_MICRO 0-#endif-#define CABAL_VERSION CABAL_VERSION_ENCODE( \- CABAL_VERSION_MAJOR, \- CABAL_VERSION_MINOR, \- CABAL_VERSION_MICRO)-#else-#warning Setup.hs is guessing the version of Cabal. If compilation of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when building (prefixed by --ghc-option= when using the 'cabal' command)-#if (__GLASGOW_HASKELL__ >= 612)-#define CABAL_VERSION CABAL_VERSION_ENCODE(1,8,0)-#else-#define CABAL_VERSION CABAL_VERSION_ENCODE(1,6,0)-#endif-#endif---- | Build a Gtk2hs package.----module Gtk2HsSetup ( gtk2hsUserHooks, getPkgConfigPackages ) where--import Distribution.Simple-import Distribution.Simple.PreProcess-import Distribution.InstalledPackageInfo ( importDirs,- showInstalledPackageInfo,- libraryDirs,- extraLibraries,- extraGHCiLibraries )-import Distribution.Simple.PackageIndex (-#if CABAL_VERSION_CHECK(1,8,0)- lookupInstalledPackageId-#else- lookupPackageId-#endif- )-import Distribution.PackageDescription as PD ( PackageDescription(..),- updatePackageDescription,- BuildInfo(..),- emptyBuildInfo, allBuildInfo,- Library(..),- libModules, hasLibs)-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..),- InstallDirs(..),-#if CABAL_VERSION_CHECK(1,8,0)- componentPackageDeps,-#else- packageDeps,-#endif- absoluteInstallDirs)-import Distribution.Simple.Compiler ( Compiler(..) )-import Distribution.Simple.Program (- Program(..), ConfiguredProgram(..),- rawSystemProgramConf, rawSystemProgramStdoutConf,- c2hsProgram, pkgConfigProgram, requireProgram, ghcPkgProgram,- simpleProgram, lookupProgram, rawSystemProgramStdout, ProgArg)-import Distribution.ModuleName ( ModuleName, components, toFilePath )-import Distribution.Simple.Utils-import Distribution.Simple.Setup (CopyFlags(..), InstallFlags(..), CopyDest(..),- defaultCopyFlags, ConfigFlags(configVerbosity),- fromFlag, toFlag, RegisterFlags(..), flagToMaybe,- fromFlagOrDefault, defaultRegisterFlags)-import Distribution.Simple.BuildPaths ( autogenModulesDir )-import Distribution.Simple.Install ( install )-#if CABAL_VERSION_CHECK(1,8,0)-import Distribution.Simple.Register ( generateRegistrationInfo, registerPackage )-#else-import qualified Distribution.Simple.Register as Register ( register )-#endif-import Distribution.Text ( simpleParse, display )-import System.FilePath-import System.Directory ( doesFileExist )-import Distribution.Version (Version(..))-import Distribution.Verbosity-import Control.Monad (when, unless, filterM)-import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList )-import Data.List (isPrefixOf, isSuffixOf, nub)-import Data.Char (isAlpha)-import qualified Data.Map as M-import qualified Data.Set as S--import Control.Applicative ((<$>))-import System.Directory (getDirectoryContents, doesDirectoryExist)---- the name of the c2hs pre-compiled header file-precompFile = "precompchs.bin"--gtk2hsUserHooks = simpleUserHooks {- hookedPrograms = [typeGenProgram, signalGenProgram, c2hsLocal],- hookedPreProcessors = [("chs", ourC2hs)],- confHook = \pd cf ->- confHook simpleUserHooks pd cf >>= return . adjustLocalBuildInfo,- postConf = \args cf pd lbi -> do- genSynthezisedFiles (fromFlag (configVerbosity cf)) pd lbi- postConf simpleUserHooks args cf pd lbi,- buildHook = \pd lbi uh bf -> fixDeps pd >>= \pd ->- (buildHook simpleUserHooks) pd lbi uh bf,- copyHook = \pd lbi uh flags -> (copyHook simpleUserHooks) pd lbi uh flags >>- installCHI pd lbi (fromFlag (copyVerbosity flags)) (fromFlag (copyDest flags)),- instHook = \pd lbi uh flags ->-#if defined(mingw32_HOST_OS) || defined(__MINGW32__)- installHook pd lbi uh flags >>- installCHI pd lbi (fromFlag (installVerbosity flags)) NoCopyDest,- regHook = registerHook-#else- instHook simpleUserHooks pd lbi uh flags >>- installCHI pd lbi (fromFlag (installVerbosity flags)) NoCopyDest-#endif- }----------------------------------------------------------------------------------- Lots of stuff for windows ghci support---------------------------------------------------------------------------------getDlls :: [FilePath] -> IO [FilePath]-getDlls dirs = filter ((== ".dll") . takeExtension) . concat <$>- mapM getDirectoryContents dirs--fixLibs :: [FilePath] -> [String] -> [String]-fixLibs dlls = concatMap $ \ lib ->- case filter (("lib" ++ lib) `isPrefixOf`) dlls of- dll:_ -> [dropExtension dll]- _ -> if lib == "z" then [] else [lib]---- The following code is a big copy-and-paste job from the sources of--- Cabal 1.8 just to be able to fix a field in the package file. Yuck.--#if CABAL_VERSION_CHECK(1,8,0)- -installHook :: PackageDescription -> LocalBuildInfo- -> UserHooks -> InstallFlags -> IO ()-installHook pkg_descr localbuildinfo _ flags = do- let copyFlags = defaultCopyFlags {- copyDistPref = installDistPref flags,- copyDest = toFlag NoCopyDest,- copyVerbosity = installVerbosity flags- }- install pkg_descr localbuildinfo copyFlags- let registerFlags = defaultRegisterFlags {- regDistPref = installDistPref flags,- regInPlace = installInPlace flags,- regPackageDB = installPackageDB flags,- regVerbosity = installVerbosity flags- }- when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags--registerHook :: PackageDescription -> LocalBuildInfo- -> UserHooks -> RegisterFlags -> IO ()-registerHook pkg_descr localbuildinfo _ flags =- if hasLibs pkg_descr- then register pkg_descr localbuildinfo flags- else setupMessage verbosity- "Package contains no library to register:" (packageId pkg_descr)- where verbosity = fromFlag (regVerbosity flags)--register :: PackageDescription -> LocalBuildInfo- -> RegisterFlags -- ^Install in the user's database?; verbose- -> IO ()-register pkg@PackageDescription { library = Just lib }- lbi@LocalBuildInfo { libraryConfig = Just clbi } regFlags- = do-- installedPkgInfoRaw <- generateRegistrationInfo- verbosity pkg lib lbi clbi inplace distPref-- dllsInScope <- getSearchPath >>= (filterM doesDirectoryExist) >>= getDlls- let libs = fixLibs dllsInScope (extraLibraries installedPkgInfoRaw)- installedPkgInfo = installedPkgInfoRaw {- extraGHCiLibraries = libs }-- -- Three different modes:- case () of- _ | modeGenerateRegFile -> die "Generate Reg File not supported"- | modeGenerateRegScript -> die "Generate Reg Script not supported"- | otherwise -> registerPackage verbosity- installedPkgInfo pkg lbi inplace packageDb-- where- modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))- modeGenerateRegScript = fromFlag (regGenScript regFlags)- inplace = fromFlag (regInPlace regFlags)- packageDb = case flagToMaybe (regPackageDB regFlags) of- Just db -> db- Nothing -> registrationPackageDB (withPackageDB lbi)- distPref = fromFlag (regDistPref regFlags)- verbosity = fromFlag (regVerbosity regFlags)--register _ _ regFlags = notice verbosity "No package to register"- where- verbosity = fromFlag (regVerbosity regFlags)--#else-installHook :: PackageDescription -> LocalBuildInfo- -> UserHooks -> InstallFlags -> IO ()-installHook pkg_descr localbuildinfo _ flags = do- let copyFlags = defaultCopyFlags {- copyDistPref = installDistPref flags,- copyInPlace = installInPlace flags,- copyUseWrapper = installUseWrapper flags,- copyDest = toFlag NoCopyDest,- copyVerbosity = installVerbosity flags- }- install pkg_descr localbuildinfo copyFlags- let registerFlags = defaultRegisterFlags {- regDistPref = installDistPref flags,- regInPlace = installInPlace flags,- regPackageDB = installPackageDB flags,- regVerbosity = installVerbosity flags- }- when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags--registerHook :: PackageDescription -> LocalBuildInfo- -> UserHooks -> RegisterFlags -> IO ()-registerHook pkg_descr localbuildinfo _ flags =- if hasLibs pkg_descr- then register pkg_descr localbuildinfo flags- else setupMessage verbosity- "Package contains no library to register:" (packageId pkg_descr)- where verbosity = fromFlag (regVerbosity flags)--register :: PackageDescription -> LocalBuildInfo- -> RegisterFlags -- ^Install in the user's database?; verbose- -> IO ()-register pkg_descr lbi regFlags = do- let verbosity = fromFlag (regVerbosity regFlags)- warn verbosity "Cannot register ghci libraries with Cabal 1.6 (need 1.8)."- Register.register pkg_descr lbi regFlags- -#endif----------------------------------------------------------------------------------- This is a hack for Cabal-1.8, It is not needed in Cabal-1.9.1 or later---------------------------------------------------------------------------------adjustLocalBuildInfo :: LocalBuildInfo -> LocalBuildInfo-adjustLocalBuildInfo lbi =- let extra = (Just libBi, [])- libBi = emptyBuildInfo { includeDirs = [ autogenModulesDir lbi- , buildDir lbi ] }- in lbi { localPkgDescr = updatePackageDescription extra (localPkgDescr lbi) }----------------------------------------------------------------------------------- Processing .chs files with our local c2hs.---------------------------------------------------------------------------------ourC2hs :: BuildInfo -> LocalBuildInfo -> PreProcessor-ourC2hs bi lbi = PreProcessor {- platformIndependent = False,- runPreProcessor = runC2HS bi lbi-}--runC2HS :: BuildInfo -> LocalBuildInfo ->- (FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO ()-runC2HS bi lbi (inDir, inFile) (outDir, outFile) verbosity = do- -- have the header file name if we don't have the precompiled header yet- header <- case lookup "x-c2hs-header" (customFieldsBI bi) of- Just h -> return h- Nothing -> die ("Need x-c2hs-Header definition in the .cabal Library section "++- "that sets the C header file to process .chs.pp files.")-- -- c2hs will output files in out dir, removing any leading path of the input file.- -- Thus, append the dir of the input file to the output dir.- let (outFileDir, newOutFile) = splitFileName outFile- let newOutDir = outDir </> outFileDir- -- additional .chi files might be needed that other packages have installed;- -- we assume that these are installed in the same place as .hi files- let chiDirs = [ dir |-#if CABAL_VERSION_CHECK(1,8,0)- ipi <- maybe [] (map fst . componentPackageDeps) (libraryConfig lbi),- dir <- maybe [] importDirs (lookupInstalledPackageId (installedPkgs lbi) ipi) ]-#else- ipi <- packageDeps lbi,- dir <- maybe [] importDirs (lookupPackageId (installedPkgs lbi) ipi) ]-#endif- rawSystemProgramConf verbosity c2hsLocal (withPrograms lbi) $- map ("--include=" ++) (outDir:chiDirs)- ++ ["--cppopts=" ++ opt | opt <- getCppOptions bi lbi]- ++ ["--output-dir=" ++ newOutDir,- "--output=" ++ newOutFile,- "--precomp=" ++ buildDir lbi </> precompFile,- header, inDir </> inFile]--getCppOptions :: BuildInfo -> LocalBuildInfo -> [String]-getCppOptions bi lbi- = nub $- ["-I" ++ dir | dir <- PD.includeDirs bi]- ++ [opt | opt@('-':c:_) <- (PD.cppOptions bi ++ PD.ccOptions bi), c `elem` "DIU"]--installCHI :: PackageDescription -- ^information from the .cabal file- -> LocalBuildInfo -- ^information from the configure step- -> Verbosity -> CopyDest -- ^flags sent to copy or install- -> IO ()-installCHI pkg@PD.PackageDescription { library = Just lib } lbi verbosity copydest = do- let InstallDirs { libdir = libPref } = absoluteInstallDirs pkg lbi copydest- -- cannot use the recommended 'findModuleFiles' since it fails if there exists- -- a modules that does not have a .chi file- mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi])- (map toFilePath-#if CABAL_VERSION_CHECK(1,8,0)- (PD.libModules lib)-#else- (PD.libModules pkg)-#endif- )- let files = [ f | Just f <- mFiles ]-#if CABAL_VERSION_CHECK(1,8,0)- installOrdinaryFiles verbosity libPref files-#else- copyFiles verbosity libPref files-#endif-- -installCHI _ _ _ _ = return ()----------------------------------------------------------------------------------- Generating the type hierarchy and signal callback .hs files.---------------------------------------------------------------------------------typeGenProgram :: Program-typeGenProgram = (simpleProgram "gtk2hsTypeGen")--signalGenProgram :: Program-signalGenProgram = (simpleProgram "gtk2hsHookGenerator")--c2hsLocal :: Program-c2hsLocal = (simpleProgram "gtk2hsC2hs")--genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()-genSynthezisedFiles verb pd lbi = do-- cPkgs <- getPkgConfigPackages verb lbi pd-- let xList = maybe [] (customFieldsBI . libBuildInfo) (library pd)- ++customFieldsPD pd- typeOpts :: String -> [ProgArg]- typeOpts tag = concat [ map (\val -> '-':'-':drop (length tag) field++'=':val) (words content)- | (field,content) <- xList,- tag `isPrefixOf` field,- field /= (tag++"file")]- ++ [ "--tag=" ++ tag- | PackageIdentifier name (Version (major:minor:_) _) <- cPkgs- , let name' = filter isAlpha (display name)- , tag <- name'- : [ name' ++ "-" ++ show major ++ "." ++ show digit- | digit <- [0,2..minor] ]- ]-- signalsOpts :: [ProgArg]- signalsOpts = concat [ map (\val -> '-':'-':drop 10 field++'=':val) (words content)- | (field,content) <- xList,- "x-signals-" `isPrefixOf` field,- field /= "x-signals-file"]-- genFile :: Program -> [ProgArg] -> FilePath -> IO ()- genFile prog args outFile = do- res <- rawSystemProgramStdoutConf verb prog (withPrograms lbi) args- rewriteFile outFile res-- (flip mapM_) (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $- \(fileTag, f) -> do- let tag = reverse (drop 4 (reverse fileTag))- info verb ("Ensuring that class hierarchy in "++f++" is up-to-date.")- genFile typeGenProgram (typeOpts tag) f-- case lookup "x-signals-file" xList of- Nothing -> return ()- Just f -> do- info verb ("Ensuring that callback hooks in "++f++" are up-to-date.")- genFile signalGenProgram signalsOpts f----FIXME: Cabal should tell us the selected pkg-config package versions in the--- LocalBuildInfo or equivalent.--- In the mean time, ask pkg-config again.--getPkgConfigPackages :: Verbosity -> LocalBuildInfo -> PackageDescription -> IO [PackageId]-getPkgConfigPackages verbosity lbi pkg =- sequence- [ do version <- pkgconfig ["--modversion", display pkgname]- case simpleParse version of- Nothing -> die $ "parsing output of pkg-config --modversion failed"- Just v -> return (PackageIdentifier pkgname v)- | Dependency pkgname _ <- concatMap pkgconfigDepends (allBuildInfo pkg) ]- where- pkgconfig = rawSystemProgramStdoutConf verbosity- pkgConfigProgram (withPrograms lbi)----------------------------------------------------------------------------------- Dependency calculation amongst .chs files.----------------------------------------------------------------------------------- Given all files of the package, find those that end in .chs and extract the--- .chs files they depend upon. Then return the PackageDescription with these--- files rearranged so that they are built in a sequence that files that are--- needed by other files are built first.-fixDeps :: PackageDescription -> IO PackageDescription-fixDeps pd@PD.PackageDescription {- PD.library = Just lib@PD.Library {- PD.exposedModules = expMods,- PD.libBuildInfo = bi@PD.BuildInfo {- PD.hsSourceDirs = srcDirs,- PD.otherModules = othMods- }}} = do- let findModule m = findFileWithExtension [".chs.pp",".chs"] srcDirs- (joinPath (components m))- mExpFiles <- mapM findModule expMods- mOthFiles <- mapM findModule othMods-- -- tag all exposed files with True so we throw an error if we need to build- -- an exposed module before an internal modules (we cannot express this)- let modDeps = zipWith (ModDep True []) expMods mExpFiles++- zipWith (ModDep False []) othMods mOthFiles- modDeps <- mapM extractDeps modDeps- let (expMods, othMods) = span mdExposed $ sortTopological modDeps- badOther = map (fromMaybe "<no file>" . mdLocation) $- filter (not . mdExposed) expMods- unless (null badOther) $- die ("internal chs modules "++intercalate "," badOther++- " depend on exposed chs modules; cabal needs to build internal modules first")- return pd { PD.library = Just lib {- PD.exposedModules = map mdOriginal expMods,- PD.libBuildInfo = bi { PD.otherModules = map mdOriginal othMods }- }}--data ModDep = ModDep {- mdExposed :: Bool,- mdRequires :: [ModuleName],- mdOriginal :: ModuleName,- mdLocation :: Maybe FilePath-}--instance Show ModDep where- show x = show (mdLocation x)--instance Eq ModDep where- ModDep { mdOriginal = m1 } == ModDep { mdOriginal = m2 } = m1==m2-instance Ord ModDep where- compare ModDep { mdOriginal = m1 } ModDep { mdOriginal = m2 } = compare m1 m2---- Extract the dependencies of this file. This is intentionally rather naive as it--- ignores CPP conditionals. We just require everything which means that the--- existance of a .chs module may not depend on some CPP condition. -extractDeps :: ModDep -> IO ModDep-extractDeps md@ModDep { mdLocation = Nothing } = return md-extractDeps md@ModDep { mdLocation = Just f } = withUTF8FileContents f $ \con -> do- let findImports acc (('{':'#':xs):xxs) = case (dropWhile ((==) ' ') xs) of- ('i':'m':'p':'o':'r':'t':' ':ys) ->- case simpleParse (takeWhile ((/=) '#') ys) of- Just m -> findImports (m:acc) xxs - Nothing -> die ("cannot parse chs import in "++f++":\n"++- "offending line is {#"++xs)- -- no more imports after the first non-import hook- _ -> return acc- findImports acc (_:xxs) = findImports acc xxs- findImports acc [] = return acc- mods <- findImports [] (lines con)- return md { mdRequires = mods }---- Find a total order of the set of modules that are partially sorted by their--- dependencies on each other. The function returns the sorted list of modules--- together with a list of modules that are required but not supplied by this--- in the input set of modules.-sortTopological :: [ModDep] -> [ModDep]-sortTopological ms = reverse $ fst $ foldl visit ([], S.empty) (map mdOriginal ms)- where- set = M.fromList (map (\m -> (mdOriginal m, m)) ms)- visit (out,visited) m- | m `S.member` visited = (out,visited)- | otherwise = case m `M.lookup` set of- Nothing -> (out, m `S.insert` visited)- Just md -> (md:out', visited')- where- (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md)
Setup.hs view
@@ -1,6 +1,7 @@--- Setup file for a Gtk2Hs module. Contains only adjustments specific to this module,--- all Gtk2Hs-specific boilerplate is stored in Gtk2HsSetup.hs which should be kept--- identical across all modules.+-- Adjustments specific to this package,+-- all Gtk2Hs-specific boilerplate is kept in+-- gtk2hs-buildtools:Gtk2HsSetup+-- import Gtk2HsSetup ( gtk2hsUserHooks ) import Distribution.Simple ( defaultMainWithHooks )
demo/actionMenu/ActionMenu.hs view
@@ -1,5 +1,13 @@+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE OverloadedStrings #-} import Graphics.UI.Gtk+import Data.Text (Text) +-- A function like this can be used to tag string literals for i18n.+-- It also avoids a lot of type annotations.+__ :: Text -> Text+__ = id -- Replace with getText from the hgettext package in localised versions+ uiDef = "<ui>\ \ <menubar>\@@ -34,65 +42,65 @@ \ <separator/>\ \ </placeholder>\ \ </toolbar>\- \</ui>"+ \</ui>" :: Text main = do initGUI -- Create the menus- fileAct <- actionNew "FileAction" "File" Nothing Nothing- editAct <- actionNew "EditAction" "Edit" Nothing Nothing+ fileAct <- actionNew "FileAction" (__"File") Nothing Nothing+ editAct <- actionNew "EditAction" (__"Edit") Nothing Nothing -- Create menu items- newAct <- actionNew "NewAction" "New"- (Just "Clear the spreadsheet area.")- (Just stockNew)- newAct `onActionActivate` putStrLn "New activated."- openAct <- actionNew "OpenAction" "Open"- (Just "Open an existing spreadsheet.")- (Just stockOpen)- openAct `onActionActivate` putStrLn "Open activated."- saveAct <- actionNew "SaveAction" "Save"- (Just "Save the current spreadsheet.")- (Just stockSave)- saveAct `onActionActivate` putStrLn "Save activated."- saveAsAct <- actionNew "SaveAsAction" "SaveAs"- (Just "Save spreadsheet under new name.")- (Just stockSaveAs)- saveAsAct `onActionActivate` putStrLn "SaveAs activated."- exitAct <- actionNew "ExitAction" "Exit"- (Just "Exit this application.")- (Just stockSaveAs)- exitAct `onActionActivate` mainQuit - cutAct <- actionNew "CutAction" "Cut"- (Just "Cut out the current selection.")- (Just stockCut)- cutAct `onActionActivate` putStrLn "Cut activated."- copyAct <- actionNew "CopyAction" "Copy"- (Just "Copy the current selection.")- (Just stockCopy)- copyAct `onActionActivate` putStrLn "Copy activated."- pasteAct <- actionNew "PasteAction" "Paste"- (Just "Paste the current selection.")- (Just stockPaste)- pasteAct `onActionActivate` putStrLn "Paste activated."- - standardGroup <- actionGroupNew "standard"+ newAct <- actionNew "NewAction" (__"New")+ (Just (__"Clear the spreadsheet area."))+ (Just stockNew)+ on newAct actionActivated $ putStrLn "New activated."+ openAct <- actionNew "OpenAction" (__"Open")+ (Just (__"Open an existing spreadsheet."))+ (Just stockOpen)+ on openAct actionActivated $ putStrLn "Open activated."+ saveAct <- actionNew "SaveAction" (__"Save")+ (Just (__"Save the current spreadsheet."))+ (Just stockSave)+ on saveAct actionActivated $ putStrLn "Save activated."+ saveAsAct <- actionNew "SaveAsAction" (__"SaveAs")+ (Just (__"Save spreadsheet under new name."))+ (Just stockSaveAs)+ on saveAsAct actionActivated $ putStrLn "SaveAs activated."+ exitAct <- actionNew "ExitAction" (__"Exit")+ (Just (__"Exit this application."))+ (Just stockSaveAs)+ on exitAct actionActivated $ mainQuit+ cutAct <- actionNew "CutAction" (__"Cut")+ (Just (__"Cut out the current selection."))+ (Just stockCut)+ on cutAct actionActivated $ putStrLn "Cut activated."+ copyAct <- actionNew "CopyAction" (__"Copy")+ (Just (__"Copy the current selection."))+ (Just stockCopy)+ on copyAct actionActivated $ putStrLn "Copy activated."+ pasteAct <- actionNew "PasteAction" (__"Paste")+ (Just (__"Paste the current selection."))+ (Just stockPaste)+ on pasteAct actionActivated $ putStrLn "Paste activated."++ standardGroup <- actionGroupNew ("standard"::Text) mapM_ (actionGroupAddAction standardGroup) [fileAct, editAct]- mapM_ (\act -> actionGroupAddActionWithAccel standardGroup act Nothing)+ mapM_ (\act -> actionGroupAddActionWithAccel standardGroup act (Nothing::Maybe Text)) [newAct, openAct, saveAct, saveAsAct, exitAct, cutAct, copyAct, pasteAct]- + ui <- uiManagerNew mid <- uiManagerAddUiFromString ui uiDef uiManagerInsertActionGroup ui standardGroup 0 win <- windowNew- win `onDestroy` mainQuit- win `onSizeRequest` return (Requisition 200 100)- (Just menuBar) <- uiManagerGetWidget ui "/ui/menubar"- (Just toolBar) <- uiManagerGetWidget ui "/ui/toolbar"- - edit <- textViewNew + on win objectDestroy mainQuit+ on win sizeRequest $ return (Requisition 200 100)+ (Just menuBar) <- uiManagerGetWidget ui ("/ui/menubar"::Text)+ (Just toolBar) <- uiManagerGetWidget ui ("/ui/toolbar"::Text)++ edit <- textViewNew vBox <- vBoxNew False 0 set vBox [boxHomogeneous := False] boxPackStart vBox menuBar PackNatural 0
demo/buttonbox/ButtonBox.hs view
@@ -10,13 +10,11 @@ window <- windowNew -- Here we connect the "destroy" event to a signal handler.- -- This event occurs when we call widgetDestroy on the window,- -- or if the user closes the window.- window `onDestroy` mainQuit+ on window objectDestroy mainQuit -- Sets the border width of the window. set window [ containerBorderWidth := 10 ]- + hbuttonbox <- hButtonBoxNew set window [ containerChild := hbuttonbox ]@@ -28,16 +26,16 @@ -- Add each button to the button box with the default packing and padding set hbuttonbox [ containerChild := button | button <- [button1, button2, button3] ]- + -- This sets button3 to be a so called 'secondary child'. When the layout- -- stlye is ButtonboxStart or ButtonboxEnd, the secondary children are- -- grouped seperately from the others. Resize the window to see the effect.+ -- style is ButtonboxStart or ButtonboxEnd, the secondary children are+ -- grouped separately from the others. Resize the window to see the effect. -- -- This is not interesting in itself but shows how to set child attributes. -- Note that the child attribute 'buttonBoxChildSecondary' takes the -- button box container child 'button3' as a parameter. set hbuttonbox [ buttonBoxLayoutStyle := ButtonboxStart- , buttonBoxChildSecondary button3 := True ]+ , buttonBoxChildSecondary button3 := True ] -- The final step is to display everything (the window and all the widgets -- contained within it)@@ -46,4 +44,3 @@ -- All Gtk+ applications must run the main event loop. Control ends here and -- waits for an event to occur (like a key press or mouse event). mainGUI-
demo/carsim/CarSim.hs view
@@ -4,9 +4,12 @@ -- license: public domain module Main where++import Control.Applicative+import Prelude+ import Data.Maybe import Graphics.UI.Gtk-import Graphics.UI.Gtk.Gdk.EventM import Graphics.Rendering.Cairo import Control.Monad import Data.IORef@@ -26,7 +29,8 @@ eventWindowSize = do dr <- eventWindow- (w,h) <- liftIO $ drawableGetSize dr+ w <- liftIO $ drawWindowGetWidth dr+ h <- liftIO $ drawWindowGetHeight dr return $ if w*h > 1 then (fromIntegral w, fromIntegral h) else (1,1)@@ -108,12 +112,12 @@ about = do ad <- aboutDialogNew- aboutDialogSetName ad "S.A.R.A.H."- aboutDialogSetVersion ad "1.0"- aboutDialogSetAuthors ad $ ["Maurício C. Antunes "- ++ "<mauricio.antunes@gmail.com>"]- aboutDialogSetComments ad $ "Software Automation of "- ++ "Road Automobile Headache"+ set ad [ aboutDialogName := "S.A.R.A.H."+ , aboutDialogVersion := "1.0"+ , aboutDialogAuthors := ["Maurício C. Antunes "+ ++ "<mauricio.antunes@gmail.com>"]+ , aboutDialogComments := "Software Automation of "+ ++ "Road Automobile Headache"] dialogRun ad widgetDestroy ad @@ -132,7 +136,7 @@ -- If 'resume' is called, 'step' will be called at small -- timesteps to update car data. If 'pause' is called, 'step'- -- calls are stoped. 'resume' is called at program startup,+ -- calls are stopped. 'resume' is called at program startup, -- and then the pause button alternates 'resume' and 'pause'. let step = do@@ -157,24 +161,24 @@ buttons <- do qr <- buttonNewFromStock stockClear- onClicked qr $ do+ on qr buttonActivated $ do (liftM length) getCars >>= setCars . newCarList getCurrentTime >>= setTimeStamp widgetQueueDraw drawingArea qp <- toggleButtonNewWithLabel stockMediaPause buttonSetUseStock qp True- onToggled qp $ do+ on qp toggled $ do p <- toggleButtonGetActive qp case p of True -> pause False -> resume qa <- buttonNewFromStock stockAbout- onClicked qa $ about+ on qa buttonActivated $ about qq <- buttonNewFromStock stockQuit- onClicked qq (do+ on qq buttonActivated (do widgetDestroy mainWindow mainQuit) @@ -184,11 +188,11 @@ containerAdd bb qa containerAdd bb qq return bb- + howMany <- do sc <- vScaleNewWithRange 1 40 1- afterRangeValueChanged sc $ do+ after sc valueChanged $ do v <- liftM floor $ rangeGetValue sc c <- getCars setCars $ newCarListFromList v c@@ -196,14 +200,14 @@ scaleSetValuePos sc PosTop scaleSetDigits sc 0- rangeSetUpdatePolicy sc UpdateDiscontinuous+-- rangeSetUpdatePolicy sc UpdateDiscontinuous rangeSetValue sc =<< liftM (fromIntegral . length) getCars al <- alignmentNew 0.5 0.5 0 1 alignmentSetPadding al 15 15 15 15 containerAdd al sc return al- + track <- do let dr = drawingArea@@ -220,23 +224,21 @@ on dr leaveNotifyEvent $ liftIO $ setJam Nothing >> return True - on dr exposeEvent $ do- (w,h) <- eventWindowSize- dw <- eventWindow- liftIO $ do- jam <- getJam- cars <- getCars- renderWithDrawable dw $ do- translate (w/2) (h/2)- scale (w/drawSide) (h/drawSide)- road2render jam cars- return True+ on dr draw $ do+ w <- liftIO $ (fromIntegral <$> widgetGetAllocatedWidth dr)+ h <- liftIO $ (fromIntegral <$> widgetGetAllocatedHeight dr)+ jam <- liftIO getJam+ cars <- liftIO getCars+ translate (w/2) (h/2)+ scale (w/drawSide) (h/drawSide)+ road2render jam cars+ -- return True af <- aspectFrameNew 0.5 0.5 (Just 1) frameSetShadowType af ShadowNone containerAdd af dr return af- + -- 'layout' is a widget that contains all interface elements -- properly arranged. @@ -249,8 +251,9 @@ boxPackStart hb vb PackGrow 0 return hb - windowSetTitle mainWindow "S.A.R.A.H."- windowSetDefaultSize mainWindow 400 400+ set mainWindow [ windowTitle := "S.A.R.A.H."+ , windowDefaultWidth := 400+ , windowDefaultHeight := 400 ] on mainWindow objectDestroy mainQuit containerAdd mainWindow layout widgetShowAll mainWindow
demo/concurrent/Progress.hs view
@@ -8,6 +8,8 @@ import Graphics.UI.Gtk +import Control.Applicative+import Prelude import Control.Concurrent main :: IO ()@@ -15,9 +17,9 @@ initGUI dia <- dialogNew dialogAddButton dia stockClose ResponseClose- contain <- dialogGetUpper dia+ contain <- castToBox <$> dialogGetContentArea dia pb <- progressBarNew- boxPackStartDefaults contain pb+ boxPackStart contain pb PackNatural 0 widgetShowAll dia forkIO (doTask pb)
demo/concurrent/ProgressThreadedRTS.hs view
@@ -10,20 +10,22 @@ import Graphics.UI.Gtk +import Control.Applicative+import Prelude import Control.Concurrent main :: IO () main = do - -- It is marked unsafe becuase it is your obligation to ensure you+ -- It is marked unsafe because it is your obligation to ensure you -- only call Gtk+ from one OS thread, or 'bad things' will happen. unsafeInitGUIForThreadedRTS dia <- dialogNew dialogAddButton dia stockClose ResponseClose- contain <- dialogGetUpper dia+ contain <- castToBox <$> dialogGetContentArea dia pb <- progressBarNew- boxPackStartDefaults contain pb+ boxPackStart contain pb PackNatural 0 widgetShowAll dia forkIO (doTask pb)
demo/demos.txt view
@@ -27,9 +27,11 @@ concurrent: Show how to let Haskell programs continue while the GUI is running. +embedded: You will need uzbl installed (http://uzbl.org/) to run the Uzbl demo.+ fastdraw: shows a palette of colors constantly changing (Example of a drawing graphics onto a canvas) -filechooser: examples of Save and Open dialogs.+filechooser: examples of Save and Open dialogs. requires the glade package fonts: shows info on all your installed fonts. @@ -91,6 +93,8 @@ Feature request: avoid svgviewer: user error (Pattern match failure in do expression at SvgViewer.hs:11:2-9) when not giving any parameter -treelist: some examples showing how to use ListView and TreeView widgets+textdrop: a minimal sample program showing how to become a drag-n-drop destination++treelist: some examples showing how to use ListView and TreeView widgets; requires the glade package unicode: Example of an international dialog box (in arabic)
demo/embedded/Embedded.hs view
@@ -1,7 +1,7 @@ -- Use GtkSocket and GtkPlug for cross-process embedded. -- Just startup program, press 'm' to create tab with new button.--- Click button for hang to simulate plug hanging process, --- but socket process still running, can switch to other tab. +-- Click button for hang to simulate plug hanging process,+-- but socket process still running, can switch to other tab. module Main where @@ -12,6 +12,7 @@ import Control.Monad import Control.Monad.Trans import Control.Concurrent+import Data.Text (unpack) import Graphics.UI.Gtk import Graphics.UI.Gtk.Gdk.DrawWindow@@ -27,10 +28,10 @@ -- Entry plug main when have two arguments. [id] -> plugMain (toNativeWindowId $ read id :: NativeWindowId) -- get GtkSocket id -- Othersise entry socket main when no arguments.- _ -> socketMain - + _ -> socketMain+ -- | GtkSocekt main.-socketMain :: IO () +socketMain :: IO () socketMain = do initGUI @@ -38,8 +39,8 @@ window <- windowNew windowSetPosition window WinPosCenter windowSetDefaultSize window 600 400- windowSetTitle window "Press `m` to new tab, press `q` exit."- window `onDestroy` mainQuit+ set window [windowTitle := "Press `m` to new tab, press `q` exit."]+ on window objectDestroy mainQuit -- Create notebook to contain GtkSocekt. notebook <- notebookNew@@ -48,8 +49,8 @@ -- Handle key press. window `on` keyPressEvent $ tryEvent $ do keyName <- eventKeyName- liftIO $ - case keyName of+ liftIO $+ case unpack keyName of "m" -> do -- Create new GtkSocket. socket <- socketNew@@ -57,9 +58,9 @@ notebookAppendPage notebook socket "Tab" -- add to GtkSocekt notebook id <- socketGetId socket -- get GtkSocket id - -- Fork process to add GtkPlug into GtkSocekt. + -- Fork process to add GtkPlug into GtkSocekt. path <- liftM2 (</>) getCurrentDirectory getProgName -- get program full path- runCommand $ path ++ " " ++ (show $ fromNativeWindowId id) -- don't use `forkProcess` + runCommand $ path ++ " " ++ (show $ fromNativeWindowId id) -- don't use `forkProcess` return () "q" -> mainQuit -- quit @@ -73,14 +74,14 @@ initGUI plug <- plugNew $ Just id- plug `onDestroy` mainQuit- + on plug objectDestroy $ mainQuit+ button <- buttonNewWithLabel "Click me to hang." plug `containerAdd` button -- Simulate a plugin hanging to see if it blocks the outer process.- button `onClicked` threadDelay 5000000- + on button buttonActivated $ threadDelay 5000000+ widgetShowAll plug- + mainGUI
+ demo/embedded/MPlayer.hs view
@@ -0,0 +1,78 @@+-- | MPlayer client demo+-- Author : Andy Stewart+-- Copyright : (c) 2010 Andy Stewart <lazycat.manatee@gmail.com>++module Main where++import Control.Applicative+import Control.Concurrent+import Control.Concurrent.STM+import Control.Monad+import Control.Monad.Trans+import Graphics.UI.Gtk+import System.Exit+import System.IO+import System.Process+import System.Environment+import Text.Printf++main :: IO ()+main = do+ args <- getArgs+ case args of+ [filepath] -> do+ initGUI++ mainWindow <- windowNew+ windowSetDefaultSize mainWindow 800 450+ windowSetPosition mainWindow WinPosCenter++ mplayer <- mplayerNew+ mplayerStick mplayer (toContainer mainWindow)++ mainWindow `afterShow` do+ mplayerRun mplayer filepath++ mainWindow `onDestroy` do+ mplayerQuit mplayer+ mainQuit++ return ()++ widgetShowAll mainWindow++ mainGUI+ _ -> putStrLn "Usage : mplayer file"++data MPlayer =+ MPlayer {mplayerWidget :: DrawingArea+ ,mplayerHandle :: TVar (Maybe (Handle, Handle, Handle, ProcessHandle))}++mplayerNew :: IO MPlayer+mplayerNew =+ MPlayer <$> drawingAreaNew+ <*> newTVarIO Nothing++mplayerStick :: MPlayer -> Container -> IO ()+mplayerStick (MPlayer {mplayerWidget = mWidget}) container = do+ widgetShowAll mWidget+ container `containerAdd` mWidget++mplayerRun :: MPlayer -> FilePath -> IO ()+mplayerRun (MPlayer {mplayerWidget = mWidget+ ,mplayerHandle = mHandle}) filepath = do+ drawWindow <- widgetGetDrawWindow mWidget -- you just can get DrawWindow after widget realized+ wid <- liftM fromNativeWindowId $ drawableGetID drawWindow+ handle <- runInteractiveCommand $ printf "mplayer %s -slave -wid %d" filepath (wid :: Int)+ writeTVarIO mHandle (Just handle)++mplayerQuit :: MPlayer -> IO ()+mplayerQuit MPlayer {mplayerHandle = mHandle} = do+ handle <- readTVarIO mHandle+ case handle of+ Just (inp, _, _, _) -> hPutStrLn inp "quit"+ Nothing -> return ()++-- | The IO version of `writeTVar`.+writeTVarIO :: TVar a -> a -> IO ()+writeTVarIO a b = atomically $ writeTVar a b
demo/embedded/Uzbl.hs view
@@ -1,9 +1,9 @@ -- | This is program use uzbl embedded in window to render webpage.--- Just simple model demo for view, haven't handle event or else. +-- Just simple model demo for view, haven't handle event or else. -- -- You need install uzbl (git clone git://github.com/Dieterbe/uzbl.git) first.--- --- How to use: +--+-- How to use: -- ./Uzbl default open Google page. -- ./Uzbl url will open url you input --@@ -11,13 +11,13 @@ import Graphics.UI.Gtk import System.Process-import System.Environment +import System.Environment main :: IO () main = do -- Init. initGUI- + -- Get program arguments. args <- getArgs let url = case args of@@ -29,7 +29,7 @@ windowSetDefaultSize window 900 600 windowSetPosition window WinPosCenter windowSetOpacity window 0.8 -- this function need window-manager support Alpha channel in X11- + -- Create socket. socket <- socketNew widgetShow socket -- must show before add to parent
demo/fastdraw/FastDraw.hs view
@@ -1,94 +1,81 @@+{-# LANGUAGE ScopedTypeVariables #-} {-# OPTIONS -O #-} -- Example of an drawing graphics onto a canvas. import Graphics.UI.Gtk-import Graphics.UI.Gtk.Gdk.GC -import Data.Array.MArray-import Data.Word+import Control.Applicative+import Prelude import Data.IORef-import Control.Monad ( when )-import Control.Monad.Trans ( liftIO )-import Data.Array.Base ( unsafeWrite ) +import Graphics.Rendering.Cairo+import Foreign (allocaArray)+import Graphics.Rendering.Cairo.Types (PixelData)+import Foreign.Storable (Storable(..))+import Foreign.C (CUChar) main = do initGUI dia <- dialogNew dialogAddButton dia stockOk ResponseOk- contain <- dialogGetUpper dia+ contain <- castToBox <$> dialogGetContentArea dia canvas <- drawingAreaNew- canvas `on` sizeRequest $ return (Requisition 256 256)+ let w = 256+ h = 256+ chan = 4+ row = w * chan+ stride = row+ widgetSetSizeRequest canvas 256 256 -- create the Pixbuf- pb <- pixbufNew ColorspaceRgb False 8 256 256- pbData <- (pixbufGetPixels pb :: IO (PixbufData Int Word8))- row <- pixbufGetRowstride pb- chan <- pixbufGetNChannels pb- bits <- pixbufGetBitsPerSample pb- putStrLn ("bytes per row: "++show row++", channels per pixel: "++show chan++- ", bits per sample: "++show bits)+ allocaArray (w * h * chan) $ \ pbData -> do -- draw into the Pixbuf- doFromTo 0 255 $ \y ->- doFromTo 0 255 $ \x -> do- writeArray pbData (x*chan+y*row) (fromIntegral x)- writeArray pbData (1+x*chan+y*row) (fromIntegral y)- writeArray pbData (2+x*chan+y*row) 0+ doFromTo 0 (h-1) $ \y ->+ doFromTo 0 (w-1) $ \x -> do+ pokeByteOff pbData (2+x*chan+y*row) (fromIntegral x :: CUChar)+ pokeByteOff pbData (1+x*chan+y*row) (fromIntegral y :: CUChar)+ pokeByteOff pbData (0+x*chan+y*row) (0 :: CUChar) -- a function to update the Pixbuf- blueRef <- newIORef 0- dirRef <- newIORef True + blueRef <- newIORef (0 :: CUChar)+ dirRef <- newIORef True let updateBlue = do blue <- readIORef blueRef- --print blue- doFromTo 0 255 $ \y ->- doFromTo 0 255 $ \x ->- -- Here, writeArray was replaced with unsafeWrite. The latter does- -- not check that the index is within bounds which has a tremendous- -- effect on performance.- -- writeArray pbData (2+x*chan+y*row) blue -- safe checked indexing- unsafeWrite pbData (2+x*chan+y*row) blue -- unchecked indexing+ -- print blue+ doFromTo 0 (h-1) $ \y ->+ doFromTo 0 (w-1) $ \x ->+ pokeByteOff pbData (0+x*chan+y*row) blue -- unchecked indexing -- arrange for the canvas to be redrawn now that we've changed -- the Pixbuf- widgetQueueDraw canvas+ widgetQueueDraw canvas -- update the blue state ready for next time dir <- readIORef dirRef- let diff = 4- let blue' = if dir then blue+diff else blue-diff- if dir then- if blue<=maxBound-diff then writeIORef blueRef blue' else- writeIORef blueRef maxBound >> modifyIORef dirRef not - else- if blue>=minBound+diff then writeIORef blueRef blue' else- writeIORef blueRef minBound >> modifyIORef dirRef not - return True - + let diff = 1+ let blue' = if dir then blue+diff else blue-diff+ if dir then+ if blue<=maxBound-diff then writeIORef blueRef blue' else+ writeIORef blueRef maxBound >> modifyIORef dirRef not+ else+ if blue>=minBound+diff then writeIORef blueRef blue' else+ writeIORef blueRef minBound >> modifyIORef dirRef not+ return True+ idleAdd updateBlue priorityLow- canvas `on` exposeEvent $ updateCanvas pb- boxPackStartDefaults contain canvas+ canvas `on` draw $ updateCanvas pbData w h stride+ boxPackStart contain canvas PackGrow 0 widgetShow canvas dialogRun dia return () -updateCanvas :: Pixbuf -> EventM EExpose Bool-updateCanvas pb = do- win <- eventWindow- region <- eventRegion- liftIO $ do- gc <- gcNew win- width <- pixbufGetWidth pb- height <- pixbufGetHeight pb- pbregion <- regionRectangle (Rectangle 0 0 width height)- regionIntersect region pbregion- rects <- regionGetRectangles region--- putStrLn ("redrawing: "++show rects)- (flip mapM_) rects $ \(Rectangle x y w h) -> do- drawPixbuf win gc pb x y x y w h RgbDitherNone 0 0- return True- +updateCanvas :: PixelData -> Int -> Int -> Int -> Render ()+updateCanvas pb w h stride = do+ s <- liftIO $ createImageSurfaceForData pb FormatRGB24 w h stride+ setSourceSurface s 0 0+ paint+ -- GHC is much better at opimising loops like this: -- -- > doFromTo 0 255 $ \y ->
demo/filechooser/FileChooserDemo.glade view
@@ -1,28 +1,24 @@-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">--<glade-interface>--<widget class="GtkWindow" id="mainWindow">- <property name="border_width">10</property>- <property name="visible">True</property>- <property name="title" translatable="yes">File Chooser Demo</property>- <property name="type">GTK_WINDOW_TOPLEVEL</property>- <property name="window_position">GTK_WIN_POS_NONE</property>- <property name="modal">False</property>- <property name="resizable">True</property>- <property name="destroy_with_parent">False</property>-- <child>- <widget class="GtkVBox" id="vbox1">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkLabel" id="label1">- <property name="visible">True</property>- <property name="label" translatable="yes">This is a demo of the GtkFileChooser that was intoduced in Gtk+ 2.4+<?xml version="1.0"?>+<!--*- mode: xml -*-->+<interface>+ <object class="GtkWindow" id="mainWindow">+ <property name="border_width">10</property>+ <property name="visible">True</property>+ <property name="title" translatable="yes">File Chooser Demo</property>+ <property name="type">GTK_WINDOW_TOPLEVEL</property>+ <property name="window_position">GTK_WIN_POS_NONE</property>+ <property name="modal">False</property>+ <property name="resizable">True</property>+ <property name="destroy_with_parent">False</property>+ <child>+ <object class="GtkVBox" id="vbox1">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkLabel" id="label1">+ <property name="visible">True</property>+ <property name="label" translatable="yes">This is a demo of the GtkFileChooser that was intoduced in Gtk+ 2.4 The dialog has four modes: * open file (selects existing file)@@ -31,386 +27,357 @@ * create folder (selects existing or bew folder) The last demo show how you can install extra widgets or a preview widget in the file open dialog</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">True</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0</property>- <property name="xpad">10</property>- <property name="ypad">10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkHButtonBox" id="hbuttonbox1">- <property name="visible">True</property>- <property name="layout_style">GTK_BUTTONBOX_EDGE</property>- <property name="spacing">5</property>-- <child>- <widget class="GtkButton" id="openFileButton">- <property name="visible">True</property>- <property name="can_default">True</property>- <property name="can_focus">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>-- <child>- <widget class="GtkAlignment" id="alignment2">- <property name="visible">True</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xscale">0</property>- <property name="yscale">0</property>-- <child>- <widget class="GtkHBox" id="hbox2">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkImage" id="image2">- <property name="visible">True</property>- <property name="stock">gtk-open</property>- <property name="icon_size">4</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label3">- <property name="visible">True</property>- <property name="label" translatable="yes">Open File</property>- <property name="use_underline">True</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- </child>- </widget>- </child>- </widget>- </child>-- <child>- <widget class="GtkButton" id="saveFileButton">- <property name="visible">True</property>- <property name="can_default">True</property>- <property name="can_focus">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>-- <child>- <widget class="GtkAlignment" id="alignment1">- <property name="visible">True</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xscale">0</property>- <property name="yscale">0</property>-- <child>- <widget class="GtkHBox" id="hbox1">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkImage" id="image1">- <property name="visible">True</property>- <property name="stock">gtk-save-as</property>- <property name="icon_size">4</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label2">- <property name="visible">True</property>- <property name="label" translatable="yes">Save File</property>- <property name="use_underline">True</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- </child>- </widget>- </child>- </widget>- </child>-- <child>- <widget class="GtkButton" id="selectFolderButton">- <property name="visible">True</property>- <property name="can_default">True</property>- <property name="can_focus">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>-- <child>- <widget class="GtkAlignment" id="alignment4">- <property name="visible">True</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xscale">0</property>- <property name="yscale">0</property>-- <child>- <widget class="GtkHBox" id="hbox4">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkImage" id="image4">- <property name="visible">True</property>- <property name="stock">gtk-open</property>- <property name="icon_size">4</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label5">- <property name="visible">True</property>- <property name="label" translatable="yes">Select Folder</property>- <property name="use_underline">True</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- </child>- </widget>- </child>- </widget>- </child>-- <child>- <widget class="GtkButton" id="createFolderButton">- <property name="visible">True</property>- <property name="can_default">True</property>- <property name="can_focus">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>-- <child>- <widget class="GtkAlignment" id="alignment3">- <property name="visible">True</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xscale">0</property>- <property name="yscale">0</property>-- <child>- <widget class="GtkHBox" id="hbox3">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkImage" id="image3">- <property name="visible">True</property>- <property name="stock">gtk-open</property>- <property name="icon_size">4</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label4">- <property name="visible">True</property>- <property name="label" translatable="yes">Create Folder</property>- <property name="use_underline">True</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- </child>- </widget>- </child>- </widget>- </child>- </widget>- <packing>- <property name="padding">5</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkHButtonBox" id="hbuttonbox2">- <property name="visible">True</property>- <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>- <property name="spacing">5</property>-- <child>- <widget class="GtkButton" id="openFilePreviewButton">- <property name="visible">True</property>- <property name="can_default">True</property>- <property name="can_focus">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>-- <child>- <widget class="GtkAlignment" id="alignment5">- <property name="visible">True</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xscale">0</property>- <property name="yscale">0</property>-- <child>- <widget class="GtkHBox" id="hbox5">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkImage" id="image5">- <property name="visible">True</property>- <property name="stock">gtk-open</property>- <property name="icon_size">4</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label6">- <property name="visible">True</property>- <property name="label" translatable="yes">Open File (with preview)</property>- <property name="use_underline">True</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- </child>- </widget>- </child>- </widget>- </child>-- <child>- <widget class="GtkButton" id="quitButton">- <property name="visible">True</property>- <property name="can_default">True</property>- <property name="can_focus">True</property>- <property name="label">gtk-quit</property>- <property name="use_stock">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- </widget>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>- </widget>- </child>-</widget>--</glade-interface>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">True</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0</property>+ <property name="xpad">10</property>+ <property name="ypad">10</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkHButtonBox" id="hbuttonbox1">+ <property name="visible">True</property>+ <property name="layout_style">GTK_BUTTONBOX_EDGE</property>+ <property name="spacing">5</property>+ <child>+ <object class="GtkButton" id="openFileButton">+ <property name="visible">True</property>+ <property name="can_default">True</property>+ <property name="can_focus">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <child>+ <object class="GtkAlignment" id="alignment2">+ <property name="visible">True</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xscale">0</property>+ <property name="yscale">0</property>+ <child>+ <object class="GtkHBox" id="hbox2">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkImage" id="image2">+ <property name="visible">True</property>+ <property name="stock">gtk-open</property>+ <property name="icon_size">4</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label3">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Open File</property>+ <property name="use_underline">True</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+ </child>+ </object>+ </child>+ <child>+ <object class="GtkButton" id="saveFileButton">+ <property name="visible">True</property>+ <property name="can_default">True</property>+ <property name="can_focus">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <child>+ <object class="GtkAlignment" id="alignment1">+ <property name="visible">True</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xscale">0</property>+ <property name="yscale">0</property>+ <child>+ <object class="GtkHBox" id="hbox1">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkImage" id="image1">+ <property name="visible">True</property>+ <property name="stock">gtk-save-as</property>+ <property name="icon_size">4</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label2">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Save File</property>+ <property name="use_underline">True</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+ </child>+ </object>+ </child>+ <child>+ <object class="GtkButton" id="selectFolderButton">+ <property name="visible">True</property>+ <property name="can_default">True</property>+ <property name="can_focus">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <child>+ <object class="GtkAlignment" id="alignment4">+ <property name="visible">True</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xscale">0</property>+ <property name="yscale">0</property>+ <child>+ <object class="GtkHBox" id="hbox4">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkImage" id="image4">+ <property name="visible">True</property>+ <property name="stock">gtk-open</property>+ <property name="icon_size">4</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label5">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Select Folder</property>+ <property name="use_underline">True</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+ </child>+ </object>+ </child>+ <child>+ <object class="GtkButton" id="createFolderButton">+ <property name="visible">True</property>+ <property name="can_default">True</property>+ <property name="can_focus">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <child>+ <object class="GtkAlignment" id="alignment3">+ <property name="visible">True</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xscale">0</property>+ <property name="yscale">0</property>+ <child>+ <object class="GtkHBox" id="hbox3">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkImage" id="image3">+ <property name="visible">True</property>+ <property name="stock">gtk-open</property>+ <property name="icon_size">4</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label4">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Create Folder</property>+ <property name="use_underline">True</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+ </child>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">5</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkHButtonBox" id="hbuttonbox2">+ <property name="visible">True</property>+ <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>+ <property name="spacing">5</property>+ <child>+ <object class="GtkButton" id="openFilePreviewButton">+ <property name="visible">True</property>+ <property name="can_default">True</property>+ <property name="can_focus">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <child>+ <object class="GtkAlignment" id="alignment5">+ <property name="visible">True</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xscale">0</property>+ <property name="yscale">0</property>+ <child>+ <object class="GtkHBox" id="hbox5">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkImage" id="image5">+ <property name="visible">True</property>+ <property name="stock">gtk-open</property>+ <property name="icon_size">4</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label6">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Open File (with preview)</property>+ <property name="use_underline">True</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+ </child>+ </object>+ </child>+ <child>+ <object class="GtkButton" id="quitButton">+ <property name="visible">True</property>+ <property name="can_default">True</property>+ <property name="can_focus">True</property>+ <property name="label">gtk-quit</property>+ <property name="use_stock">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+</interface>
demo/filechooser/FileChooserDemo.hs view
@@ -1,40 +1,39 @@ module Main where -import Graphics.UI.Gtk-import Graphics.UI.Gtk.Glade+import Graphics.UI.Gtk hiding (response) main :: IO () main = do initGUI -- load up our main window- dialogXmlM <- xmlNew "FileChooserDemo.glade"- let dialogXml = case dialogXmlM of- (Just dialogXml) -> dialogXml- Nothing -> error $ "can't find the glade file \"FileChooserDemo.glade\""- ++ "in the current directory"+ gui <- builderNew+ builderAddFromFile gui "FileChooserDemo.glade" + mainWindow <- builderGetObject gui castToWindow "mainWindow"+ -- get a handle on a various objects from the glade file- mainWindow <- xmlGetWidget dialogXml castToWindow "mainWindow"- mainWindow `onDestroy` mainQuit- - -- and associate actions with the buttons- selectFolderButton <- xmlGetWidget dialogXml castToButton "selectFolderButton"+ on mainWindow objectDestroy mainQuit++ let onClicked obj = on obj buttonActivated++ -- -- and associate actions with the buttons+ selectFolderButton <- builderGetObject gui castToButton "selectFolderButton" selectFolderButton `onClicked` openSelectFolderDialog mainWindow - createFolderButton <- xmlGetWidget dialogXml castToButton "createFolderButton"+ createFolderButton <- builderGetObject gui castToButton "createFolderButton" createFolderButton `onClicked` openCreateFolderDialog mainWindow - openFileButton <- xmlGetWidget dialogXml castToButton "openFileButton"+ openFileButton <- builderGetObject gui castToButton "openFileButton" openFileButton `onClicked` openOpenFileDialog mainWindow - saveFileButton <- xmlGetWidget dialogXml castToButton "saveFileButton"+ saveFileButton <- builderGetObject gui castToButton "saveFileButton" saveFileButton `onClicked` openSaveFileDialog mainWindow - openFilePreviewButton <- xmlGetWidget dialogXml castToButton "openFilePreviewButton"+ openFilePreviewButton <- builderGetObject gui castToButton "openFilePreviewButton" openFilePreviewButton `onClicked` openFilePreviewDialog mainWindow - quitButton <- xmlGetWidget dialogXml castToButton "quitButton"+ quitButton <- builderGetObject gui castToButton "quitButton" quitButton `onClicked` (do widgetDestroy mainWindow mainQuit)@@ -48,16 +47,16 @@ openSelectFolderDialog parentWindow = do dialog <- fileChooserDialogNew (Just $ "Demo of the standard dialog "- ++ "to select an existing folder") --dialog title+ ++ "to select an existing folder") --dialog title (Just parentWindow) --the parent window- FileChooserActionSelectFolder --the kind of dialog we want- [("Yes, this new dialog looks nice" --The buttons to display- , ResponseAccept)- ,("Eugh! Take me away!"- ,ResponseCancel)]+ FileChooserActionSelectFolder --the kind of dialog we want+ [("Yes, this new dialog looks nice" --The buttons to display+ , ResponseAccept)+ ,("Eugh! Take me away!"+ ,ResponseCancel)] widgetShow dialog response <- dialogRun dialog- case response of + case response of ResponseAccept -> do Just fileName <- fileChooserGetFilename dialog putStrLn $ "you selected the folder " ++ show fileName ResponseCancel -> putStrLn "dialog canceled"@@ -68,16 +67,16 @@ openCreateFolderDialog parentWindow = do dialog <- fileChooserDialogNew (Just $ "Demo of the standard dialog to select "- ++ "a new folder (or existing) folder") --dialog title+ ++ "a new folder (or existing) folder") --dialog title (Just parentWindow) --the parent window- FileChooserActionCreateFolder --the kind of dialog we want- [("I want this new folder" --The buttons to display- , ResponseAccept)- ,("Bored now."- ,ResponseCancel)]+ FileChooserActionCreateFolder --the kind of dialog we want+ [("I want this new folder" --The buttons to display+ , ResponseAccept)+ ,("Bored now."+ ,ResponseCancel)] widgetShow dialog response <- dialogRun dialog- case response of + case response of ResponseAccept -> do Just fileName <- fileChooserGetFilename dialog putStrLn $ "you selected the folder " ++ show fileName ResponseCancel -> putStrLn "Getting bored?"@@ -88,17 +87,17 @@ openOpenFileDialog parentWindow = do dialog <- fileChooserDialogNew (Just $ "Demo of the standard dialog to select "- ++ "an existing file") --dialog title+ ++ "an existing file") --dialog title (Just parentWindow) --the parent window- FileChooserActionOpen --the kind of dialog we want- [("gtk-cancel" --The buttons to display- ,ResponseCancel)- ,("gtk-open" - , ResponseAccept)]+ FileChooserActionOpen --the kind of dialog we want+ [("gtk-cancel" --The buttons to display+ ,ResponseCancel)+ ,("gtk-open"+ , ResponseAccept)] widgetShow dialog response <- dialogRun dialog- case response of + case response of ResponseAccept -> do Just fileName <- fileChooserGetFilename dialog putStrLn $ "you selected the file " ++ show fileName ResponseCancel -> putStrLn "dialog canceled"@@ -109,16 +108,16 @@ openSaveFileDialog parentWindow = do dialog <- fileChooserDialogNew (Just $ "Demo of the standard dialog to select "- ++ "a new file") --dialog title+ ++ "a new file") --dialog title (Just parentWindow) --the parent window- FileChooserActionSave --the kind of dialog we want- [("gtk-cancel" --The buttons to display- ,ResponseCancel) --you can use stock buttons- ,("gtk-save"- , ResponseAccept)]+ FileChooserActionSave --the kind of dialog we want+ [("gtk-cancel" --The buttons to display+ ,ResponseCancel) --you can use stock buttons+ ,("gtk-save"+ , ResponseAccept)] widgetShow dialog response <- dialogRun dialog- case response of + case response of ResponseAccept -> do Just fileName <- fileChooserGetFilename dialog putStrLn $ "you called the new file " ++ show fileName ResponseCancel -> putStrLn "dialog canceled"@@ -129,23 +128,23 @@ openFilePreviewDialog parentWindow = do dialog <- fileChooserDialogNew (Just $ "Demo of the standard dialog to select "- ++ "a new file - with a preview widget") --dialog title+ ++ "a new file - with a preview widget") --dialog title (Just parentWindow) --the parent window- FileChooserActionOpen --the kind of dialog we want- [("_Yes, yes that's very clever" --The buttons to display- , ResponseAccept)- ,("_No, I'm not impressed"- ,ResponseCancel)]+ FileChooserActionOpen --the kind of dialog we want+ [("_Yes, yes that's very clever" --The buttons to display+ , ResponseAccept)+ ,("_No, I'm not impressed"+ ,ResponseCancel)] --create and set an extra widget checkButton <- checkButtonNewWithLabel "frobnicate this file" dialog `fileChooserSetExtraWidget` checkButton- + --create and set a preview widget previewLabel <- labelNew $ Just "Preview appears here" previewLabel `labelSetLineWrap` True dialog `fileChooserSetPreviewWidget` previewLabel- dialog `onUpdatePreview` do+ on dialog updatePreview $ do previewFile <- fileChooserGetPreviewFilename dialog previewLabel `labelSetText` case previewFile of Nothing -> "Preview appears here"@@ -154,10 +153,10 @@ widgetShow dialog response <- dialogRun dialog- case response of + case response of ResponseAccept -> do fileName <- fileChooserGetFilename dialog putStrLn $ "you selected the new file " ++ show fileName- + --check the state of the extra widget frobnicate <- toggleButtonGetActive checkButton putStrLn $ if frobnicate@@ -166,4 +165,3 @@ ResponseCancel -> putStrLn "you were not impressed" ResponseDeleteEvent -> putStrLn "dialog closed" widgetHide dialog-
demo/fonts/Fonts.hs view
@@ -12,9 +12,8 @@ mapM_ (\fc -> do sizes <- pangoFontFaceListSizes fc let showSize Nothing = "all sizes"- showSize (Just sz) = concat (intersperse ", " (map show sz))++- " points"+ showSize (Just sz) = concat (intersperse ", " (map show sz))+++ " points" putStrLn (" "++show fc++" in "++showSize sizes) ) fcs ) ffs-
demo/graphic/Drawing.hs view
@@ -39,8 +39,7 @@ } drawArc win gc False 0 0 width height (135*64) (90*64) - drawLayoutWithColors win gc 30 (height `div` 2) text + drawLayoutWithColors win gc 30 (height `div` 2) text (Just (Color 0 0 0)) Nothing return True-
demo/gtkbuilder/GtkBuilderTest.hs view
@@ -3,20 +3,20 @@ import Graphics.UI.Gtk main = do- initGUI- - -- Create the builder, and load the UI file- builder <- builderNew- builderAddFromFile builder "simple.ui"- - -- Retrieve some objects from the UI- window <- builderGetObject builder castToWindow "window1"- button <- builderGetObject builder castToButton "button1"- - -- Basic user interation- button `onClicked` putStrLn "button pressed!"- window `onDestroy` mainQuit- - -- Display the window- widgetShowAll window- mainGUI+ initGUI++ -- Create the builder, and load the UI file+ builder <- builderNew+ builderAddFromFile builder "simple.ui"++ -- Retrieve some objects from the UI+ window <- builderGetObject builder castToWindow "window1"+ button <- builderGetObject builder castToButton "button1"++ -- Basic user interaction+ on button buttonActivated $ putStrLn "button pressed!"+ on window objectDestroy mainQuit++ -- Display the window+ widgetShowAll window+ mainGUI
demo/hello/World.hs view
@@ -11,7 +11,7 @@ -- Here we connect the "destroy" event to a signal handler. -- This event occurs when we call widgetDestroy on the window -- or if the user closes the window.- onDestroy window mainQuit+ on window objectDestroy mainQuit -- Sets the border width and tile of the window. Note that border width -- attribute is in 'Container' from which 'Window' is derived. set window [ containerBorderWidth := 10, windowTitle := "Hello World" ]@@ -20,11 +20,11 @@ set button [ buttonLabel := "Hello World" ] -- When the button receives the "clicked" signal, it will call the -- function given as the second argument.- onClicked button (putStrLn "Hello World")+ on button buttonActivated (putStrLn "Hello World") -- Gtk+ allows several callbacks for the same event. -- This one will cause the window to be destroyed by calling -- widgetDestroy. The callbacks are called in the sequence they were added.- onClicked button $ do+ on button buttonActivated $ do putStrLn "A \"clicked\"-handler to say \"destroy\"" widgetDestroy window -- Insert the hello-world button into the window.
demo/inputmethod/Layout.hs view
@@ -1,9 +1,11 @@+{-# LANGUAGE OverloadedStrings #-} -- Example of using a PangoLayout import Data.IORef+import Data.Monoid ((<>))+import qualified Data.Text as T import Graphics.UI.Gtk-import Graphics.UI.Gtk.Gdk.EventM import Graphics.Rendering.Cairo loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit,\@@ -15,54 +17,54 @@ \ Excepteur sint occaecat cupidatat non proident, sunt in culpa\ \ qui officia deserunt mollit anim id est laborum." -data Buffer = Buffer String Int+data Buffer = Buffer T.Text Int -defaultBuffer = Buffer loremIpsum (length loremIpsum)+defaultBuffer = Buffer loremIpsum (T.length loremIpsum) displayBuffer (Buffer str pos) =- before ++ "<CURSOR>" ++ after- where (before,after) = splitAt pos str+ before <> "<CURSOR>" <> after+ where (before,after) = T.splitAt pos str displayBufferPreedit (Buffer str pos) preeditStr preeditPos =- before ++ "[" ++ prebefore ++ "<CURSOR>" ++ preafter ++ "]" ++ after- where (before,after) = splitAt pos str- (prebefore, preafter) = splitAt preeditPos preeditStr+ before <> "[" <> prebefore <> "<CURSOR>" <> preafter <> "]" <> after+ where (before,after) = T.splitAt pos str+ (prebefore, preafter) = T.splitAt preeditPos preeditStr -insertStr new (Buffer str pos) = Buffer (before++new++after) (pos+length new)- where (before,after) = splitAt pos str+insertStr new (Buffer str pos) = Buffer (before<>new<>after) (pos+T.length new)+ where (before,after) = T.splitAt pos str deleteChar b@(Buffer str 0) = b-deleteChar (Buffer str pos) = Buffer (init before ++ after) (pos-1)- where (before,after) = splitAt pos str+deleteChar (Buffer str pos) = Buffer (T.init before <> after) (pos-1)+ where (before,after) = T.splitAt pos str moveLeft b@(Buffer str pos) | pos==0 = b | otherwise = Buffer str (pos-1) -moveRight b@(Buffer str pos) | pos==length str = b+moveRight b@(Buffer str pos) | pos==T.length str = b | otherwise = Buffer str (pos+1) main = do initGUI- + -- Create the main window. win <- windowNew on win objectDestroy mainQuit -- Create a drawing area in which we can render text. area <- drawingAreaNew containerAdd win area- on area sizeRequest $ return (Requisition 100 100)- + widgetSetSizeRequest area 100 100+ -- Our widget's data buffer <- newIORef defaultBuffer preeditRef <- newIORef Nothing- + -- Create a Cairo Context that contains information about the current font, -- etc. ctxt <- cairoCreateContext Nothing lay <- layoutEmpty ctxt layoutSetWrap lay WrapWholeWords- + let relayout = do buffer@(Buffer _ cursor) <- readIORef buffer preedit <- readIORef preeditRef@@ -75,19 +77,19 @@ layoutSetAttributes lay (map (shiftAttribute (cursor + 1)) (concat attrs)) widgetQueueDraw area- + relayout- + -- Wrap the layout to a different width each time the window is resized. on area sizeAllocate $ \(Rectangle _ _ w _) -> layoutSetWidth lay (Just (fromIntegral w))- + -- Setup the handler to draw the layout.- on area exposeEvent $ updateArea area lay- + on area draw $ updateArea area lay+ -- Set up input method im <- imMulticontextNew- + on im imContextPreeditStart $ do writeIORef preeditRef (Just ("",[],0)) relayout@@ -107,9 +109,9 @@ on im imContextDeleteSurrounding' $ \off nchars -> do putStrLn $ "delete-surrounding("++show off++","++show nchars++")" return False- + on win realize $ do- imContextSetClientWindow im . Just =<< widgetGetDrawWindow win+ imContextSetClientWindow im =<< widgetGetWindow win on win focusInEvent $ liftIO (imContextFocusIn im) >> return False on win focusOutEvent $ liftIO (imContextFocusOut im) >> return False on win keyReleaseEvent $ imContextFilterKeypress im@@ -120,20 +122,15 @@ case mod of Just f -> liftIO $ modifyIORef buffer f >> relayout >> return True Nothing -> return False- + widgetShowAll win mainGUI -updateArea :: DrawingArea -> PangoLayout -> EventM EExpose Bool+updateArea :: DrawingArea -> PangoLayout -> Render () updateArea area lay = do- win <- eventWindow- liftIO $ do- renderWithDrawable win $ do moveTo 0 0 showLayout lay - return True- interpretKeyPress :: EventM EKey (Maybe (Buffer -> Buffer)) interpretKeyPress = do modifiers <- eventModifier@@ -145,7 +142,7 @@ -- This does not appear to get called; the IM handles -- unmodified keypresses. liftIO $ putStrLn "Literal character not handled by IM"- returnJust (insertStr [ch])+ returnJust (insertStr $ T.singleton ch) Nothing -> do case keyName of "Left" -> returnJust moveLeft
@@ -1,32 +1,33 @@+{-# LANGUAGE OverloadedStrings #-} module Main where import Graphics.UI.Gtk-import Control.Concurrent.MVar-import Control.Monad ( liftM )-import Data.Maybe ( fromMaybe ) import Data.List ( findIndex )-+import Control.Monad.IO.Class (MonadIO(..))+import qualified Data.Text as T main = do initGUI win <- windowNew- onDestroy win mainQuit + on win deleteEvent $ liftIO mainQuit >> return False - combo <- comboBoxEntryNewText+ combo <- comboBoxNewWithEntry+ comboBoxSetModelText combo+ mapM_ (comboBoxAppendText combo)- (words "ice-cream turkey pasta sandwich steak")+ (T.words "ice-cream turkey pasta sandwich steak") -- select the first item comboBoxSetActive combo 0- + -- Get the entry widget that the ComboBoxEntry uses. (Just w) <- binGetChild combo let entry = castToEntry w- + -- Whenever the user has completed editing the text, append the new -- text to the store unless it's already in there.- onEntryActivate entry $ do+ on entry entryActivated $ do str <- entryGetText entry store <- comboBoxGetModelText combo elems <- listStoreToList store@@ -38,6 +39,6 @@ return () containerAdd win combo- + widgetShowAll win- mainGUI + mainGUI
@@ -13,6 +13,6 @@ HC_RULE = $(HC) --make $< -o $@ $(HCFLAGS) clean:- rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROG)+ rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROGS) HC=ghc
@@ -41,8 +41,8 @@ = do item <- menuItemNewWithLabelOrMnemonic name menuShellAppend menu item case action of- Just act -> onActivateLeaf item act- Nothing -> onActivateLeaf item (return ())+ Just act -> on item menuItemActivate act+ Nothing -> on item menuItemActivate (return ()) menuItemNewWithLabelOrMnemonic name | elem '_' name = menuItemNewWithMnemonic name | otherwise = menuItemNewWithLabel name@@ -65,6 +65,6 @@ set window [ windowTitle := "Demo" , containerChild := menuBar ]- onDestroy window mainQuit+ on window objectDestroy mainQuit widgetShowAll window mainGUI
+ demo/notebook/Makefile view
@@ -0,0 +1,15 @@++PROGS = notebook+SOURCES = Notebook.hs++all : $(PROGS)++notebook : Notebook.hs+ $(HC_RULE)++HC_RULE = $(HC) --make $< -o $@ $(HCFLAGS)++clean:+ rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROGS)++HC=ghc
+ demo/notebook/Notebook.hs view
@@ -0,0 +1,145 @@+{-# LANGUAGE OverloadedStrings #-}+-- | Notebook demo (include Spinner animation).+-- Author : Andy Stewart+-- Copyright : (c) 2010 Andy Stewart <lazycat.manatee@gmail.com>++module Main where++import Control.Monad+import Control.Monad.IO.Class+import Data.Maybe+import Data.Text (Text)+import Data.Monoid ((<>))+import Graphics.UI.Gtk+import qualified Data.Text as T (unpack)++data NotebookTab =+ NotebookTab {ntBox :: HBox+ ,ntSpinner :: Spinner+ ,ntLabel :: Label+ ,ntCloseButton :: ToolButton+ ,ntSize :: Int}++-- | Main+main :: IO ()+main = do+ -- Init.+ initGUI++ -- Create window and notebook.+ window <- windowNew+ notebook <- notebookNew++ -- Set window.+ windowSetDefaultSize window 800 600+ windowSetPosition window WinPosCenter+ set window [windowTitle := ("Press Ctrl + n to create new tab."::Text)]++ -- Handle key press action.+ window `on` keyPressEvent $ tryEvent $ do+ -- Create new tab when user press Ctrl+n+ [Control] <- eventModifier+ "n" <- eventKeyName+ liftIO $ do+ -- Create text view.+ textView <- textViewNew+ widgetShowAll textView -- must show before add notebook,+ -- otherwise notebook won't display child widget+ -- even have add in notebook.++ -- Create notebook tab.+ tab <- notebookTabNew (Just "Cool tab") Nothing+ menuLabel <- labelNew (Nothing :: Maybe Text)++ -- Add widgets in notebook.+ notebookAppendPageMenu notebook textView (ntBox tab) menuLabel++ -- Start spinner animation when create tab.+ notebookTabStart tab++ -- Stop spinner animation after finish load.+ timeoutAdd (notebookTabStop tab >> return False) 5000++ -- Close tab when click button.+ ntCloseButton tab `onToolButtonClicked` do+ index <- notebookPageNum notebook textView+ index ?>= \i -> notebookRemovePage notebook i++ return ()++ -- Show window.+ window `containerAdd` notebook+ widgetShowAll window+ on window objectDestroy mainQuit+ mainGUI++-- | Create notebook tab.+notebookTabNew :: Maybe Text -> Maybe Int -> IO NotebookTab+notebookTabNew name size = do+ -- Init.+ let iconSize = fromMaybe 12 size+ box <- hBoxNew False 0+ spinner <- spinnerNew+ label <- labelNew name+ image <- imageNewFromIcon "window-close" iconSize+ closeButton <- toolButtonNew (Just image) (Nothing::Maybe Text)++ -- Show.+ boxPackStart box label PackNatural 0+ boxPackStart box closeButton PackNatural 0+ widgetShowAll box++ return $ NotebookTab box spinner label closeButton iconSize++-- | Set tab name.+notebookTabSetName :: NotebookTab -> Text -> IO ()+notebookTabSetName tab =+ labelSetText (ntLabel tab)++-- | Start spinner animation.+notebookTabStart :: NotebookTab -> IO ()+notebookTabStart NotebookTab {ntBox = box+ ,ntSpinner = spinner+ ,ntSize = size} = do+ boxTryPack box spinner PackNatural (Just 0) (size `div` 2)+ spinnerStart spinner+ widgetShow spinner++-- | Stop spinner animation.+notebookTabStop :: NotebookTab -> IO ()+notebookTabStop NotebookTab {ntBox = box+ ,ntSpinner = spinner} = do+ containerTryRemove box spinner+ spinnerStop spinner++-- | Create image widget with given icon name and size.+imageNewFromIcon :: Text -> Int -> IO Image+imageNewFromIcon iconName size = do+ iconTheme <- iconThemeGetDefault+ pixbuf <- do+ -- Function 'iconThemeLoadIcon' can scale icon with specified size.+ pixbuf <- iconThemeLoadIcon iconTheme iconName size IconLookupUseBuiltin+ case pixbuf of+ Just p -> return p+ Nothing -> error $ "imageNewFromIcon : search icon " <> T.unpack iconName <> " failed."+ imageNewFromPixbuf pixbuf++-- | Try to packing widget in box.+-- If @child@ have exist parent, do nothing,+-- otherwise, add @child@ to @parent@.+boxTryPack :: (BoxClass parent, WidgetClass child) => parent -> child -> Packing -> Maybe Int -> Int -> IO ()+boxTryPack box widget packing order space = do+ parent <- widgetGetParent widget+ when (isNothing parent) $ do+ boxPackStart box widget packing space+ order ?>= boxReorderChild box widget++-- | Try to remove child from parent.+containerTryRemove :: (ContainerClass parent, WidgetClass child) => parent -> child -> IO ()+containerTryRemove parent widget = do+ hasParent <- widgetGetParent widget+ unless (isNothing hasParent) $ containerRemove parent widget++-- | Maybe.+(?>=) :: Monad m => Maybe a -> (a -> m ()) -> m ()+m ?>= f = maybe (return ()) f m
demo/statusicon/StatusIcon.hs view
@@ -1,30 +1,26 @@ -- 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"+ statusIconSetTooltipText icon $ Just "This is a test" menu <- mkmenu icon- I.onPopupMenu icon $ \b a -> do + on icon statusIconPopupMenu $ \b a -> do widgetShowAll menu print (b,a) menuPopup menu $ maybe Nothing (\b' -> Just (b',a)) b- I.onActivate icon $ do+ on icon statusIconActivate $ do putStrLn "'activate' signal triggered" mainGUI -mkmenu s = do +mkmenu s = do m <- menuNew- mapM_ (mkitem m) [("Let's blink!",statusIconSetBlinking s True)- ,("Let's stop blink!",statusIconSetBlinking s False)- ,("Quit",mainQuit)] + mapM_ (mkitem m) [("Quit",mainQuit)] return m where- mkitem menu (label,act) = + mkitem menu (label,act) = do i <- menuItemNewWithLabel label menuShellAppend menu i- i `onActivateLeaf` act+ on i menuItemActivated act
− demo/treeList/Completion.hs
@@ -1,82 +0,0 @@--- Demo to show off entry completion.--import Graphics.UI.Gtk-import Data.Char-import Data.List--data ColorDesc = ColorDesc {- cdColor :: Color,- cdName :: String- } deriving Show--compareCol :: ColumnId ColorDesc String-compareCol = makeColumnIdString 0--invertColor (Color r g b) = Color (32767+r) (32767+g) (32767+b) ---Color (65535-r) (65535-g) (65535-b)--parseColor s = ColorDesc c (dropWhile isSpace (upperToSpace name))- where- s1 = dropWhile isSpace s- (s2,s3) = span isDigit s1- s4 = dropWhile isSpace s3- (s5,s6) = span isDigit s4- s7 = dropWhile isSpace s6- (s8,s9) = span isDigit s7- n1 = read ('0':s2)- n2 = read ('0':s5)- n3 = read ('0':s8)- c = Color (n1*256+n1) (n2*256+n2) (n3*256+n3)- name = dropWhile isSpace s9- upperToSpace [] = []- upperToSpace (x:xs) | isUpper x = ' ':toLower x:upperToSpace xs- | otherwise = x:upperToSpace xs--main =- do- initGUI- window <- windowNew- - contents <- readFile "rgb.txt"- let killDups [] = []- killDups [x] = [x]- killDups (x:y:xs) | cdName x==cdName y = killDups (y:xs)- | otherwise = x:killDups (y:xs)- cols = killDups $ map parseColor (drop 1 (lines contents))- store <- listStoreNew cols- customStoreSetColumn store compareCol cdName-- entry <- entryNew- completion <- entryCompletionNew- entrySetCompletion entry completion-- set completion [entryCompletionModel := Just store]- cell <- cellRendererTextNew- set cell [cellTextBackgroundSet := True,- cellTextForegroundSet := True]- cellLayoutPackStart completion cell True- cellLayoutSetAttributes completion cell store- (\cd -> [cellText := cdName cd,- cellTextBackgroundColor := cdColor cd,- cellTextForegroundColor := invertColor (cdColor cd)])- entryCompletionSetMatchFunc completion (matchFunc store)- on completion matchSelected $ \model iter -> do- color <- treeModelGetValue model iter compareCol- entrySetText entry color- return True- set window [containerChild := entry]- widgetShowAll window- onDestroy window mainQuit- mainGUI--matchFunc :: ListStore ColorDesc -> String -> TreeIter -> IO Bool-matchFunc model str iter = do- --putStrLn ("iter is "++show iter)- tp <- treeModelGetPath model iter- r <- case tp of- (i:_) -> do row <- listStoreGetValue model i- return $ any (isPrefixOf (map toLower str))- (words (map toLower (cdName row)))- otherwise -> return False- return r-
− demo/treeList/DirList.hs
@@ -1,82 +0,0 @@-{-# OPTIONS -cpp #-}--- Test file for the ListView widget.-module Main(main) where--import Graphics.UI.Gtk-import Graphics.UI.Gtk.ModelView as New--import Control.Exception-import System.Directory-import System.IO-import System.Locale-import System.Time--data FileInfo = FileInfo {- fName :: String,- fSize :: Integer,- fTime :: ClockTime-}--main = do- initGUI- win <- windowNew- win `onDestroy` mainQuit-- curDir <- getCurrentDirectory- files <- getDirectoryContents curDir- fInfos <- (flip mapM) files $ \f -> do- s <- handle (\e ->-#if __GLASGOW_HASKELL__>=610- case e :: SomeException of- e ->-#endif- return 0) $ do- h <- openFile f ReadMode- s <- hFileSize h- hClose h- return s- t <- getModificationTime f- return FileInfo { fName = f- , fSize = s- , fTime = t }-- store <- New.listStoreNew fInfos-- tv <- New.treeViewNewWithModel store- containerAdd win tv-- tvc <- New.treeViewColumnNew- set tvc [ New.treeViewColumnTitle := "File name"- , New.treeViewColumnResizable := True ]- New.treeViewAppendColumn tv tvc-- name <- New.cellRendererTextNew- New.treeViewColumnPackStart tvc name True- New.cellLayoutSetAttributes tvc name store $ \FileInfo { fName = name } ->- [ New.cellText := name ]-- tvc <- New.treeViewColumnNew- set tvc [ New.treeViewColumnTitle := "Size"- , New.treeViewColumnResizable := True ]- New.treeViewAppendColumn tv tvc-- size <- New.cellRendererTextNew- New.treeViewColumnPackStart tvc size True- New.cellLayoutSetAttributes tvc size store $ \FileInfo { fSize = size } ->- [ New.cellText := show size ]-- tvc <- New.treeViewColumnNew- set tvc [ New.treeViewColumnTitle := "Modification time"- , New.treeViewColumnResizable := True ]- New.treeViewAppendColumn tv tvc-- time <- New.cellRendererTextNew- New.treeViewColumnPackStart tvc time True- New.cellLayoutSetAttributes tvc time store $ \FileInfo { fTime = time } ->- [ New.cellText :=> do- calTime <- toCalendarTime time- return (formatCalendarTime defaultTimeLocale "%D %T" calTime)- ]-- widgetShowAll win- mainGUI
− demo/treeList/FilterDemo.hs
@@ -1,71 +0,0 @@--- a demo that shows how to create a normal tree view and a tree view in--- which only a chosen subset of rows are shown (namely those with upper case letters)-module Main ( main ) where--import Graphics.UI.Gtk-import Data.List-import Data.Char-import Debug.Trace---- | Define a virtual column of the model that determines the visibility of a row in--- the model.-visCol :: ColumnId String Bool-visCol = makeColumnIdBool 0--main = do- initGUI- - win <- windowNew- onDestroy win mainQuit- - content <- readFile "FilterDemo.hs"-- -- create a view that shows all lines- model <- listStoreNew (lines content)- viewAll <- treeViewNewWithModel model- col <- treeViewColumnNew- ren <- cellRendererTextNew- cellLayoutPackStart col ren True- cellLayoutSetAttributes col ren model $ \row -> [ cellText := row ]- treeViewAppendColumn viewAll col-- -- create a view that only shows lines with upper case characters- fModel <- treeModelFilterNew model []-- -- create a virtual column 'visCol' that contains @True@ if a certain row has- -- upper case letters. Then set this column to determine the visibility of a row.- customStoreSetColumn model visCol (any isUpper)- treeModelFilterSetVisibleColumn fModel visCol--{-- -- this is an alternative way to determine the visibility of a row. In this case,- -- it is not necessary to create the column 'visCol'.- treeModelFilterSetVisibleFunc fModel $ Just $ \iter -> do- row <- treeModelGetRow model iter- return (any isUpper row)--}- -- note: it is important to insert the model into the view after the visibility- -- row or the visibility function have been set. Otherwise, the view is filled- -- first and setting a new visibility column/function will not update the view.- viewFew <- treeViewNewWithModel fModel- col <- treeViewColumnNew- ren <- cellRendererTextNew- cellLayoutPackStart col ren True- cellLayoutSetAttributes col ren model $ \row -> [ cellText := row ]-- treeViewAppendColumn viewFew col- - - - box <- vBoxNew False 0- swAll <- scrolledWindowNew Nothing Nothing- containerAdd swAll viewAll- boxPackStart box swAll PackGrow 4-- swFew <- scrolledWindowNew Nothing Nothing- containerAdd swFew viewFew- boxPackEnd box swFew PackGrow 4- - containerAdd win box- widgetShowAll win- mainGUI
− demo/treeList/ListDND.hs
@@ -1,248 +0,0 @@-module Main where--import Graphics.UI.Gtk-import Graphics.UI.Gtk.Gdk.EventM--import System.Glib.GObject ( toGObject )-import System.FilePath-import Control.Concurrent.MVar-import Control.Monad ( liftM )-import Control.Monad.Trans ( liftIO )-import Data.Maybe ( fromMaybe )-import Data.List ( findIndex )--roomStrCol :: ColumnId String String-roomStrCol = makeColumnIdString 1---- Define a string column and an image column on the store holding the--- computer types.-compPicCol :: ColumnId CompType Pixbuf-compPicCol = makeColumnIdPixbuf 1--compStrCol :: ColumnId CompType String-compStrCol = makeColumnIdString 2--data Computer = Computer {- name :: String,- addr :: (Int, Int, Int, Int),- roomStore :: ListStore String,- roomSel :: Int,- cType :: CompType }--data CompType- = MacBookPro- | MacBook- | Printer- | MacPro- | Xserve- | IMac- deriving (Enum, Bounded, Show)--showCT :: CompType -> String-showCT ct = case show ct of- 'I':xs -> 'i':xs- xs -> xs--main = do- initGUI-- win <- windowNew- onDestroy win mainQuit-- -- create a tag that we use as selection, target and selection type- compTypeTag <- atomNew "_CompType"-- let pNames = map ("resListDND" </>)- ["laptop.png","laptopSmall.png","printer.png",- "tower.png","server.png","desktop.png"]- pics <- mapM pixbufNewFromFile pNames-- smallPics <- mapM (\n -> pixbufNewFromFileAtScale n 48 48 True) pNames- - [noRoom, publicRoom, restrictedRoom] <- mapM listStoreNew- [["Paul (Home)","John (Home)","Fred (Home)"],- ["N12","S112", "S113", "S114"],- ["Server Room Upstairs", "Server Room Downstairs"]]-- -- define extractor function for the string column- treeModelSetColumn noRoom roomStrCol id- treeModelSetColumn publicRoom roomStrCol id- treeModelSetColumn restrictedRoom roomStrCol id- - let genRoomStore MacBookPro = noRoom- genRoomStore MacBook = noRoom- genRoomStore Printer = publicRoom- genRoomStore MacPro = publicRoom- genRoomStore Xserve = restrictedRoom- genRoomStore IMac = publicRoom-- -- the initial computer list - it's a coincidence that there's- -- one computer of each type- content <- listStoreNewDND - (map (\t -> Computer { name = showCT t, addr = (192,168,0,fromEnum t+1),- roomStore = genRoomStore t, roomSel = 0, cType = t})- [minBound :: CompType .. maxBound])- (Just listStoreDefaultDragSourceIface)- (Just DragDestIface {- treeDragDestRowDropPossible = \store path@(i:_) -> do- mCT <- selectionDataGet compTypeTag- case mCT :: Maybe [Int] of- Just [ct] -> return True- Nothing ->- (treeDragDestRowDropPossible listStoreDefaultDragDestIface)- store path- _ -> return False,- treeDragDestDragDataReceived = \store path@(i:_) -> do- mCT <- selectionDataGet compTypeTag- case mCT of- Just [ct] -> do- let t = toEnum ct- liftIO $ listStoreInsert store i- Computer { name = showCT t, addr = (192,168,0,254),- roomStore = genRoomStore t, roomSel = 0,- cType = t }- return True- Nothing ->- (treeDragDestDragDataReceived listStoreDefaultDragDestIface)- store path- })- -- the area with the possible computer types- compTypes <- listStoreNewDND [minBound :: CompType .. maxBound]- (Just DragSourceIface {- treeDragSourceRowDraggable = \store (i:_) -> return True,- treeDragSourceDragDataGet = \store (i:_) -> do- ty <- selectionDataGetTarget- ct <- liftIO $ listStoreGetValue store i- selectionDataSet compTypeTag [fromEnum ct]- return True,- treeDragSourceDragDataDelete = \store path -> return True- })- Nothing-- -- define extractor functions for the two column- treeModelSetColumn compTypes compPicCol $- \t -> pics !! fromEnum t- treeModelSetColumn compTypes compStrCol showCT- - -- create an icon view of all the computer types- typesView <- iconViewNew- set typesView [iconViewModel := Just compTypes,- iconViewPixbufColumn := compPicCol,- iconViewTextColumn := compStrCol,- iconViewColumns := 6] -- -- create an editable list of computers- inventory <- treeViewNewWithModel content-- tyCol <- treeViewColumnNew- treeViewColumnSetTitle tyCol "Type"- picRen <- cellRendererPixbufNew- treeViewColumnPackStart tyCol picRen False- cellLayoutSetAttributes tyCol picRen content- (\Computer { cType = t} -> [cellPixbuf := smallPics !! fromEnum t])- tyRen <- cellRendererTextNew- treeViewColumnPackStart tyCol tyRen False- cellLayoutSetAttributes tyCol tyRen content- (\Computer { cType = t} -> [cellText := showCT t])- treeViewAppendColumn inventory tyCol-- nameCol <- treeViewColumnNew- treeViewColumnSetTitle nameCol "Name"- treeViewColumnSetResizable nameCol True- treeViewColumnSetMinWidth nameCol 100- nameRen <- cellRendererTextNew- set nameRen [ cellTextEditable := True,- cellTextEditableSet := True,- cellTextEllipsize := EllipsizeEnd,- cellTextEllipsizeSet := True]- treeViewColumnPackStart nameCol nameRen True- cellLayoutSetAttributes nameCol nameRen content- (\Computer { name = n } -> [cellText := n])- treeViewAppendColumn inventory nameCol- on nameRen edited $ \[i] str -> do- val <- listStoreGetValue content i- listStoreSetValue content i val { name = str }-- addrCol <- treeViewColumnNew- treeViewColumnSetTitle addrCol "Address"- oct1 <- cellRendererTextNew- dot1 <- cellRendererTextNew- oct2 <- cellRendererTextNew- dot2 <- cellRendererTextNew- oct3 <- cellRendererTextNew- dot3 <- cellRendererTextNew- oct4 <- cellRendererTextNew- mapM_ (uncurry (cellLayoutPackStart addrCol))- [(oct1, True), (dot1, False), (oct2, True),- (dot2, False), (oct3, True), (dot3, False), (oct4, True)]- mapM_ (\d -> set d [cellText := ".",- cellTextWidthChars := 0]) [dot1, dot2, dot3]- mapM_ (\o -> set o [cellXAlign := 1.0,- cellTextWidthChars := 3]) [oct1, oct2, oct3, oct4]- cellLayoutSetAttributes addrCol oct1 content- (\Computer { addr = (o1,_,_,_)} -> [cellText := show o1])- cellLayoutSetAttributes addrCol oct2 content- (\Computer { addr = (_,o2,_,_)} -> [cellText := show o2])- cellLayoutSetAttributes addrCol oct3 content- (\Computer { addr = (_,_,o3,_)} -> [cellText := show o3])- cellLayoutSetAttributes addrCol oct4 content- (\Computer { addr = (_,_,_,o4)} -> [cellText := show o4]) - treeViewAppendColumn inventory addrCol-- roomCol <- treeViewColumnNew- treeViewColumnSetTitle roomCol "Room"- treeViewColumnSetResizable roomCol True- treeViewColumnSetSizing roomCol TreeViewColumnAutosize- roomRen <- cellRendererComboNew- set roomRen [ cellTextEditable := True,- cellTextEditableSet := True,- cellComboHasEntry := True ]- treeViewColumnPackStart roomCol roomRen True- cellLayoutSetAttributes roomCol roomRen content- (\Computer { roomStore = t, roomSel = idx } ->- [cellText :=> listStoreGetValue t idx,- cellComboTextModel := (t, roomStrCol)])- on roomRen edited $ \[i] str -> do- row@Computer { roomStore = t } <- listStoreGetValue content i- elems <- listStoreToList t- idx <- case (findIndex ((==) str) elems) of- Just idx -> return idx- Nothing -> listStoreAppend t str- listStoreSetValue content i row { roomSel = idx }- treeViewAppendColumn inventory roomCol-- -- make typesView a drag source for compTypeTag values- tl <- targetListNew- targetListAdd tl compTypeTag [TargetSameApp] 0- iconViewEnableModelDragSource typesView [Button1] tl [ActionCopy]- - -- Due to a bug in Gtk+, the treeDragSourceDragDataGet handler in- -- the DND source handler is not called unless the IconView is also- -- set to be a DND destination. Bugzilla 550528- tl <- targetListNew- iconViewEnableModelDragDest typesView tl []- - -- make the inventory widget a drag destination for compTypeTag values- tl <- targetListNew- targetListAdd tl compTypeTag [TargetSameApp] 0- targetListAdd tl targetTreeModelRow [TargetSameWidget] 0- treeViewEnableModelDragDest inventory tl [ActionMove]- tl <- targetListNew- targetListAdd tl targetTreeModelRow [TargetSameWidget] 0- treeViewEnableModelDragSource inventory [Button1] tl [ActionMove]- - -- Install drag and drop for permuting rows. This is now done above using- -- the explicit target 'targetTreeModelRow'. Calling the function below- -- will set a completely new 'TargetList' thereby removing our own- -- 'compTypeTag' from the inventory widget's target list.- - --treeViewSetReorderable inventory True-- -- arrange the widgets- v <- vPanedNew- panedAdd1 v typesView- panedAdd2 v inventory- containerAdd win v-- widgetShowAll win- mainGUI
− demo/treeList/ListDemo.hs
@@ -1,66 +0,0 @@-module Main where--import Graphics.UI.Gtk-import System.Glib.Signals (on)-import Data.List ( isPrefixOf )-import Data.Char ( toLower )--data Phone = Phone { name :: String, number :: Int, marked :: Bool }--main = do- initGUI-- win <- windowNew- onDestroy win mainQuit-- -- create a new list model- model <- listStoreNew- [Phone { name = "Foo", number = 12345, marked = False }- ,Phone { name = "Bar", number = 67890, marked = True }- ,Phone { name = "Baz", number = 39496, marked = False }]- view <- treeViewNewWithModel model- - treeViewSetHeadersVisible view True-- -- add a couple columns- col1 <- treeViewColumnNew- col2 <- treeViewColumnNew- col3 <- treeViewColumnNew-- treeViewColumnSetTitle col1 "String column"- treeViewColumnSetTitle col2 "Int column"- treeViewColumnSetTitle col3 "Bool column"-- renderer1 <- cellRendererTextNew- renderer2 <- cellRendererTextNew- renderer3 <- cellRendererToggleNew-- cellLayoutPackStart col1 renderer1 True- cellLayoutPackStart col2 renderer2 True- cellLayoutPackStart col3 renderer3 True-- cellLayoutSetAttributes col1 renderer1 model $ \row -> [ cellText := name row ]- cellLayoutSetAttributes col2 renderer2 model $ \row -> [ cellText := show (number row) ]- cellLayoutSetAttributes col3 renderer3 model $ \row -> [ cellToggleActive := marked row ]-- treeViewAppendColumn view col1- treeViewAppendColumn view col2- treeViewAppendColumn view col3-- -- update the model when the toggle buttons are activated- on renderer3 cellToggled $ \pathStr -> do- let (i:_) = stringToTreePath pathStr- val <- listStoreGetValue model i- listStoreSetValue model i val { marked = not (marked val) }--- -- enable interactive search- treeViewSetEnableSearch view True- treeViewSetSearchEqualFunc view $ Just $ \str iter -> do- (i:_) <- treeModelGetPath model iter- row <- listStoreGetValue model i- return (map toLower str `isPrefixOf` map toLower (name row))- - containerAdd win view- widgetShowAll win- mainGUI
− demo/treeList/ListTest.glade
@@ -1,1404 +0,0 @@-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">--<glade-interface>--<widget class="GtkWindow" id="window">- <property name="visible">True</property>- <property name="title" translatable="yes">List Test</property>- <property name="type">GTK_WINDOW_TOPLEVEL</property>- <property name="window_position">GTK_WIN_POS_NONE</property>- <property name="modal">False</property>- <property name="resizable">True</property>- <property name="destroy_with_parent">False</property>- <property name="decorated">True</property>- <property name="skip_taskbar_hint">False</property>- <property name="skip_pager_hint">False</property>- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>- <property name="focus_on_map">True</property>-- <child>- <widget class="GtkVBox" id="vbox1">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkScrolledWindow" id="scrolledwindow1">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>- <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>- <property name="shadow_type">GTK_SHADOW_IN</property>- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>-- <child>- <widget class="GtkTreeView" id="view">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="headers_visible">True</property>- <property name="rules_hint">False</property>- <property name="reorderable">False</property>- <property name="enable_search">True</property>- <property name="fixed_height_mode">False</property>- <property name="hover_selection">False</property>- <property name="hover_expand">False</property>- </widget>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkHBox" id="hbox1">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkVBox" id="vbox2">- <property name="border_width">8</property>- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">12</property>-- <child>- <widget class="GtkExpander" id="expander6">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkTable" id="table1">- <property name="border_width">2</property>- <property name="visible">True</property>- <property name="n_rows">3</property>- <property name="n_columns">2</property>- <property name="homogeneous">False</property>- <property name="row_spacing">2</property>- <property name="column_spacing">18</property>-- <child>- <widget class="GtkSpinButton" id="intValue">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">True</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">True</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkCheckButton" id="boolValue">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- <property name="active">False</property>- <property name="inconsistent">False</property>- <property name="draw_indicator">True</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label2">- <property name="visible">True</property>- <property name="label" translatable="yes">String value:</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">1</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label3">- <property name="visible">True</property>- <property name="label" translatable="yes">Number value:</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">1</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label4">- <property name="visible">True</property>- <property name="label" translatable="yes">Boolean value:</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">1</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="stringValue">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">expand|shrink|fill</property>- <property name="y_options"></property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label29">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Value</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander5">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkVBox" id="vbox7">- <property name="border_width">4</property>- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkHBox" id="hbox9">- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="insert">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">insert</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label23">- <property name="visible">True</property>- <property name="label" translatable="yes">new entry at</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="newIndex">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">4</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkHBox" id="hbox7">- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="prepend">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">prepend</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label21">- <property name="visible">True</property>- <property name="label" translatable="yes">new entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label30">- <property name="visible">True</property>- <property name="label" translatable="yes"></property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkHBox" id="hbox8">- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="append">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">append</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label22">- <property name="visible">True</property>- <property name="label" translatable="yes">new entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label31">- <property name="visible">True</property>- <property name="label" translatable="yes"></property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkHBox" id="hbox6">- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="update">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">update</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label20">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="updateIndex">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label28">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Insert and Update</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander1">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkVBox" id="vbox8">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkHBox" id="hbox5">- <property name="border_width">4</property>- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="remove">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">delete</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label19">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="removeIndex">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label32">- <property name="visible">True</property>- <property name="label" translatable="yes"></property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label33">- <property name="visible">True</property>- <property name="label" translatable="yes"></property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkHBox" id="hbox10">- <property name="border_width">4</property>- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="clear">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">clear</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label34">- <property name="visible">True</property>- <property name="label" translatable="yes">all</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label35">- <property name="visible">True</property>- <property name="label" translatable="yes"></property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label36">- <property name="visible">True</property>- <property name="label" translatable="yes"></property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label37">- <property name="visible">True</property>- <property name="label" translatable="yes"></property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label24">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Delete</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander2">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkVBox" id="vbox4">- <property name="border_width">4</property>- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkHBox" id="hbox3">- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="button18">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">move</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label15">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="spinbutton6">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label17">- <property name="visible">True</property>- <property name="label" translatable="yes">before</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="spinbutton7">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkHBox" id="hbox4">- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="button19">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">move</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label16">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="spinbutton5">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label18">- <property name="visible">True</property>- <property name="label" translatable="yes">after</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="spinbutton8">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label25">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Move</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander3">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkHBox" id="hbox2">- <property name="border_width">4</property>- <property name="visible">True</property>- <property name="homogeneous">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkButton" id="button17">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">swap</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label14">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="spinbutton3">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label13">- <property name="visible">True</property>- <property name="label" translatable="yes">with</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkSpinButton" id="spinbutton4">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">False</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">False</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label26">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Swap</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander4">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">False</property>- <property name="spacing">0</property>-- <child>- <placeholder/>- </child>-- <child>- <widget class="GtkLabel" id="label27">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Reorder</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>- </widget>- </child>-</widget>--</glade-interface>
− demo/treeList/ListTest.hs
@@ -1,102 +0,0 @@-module Main where--import Graphics.UI.Gtk-import Graphics.UI.Gtk.Glade-import Graphics.UI.Gtk.ModelView as New--data Phone = Phone { name :: String, number :: Int, marked :: Bool }--main = do- initGUI- Just xml <- xmlNew "ListTest.glade"- - win <- xmlGetWidget xml castToWindow "window"- onDestroy win mainQuit-- view <- xmlGetWidget xml castToTreeView "view"-- stringValue <- xmlGetWidget xml castToEntry "stringValue"- intValue <- xmlGetWidget xml castToSpinButton "intValue"- boolValue <- xmlGetWidget xml castToCheckButton "boolValue"-- insertButton <- xmlGetWidget xml castToButton "insert"- prependButton <- xmlGetWidget xml castToButton "prepend"- appendButton <- xmlGetWidget xml castToButton "append"- updateButton <- xmlGetWidget xml castToButton "update"- newIndex <- xmlGetWidget xml castToSpinButton "newIndex"- updateIndex <- xmlGetWidget xml castToSpinButton "updateIndex"-- removeButton <- xmlGetWidget xml castToButton "remove"- clearButton <- xmlGetWidget xml castToButton "clear"- removeIndex <- xmlGetWidget xml castToSpinButton "removeIndex"-- -- create a new list store- store <- storeImpl- New.treeViewSetModel view store- setupView view store-- let getValues = do- name <- entryGetText stringValue- number <- spinButtonGetValue intValue- marked <- toggleButtonGetActive boolValue- return Phone {- name = name,- number = floor number,- marked = marked- }-- onClicked prependButton $ getValues >>= New.listStorePrepend store- onClicked appendButton $ getValues >>= New.listStoreAppend store >> return ()-- onClicked insertButton $ do- value <- getValues- index <- fmap floor $ spinButtonGetValue newIndex- New.listStoreInsert store index value-- onClicked updateButton $ do- value <- getValues- index <- fmap floor $ spinButtonGetValue updateIndex- New.listStoreSetValue store index value- - onClicked removeButton $ do- index <- fmap floor $ spinButtonGetValue removeIndex- New.listStoreRemove store index-- onClicked clearButton $ New.listStoreClear store- - New.treeViewSetReorderable view True---- containerAdd win view- widgetShowAll win- mainGUI --setupView view model = do- New.treeViewSetHeadersVisible view True-- -- add a couple columns- renderer1 <- New.cellRendererTextNew- col1 <- New.treeViewColumnNew- New.treeViewColumnPackStart col1 renderer1 True- New.cellLayoutSetAttributes col1 renderer1 model $ \row -> [ New.cellText := name row ]- New.treeViewColumnSetTitle col1 "String column"- New.treeViewAppendColumn view col1-- renderer2 <- New.cellRendererTextNew- col2 <- New.treeViewColumnNew- New.treeViewColumnPackStart col2 renderer2 True- New.cellLayoutSetAttributes col2 renderer2 model $ \row -> [ New.cellText := show (number row) ]- New.treeViewColumnSetTitle col2 "Int column"- New.treeViewAppendColumn view col2-- renderer3 <- New.cellRendererToggleNew- col3 <- New.treeViewColumnNew- New.treeViewColumnPackStart col3 renderer3 True- New.cellLayoutSetAttributes col3 renderer3 model $ \row -> [ New.cellToggleActive := marked row ]- New.treeViewColumnSetTitle col3 "Check box column"- New.treeViewAppendColumn view col3--storeImpl =- New.listStoreNew- [Phone { name = "Foo", number = 12345, marked = False }- ,Phone { name = "Bar", number = 67890, marked = True }- ,Phone { name = "Baz", number = 39496, marked = False }]
− demo/treeList/ListText.hs
@@ -1,78 +0,0 @@-import Graphics.UI.Gtk-import Data.Char-import Data.List-import Data.Maybe--data RowInfo = RowInfo { rowString :: String, rowCase :: Maybe Bool }--mkCase Nothing str = str-mkCase (Just False) str = map toLower str-mkCase (Just True) str = map toUpper str--advCase Nothing = Just False-advCase (Just False) = Just True-advCase (Just True) = Nothing--main :: IO ()-main = do- unsafeInitGUIForThreadedRTS- win <- windowNew- win `on` objectDestroy $ mainQuit-- content <- readFile "ListText.hs"-- model <- listStoreNew (map (\r -> RowInfo r Nothing) (lines content))- view <- treeViewNewWithModel model-- -- add a column showing the index- col <- treeViewColumnNew- treeViewAppendColumn view col-- cell <- cellRendererTextNew- cellLayoutPackStart col cell True- cellLayoutSetAttributeFunc col cell model $ \(TreeIter _ n _ _) ->- set cell [cellText := show n]- set col [treeViewColumnTitle := "line",- treeViewColumnReorderable := True ]-- -- add a column showing the line in the file- col <- treeViewColumnNew- treeViewAppendColumn view col- set col [treeViewColumnTitle := "line in file",- treeViewColumnReorderable := True ]-- cell <- cellRendererTextNew- cellLayoutPackStart col cell True- cellLayoutSetAttributes col cell model $- \row -> [cellText := mkCase (rowCase row) (rowString row)]- - -- add a column showing if it is forced to a specific case- col <- treeViewColumnNew- treeViewAppendColumn view col- set col [treeViewColumnTitle := "case",- treeViewColumnReorderable := True ]-- cell <- cellRendererToggleNew- cellLayoutPackStart col cell True- cellLayoutSetAttributes col cell model $- \row -> [cellToggleActive := fromMaybe False (rowCase row),- cellToggleInconsistent := rowCase row==Nothing]- cell `on` cellToggled $ \tpStr -> do- let [i] = stringToTreePath tpStr- row@RowInfo { rowCase = c } <- listStoreGetValue model i- listStoreSetValue model i row { rowCase = advCase c }-- -- to annoy the user: don't allow any columns to be dropped at the far right- treeViewSetColumnDragFunction view $ Just $ \_ rCol _ -> do- return (rCol /= Nothing)-- treeViewSetSearchEqualFunc view $ Just $ \str (TreeIter _ n _ _) -> do- row <- listStoreGetValue model (fromIntegral n)- return (map toLower str `isPrefixOf` map toLower (filter isAlphaNum (rowString row)))-- swin <- scrolledWindowNew Nothing Nothing- set swin [ containerChild := view ]- set win [ containerChild := swin ]- widgetShowAll win- mainGUI-
− demo/treeList/Makefile
@@ -1,45 +0,0 @@--PROGS = listdemo treedemo listtest treetest dirlist treesort completion \- listdnd filterdemo listtext--SOURCES = ListDemo.hs TreeDemo.hs ListTest.hs TreeTest.hs DirList.hs \- TreeSort.hs Completion.hs ListDND.hs FilterDemo.hs ListText.hs--all : $(PROGS)--listdemo : ListDemo.hs- $(HC_RULE)--treedemo : TreeDemo.hs- $(HC_RULE)--listtest : ListTest.hs- $(HC_RULE)--treetest : TreeTest.hs- $(HC_RULE)--dirlist : DirList.hs- $(HC_RULE)--treesort : TreeSort.hs- $(HC_RULE)--completion : Completion.hs- $(HC_RULE)--listdnd : ListDND.hs- $(HC_RULE)--filterdemo : FilterDemo.hs- $(HC_RULE)--listtext : ListText.hs- $(HC_RULE)--HC_RULE = $(HC) --make $< -o $@ $(HCFLAGS)--clean:- rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROGS)--HC=ghc
− demo/treeList/TreeDemo.hs
@@ -1,68 +0,0 @@-module Main where--import Graphics.UI.Gtk-import Graphics.UI.Gtk.ModelView as New--import qualified Data.Tree as Tree--data Phone = Phone { name :: String, number :: Int, marked :: Bool }--main = do- initGUI-- win <- windowNew- onDestroy win mainQuit-- -- create a new tree model- model <- storeImpl- view <- New.treeViewNewWithModel model-- New.treeViewSetHeadersVisible view True-- -- add three columns- col1 <- New.treeViewColumnNew- col2 <- New.treeViewColumnNew- col3 <- New.treeViewColumnNew-- New.treeViewColumnSetTitle col1 "String column"- New.treeViewColumnSetTitle col2 "Int column"- New.treeViewColumnSetTitle col3 "Bool column"-- renderer1 <- New.cellRendererTextNew- renderer2 <- New.cellRendererTextNew- renderer3 <- New.cellRendererToggleNew-- New.cellLayoutPackStart col1 renderer1 True - New.cellLayoutPackStart col2 renderer2 True- New.cellLayoutPackStart col3 renderer3 True-- New.cellLayoutSetAttributes col1 renderer1 model $ \row -> [ New.cellText := name row ]- New.cellLayoutSetAttributes col2 renderer2 model $ \row -> [ New.cellText := show (number row) ]- New.cellLayoutSetAttributes col3 renderer3 model $ \row -> [ New.cellToggleActive := marked row ]-- New.treeViewAppendColumn view col1- New.treeViewAppendColumn view col2 - New.treeViewAppendColumn view col3- - containerAdd win view- widgetShowAll win- mainGUI --storeImpl =- New.treeStoreNew- [Tree.Node {- Tree.rootLabel = Phone { name = "Foo", number = 1, marked = False },- Tree.subForest = [leafNode Phone { name = "Bar", number = 11, marked = True }- ,leafNode Phone { name = "Baz", number = 12, marked = False }]- },- Tree.Node {- Tree.rootLabel = Phone { name = "Foo", number = 2, marked = False },- Tree.subForest = [leafNode Phone { name = "Bar", number = 21, marked = True }- ,leafNode Phone { name = "Baz", number = 22, marked = False }]- },- Tree.Node {- Tree.rootLabel = Phone { name = "Foo", number = 3, marked = False },- Tree.subForest = [leafNode Phone { name = "Bar", number = 31, marked = True }- ,leafNode Phone { name = "Baz", number = 32, marked = False }]- }]- where leafNode a = Tree.Node { Tree.rootLabel = a, Tree.subForest = [] }
− demo/treeList/TreeSort.hs
@@ -1,85 +0,0 @@-import Graphics.UI.Gtk-import Graphics.UI.Gtk.ModelView as New-import Data.Tree--main = do- initGUI- win <- windowNew- -- Create a tree model with some unsorted data.- rawmodel <- New.treeStoreNew - [Node ("zoo",8) [], Node ("foo",5) [],- Node ("bar",20) [], Node ("baz",2) []]-- -- Create a sorting proxy model, that is, a model that permutates the- -- rows of a different model such that they appear to be sorted.- model <- New.treeModelSortNewWithModel rawmodel- - -- Define two sorting functions, one being the default sorting function and- -- the other one being the sorting function for the 'SortColumnId' 2.- -- 'SortColumnId's are arbitrary positive numbers, i.e., we could have chosen- -- any other unique number.- New.treeSortableSetDefaultSortFunc model $ \iter1 iter2 -> do- (t1,_) <- New.treeModelGetRow rawmodel iter1- (t2,_) <- New.treeModelGetRow rawmodel iter2- return (compare t1 t2)- New.treeSortableSetSortFunc model 2 $ \iter1 iter2 -> do- (_,n1) <- New.treeModelGetRow rawmodel iter1- (_,n2) <- New.treeModelGetRow rawmodel iter2- return (compare n1 n2)-- -- Create the view.- view <- New.treeViewNewWithModel model-- -- Create and insert two columns, one with the heading Name, one with the- -- heading Number. Associate the 'SortColumnId' 2 with the latter column such- -- that clicking on the Number header will sort the rows by the numbers.- col <- New.treeViewColumnNew- New.treeViewColumnSetTitle col "Name"- rend <- New.cellRendererTextNew- New.cellLayoutPackStart col rend True- New.cellLayoutSetAttributeFunc col rend model $ \iter -> do- cIter <- New.treeModelSortConvertIterToChildIter model iter- (n,_) <- New.treeModelGetRow rawmodel cIter- set rend [New.cellText := n]- New.treeViewAppendColumn view col-- col' <- New.treeViewColumnNew- New.treeViewColumnSetTitle col' "Number"- rend <- New.cellRendererTextNew- New.cellLayoutPackStart col' rend True- New.cellLayoutSetAttributeFunc col' rend model $ \iter -> do- cIter <- New.treeModelSortConvertIterToChildIter model iter- (_,c) <- New.treeModelGetRow rawmodel cIter- set rend [New.cellText := show c]- New.treeViewAppendColumn view col'- New.treeViewColumnSetSortColumnId col' 2-- -- Create a button that shows information on the current state of the sorting- -- settings.- button <- buttonNewWithLabel "Dump Info"- button `onClicked` do- sId <- New.treeViewColumnGetSortColumnId col- putStrLn ("tvc1 sort id is "++show sId)- sId <- New.treeViewColumnGetSortColumnId col'- putStrLn ("tvc2 sort id is "++show sId)- sId <- New.treeSortableGetSortColumnId model- putStrLn ("sort id is "++show sId)- -- Show all entries of the proxy model- let recurse Nothing = return ()- recurse (Just iter) = do- cIter <- New.treeModelSortConvertIterToChildIter model iter- row <- New.treeModelGetRow rawmodel cIter- putStrLn ("iter "++show cIter++": "++show row)- mIter <- New.treeModelIterNext model iter- recurse mIter- mIter <- New.treeModelGetIterFirst model- recurse mIter-- -- Put it all together. - vBox <- vBoxNew False 3- boxPackStartDefaults vBox view- boxPackEnd vBox button PackNatural 0- containerAdd win vBox- widgetShowAll win- win `onDestroy` mainQuit- mainGUI
− demo/treeList/TreeTest.glade
@@ -1,1108 +0,0 @@-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">--<glade-interface>--<widget class="GtkWindow" id="window">- <property name="visible">True</property>- <property name="title" translatable="yes">Tree Test</property>- <property name="type">GTK_WINDOW_TOPLEVEL</property>- <property name="window_position">GTK_WIN_POS_NONE</property>- <property name="modal">False</property>- <property name="resizable">True</property>- <property name="destroy_with_parent">False</property>- <property name="decorated">True</property>- <property name="skip_taskbar_hint">False</property>- <property name="skip_pager_hint">False</property>- <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>- <property name="focus_on_map">True</property>- <property name="urgency_hint">False</property>-- <child>- <widget class="GtkVBox" id="vbox1">- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkScrolledWindow" id="scrolledwindow1">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>- <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>- <property name="shadow_type">GTK_SHADOW_IN</property>- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>-- <child>- <widget class="GtkTreeView" id="view">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="headers_visible">True</property>- <property name="rules_hint">False</property>- <property name="reorderable">False</property>- <property name="enable_search">True</property>- <property name="fixed_height_mode">False</property>- <property name="hover_selection">False</property>- <property name="hover_expand">False</property>- </widget>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkVBox" id="vbox2">- <property name="border_width">8</property>- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">12</property>-- <child>- <widget class="GtkExpander" id="expander6">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkTable" id="table1">- <property name="border_width">2</property>- <property name="visible">True</property>- <property name="n_rows">3</property>- <property name="n_columns">2</property>- <property name="homogeneous">False</property>- <property name="row_spacing">4</property>- <property name="column_spacing">18</property>-- <child>- <widget class="GtkSpinButton" id="intValue">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="climb_rate">1</property>- <property name="digits">0</property>- <property name="numeric">True</property>- <property name="update_policy">GTK_UPDATE_ALWAYS</property>- <property name="snap_to_ticks">True</property>- <property name="wrap">False</property>- <property name="adjustment">1 0 100 1 10 10</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkCheckButton" id="boolValue">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- <property name="active">False</property>- <property name="inconsistent">False</property>- <property name="draw_indicator">True</property>-- <child>- <placeholder/>- </child>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="stringValue">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">expand|shrink|fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label3">- <property name="visible">True</property>- <property name="label" translatable="yes">Number value:</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">1</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options"></property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label2">- <property name="visible">True</property>- <property name="label" translatable="yes">String value:</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">1</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options"></property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label4">- <property name="visible">True</property>- <property name="label" translatable="yes">Boolean value:</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">1</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">2</property>- <property name="bottom_attach">3</property>- <property name="x_options"></property>- <property name="y_options"></property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label29">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Value</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander5">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkTable" id="table3">- <property name="visible">True</property>- <property name="n_rows">2</property>- <property name="n_columns">3</property>- <property name="homogeneous">False</property>- <property name="row_spacing">4</property>- <property name="column_spacing">2</property>-- <child>- <widget class="GtkButton" id="insert">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">insert</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label23">- <property name="visible">True</property>- <property name="label" translatable="yes">new entry at</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="newPath">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkButton" id="update">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">update</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label20">- <property name="visible">True</property>- <property name="label" translatable="yes">entry at</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="updatePath">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="y_options"></property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label28">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Insert and Update</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander1">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">True</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkTable" id="table2">- <property name="visible">True</property>- <property name="n_rows">2</property>- <property name="n_columns">3</property>- <property name="homogeneous">False</property>- <property name="row_spacing">4</property>- <property name="column_spacing">2</property>-- <child>- <widget class="GtkButton" id="remove">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">delete</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkButton" id="clear">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">clear</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label19">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label34">- <property name="visible">True</property>- <property name="label" translatable="yes">all</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="removePath">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="y_options"></property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label24">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Delete</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander2">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkTable" id="table4">- <property name="visible">True</property>- <property name="n_rows">2</property>- <property name="n_columns">5</property>- <property name="homogeneous">False</property>- <property name="row_spacing">4</property>- <property name="column_spacing">2</property>-- <child>- <widget class="GtkButton" id="button18">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">move</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkButton" id="button19">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">move</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="left_attach">0</property>- <property name="right_attach">1</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label15">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label16">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">1</property>- <property name="right_attach">2</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label17">- <property name="visible">True</property>- <property name="label" translatable="yes">before</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">3</property>- <property name="right_attach">4</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label18">- <property name="visible">True</property>- <property name="label" translatable="yes">after</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="left_attach">3</property>- <property name="right_attach">4</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="x_options">fill</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="entry4">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="entry5">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="left_attach">4</property>- <property name="right_attach">5</property>- <property name="top_attach">0</property>- <property name="bottom_attach">1</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="entry6">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="left_attach">2</property>- <property name="right_attach">3</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="y_options"></property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="entry7">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="left_attach">4</property>- <property name="right_attach">5</property>- <property name="top_attach">1</property>- <property name="bottom_attach">2</property>- <property name="y_options"></property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label25">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Move</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander3">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">False</property>- <property name="spacing">0</property>-- <child>- <widget class="GtkHBox" id="hbox2">- <property name="border_width">4</property>- <property name="visible">True</property>- <property name="homogeneous">False</property>- <property name="spacing">2</property>-- <child>- <widget class="GtkButton" id="button17">- <property name="width_request">54</property>- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="label" translatable="yes">swap</property>- <property name="use_underline">True</property>- <property name="relief">GTK_RELIEF_NORMAL</property>- <property name="focus_on_click">True</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label14">- <property name="visible">True</property>- <property name="label" translatable="yes">entry</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="entry8">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkLabel" id="label13">- <property name="visible">True</property>- <property name="label" translatable="yes">with</property>- <property name="use_underline">False</property>- <property name="use_markup">False</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0</property>- <property name="yalign">0.5</property>- <property name="xpad">4</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>-- <child>- <widget class="GtkEntry" id="entry9">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="editable">True</property>- <property name="visibility">True</property>- <property name="max_length">0</property>- <property name="text" translatable="yes"></property>- <property name="has_frame">True</property>- <property name="invisible_char">*</property>- <property name="activates_default">False</property>- <property name="width_chars">10</property>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">True</property>- <property name="fill">True</property>- </packing>- </child>- </widget>- </child>-- <child>- <widget class="GtkLabel" id="label26">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Swap</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>-- <child>- <widget class="GtkExpander" id="expander4">- <property name="visible">True</property>- <property name="can_focus">True</property>- <property name="expanded">False</property>- <property name="spacing">0</property>-- <child>- <placeholder/>- </child>-- <child>- <widget class="GtkLabel" id="label27">- <property name="visible">True</property>- <property name="label" translatable="yes"><b>Reorder</b></property>- <property name="use_underline">False</property>- <property name="use_markup">True</property>- <property name="justify">GTK_JUSTIFY_LEFT</property>- <property name="wrap">False</property>- <property name="selectable">False</property>- <property name="xalign">0.5</property>- <property name="yalign">0.5</property>- <property name="xpad">0</property>- <property name="ypad">0</property>- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>- <property name="width_chars">-1</property>- <property name="single_line_mode">False</property>- <property name="angle">0</property>- </widget>- <packing>- <property name="type">label_item</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">False</property>- </packing>- </child>- </widget>- <packing>- <property name="padding">0</property>- <property name="expand">False</property>- <property name="fill">True</property>- </packing>- </child>- </widget>- </child>-</widget>--</glade-interface>
− demo/treeList/TreeTest.hs
@@ -1,115 +0,0 @@-module Main where--import Graphics.UI.Gtk-import Graphics.UI.Gtk.Glade-import Graphics.UI.Gtk.ModelView as New--import qualified Data.Tree as Tree--data Phone = Phone { name :: String, number :: Int, marked :: Bool }--main = do- initGUI- Just xml <- xmlNew "TreeTest.glade"- - win <- xmlGetWidget xml castToWindow "window"- onDestroy win mainQuit-- view <- xmlGetWidget xml castToTreeView "view"-- stringValue <- xmlGetWidget xml castToEntry "stringValue"- intValue <- xmlGetWidget xml castToSpinButton "intValue"- boolValue <- xmlGetWidget xml castToCheckButton "boolValue"-- insertButton <- xmlGetWidget xml castToButton "insert"- updateButton <- xmlGetWidget xml castToButton "update"- newPath <- xmlGetWidget xml castToEntry "newPath"- updatePath <- xmlGetWidget xml castToEntry "updatePath"-- removeButton <- xmlGetWidget xml castToButton "remove"- clearButton <- xmlGetWidget xml castToButton "clear"- removePath <- xmlGetWidget xml castToEntry "removePath"-- -- create a new list store- store <- storeImpl- New.treeViewSetModel view store- setupView view store-- let getValues = do- name <- entryGetText stringValue- number <- spinButtonGetValue intValue- marked <- toggleButtonGetActive boolValue- return Phone {- name = name,- number = floor number,- marked = marked- }-- onClicked insertButton $ do- value <- getValues- path <- fmap read $ get newPath entryText- New.treeStoreInsert store (init path) (last path) value-- onClicked updateButton $ do- value <- getValues- path <- fmap read $ get updatePath entryText- New.treeStoreSetValue store path value- - onClicked removeButton $ do- path <- fmap read $ get removePath entryText- New.treeStoreRemove store path- return ()-- onClicked clearButton $ New.treeStoreClear store-- New.treeViewSetReorderable view True-- widgetShowAll win- mainGUI --setupView view model = do- New.treeViewSetHeadersVisible view True-- -- add three columns- col1 <- New.treeViewColumnNew- col2 <- New.treeViewColumnNew- col3 <- New.treeViewColumnNew-- New.treeViewColumnSetTitle col1 "String column"- New.treeViewColumnSetTitle col2 "Int column"- New.treeViewColumnSetTitle col3 "Bool column"-- renderer1 <- New.cellRendererTextNew- renderer2 <- New.cellRendererTextNew- renderer3 <- New.cellRendererToggleNew-- New.cellLayoutPackStart col1 renderer1 True - New.cellLayoutPackStart col2 renderer2 True- New.cellLayoutPackStart col3 renderer3 True-- New.cellLayoutSetAttributes col1 renderer1 model $ \row -> [ New.cellText := name row ]- New.cellLayoutSetAttributes col2 renderer2 model $ \row -> [ New.cellText := show (number row) ]- New.cellLayoutSetAttributes col3 renderer3 model $ \row -> [ New.cellToggleActive := marked row ]-- New.treeViewAppendColumn view col1- New.treeViewAppendColumn view col2 - New.treeViewAppendColumn view col3--storeImpl =- New.treeStoreNew- [Tree.Node {- Tree.rootLabel = Phone { name = "Foo", number = 1, marked = False },- Tree.subForest = [leafNode Phone { name = "Bar", number = 11, marked = True }- ,leafNode Phone { name = "Baz", number = 12, marked = False }]- },- Tree.Node {- Tree.rootLabel = Phone { name = "Foo", number = 2, marked = False },- Tree.subForest = [leafNode Phone { name = "Bar", number = 21, marked = True }- ,leafNode Phone { name = "Baz", number = 22, marked = False }]- },- Tree.Node {- Tree.rootLabel = Phone { name = "Foo", number = 3, marked = False },- Tree.subForest = [leafNode Phone { name = "Bar", number = 31, marked = True }- ,leafNode Phone { name = "Baz", number = 32, marked = False }]- }]- where leafNode a = Tree.Node { Tree.rootLabel = a, Tree.subForest = [] }
− demo/treeList/resListDND/desktop.png
binary file changed (8078 → absent bytes)
− demo/treeList/resListDND/laptop.png
binary file changed (7657 → absent bytes)
− demo/treeList/resListDND/laptopSmall.png
binary file changed (7726 → absent bytes)
− demo/treeList/resListDND/printer.png
binary file changed (7869 → absent bytes)
− demo/treeList/resListDND/server.png
binary file changed (6448 → absent bytes)
− demo/treeList/resListDND/tower.png
binary file changed (11777 → absent bytes)
− demo/treeList/rgb.txt
@@ -1,753 +0,0 @@-! $Xorg: rgb.txt,v 1.3 2000/08/17 19:54:00 cpqbld Exp $-255 250 250 snow-248 248 255 ghost white-248 248 255 GhostWhite-245 245 245 white smoke-245 245 245 WhiteSmoke-220 220 220 gainsboro-255 250 240 floral white-255 250 240 FloralWhite-253 245 230 old lace-253 245 230 OldLace-250 240 230 linen-250 235 215 antique white-250 235 215 AntiqueWhite-255 239 213 papaya whip-255 239 213 PapayaWhip-255 235 205 blanched almond-255 235 205 BlanchedAlmond-255 228 196 bisque-255 218 185 peach puff-255 218 185 PeachPuff-255 222 173 navajo white-255 222 173 NavajoWhite-255 228 181 moccasin-255 248 220 cornsilk-255 255 240 ivory-255 250 205 lemon chiffon-255 250 205 LemonChiffon-255 245 238 seashell-240 255 240 honeydew-245 255 250 mint cream-245 255 250 MintCream-240 255 255 azure-240 248 255 alice blue-240 248 255 AliceBlue-230 230 250 lavender-255 240 245 lavender blush-255 240 245 LavenderBlush-255 228 225 misty rose-255 228 225 MistyRose-255 255 255 white- 0 0 0 black- 47 79 79 dark slate gray- 47 79 79 DarkSlateGray- 47 79 79 dark slate grey- 47 79 79 DarkSlateGrey-105 105 105 dim gray-105 105 105 DimGray-105 105 105 dim grey-105 105 105 DimGrey-112 128 144 slate gray-112 128 144 SlateGray-112 128 144 slate grey-112 128 144 SlateGrey-119 136 153 light slate gray-119 136 153 LightSlateGray-119 136 153 light slate grey-119 136 153 LightSlateGrey-190 190 190 gray-190 190 190 grey-211 211 211 light grey-211 211 211 LightGrey-211 211 211 light gray-211 211 211 LightGray- 25 25 112 midnight blue- 25 25 112 MidnightBlue- 0 0 128 navy- 0 0 128 navy blue- 0 0 128 NavyBlue-100 149 237 cornflower blue-100 149 237 CornflowerBlue- 72 61 139 dark slate blue- 72 61 139 DarkSlateBlue-106 90 205 slate blue-106 90 205 SlateBlue-123 104 238 medium slate blue-123 104 238 MediumSlateBlue-132 112 255 light slate blue-132 112 255 LightSlateBlue- 0 0 205 medium blue- 0 0 205 MediumBlue- 65 105 225 royal blue- 65 105 225 RoyalBlue- 0 0 255 blue- 30 144 255 dodger blue- 30 144 255 DodgerBlue- 0 191 255 deep sky blue- 0 191 255 DeepSkyBlue-135 206 235 sky blue-135 206 235 SkyBlue-135 206 250 light sky blue-135 206 250 LightSkyBlue- 70 130 180 steel blue- 70 130 180 SteelBlue-176 196 222 light steel blue-176 196 222 LightSteelBlue-173 216 230 light blue-173 216 230 LightBlue-176 224 230 powder blue-176 224 230 PowderBlue-175 238 238 pale turquoise-175 238 238 PaleTurquoise- 0 206 209 dark turquoise- 0 206 209 DarkTurquoise- 72 209 204 medium turquoise- 72 209 204 MediumTurquoise- 64 224 208 turquoise- 0 255 255 cyan-224 255 255 light cyan-224 255 255 LightCyan- 95 158 160 cadet blue- 95 158 160 CadetBlue-102 205 170 medium aquamarine-102 205 170 MediumAquamarine-127 255 212 aquamarine- 0 100 0 dark green- 0 100 0 DarkGreen- 85 107 47 dark olive green- 85 107 47 DarkOliveGreen-143 188 143 dark sea green-143 188 143 DarkSeaGreen- 46 139 87 sea green- 46 139 87 SeaGreen- 60 179 113 medium sea green- 60 179 113 MediumSeaGreen- 32 178 170 light sea green- 32 178 170 LightSeaGreen-152 251 152 pale green-152 251 152 PaleGreen- 0 255 127 spring green- 0 255 127 SpringGreen-124 252 0 lawn green-124 252 0 LawnGreen- 0 255 0 green-127 255 0 chartreuse- 0 250 154 medium spring green- 0 250 154 MediumSpringGreen-173 255 47 green yellow-173 255 47 GreenYellow- 50 205 50 lime green- 50 205 50 LimeGreen-154 205 50 yellow green-154 205 50 YellowGreen- 34 139 34 forest green- 34 139 34 ForestGreen-107 142 35 olive drab-107 142 35 OliveDrab-189 183 107 dark khaki-189 183 107 DarkKhaki-240 230 140 khaki-238 232 170 pale goldenrod-238 232 170 PaleGoldenrod-250 250 210 light goldenrod yellow-250 250 210 LightGoldenrodYellow-255 255 224 light yellow-255 255 224 LightYellow-255 255 0 yellow-255 215 0 gold-238 221 130 light goldenrod-238 221 130 LightGoldenrod-218 165 32 goldenrod-184 134 11 dark goldenrod-184 134 11 DarkGoldenrod-188 143 143 rosy brown-188 143 143 RosyBrown-205 92 92 indian red-205 92 92 IndianRed-139 69 19 saddle brown-139 69 19 SaddleBrown-160 82 45 sienna-205 133 63 peru-222 184 135 burlywood-245 245 220 beige-245 222 179 wheat-244 164 96 sandy brown-244 164 96 SandyBrown-210 180 140 tan-210 105 30 chocolate-178 34 34 firebrick-165 42 42 brown-233 150 122 dark salmon-233 150 122 DarkSalmon-250 128 114 salmon-255 160 122 light salmon-255 160 122 LightSalmon-255 165 0 orange-255 140 0 dark orange-255 140 0 DarkOrange-255 127 80 coral-240 128 128 light coral-240 128 128 LightCoral-255 99 71 tomato-255 69 0 orange red-255 69 0 OrangeRed-255 0 0 red-255 105 180 hot pink-255 105 180 HotPink-255 20 147 deep pink-255 20 147 DeepPink-255 192 203 pink-255 182 193 light pink-255 182 193 LightPink-219 112 147 pale violet red-219 112 147 PaleVioletRed-176 48 96 maroon-199 21 133 medium violet red-199 21 133 MediumVioletRed-208 32 144 violet red-208 32 144 VioletRed-255 0 255 magenta-238 130 238 violet-221 160 221 plum-218 112 214 orchid-186 85 211 medium orchid-186 85 211 MediumOrchid-153 50 204 dark orchid-153 50 204 DarkOrchid-148 0 211 dark violet-148 0 211 DarkViolet-138 43 226 blue violet-138 43 226 BlueViolet-160 32 240 purple-147 112 219 medium purple-147 112 219 MediumPurple-216 191 216 thistle-255 250 250 snow1-238 233 233 snow2-205 201 201 snow3-139 137 137 snow4-255 245 238 seashell1-238 229 222 seashell2-205 197 191 seashell3-139 134 130 seashell4-255 239 219 AntiqueWhite1-238 223 204 AntiqueWhite2-205 192 176 AntiqueWhite3-139 131 120 AntiqueWhite4-255 228 196 bisque1-238 213 183 bisque2-205 183 158 bisque3-139 125 107 bisque4-255 218 185 PeachPuff1-238 203 173 PeachPuff2-205 175 149 PeachPuff3-139 119 101 PeachPuff4-255 222 173 NavajoWhite1-238 207 161 NavajoWhite2-205 179 139 NavajoWhite3-139 121 94 NavajoWhite4-255 250 205 LemonChiffon1-238 233 191 LemonChiffon2-205 201 165 LemonChiffon3-139 137 112 LemonChiffon4-255 248 220 cornsilk1-238 232 205 cornsilk2-205 200 177 cornsilk3-139 136 120 cornsilk4-255 255 240 ivory1-238 238 224 ivory2-205 205 193 ivory3-139 139 131 ivory4-240 255 240 honeydew1-224 238 224 honeydew2-193 205 193 honeydew3-131 139 131 honeydew4-255 240 245 LavenderBlush1-238 224 229 LavenderBlush2-205 193 197 LavenderBlush3-139 131 134 LavenderBlush4-255 228 225 MistyRose1-238 213 210 MistyRose2-205 183 181 MistyRose3-139 125 123 MistyRose4-240 255 255 azure1-224 238 238 azure2-193 205 205 azure3-131 139 139 azure4-131 111 255 SlateBlue1-122 103 238 SlateBlue2-105 89 205 SlateBlue3- 71 60 139 SlateBlue4- 72 118 255 RoyalBlue1- 67 110 238 RoyalBlue2- 58 95 205 RoyalBlue3- 39 64 139 RoyalBlue4- 0 0 255 blue1- 0 0 238 blue2- 0 0 205 blue3- 0 0 139 blue4- 30 144 255 DodgerBlue1- 28 134 238 DodgerBlue2- 24 116 205 DodgerBlue3- 16 78 139 DodgerBlue4- 99 184 255 SteelBlue1- 92 172 238 SteelBlue2- 79 148 205 SteelBlue3- 54 100 139 SteelBlue4- 0 191 255 DeepSkyBlue1- 0 178 238 DeepSkyBlue2- 0 154 205 DeepSkyBlue3- 0 104 139 DeepSkyBlue4-135 206 255 SkyBlue1-126 192 238 SkyBlue2-108 166 205 SkyBlue3- 74 112 139 SkyBlue4-176 226 255 LightSkyBlue1-164 211 238 LightSkyBlue2-141 182 205 LightSkyBlue3- 96 123 139 LightSkyBlue4-198 226 255 SlateGray1-185 211 238 SlateGray2-159 182 205 SlateGray3-108 123 139 SlateGray4-202 225 255 LightSteelBlue1-188 210 238 LightSteelBlue2-162 181 205 LightSteelBlue3-110 123 139 LightSteelBlue4-191 239 255 LightBlue1-178 223 238 LightBlue2-154 192 205 LightBlue3-104 131 139 LightBlue4-224 255 255 LightCyan1-209 238 238 LightCyan2-180 205 205 LightCyan3-122 139 139 LightCyan4-187 255 255 PaleTurquoise1-174 238 238 PaleTurquoise2-150 205 205 PaleTurquoise3-102 139 139 PaleTurquoise4-152 245 255 CadetBlue1-142 229 238 CadetBlue2-122 197 205 CadetBlue3- 83 134 139 CadetBlue4- 0 245 255 turquoise1- 0 229 238 turquoise2- 0 197 205 turquoise3- 0 134 139 turquoise4- 0 255 255 cyan1- 0 238 238 cyan2- 0 205 205 cyan3- 0 139 139 cyan4-151 255 255 DarkSlateGray1-141 238 238 DarkSlateGray2-121 205 205 DarkSlateGray3- 82 139 139 DarkSlateGray4-127 255 212 aquamarine1-118 238 198 aquamarine2-102 205 170 aquamarine3- 69 139 116 aquamarine4-193 255 193 DarkSeaGreen1-180 238 180 DarkSeaGreen2-155 205 155 DarkSeaGreen3-105 139 105 DarkSeaGreen4- 84 255 159 SeaGreen1- 78 238 148 SeaGreen2- 67 205 128 SeaGreen3- 46 139 87 SeaGreen4-154 255 154 PaleGreen1-144 238 144 PaleGreen2-124 205 124 PaleGreen3- 84 139 84 PaleGreen4- 0 255 127 SpringGreen1- 0 238 118 SpringGreen2- 0 205 102 SpringGreen3- 0 139 69 SpringGreen4- 0 255 0 green1- 0 238 0 green2- 0 205 0 green3- 0 139 0 green4-127 255 0 chartreuse1-118 238 0 chartreuse2-102 205 0 chartreuse3- 69 139 0 chartreuse4-192 255 62 OliveDrab1-179 238 58 OliveDrab2-154 205 50 OliveDrab3-105 139 34 OliveDrab4-202 255 112 DarkOliveGreen1-188 238 104 DarkOliveGreen2-162 205 90 DarkOliveGreen3-110 139 61 DarkOliveGreen4-255 246 143 khaki1-238 230 133 khaki2-205 198 115 khaki3-139 134 78 khaki4-255 236 139 LightGoldenrod1-238 220 130 LightGoldenrod2-205 190 112 LightGoldenrod3-139 129 76 LightGoldenrod4-255 255 224 LightYellow1-238 238 209 LightYellow2-205 205 180 LightYellow3-139 139 122 LightYellow4-255 255 0 yellow1-238 238 0 yellow2-205 205 0 yellow3-139 139 0 yellow4-255 215 0 gold1-238 201 0 gold2-205 173 0 gold3-139 117 0 gold4-255 193 37 goldenrod1-238 180 34 goldenrod2-205 155 29 goldenrod3-139 105 20 goldenrod4-255 185 15 DarkGoldenrod1-238 173 14 DarkGoldenrod2-205 149 12 DarkGoldenrod3-139 101 8 DarkGoldenrod4-255 193 193 RosyBrown1-238 180 180 RosyBrown2-205 155 155 RosyBrown3-139 105 105 RosyBrown4-255 106 106 IndianRed1-238 99 99 IndianRed2-205 85 85 IndianRed3-139 58 58 IndianRed4-255 130 71 sienna1-238 121 66 sienna2-205 104 57 sienna3-139 71 38 sienna4-255 211 155 burlywood1-238 197 145 burlywood2-205 170 125 burlywood3-139 115 85 burlywood4-255 231 186 wheat1-238 216 174 wheat2-205 186 150 wheat3-139 126 102 wheat4-255 165 79 tan1-238 154 73 tan2-205 133 63 tan3-139 90 43 tan4-255 127 36 chocolate1-238 118 33 chocolate2-205 102 29 chocolate3-139 69 19 chocolate4-255 48 48 firebrick1-238 44 44 firebrick2-205 38 38 firebrick3-139 26 26 firebrick4-255 64 64 brown1-238 59 59 brown2-205 51 51 brown3-139 35 35 brown4-255 140 105 salmon1-238 130 98 salmon2-205 112 84 salmon3-139 76 57 salmon4-255 160 122 LightSalmon1-238 149 114 LightSalmon2-205 129 98 LightSalmon3-139 87 66 LightSalmon4-255 165 0 orange1-238 154 0 orange2-205 133 0 orange3-139 90 0 orange4-255 127 0 DarkOrange1-238 118 0 DarkOrange2-205 102 0 DarkOrange3-139 69 0 DarkOrange4-255 114 86 coral1-238 106 80 coral2-205 91 69 coral3-139 62 47 coral4-255 99 71 tomato1-238 92 66 tomato2-205 79 57 tomato3-139 54 38 tomato4-255 69 0 OrangeRed1-238 64 0 OrangeRed2-205 55 0 OrangeRed3-139 37 0 OrangeRed4-255 0 0 red1-238 0 0 red2-205 0 0 red3-139 0 0 red4-255 20 147 DeepPink1-238 18 137 DeepPink2-205 16 118 DeepPink3-139 10 80 DeepPink4-255 110 180 HotPink1-238 106 167 HotPink2-205 96 144 HotPink3-139 58 98 HotPink4-255 181 197 pink1-238 169 184 pink2-205 145 158 pink3-139 99 108 pink4-255 174 185 LightPink1-238 162 173 LightPink2-205 140 149 LightPink3-139 95 101 LightPink4-255 130 171 PaleVioletRed1-238 121 159 PaleVioletRed2-205 104 137 PaleVioletRed3-139 71 93 PaleVioletRed4-255 52 179 maroon1-238 48 167 maroon2-205 41 144 maroon3-139 28 98 maroon4-255 62 150 VioletRed1-238 58 140 VioletRed2-205 50 120 VioletRed3-139 34 82 VioletRed4-255 0 255 magenta1-238 0 238 magenta2-205 0 205 magenta3-139 0 139 magenta4-255 131 250 orchid1-238 122 233 orchid2-205 105 201 orchid3-139 71 137 orchid4-255 187 255 plum1-238 174 238 plum2-205 150 205 plum3-139 102 139 plum4-224 102 255 MediumOrchid1-209 95 238 MediumOrchid2-180 82 205 MediumOrchid3-122 55 139 MediumOrchid4-191 62 255 DarkOrchid1-178 58 238 DarkOrchid2-154 50 205 DarkOrchid3-104 34 139 DarkOrchid4-155 48 255 purple1-145 44 238 purple2-125 38 205 purple3- 85 26 139 purple4-171 130 255 MediumPurple1-159 121 238 MediumPurple2-137 104 205 MediumPurple3- 93 71 139 MediumPurple4-255 225 255 thistle1-238 210 238 thistle2-205 181 205 thistle3-139 123 139 thistle4- 0 0 0 gray0- 0 0 0 grey0- 3 3 3 gray1- 3 3 3 grey1- 5 5 5 gray2- 5 5 5 grey2- 8 8 8 gray3- 8 8 8 grey3- 10 10 10 gray4- 10 10 10 grey4- 13 13 13 gray5- 13 13 13 grey5- 15 15 15 gray6- 15 15 15 grey6- 18 18 18 gray7- 18 18 18 grey7- 20 20 20 gray8- 20 20 20 grey8- 23 23 23 gray9- 23 23 23 grey9- 26 26 26 gray10- 26 26 26 grey10- 28 28 28 gray11- 28 28 28 grey11- 31 31 31 gray12- 31 31 31 grey12- 33 33 33 gray13- 33 33 33 grey13- 36 36 36 gray14- 36 36 36 grey14- 38 38 38 gray15- 38 38 38 grey15- 41 41 41 gray16- 41 41 41 grey16- 43 43 43 gray17- 43 43 43 grey17- 46 46 46 gray18- 46 46 46 grey18- 48 48 48 gray19- 48 48 48 grey19- 51 51 51 gray20- 51 51 51 grey20- 54 54 54 gray21- 54 54 54 grey21- 56 56 56 gray22- 56 56 56 grey22- 59 59 59 gray23- 59 59 59 grey23- 61 61 61 gray24- 61 61 61 grey24- 64 64 64 gray25- 64 64 64 grey25- 66 66 66 gray26- 66 66 66 grey26- 69 69 69 gray27- 69 69 69 grey27- 71 71 71 gray28- 71 71 71 grey28- 74 74 74 gray29- 74 74 74 grey29- 77 77 77 gray30- 77 77 77 grey30- 79 79 79 gray31- 79 79 79 grey31- 82 82 82 gray32- 82 82 82 grey32- 84 84 84 gray33- 84 84 84 grey33- 87 87 87 gray34- 87 87 87 grey34- 89 89 89 gray35- 89 89 89 grey35- 92 92 92 gray36- 92 92 92 grey36- 94 94 94 gray37- 94 94 94 grey37- 97 97 97 gray38- 97 97 97 grey38- 99 99 99 gray39- 99 99 99 grey39-102 102 102 gray40-102 102 102 grey40-105 105 105 gray41-105 105 105 grey41-107 107 107 gray42-107 107 107 grey42-110 110 110 gray43-110 110 110 grey43-112 112 112 gray44-112 112 112 grey44-115 115 115 gray45-115 115 115 grey45-117 117 117 gray46-117 117 117 grey46-120 120 120 gray47-120 120 120 grey47-122 122 122 gray48-122 122 122 grey48-125 125 125 gray49-125 125 125 grey49-127 127 127 gray50-127 127 127 grey50-130 130 130 gray51-130 130 130 grey51-133 133 133 gray52-133 133 133 grey52-135 135 135 gray53-135 135 135 grey53-138 138 138 gray54-138 138 138 grey54-140 140 140 gray55-140 140 140 grey55-143 143 143 gray56-143 143 143 grey56-145 145 145 gray57-145 145 145 grey57-148 148 148 gray58-148 148 148 grey58-150 150 150 gray59-150 150 150 grey59-153 153 153 gray60-153 153 153 grey60-156 156 156 gray61-156 156 156 grey61-158 158 158 gray62-158 158 158 grey62-161 161 161 gray63-161 161 161 grey63-163 163 163 gray64-163 163 163 grey64-166 166 166 gray65-166 166 166 grey65-168 168 168 gray66-168 168 168 grey66-171 171 171 gray67-171 171 171 grey67-173 173 173 gray68-173 173 173 grey68-176 176 176 gray69-176 176 176 grey69-179 179 179 gray70-179 179 179 grey70-181 181 181 gray71-181 181 181 grey71-184 184 184 gray72-184 184 184 grey72-186 186 186 gray73-186 186 186 grey73-189 189 189 gray74-189 189 189 grey74-191 191 191 gray75-191 191 191 grey75-194 194 194 gray76-194 194 194 grey76-196 196 196 gray77-196 196 196 grey77-199 199 199 gray78-199 199 199 grey78-201 201 201 gray79-201 201 201 grey79-204 204 204 gray80-204 204 204 grey80-207 207 207 gray81-207 207 207 grey81-209 209 209 gray82-209 209 209 grey82-212 212 212 gray83-212 212 212 grey83-214 214 214 gray84-214 214 214 grey84-217 217 217 gray85-217 217 217 grey85-219 219 219 gray86-219 219 219 grey86-222 222 222 gray87-222 222 222 grey87-224 224 224 gray88-224 224 224 grey88-227 227 227 gray89-227 227 227 grey89-229 229 229 gray90-229 229 229 grey90-232 232 232 gray91-232 232 232 grey91-235 235 235 gray92-235 235 235 grey92-237 237 237 gray93-237 237 237 grey93-240 240 240 gray94-240 240 240 grey94-242 242 242 gray95-242 242 242 grey95-245 245 245 gray96-245 245 245 grey96-247 247 247 gray97-247 247 247 grey97-250 250 250 gray98-250 250 250 grey98-252 252 252 gray99-252 252 252 grey99-255 255 255 gray100-255 255 255 grey100-169 169 169 dark grey-169 169 169 DarkGrey-169 169 169 dark gray-169 169 169 DarkGray-0 0 139 dark blue-0 0 139 DarkBlue-0 139 139 dark cyan-0 139 139 DarkCyan-139 0 139 dark magenta-139 0 139 DarkMagenta-139 0 0 dark red-139 0 0 DarkRed-144 238 144 light green-144 238 144 LightGreen
+ demo/treelist/Completion.hs view
@@ -0,0 +1,81 @@+-- Demo to show off entry completion.++import Graphics.UI.Gtk+import Data.Char+import Data.List++data ColorDesc = ColorDesc {+ cdColor :: Color,+ cdName :: String+ } deriving Show++compareCol :: ColumnId ColorDesc String+compareCol = makeColumnIdString 0++invertColor (Color r g b) = Color (32767+r) (32767+g) (32767+b)+--Color (65535-r) (65535-g) (65535-b)++parseColor s = ColorDesc c (dropWhile isSpace (upperToSpace name))+ where+ s1 = dropWhile isSpace s+ (s2,s3) = span isDigit s1+ s4 = dropWhile isSpace s3+ (s5,s6) = span isDigit s4+ s7 = dropWhile isSpace s6+ (s8,s9) = span isDigit s7+ n1 = read ('0':s2)+ n2 = read ('0':s5)+ n3 = read ('0':s8)+ c = Color (n1*256+n1) (n2*256+n2) (n3*256+n3)+ name = dropWhile isSpace s9+ upperToSpace [] = []+ upperToSpace (x:xs) | isUpper x = ' ':toLower x:upperToSpace xs+ | otherwise = x:upperToSpace xs++main =+ do+ initGUI+ window <- windowNew++ contents <- readFile "rgb.txt"+ let killDups [] = []+ killDups [x] = [x]+ killDups (x:y:xs) | cdName x==cdName y = killDups (y:xs)+ | otherwise = x:killDups (y:xs)+ cols = killDups $ map parseColor (drop 1 (lines contents))+ store <- listStoreNew cols+ customStoreSetColumn store compareCol cdName++ entry <- entryNew+ completion <- entryCompletionNew+ entrySetCompletion entry completion++ set completion [entryCompletionModel := Just store]+ cell <- cellRendererTextNew+ set cell [cellTextBackgroundSet := True,+ cellTextForegroundSet := True]+ cellLayoutPackStart completion cell True+ cellLayoutSetAttributes completion cell store+ (\cd -> [cellText := cdName cd,+ cellTextBackgroundColor := cdColor cd,+ cellTextForegroundColor := invertColor (cdColor cd)])+ entryCompletionSetMatchFunc completion (matchFunc store)+ on completion matchSelected $ \model iter -> do+ color <- treeModelGetValue model iter compareCol+ entrySetText entry color+ return True+ set window [containerChild := entry]+ widgetShowAll window+ on window objectDestroy mainQuit+ mainGUI++matchFunc :: ListStore ColorDesc -> String -> TreeIter -> IO Bool+matchFunc model str iter = do+ --putStrLn ("iter is "++show iter)+ tp <- treeModelGetPath model iter+ r <- case tp of+ (i:_) -> do row <- listStoreGetValue model i+ return $ any (isPrefixOf (map toLower str))+ (words (map toLower (cdName row)))+ otherwise -> return False+ return r
+ demo/treelist/DirList.hs view
@@ -0,0 +1,81 @@+{-# OPTIONS -cpp #-}+-- Test file for the ListView widget.+module Main(main) where++import Graphics.UI.Gtk+import Graphics.UI.Gtk.ModelView as New++import Control.Exception+import System.Directory+import System.IO+import System.Locale+import Data.Time++data FileInfo = FileInfo {+ fName :: String,+ fSize :: Integer,+ fTime :: UTCTime+}++main = do+ initGUI+ win <- windowNew+ on win objectDestroy mainQuit++ curDir <- getCurrentDirectory+ files <- getDirectoryContents curDir+ fInfos <- (flip mapM) files $ \f -> do+ s <- handle (\e ->+#if __GLASGOW_HASKELL__>=610+ case e :: SomeException of+ e ->+#endif+ return 0) $ do+ h <- openFile f ReadMode+ s <- hFileSize h+ hClose h+ return s+ t <- getModificationTime f+ return FileInfo { fName = f+ , fSize = s+ , fTime = t }++ store <- New.listStoreNew fInfos++ tv <- New.treeViewNewWithModel store+ containerAdd win tv++ tvc <- New.treeViewColumnNew+ set tvc [ New.treeViewColumnTitle := "File name"+ , New.treeViewColumnResizable := True ]+ New.treeViewAppendColumn tv tvc++ name <- New.cellRendererTextNew+ New.treeViewColumnPackStart tvc name True+ New.cellLayoutSetAttributes tvc name store $ \FileInfo { fName = name } ->+ [ New.cellText := name ]++ tvc <- New.treeViewColumnNew+ set tvc [ New.treeViewColumnTitle := "Size"+ , New.treeViewColumnResizable := True ]+ New.treeViewAppendColumn tv tvc++ size <- New.cellRendererTextNew+ New.treeViewColumnPackStart tvc size True+ New.cellLayoutSetAttributes tvc size store $ \FileInfo { fSize = size } ->+ [ New.cellText := show size ]++ tvc <- New.treeViewColumnNew+ set tvc [ New.treeViewColumnTitle := "Modification time"+ , New.treeViewColumnResizable := True ]+ New.treeViewAppendColumn tv tvc++ time <- New.cellRendererTextNew+ New.treeViewColumnPackStart tvc time True+ New.cellLayoutSetAttributes tvc time store $ \FileInfo { fTime = time } ->+ [ New.cellText :=>+ return (formatTime defaultTimeLocale "%D %T" time)+ ]++ widgetShowAll win+ mainGUI
+ demo/treelist/FilterDemo.hs view
@@ -0,0 +1,71 @@+-- a demo that shows how to create a normal tree view and a tree view in+-- which only a chosen subset of rows are shown (namely those with upper case letters)+module Main ( main ) where++import Graphics.UI.Gtk+import Data.List+import Data.Char+import Debug.Trace++-- | Define a virtual column of the model that determines the visibility of a row in+-- the model.+visCol :: ColumnId String Bool+visCol = makeColumnIdBool 0++main = do+ initGUI++ win <- windowNew+ on win objectDestroy mainQuit++ content <- readFile "FilterDemo.hs"++ -- create a view that shows all lines+ model <- listStoreNew (lines content)+ viewAll <- treeViewNewWithModel model+ col <- treeViewColumnNew+ ren <- cellRendererTextNew+ cellLayoutPackStart col ren True+ cellLayoutSetAttributes col ren model $ \row -> [ cellText := row ]+ treeViewAppendColumn viewAll col++ -- create a view that only shows lines with upper case characters+ fModel <- treeModelFilterNew model []++ -- create a virtual column 'visCol' that contains @True@ if a certain row has+ -- upper case letters. Then set this column to determine the visibility of a row.+ customStoreSetColumn model visCol (any isUpper)+ treeModelFilterSetVisibleColumn fModel visCol++{-+ -- this is an alternative way to determine the visibility of a row. In this case,+ -- it is not necessary to create the column 'visCol'.+ treeModelFilterSetVisibleFunc fModel $ Just $ \iter -> do+ row <- treeModelGetRow model iter+ return (any isUpper row)+-}+ -- note: it is important to insert the model into the view after the visibility+ -- row or the visibility function have been set. Otherwise, the view is filled+ -- first and setting a new visibility column/function will not update the view.+ viewFew <- treeViewNewWithModel fModel+ col <- treeViewColumnNew+ ren <- cellRendererTextNew+ cellLayoutPackStart col ren True+ cellLayoutSetAttributes col ren model $ \row -> [ cellText := row ]++ treeViewAppendColumn viewFew col++++ box <- vBoxNew False 0+ swAll <- scrolledWindowNew Nothing Nothing+ containerAdd swAll viewAll+ boxPackStart box swAll PackGrow 4++ swFew <- scrolledWindowNew Nothing Nothing+ containerAdd swFew viewFew+ boxPackEnd box swFew PackGrow 4++ containerAdd win box+ widgetShowAll win+ mainGUI
+ demo/treelist/ListDND.hs view
@@ -0,0 +1,248 @@+module Main where++import Graphics.UI.Gtk+import Graphics.UI.Gtk.Gdk.EventM++import System.Glib.GObject ( toGObject )+import System.FilePath+import Control.Concurrent.MVar+import Control.Monad ( liftM )+import Control.Monad.Trans ( liftIO )+import Data.Maybe ( fromMaybe )+import Data.List ( findIndex )++roomStrCol :: ColumnId String String+roomStrCol = makeColumnIdString 1++-- Define a string column and an image column on the store holding the+-- computer types.+compPicCol :: ColumnId CompType Pixbuf+compPicCol = makeColumnIdPixbuf 1++compStrCol :: ColumnId CompType String+compStrCol = makeColumnIdString 2++data Computer = Computer {+ name :: String,+ addr :: (Int, Int, Int, Int),+ roomStore :: ListStore String,+ roomSel :: Int,+ cType :: CompType }++data CompType+ = MacBookPro+ | MacBook+ | Printer+ | MacPro+ | Xserve+ | IMac+ deriving (Enum, Bounded, Show)++showCT :: CompType -> String+showCT ct = case show ct of+ 'I':xs -> 'i':xs+ xs -> xs++main = do+ initGUI++ win <- windowNew+ on win objectDestroy mainQuit++ -- create a tag that we use as selection, target and selection type+ compTypeTag <- atomNew "_CompType"++ let pNames = map ("resListDND" </>)+ ["laptop.png","laptopSmall.png","printer.png",+ "tower.png","server.png","desktop.png"]+ pics <- mapM pixbufNewFromFile pNames++ smallPics <- mapM (\n -> pixbufNewFromFileAtScale n 48 48 True) pNames++ [noRoom, publicRoom, restrictedRoom] <- mapM listStoreNew+ [["Paul (Home)","John (Home)","Fred (Home)"],+ ["N12","S112", "S113", "S114"],+ ["Server Room Upstairs", "Server Room Downstairs"]]++ -- define extractor function for the string column+ treeModelSetColumn noRoom roomStrCol id+ treeModelSetColumn publicRoom roomStrCol id+ treeModelSetColumn restrictedRoom roomStrCol id++ let genRoomStore MacBookPro = noRoom+ genRoomStore MacBook = noRoom+ genRoomStore Printer = publicRoom+ genRoomStore MacPro = publicRoom+ genRoomStore Xserve = restrictedRoom+ genRoomStore IMac = publicRoom++ -- the initial computer list - it's a coincidence that there's+ -- one computer of each type+ content <- listStoreNewDND+ (map (\t -> Computer { name = showCT t, addr = (192,168,0,fromEnum t+1),+ roomStore = genRoomStore t, roomSel = 0, cType = t})+ [minBound :: CompType .. maxBound])+ (Just listStoreDefaultDragSourceIface)+ (Just DragDestIface {+ treeDragDestRowDropPossible = \store path@(i:_) -> do+ mCT <- selectionDataGet compTypeTag+ case mCT :: Maybe [Int] of+ Just [ct] -> return True+ Nothing ->+ (treeDragDestRowDropPossible listStoreDefaultDragDestIface)+ store path+ _ -> return False,+ treeDragDestDragDataReceived = \store path@(i:_) -> do+ mCT <- selectionDataGet compTypeTag+ case mCT of+ Just [ct] -> do+ let t = toEnum ct+ liftIO $ listStoreInsert store i+ Computer { name = showCT t, addr = (192,168,0,254),+ roomStore = genRoomStore t, roomSel = 0,+ cType = t }+ return True+ Nothing ->+ (treeDragDestDragDataReceived listStoreDefaultDragDestIface)+ store path+ })+ -- the area with the possible computer types+ compTypes <- listStoreNewDND [minBound :: CompType .. maxBound]+ (Just DragSourceIface {+ treeDragSourceRowDraggable = \store (i:_) -> return True,+ treeDragSourceDragDataGet = \store (i:_) -> do+ ty <- selectionDataGetTarget+ ct <- liftIO $ listStoreGetValue store i+ selectionDataSet compTypeTag [fromEnum ct]+ return True,+ treeDragSourceDragDataDelete = \store path -> return True+ })+ Nothing++ -- define extractor functions for the two column+ treeModelSetColumn compTypes compPicCol $+ \t -> pics !! fromEnum t+ treeModelSetColumn compTypes compStrCol showCT++ -- create an icon view of all the computer types+ typesView <- iconViewNew+ set typesView [iconViewModel := Just compTypes,+ iconViewPixbufColumn := compPicCol,+ iconViewTextColumn := compStrCol,+ iconViewColumns := 6]++ -- create an editable list of computers+ inventory <- treeViewNewWithModel content++ tyCol <- treeViewColumnNew+ treeViewColumnSetTitle tyCol "Type"+ picRen <- cellRendererPixbufNew+ treeViewColumnPackStart tyCol picRen False+ cellLayoutSetAttributes tyCol picRen content+ (\Computer { cType = t} -> [cellPixbuf := smallPics !! fromEnum t])+ tyRen <- cellRendererTextNew+ treeViewColumnPackStart tyCol tyRen False+ cellLayoutSetAttributes tyCol tyRen content+ (\Computer { cType = t} -> [cellText := showCT t])+ treeViewAppendColumn inventory tyCol++ nameCol <- treeViewColumnNew+ treeViewColumnSetTitle nameCol "Name"+ treeViewColumnSetResizable nameCol True+ treeViewColumnSetMinWidth nameCol 100+ nameRen <- cellRendererTextNew+ set nameRen [ cellTextEditable := True,+ cellTextEditableSet := True,+ cellTextEllipsize := EllipsizeEnd,+ cellTextEllipsizeSet := True]+ treeViewColumnPackStart nameCol nameRen True+ cellLayoutSetAttributes nameCol nameRen content+ (\Computer { name = n } -> [cellText := n])+ treeViewAppendColumn inventory nameCol+ on nameRen edited $ \[i] str -> do+ val <- listStoreGetValue content i+ listStoreSetValue content i val { name = str }++ addrCol <- treeViewColumnNew+ treeViewColumnSetTitle addrCol "Address"+ oct1 <- cellRendererTextNew+ dot1 <- cellRendererTextNew+ oct2 <- cellRendererTextNew+ dot2 <- cellRendererTextNew+ oct3 <- cellRendererTextNew+ dot3 <- cellRendererTextNew+ oct4 <- cellRendererTextNew+ mapM_ (uncurry (cellLayoutPackStart addrCol))+ [(oct1, True), (dot1, False), (oct2, True),+ (dot2, False), (oct3, True), (dot3, False), (oct4, True)]+ mapM_ (\d -> set d [cellText := ".",+ cellTextWidthChars := 0]) [dot1, dot2, dot3]+ mapM_ (\o -> set o [cellXAlign := 1.0,+ cellTextWidthChars := 3]) [oct1, oct2, oct3, oct4]+ cellLayoutSetAttributes addrCol oct1 content+ (\Computer { addr = (o1,_,_,_)} -> [cellText := show o1])+ cellLayoutSetAttributes addrCol oct2 content+ (\Computer { addr = (_,o2,_,_)} -> [cellText := show o2])+ cellLayoutSetAttributes addrCol oct3 content+ (\Computer { addr = (_,_,o3,_)} -> [cellText := show o3])+ cellLayoutSetAttributes addrCol oct4 content+ (\Computer { addr = (_,_,_,o4)} -> [cellText := show o4])+ treeViewAppendColumn inventory addrCol++ roomCol <- treeViewColumnNew+ treeViewColumnSetTitle roomCol "Room"+ treeViewColumnSetResizable roomCol True+ treeViewColumnSetSizing roomCol TreeViewColumnAutosize+ roomRen <- cellRendererComboNew+ set roomRen [ cellTextEditable := True,+ cellTextEditableSet := True,+ cellComboHasEntry := True ]+ treeViewColumnPackStart roomCol roomRen True+ cellLayoutSetAttributes roomCol roomRen content+ (\Computer { roomStore = t, roomSel = idx } ->+ [cellText :=> listStoreGetValue t idx,+ cellComboTextModel := (t, roomStrCol)])+ on roomRen edited $ \[i] str -> do+ row@Computer { roomStore = t } <- listStoreGetValue content i+ elems <- listStoreToList t+ idx <- case (findIndex ((==) str) elems) of+ Just idx -> return idx+ Nothing -> listStoreAppend t str+ listStoreSetValue content i row { roomSel = idx }+ treeViewAppendColumn inventory roomCol++ -- make typesView a drag source for compTypeTag values+ tl <- targetListNew+ targetListAdd tl compTypeTag [TargetSameApp] 0+ iconViewEnableModelDragSource typesView [Button1] tl [ActionCopy]++ -- Due to a bug in Gtk+, the treeDragSourceDragDataGet handler in+ -- the DND source handler is not called unless the IconView is also+ -- set to be a DND destination. Bugzilla 550528+ tl <- targetListNew+ iconViewEnableModelDragDest typesView tl []++ -- make the inventory widget a drag destination for compTypeTag values+ tl <- targetListNew+ targetListAdd tl compTypeTag [TargetSameApp] 0+ targetListAdd tl targetTreeModelRow [TargetSameWidget] 0+ treeViewEnableModelDragDest inventory tl [ActionMove]+ tl <- targetListNew+ targetListAdd tl targetTreeModelRow [TargetSameWidget] 0+ treeViewEnableModelDragSource inventory [Button1] tl [ActionMove]++ -- Install drag and drop for permuting rows. This is now done above using+ -- the explicit target 'targetTreeModelRow'. Calling the function below+ -- will set a completely new 'TargetList' thereby removing our own+ -- 'compTypeTag' from the inventory widget's target list.++ --treeViewSetReorderable inventory True++ -- arrange the widgets+ v <- vPanedNew+ panedAdd1 v typesView+ panedAdd2 v inventory+ containerAdd win v++ widgetShowAll win+ mainGUI
+ demo/treelist/ListDemo.hs view
@@ -0,0 +1,67 @@+module Main where++import Control.Monad.IO.Class+import Graphics.UI.Gtk+import System.Glib.Signals (on)+import Data.List ( isPrefixOf )+import Data.Char ( toLower )++data Phone = Phone { name :: String, number :: Int, marked :: Bool }++main = do+ initGUI++ win <- windowNew+ on win objectDestroy mainQuit++ -- create a new list model+ model <- listStoreNew+ [Phone { name = "Foo", number = 12345, marked = False }+ ,Phone { name = "Bar", number = 67890, marked = True }+ ,Phone { name = "Baz", number = 39496, marked = False }]+ view <- treeViewNewWithModel model++ treeViewSetHeadersVisible view True++ -- add a couple columns+ col1 <- treeViewColumnNew+ col2 <- treeViewColumnNew+ col3 <- treeViewColumnNew++ treeViewColumnSetTitle col1 "String column"+ treeViewColumnSetTitle col2 "Int column"+ treeViewColumnSetTitle col3 "Bool column"++ renderer1 <- cellRendererTextNew+ renderer2 <- cellRendererTextNew+ renderer3 <- cellRendererToggleNew++ cellLayoutPackStart col1 renderer1 True+ cellLayoutPackStart col2 renderer2 True+ cellLayoutPackStart col3 renderer3 True++ cellLayoutSetAttributes col1 renderer1 model $ \row -> [ cellText := name row ]+ cellLayoutSetAttributes col2 renderer2 model $ \row -> [ cellText := show (number row) ]+ cellLayoutSetAttributes col3 renderer3 model $ \row -> [ cellToggleActive := marked row ]++ treeViewAppendColumn view col1+ treeViewAppendColumn view col2+ treeViewAppendColumn view col3++ -- update the model when the toggle buttons are activated+ on renderer3 cellToggled $ \pathStr -> do+ let (i:_) = stringToTreePath pathStr+ val <- listStoreGetValue model i+ listStoreSetValue model i val { marked = not (marked val) }+++ -- enable interactive search+ treeViewSetEnableSearch view True+ treeViewSetSearchEqualFunc view $ Just $ \str iter -> do+ (i:_) <- treeModelGetPath model iter+ row <- listStoreGetValue model i+ return (map toLower str `isPrefixOf` map toLower (name row))++ containerAdd win view+ widgetShowAll win+ mainGUI
+ demo/treelist/ListTest.glade view
@@ -0,0 +1,1389 @@+<?xml version="1.0"?>+<!--*- mode: xml -*-->+<interface>+ <object class="GtkAdjustment" id="adjustment1">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment10">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment2">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment3">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment4">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment5">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment6">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment7">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment8">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkAdjustment" id="adjustment9">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkWindow" id="window">+ <property name="visible">True</property>+ <property name="title" translatable="yes">List Test</property>+ <property name="type">GTK_WINDOW_TOPLEVEL</property>+ <property name="window_position">GTK_WIN_POS_NONE</property>+ <property name="modal">False</property>+ <property name="resizable">True</property>+ <property name="destroy_with_parent">False</property>+ <property name="decorated">True</property>+ <property name="skip_taskbar_hint">False</property>+ <property name="skip_pager_hint">False</property>+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>+ <property name="focus_on_map">True</property>+ <child>+ <object class="GtkVBox" id="vbox1">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkScrolledWindow" id="scrolledwindow1">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>+ <property name="shadow_type">GTK_SHADOW_IN</property>+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>+ <child>+ <object class="GtkTreeView" id="view">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="headers_visible">True</property>+ <property name="rules_hint">False</property>+ <property name="reorderable">False</property>+ <property name="enable_search">True</property>+ <property name="fixed_height_mode">False</property>+ <property name="hover_selection">False</property>+ <property name="hover_expand">False</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkHBox" id="hbox1">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkVBox" id="vbox2">+ <property name="border_width">8</property>+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">12</property>+ <child>+ <object class="GtkExpander" id="expander6">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkTable" id="table1">+ <property name="border_width">2</property>+ <property name="visible">True</property>+ <property name="n_rows">3</property>+ <property name="n_columns">2</property>+ <property name="homogeneous">False</property>+ <property name="row_spacing">2</property>+ <property name="column_spacing">18</property>+ <child>+ <object class="GtkSpinButton" id="intValue">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">True</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">True</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment1</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkCheckButton" id="boolValue">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ <property name="active">False</property>+ <property name="inconsistent">False</property>+ <property name="draw_indicator">True</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">2</property>+ <property name="bottom_attach">3</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label2">+ <property name="visible">True</property>+ <property name="label" translatable="yes">String value:</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">1</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label3">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Number value:</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">1</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label4">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Boolean value:</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">1</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">2</property>+ <property name="bottom_attach">3</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="stringValue">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">expand|shrink|fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label29">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Value</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander5">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkVBox" id="vbox7">+ <property name="border_width">4</property>+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkHBox" id="hbox9">+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="insert">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">insert</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label23">+ <property name="visible">True</property>+ <property name="label" translatable="yes">new entry at</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="newIndex">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment2</property>+ </object>+ <packing>+ <property name="padding">4</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkHBox" id="hbox7">+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="prepend">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">prepend</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label21">+ <property name="visible">True</property>+ <property name="label" translatable="yes">new entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label30">+ <property name="visible">True</property>+ <property name="label" translatable="yes"/>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkHBox" id="hbox8">+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="append">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">append</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label22">+ <property name="visible">True</property>+ <property name="label" translatable="yes">new entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label31">+ <property name="visible">True</property>+ <property name="label" translatable="yes"/>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkHBox" id="hbox6">+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="update">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">update</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label20">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="updateIndex">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment3</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label28">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Insert and Update</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander1">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkVBox" id="vbox8">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkHBox" id="hbox5">+ <property name="border_width">4</property>+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="remove">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">delete</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label19">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="removeIndex">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment4</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label32">+ <property name="visible">True</property>+ <property name="label" translatable="yes"/>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label33">+ <property name="visible">True</property>+ <property name="label" translatable="yes"/>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkHBox" id="hbox10">+ <property name="border_width">4</property>+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="clear">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">clear</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label34">+ <property name="visible">True</property>+ <property name="label" translatable="yes">all</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label35">+ <property name="visible">True</property>+ <property name="label" translatable="yes"/>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label36">+ <property name="visible">True</property>+ <property name="label" translatable="yes"/>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label37">+ <property name="visible">True</property>+ <property name="label" translatable="yes"/>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label24">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Delete</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander2">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkVBox" id="vbox4">+ <property name="border_width">4</property>+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkHBox" id="hbox3">+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="button18">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">move</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label15">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="spinbutton6">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment5</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label17">+ <property name="visible">True</property>+ <property name="label" translatable="yes">before</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="spinbutton7">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment6</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkHBox" id="hbox4">+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="button19">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">move</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label16">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="spinbutton5">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment7</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label18">+ <property name="visible">True</property>+ <property name="label" translatable="yes">after</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="spinbutton8">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment8</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label25">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Move</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander3">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkHBox" id="hbox2">+ <property name="border_width">4</property>+ <property name="visible">True</property>+ <property name="homogeneous">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkButton" id="button17">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">swap</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label14">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="spinbutton3">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment9</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label13">+ <property name="visible">True</property>+ <property name="label" translatable="yes">with</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkSpinButton" id="spinbutton4">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">False</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">False</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment10</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label26">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Swap</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander4">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">False</property>+ <property name="spacing">0</property>+ <child>+ <placeholder/>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label27">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Reorder</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+</interface>
+ demo/treelist/ListTest.hs view
@@ -0,0 +1,105 @@+module Main where++import Graphics.UI.Gtk+import Graphics.UI.Gtk.ModelView as New++data Phone = Phone { name :: String, number :: Int, marked :: Bool }++main = do+ initGUI++ gui <- builderNew+ builderAddFromFile gui "ListTest.glade"++ win <- builderGetObject gui castToWindow "window"+ on win objectDestroy mainQuit++ view <- builderGetObject gui castToTreeView "view"++ stringValue <- builderGetObject gui castToEntry "stringValue"+ intValue <- builderGetObject gui castToSpinButton "intValue"+ boolValue <- builderGetObject gui castToCheckButton "boolValue"++ insertButton <- builderGetObject gui castToButton "insert"+ prependButton <- builderGetObject gui castToButton "prepend"+ appendButton <- builderGetObject gui castToButton "append"+ updateButton <- builderGetObject gui castToButton "update"+ newIndex <- builderGetObject gui castToSpinButton "newIndex"+ updateIndex <- builderGetObject gui castToSpinButton "updateIndex"++ removeButton <- builderGetObject gui castToButton "remove"+ clearButton <- builderGetObject gui castToButton "clear"+ removeIndex <- builderGetObject gui castToSpinButton "removeIndex"++ -- create a new list store+ store <- storeImpl+ New.treeViewSetModel view store+ setupView view store++ let getValues = do+ name <- entryGetText stringValue+ number <- spinButtonGetValue intValue+ marked <- toggleButtonGetActive boolValue+ return Phone {+ name = name,+ number = floor number,+ marked = marked+ }++ let onClicked obj act = on obj buttonActivated $ act++ onClicked prependButton $ getValues >>= New.listStorePrepend store+ onClicked appendButton $ getValues >>= New.listStoreAppend store >> return ()++ onClicked insertButton $ do+ value <- getValues+ index <- fmap floor $ spinButtonGetValue newIndex+ New.listStoreInsert store index value++ onClicked updateButton $ do+ value <- getValues+ index <- fmap floor $ spinButtonGetValue updateIndex+ New.listStoreSetValue store index value++ onClicked removeButton $ do+ index <- fmap floor $ spinButtonGetValue removeIndex+ New.listStoreRemove store index++ onClicked clearButton $ New.listStoreClear store++ New.treeViewSetReorderable view True++-- containerAdd win view+ widgetShowAll win+ mainGUI++setupView view model = do+ New.treeViewSetHeadersVisible view True++ -- add a couple columns+ renderer1 <- New.cellRendererTextNew+ col1 <- New.treeViewColumnNew+ New.treeViewColumnPackStart col1 renderer1 True+ New.cellLayoutSetAttributes col1 renderer1 model $ \row -> [ New.cellText := name row ]+ New.treeViewColumnSetTitle col1 "String column"+ New.treeViewAppendColumn view col1++ renderer2 <- New.cellRendererTextNew+ col2 <- New.treeViewColumnNew+ New.treeViewColumnPackStart col2 renderer2 True+ New.cellLayoutSetAttributes col2 renderer2 model $ \row -> [ New.cellText := show (number row) ]+ New.treeViewColumnSetTitle col2 "Int column"+ New.treeViewAppendColumn view col2++ renderer3 <- New.cellRendererToggleNew+ col3 <- New.treeViewColumnNew+ New.treeViewColumnPackStart col3 renderer3 True+ New.cellLayoutSetAttributes col3 renderer3 model $ \row -> [ New.cellToggleActive := marked row ]+ New.treeViewColumnSetTitle col3 "Check box column"+ New.treeViewAppendColumn view col3++storeImpl =+ New.listStoreNew+ [Phone { name = "Foo", number = 12345, marked = False }+ ,Phone { name = "Bar", number = 67890, marked = True }+ ,Phone { name = "Baz", number = 39496, marked = False }]
+ demo/treelist/ListText.hs view
@@ -0,0 +1,77 @@+import Graphics.UI.Gtk+import Data.Char+import Data.List+import Data.Maybe++data RowInfo = RowInfo { rowString :: String, rowCase :: Maybe Bool }++mkCase Nothing str = str+mkCase (Just False) str = map toLower str+mkCase (Just True) str = map toUpper str++advCase Nothing = Just False+advCase (Just False) = Just True+advCase (Just True) = Nothing++main :: IO ()+main = do+ unsafeInitGUIForThreadedRTS+ win <- windowNew+ win `on` objectDestroy $ mainQuit++ content <- readFile "ListText.hs"++ model <- listStoreNew (map (\r -> RowInfo r Nothing) (lines content))+ view <- treeViewNewWithModel model++ -- add a column showing the index+ col <- treeViewColumnNew+ treeViewAppendColumn view col++ cell <- cellRendererTextNew+ cellLayoutPackStart col cell True+ cellLayoutSetAttributeFunc col cell model $ \(TreeIter _ n _ _) ->+ set cell [cellText := show n]+ set col [treeViewColumnTitle := "line",+ treeViewColumnReorderable := True ]++ -- add a column showing the line in the file+ col <- treeViewColumnNew+ treeViewAppendColumn view col+ set col [treeViewColumnTitle := "line in file",+ treeViewColumnReorderable := True ]++ cell <- cellRendererTextNew+ cellLayoutPackStart col cell True+ cellLayoutSetAttributes col cell model $+ \row -> [cellText := mkCase (rowCase row) (rowString row)]++ -- add a column showing if it is forced to a specific case+ col <- treeViewColumnNew+ treeViewAppendColumn view col+ set col [treeViewColumnTitle := "case",+ treeViewColumnReorderable := True ]++ cell <- cellRendererToggleNew+ cellLayoutPackStart col cell True+ cellLayoutSetAttributes col cell model $+ \row -> [cellToggleActive := fromMaybe False (rowCase row),+ cellToggleInconsistent := rowCase row==Nothing]+ cell `on` cellToggled $ \tpStr -> do+ let [i] = stringToTreePath tpStr+ row@RowInfo { rowCase = c } <- listStoreGetValue model i+ listStoreSetValue model i row { rowCase = advCase c }++ -- to annoy the user: don't allow any columns to be dropped at the far right+ treeViewSetColumnDragFunction view $ Just $ \_ rCol _ -> do+ return (rCol /= Nothing)++ treeViewSetSearchEqualFunc view $ Just $ \str (TreeIter _ n _ _) -> do+ row <- listStoreGetValue model (fromIntegral n)+ return (map toLower str `isPrefixOf` map toLower (filter isAlphaNum (rowString row)))++ swin <- scrolledWindowNew Nothing Nothing+ set swin [ containerChild := view ]+ set win [ containerChild := swin ]+ widgetShowAll win+ mainGUI
+ demo/treelist/Makefile view
@@ -0,0 +1,45 @@++PROGS = listdemo treedemo listtest treetest dirlist treesort completion \+ listdnd filterdemo listtext++SOURCES = ListDemo.hs TreeDemo.hs ListTest.hs TreeTest.hs DirList.hs \+ TreeSort.hs Completion.hs ListDND.hs FilterDemo.hs ListText.hs++all : $(PROGS)++listdemo : ListDemo.hs+ $(HC_RULE)++treedemo : TreeDemo.hs+ $(HC_RULE)++listtest : ListTest.hs+ $(HC_RULE)++treetest : TreeTest.hs+ $(HC_RULE)++dirlist : DirList.hs+ $(HC_RULE)++treesort : TreeSort.hs+ $(HC_RULE)++completion : Completion.hs+ $(HC_RULE)++listdnd : ListDND.hs+ $(HC_RULE)++filterdemo : FilterDemo.hs+ $(HC_RULE)++listtext : ListText.hs+ $(HC_RULE)++HC_RULE = $(HC) --make $< -o $@ $(HCFLAGS)++clean:+ rm -f $(SOURCES:.hs=.hi) $(SOURCES:.hs=.o) $(PROGS)++HC=ghc
+ demo/treelist/TreeDemo.hs view
@@ -0,0 +1,69 @@+module Main where++import Control.Monad.IO.Class+import Graphics.UI.Gtk+import Graphics.UI.Gtk.ModelView as New++import qualified Data.Tree as Tree++data Phone = Phone { name :: String, number :: Int, marked :: Bool }++main = do+ initGUI++ win <- windowNew+ on win objectDestroy mainQuit++ -- create a new tree model+ model <- storeImpl+ view <- New.treeViewNewWithModel model++ New.treeViewSetHeadersVisible view True++ -- add three columns+ col1 <- New.treeViewColumnNew+ col2 <- New.treeViewColumnNew+ col3 <- New.treeViewColumnNew++ New.treeViewColumnSetTitle col1 "String column"+ New.treeViewColumnSetTitle col2 "Int column"+ New.treeViewColumnSetTitle col3 "Bool column"++ renderer1 <- New.cellRendererTextNew+ renderer2 <- New.cellRendererTextNew+ renderer3 <- New.cellRendererToggleNew++ New.cellLayoutPackStart col1 renderer1 True+ New.cellLayoutPackStart col2 renderer2 True+ New.cellLayoutPackStart col3 renderer3 True++ New.cellLayoutSetAttributes col1 renderer1 model $ \row -> [ New.cellText := name row ]+ New.cellLayoutSetAttributes col2 renderer2 model $ \row -> [ New.cellText := show (number row) ]+ New.cellLayoutSetAttributes col3 renderer3 model $ \row -> [ New.cellToggleActive := marked row ]++ New.treeViewAppendColumn view col1+ New.treeViewAppendColumn view col2+ New.treeViewAppendColumn view col3++ containerAdd win view+ widgetShowAll win+ mainGUI++storeImpl =+ New.treeStoreNew+ [Tree.Node {+ Tree.rootLabel = Phone { name = "Foo", number = 1, marked = False },+ Tree.subForest = [leafNode Phone { name = "Bar", number = 11, marked = True }+ ,leafNode Phone { name = "Baz", number = 12, marked = False }]+ },+ Tree.Node {+ Tree.rootLabel = Phone { name = "Foo", number = 2, marked = False },+ Tree.subForest = [leafNode Phone { name = "Bar", number = 21, marked = True }+ ,leafNode Phone { name = "Baz", number = 22, marked = False }]+ },+ Tree.Node {+ Tree.rootLabel = Phone { name = "Foo", number = 3, marked = False },+ Tree.subForest = [leafNode Phone { name = "Bar", number = 31, marked = True }+ ,leafNode Phone { name = "Baz", number = 32, marked = False }]+ }]+ where leafNode a = Tree.Node { Tree.rootLabel = a, Tree.subForest = [] }
+ demo/treelist/TreeSort.hs view
@@ -0,0 +1,86 @@+import Graphics.UI.Gtk+import Graphics.UI.Gtk.ModelView as New+import Data.Tree++main = do+ initGUI+ win <- windowNew+ -- Create a tree model with some unsorted data.+ rawmodel <- New.treeStoreNew+ [Node ("zoo",8) [], Node ("foo",5) [],+ Node ("bar",20) [], Node ("baz",2) []]++ -- Create a sorting proxy model, that is, a model that permutates the+ -- rows of a different model such that they appear to be sorted.+ model <- New.treeModelSortNewWithModel rawmodel++ -- Define two sorting functions, one being the default sorting function and+ -- the other one being the sorting function for the 'SortColumnId' 2.+ -- 'SortColumnId's are arbitrary positive numbers, i.e., we could have chosen+ -- any other unique number.+ New.treeSortableSetDefaultSortFunc model $ Just $ \iter1 iter2 -> do+ (t1,_) <- New.treeModelGetRow rawmodel iter1+ (t2,_) <- New.treeModelGetRow rawmodel iter2+ return (compare t1 t2)+ New.treeSortableSetSortFunc model 2 $ \iter1 iter2 -> do+ (_,n1) <- New.treeModelGetRow rawmodel iter1+ (_,n2) <- New.treeModelGetRow rawmodel iter2+ return (compare n1 n2)++ -- Create the view.+ view <- New.treeViewNewWithModel model++ -- Create and insert two columns, one with the heading Name, one with the+ -- heading Number. Associate the 'SortColumnId' 2 with the latter column such+ -- that clicking on the Number header will sort the rows by the numbers.+ col <- New.treeViewColumnNew+ New.treeViewColumnSetTitle col "Name"+ rend <- New.cellRendererTextNew+ New.cellLayoutPackStart col rend True+ New.cellLayoutSetAttributeFunc col rend model $ \iter -> do+ cIter <- New.treeModelSortConvertIterToChildIter model iter+ (n,_) <- New.treeModelGetRow rawmodel cIter+ set rend [New.cellText := n]+ New.treeViewAppendColumn view col++ col' <- New.treeViewColumnNew+ New.treeViewColumnSetTitle col' "Number"+ rend <- New.cellRendererTextNew+ New.cellLayoutPackStart col' rend True+ New.cellLayoutSetAttributeFunc col' rend model $ \iter -> do+ cIter <- New.treeModelSortConvertIterToChildIter model iter+ (_,c) <- New.treeModelGetRow rawmodel cIter+ set rend [New.cellText := show c]+ New.treeViewAppendColumn view col'+ New.treeViewColumnSetSortColumnId col' 2++ -- Create a button that shows information on the current state of the sorting+ -- settings.+ button <- buttonNewWithLabel "Dump Info"+ on button buttonActivated $ do+ sId <- New.treeViewColumnGetSortColumnId col+ putStrLn ("tvc1 sort id is "++show sId)+ sId <- New.treeViewColumnGetSortColumnId col'+ putStrLn ("tvc2 sort id is "++show sId)+ sId <- New.treeSortableGetSortColumnId model+ putStrLn ("sort id is "++show sId)+ -- Show all entries of the proxy model+ let recurse Nothing = return ()+ recurse (Just iter) = do+ cIter <- New.treeModelSortConvertIterToChildIter model iter+ row <- New.treeModelGetRow rawmodel cIter+ putStrLn ("iter "++show cIter++": "++show row)+ mIter <- New.treeModelIterNext model iter+ recurse mIter+ mIter <- New.treeModelGetIterFirst model+ recurse mIter++ -- Put it all together.+ vBox <- vBoxNew False 3+ -- boxPackStartDefaults vBox view+ boxPackStart vBox view PackRepel 0+ boxPackEnd vBox button PackNatural 0+ containerAdd win vBox+ widgetShowAll win+ on win objectDestroy mainQuit+ mainGUI
+ demo/treelist/TreeTest.glade view
@@ -0,0 +1,1040 @@+<?xml version="1.0"?>+<!--*- mode: xml -*-->+<interface>+ <object class="GtkAdjustment" id="adjustment1">+ <property name="upper">100</property>+ <property name="lower">0</property>+ <property name="page_increment">10</property>+ <property name="step_increment">1</property>+ <property name="page_size">10</property>+ <property name="value">1</property>+ </object>+ <object class="GtkWindow" id="window">+ <property name="visible">True</property>+ <property name="title" translatable="yes">Tree Test</property>+ <property name="type">GTK_WINDOW_TOPLEVEL</property>+ <property name="window_position">GTK_WIN_POS_NONE</property>+ <property name="modal">False</property>+ <property name="resizable">True</property>+ <property name="destroy_with_parent">False</property>+ <property name="decorated">True</property>+ <property name="skip_taskbar_hint">False</property>+ <property name="skip_pager_hint">False</property>+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>+ <property name="focus_on_map">True</property>+ <property name="urgency_hint">False</property>+ <child>+ <object class="GtkVBox" id="vbox1">+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkScrolledWindow" id="scrolledwindow1">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>+ <property name="shadow_type">GTK_SHADOW_IN</property>+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>+ <child>+ <object class="GtkTreeView" id="view">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="headers_visible">True</property>+ <property name="rules_hint">False</property>+ <property name="reorderable">False</property>+ <property name="enable_search">True</property>+ <property name="fixed_height_mode">False</property>+ <property name="hover_selection">False</property>+ <property name="hover_expand">False</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkVBox" id="vbox2">+ <property name="border_width">8</property>+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">12</property>+ <child>+ <object class="GtkExpander" id="expander6">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkTable" id="table1">+ <property name="border_width">2</property>+ <property name="visible">True</property>+ <property name="n_rows">3</property>+ <property name="n_columns">2</property>+ <property name="homogeneous">False</property>+ <property name="row_spacing">4</property>+ <property name="column_spacing">18</property>+ <child>+ <object class="GtkSpinButton" id="intValue">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="climb_rate">1</property>+ <property name="digits">0</property>+ <property name="numeric">True</property>+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>+ <property name="snap_to_ticks">True</property>+ <property name="wrap">False</property>+ <property name="adjustment">adjustment1</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkCheckButton" id="boolValue">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ <property name="active">False</property>+ <property name="inconsistent">False</property>+ <property name="draw_indicator">True</property>+ <child>+ <placeholder/>+ </child>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">2</property>+ <property name="bottom_attach">3</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="stringValue">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">expand|shrink|fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label3">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Number value:</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">1</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options"/>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label2">+ <property name="visible">True</property>+ <property name="label" translatable="yes">String value:</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">1</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options"/>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label4">+ <property name="visible">True</property>+ <property name="label" translatable="yes">Boolean value:</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">1</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">2</property>+ <property name="bottom_attach">3</property>+ <property name="x_options"/>+ <property name="y_options"/>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label29">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Value</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander5">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkTable" id="table3">+ <property name="visible">True</property>+ <property name="n_rows">2</property>+ <property name="n_columns">3</property>+ <property name="homogeneous">False</property>+ <property name="row_spacing">4</property>+ <property name="column_spacing">2</property>+ <child>+ <object class="GtkButton" id="insert">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">insert</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label23">+ <property name="visible">True</property>+ <property name="label" translatable="yes">new entry at</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="newPath">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="left_attach">2</property>+ <property name="right_attach">3</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkButton" id="update">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">update</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label20">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry at</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="updatePath">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="left_attach">2</property>+ <property name="right_attach">3</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="y_options"/>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label28">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Insert and Update</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander1">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">True</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkTable" id="table2">+ <property name="visible">True</property>+ <property name="n_rows">2</property>+ <property name="n_columns">3</property>+ <property name="homogeneous">False</property>+ <property name="row_spacing">4</property>+ <property name="column_spacing">2</property>+ <child>+ <object class="GtkButton" id="remove">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">delete</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkButton" id="clear">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">clear</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label19">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label34">+ <property name="visible">True</property>+ <property name="label" translatable="yes">all</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="removePath">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="left_attach">2</property>+ <property name="right_attach">3</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="y_options"/>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label24">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Delete</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander2">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkTable" id="table4">+ <property name="visible">True</property>+ <property name="n_rows">2</property>+ <property name="n_columns">5</property>+ <property name="homogeneous">False</property>+ <property name="row_spacing">4</property>+ <property name="column_spacing">2</property>+ <child>+ <object class="GtkButton" id="button18">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">move</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkButton" id="button19">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">move</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="left_attach">0</property>+ <property name="right_attach">1</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label15">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label16">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">1</property>+ <property name="right_attach">2</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label17">+ <property name="visible">True</property>+ <property name="label" translatable="yes">before</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">3</property>+ <property name="right_attach">4</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label18">+ <property name="visible">True</property>+ <property name="label" translatable="yes">after</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="left_attach">3</property>+ <property name="right_attach">4</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="x_options">fill</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="entry4">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="left_attach">2</property>+ <property name="right_attach">3</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="entry5">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="left_attach">4</property>+ <property name="right_attach">5</property>+ <property name="top_attach">0</property>+ <property name="bottom_attach">1</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="entry6">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="left_attach">2</property>+ <property name="right_attach">3</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="y_options"/>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="entry7">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="left_attach">4</property>+ <property name="right_attach">5</property>+ <property name="top_attach">1</property>+ <property name="bottom_attach">2</property>+ <property name="y_options"/>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label25">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Move</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander3">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">False</property>+ <property name="spacing">0</property>+ <child>+ <object class="GtkHBox" id="hbox2">+ <property name="border_width">4</property>+ <property name="visible">True</property>+ <property name="homogeneous">False</property>+ <property name="spacing">2</property>+ <child>+ <object class="GtkButton" id="button17">+ <property name="width_request">54</property>+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="label" translatable="yes">swap</property>+ <property name="use_underline">True</property>+ <property name="relief">GTK_RELIEF_NORMAL</property>+ <property name="focus_on_click">True</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label14">+ <property name="visible">True</property>+ <property name="label" translatable="yes">entry</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="entry8">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkLabel" id="label13">+ <property name="visible">True</property>+ <property name="label" translatable="yes">with</property>+ <property name="use_underline">False</property>+ <property name="use_markup">False</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0</property>+ <property name="yalign">0.5</property>+ <property name="xpad">4</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ <child>+ <object class="GtkEntry" id="entry9">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="editable">True</property>+ <property name="visibility">True</property>+ <property name="max_length">0</property>+ <property name="text" translatable="yes"/>+ <property name="has_frame">True</property>+ <property name="invisible_char">*</property>+ <property name="activates_default">False</property>+ <property name="width_chars">10</property>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">True</property>+ <property name="fill">True</property>+ </packing>+ </child>+ </object>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label26">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Swap</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ <child>+ <object class="GtkExpander" id="expander4">+ <property name="visible">True</property>+ <property name="can_focus">True</property>+ <property name="expanded">False</property>+ <property name="spacing">0</property>+ <child>+ <placeholder/>+ </child>+ <child type="label">+ <object class="GtkLabel" id="label27">+ <property name="visible">True</property>+ <property name="label" translatable="yes"><b>Reorder</b></property>+ <property name="use_underline">False</property>+ <property name="use_markup">True</property>+ <property name="justify">GTK_JUSTIFY_LEFT</property>+ <property name="wrap">False</property>+ <property name="selectable">False</property>+ <property name="xalign">0.5</property>+ <property name="yalign">0.5</property>+ <property name="xpad">0</property>+ <property name="ypad">0</property>+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>+ <property name="width_chars">-1</property>+ <property name="single_line_mode">False</property>+ <property name="angle">0</property>+ </object>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">False</property>+ </packing>+ </child>+ </object>+ <packing>+ <property name="padding">0</property>+ <property name="expand">False</property>+ <property name="fill">True</property>+ </packing>+ </child>+ </object>+ </child>+ </object>+</interface>
+ demo/treelist/TreeTest.hs view
@@ -0,0 +1,116 @@+module Main where++import Graphics.UI.Gtk+import Graphics.UI.Gtk.ModelView as New++import qualified Data.Tree as Tree++data Phone = Phone { name :: String, number :: Int, marked :: Bool }++main = do+ initGUI++ gui <- builderNew+ builderAddFromFile gui "TreeTest.glade"++ win <- builderGetObject gui castToWindow "window"+ on win objectDestroy mainQuit++ view <- builderGetObject gui castToTreeView "view"++ stringValue <- builderGetObject gui castToEntry "stringValue"+ intValue <- builderGetObject gui castToSpinButton "intValue"+ boolValue <- builderGetObject gui castToCheckButton "boolValue"++ insertButton <- builderGetObject gui castToButton "insert"+ updateButton <- builderGetObject gui castToButton "update"+ newPath <- builderGetObject gui castToEntry "newPath"+ updatePath <- builderGetObject gui castToEntry "updatePath"++ removeButton <- builderGetObject gui castToButton "remove"+ clearButton <- builderGetObject gui castToButton "clear"+ removePath <- builderGetObject gui castToEntry "removePath"++ -- create a new list store+ store <- storeImpl+ New.treeViewSetModel view store+ setupView view store++ let getValues = do+ name <- entryGetText stringValue+ number <- spinButtonGetValue intValue+ marked <- toggleButtonGetActive boolValue+ return Phone {+ name = name,+ number = floor number,+ marked = marked+ }++ on insertButton buttonActivated $ do+ value <- getValues+ path <- fmap read $ get newPath entryText+ New.treeStoreInsert store (init path) (last path) value++ on updateButton buttonActivated $ do+ value <- getValues+ path <- fmap read $ get updatePath entryText+ New.treeStoreSetValue store path value++ on removeButton buttonActivated $ do+ path <- fmap read $ get removePath entryText+ New.treeStoreRemove store path+ return ()++ on clearButton buttonActivated $ New.treeStoreClear store++ New.treeViewSetReorderable view True++ widgetShowAll win+ mainGUI++setupView view model = do+ New.treeViewSetHeadersVisible view True++ -- add three columns+ col1 <- New.treeViewColumnNew+ col2 <- New.treeViewColumnNew+ col3 <- New.treeViewColumnNew++ New.treeViewColumnSetTitle col1 "String column"+ New.treeViewColumnSetTitle col2 "Int column"+ New.treeViewColumnSetTitle col3 "Bool column"++ renderer1 <- New.cellRendererTextNew+ renderer2 <- New.cellRendererTextNew+ renderer3 <- New.cellRendererToggleNew++ New.cellLayoutPackStart col1 renderer1 True+ New.cellLayoutPackStart col2 renderer2 True+ New.cellLayoutPackStart col3 renderer3 True++ New.cellLayoutSetAttributes col1 renderer1 model $ \row -> [ New.cellText := name row ]+ New.cellLayoutSetAttributes col2 renderer2 model $ \row -> [ New.cellText := show (number row) ]+ New.cellLayoutSetAttributes col3 renderer3 model $ \row -> [ New.cellToggleActive := marked row ]++ New.treeViewAppendColumn view col1+ New.treeViewAppendColumn view col2+ New.treeViewAppendColumn view col3++storeImpl =+ New.treeStoreNew+ [Tree.Node {+ Tree.rootLabel = Phone { name = "Foo", number = 1, marked = False },+ Tree.subForest = [leafNode Phone { name = "Bar", number = 11, marked = True }+ ,leafNode Phone { name = "Baz", number = 12, marked = False }]+ },+ Tree.Node {+ Tree.rootLabel = Phone { name = "Foo", number = 2, marked = False },+ Tree.subForest = [leafNode Phone { name = "Bar", number = 21, marked = True }+ ,leafNode Phone { name = "Baz", number = 22, marked = False }]+ },+ Tree.Node {+ Tree.rootLabel = Phone { name = "Foo", number = 3, marked = False },+ Tree.subForest = [leafNode Phone { name = "Bar", number = 31, marked = True }+ ,leafNode Phone { name = "Baz", number = 32, marked = False }]+ }]+ where leafNode a = Tree.Node { Tree.rootLabel = a, Tree.subForest = [] }
+ demo/treelist/resListDND/desktop.png view
binary file changed (absent → 8078 bytes)
+ demo/treelist/resListDND/laptop.png view
binary file changed (absent → 7657 bytes)
+ demo/treelist/resListDND/laptopSmall.png view
binary file changed (absent → 7726 bytes)
+ demo/treelist/resListDND/printer.png view
binary file changed (absent → 7869 bytes)
+ demo/treelist/resListDND/server.png view
binary file changed (absent → 6448 bytes)
+ demo/treelist/resListDND/tower.png view
binary file changed (absent → 11777 bytes)
+ demo/treelist/rgb.txt view
@@ -0,0 +1,753 @@+! $Xorg: rgb.txt,v 1.3 2000/08/17 19:54:00 cpqbld Exp $+255 250 250 snow+248 248 255 ghost white+248 248 255 GhostWhite+245 245 245 white smoke+245 245 245 WhiteSmoke+220 220 220 gainsboro+255 250 240 floral white+255 250 240 FloralWhite+253 245 230 old lace+253 245 230 OldLace+250 240 230 linen+250 235 215 antique white+250 235 215 AntiqueWhite+255 239 213 papaya whip+255 239 213 PapayaWhip+255 235 205 blanched almond+255 235 205 BlanchedAlmond+255 228 196 bisque+255 218 185 peach puff+255 218 185 PeachPuff+255 222 173 navajo white+255 222 173 NavajoWhite+255 228 181 moccasin+255 248 220 cornsilk+255 255 240 ivory+255 250 205 lemon chiffon+255 250 205 LemonChiffon+255 245 238 seashell+240 255 240 honeydew+245 255 250 mint cream+245 255 250 MintCream+240 255 255 azure+240 248 255 alice blue+240 248 255 AliceBlue+230 230 250 lavender+255 240 245 lavender blush+255 240 245 LavenderBlush+255 228 225 misty rose+255 228 225 MistyRose+255 255 255 white+ 0 0 0 black+ 47 79 79 dark slate gray+ 47 79 79 DarkSlateGray+ 47 79 79 dark slate grey+ 47 79 79 DarkSlateGrey+105 105 105 dim gray+105 105 105 DimGray+105 105 105 dim grey+105 105 105 DimGrey+112 128 144 slate gray+112 128 144 SlateGray+112 128 144 slate grey+112 128 144 SlateGrey+119 136 153 light slate gray+119 136 153 LightSlateGray+119 136 153 light slate grey+119 136 153 LightSlateGrey+190 190 190 gray+190 190 190 grey+211 211 211 light grey+211 211 211 LightGrey+211 211 211 light gray+211 211 211 LightGray+ 25 25 112 midnight blue+ 25 25 112 MidnightBlue+ 0 0 128 navy+ 0 0 128 navy blue+ 0 0 128 NavyBlue+100 149 237 cornflower blue+100 149 237 CornflowerBlue+ 72 61 139 dark slate blue+ 72 61 139 DarkSlateBlue+106 90 205 slate blue+106 90 205 SlateBlue+123 104 238 medium slate blue+123 104 238 MediumSlateBlue+132 112 255 light slate blue+132 112 255 LightSlateBlue+ 0 0 205 medium blue+ 0 0 205 MediumBlue+ 65 105 225 royal blue+ 65 105 225 RoyalBlue+ 0 0 255 blue+ 30 144 255 dodger blue+ 30 144 255 DodgerBlue+ 0 191 255 deep sky blue+ 0 191 255 DeepSkyBlue+135 206 235 sky blue+135 206 235 SkyBlue+135 206 250 light sky blue+135 206 250 LightSkyBlue+ 70 130 180 steel blue+ 70 130 180 SteelBlue+176 196 222 light steel blue+176 196 222 LightSteelBlue+173 216 230 light blue+173 216 230 LightBlue+176 224 230 powder blue+176 224 230 PowderBlue+175 238 238 pale turquoise+175 238 238 PaleTurquoise+ 0 206 209 dark turquoise+ 0 206 209 DarkTurquoise+ 72 209 204 medium turquoise+ 72 209 204 MediumTurquoise+ 64 224 208 turquoise+ 0 255 255 cyan+224 255 255 light cyan+224 255 255 LightCyan+ 95 158 160 cadet blue+ 95 158 160 CadetBlue+102 205 170 medium aquamarine+102 205 170 MediumAquamarine+127 255 212 aquamarine+ 0 100 0 dark green+ 0 100 0 DarkGreen+ 85 107 47 dark olive green+ 85 107 47 DarkOliveGreen+143 188 143 dark sea green+143 188 143 DarkSeaGreen+ 46 139 87 sea green+ 46 139 87 SeaGreen+ 60 179 113 medium sea green+ 60 179 113 MediumSeaGreen+ 32 178 170 light sea green+ 32 178 170 LightSeaGreen+152 251 152 pale green+152 251 152 PaleGreen+ 0 255 127 spring green+ 0 255 127 SpringGreen+124 252 0 lawn green+124 252 0 LawnGreen+ 0 255 0 green+127 255 0 chartreuse+ 0 250 154 medium spring green+ 0 250 154 MediumSpringGreen+173 255 47 green yellow+173 255 47 GreenYellow+ 50 205 50 lime green+ 50 205 50 LimeGreen+154 205 50 yellow green+154 205 50 YellowGreen+ 34 139 34 forest green+ 34 139 34 ForestGreen+107 142 35 olive drab+107 142 35 OliveDrab+189 183 107 dark khaki+189 183 107 DarkKhaki+240 230 140 khaki+238 232 170 pale goldenrod+238 232 170 PaleGoldenrod+250 250 210 light goldenrod yellow+250 250 210 LightGoldenrodYellow+255 255 224 light yellow+255 255 224 LightYellow+255 255 0 yellow+255 215 0 gold+238 221 130 light goldenrod+238 221 130 LightGoldenrod+218 165 32 goldenrod+184 134 11 dark goldenrod+184 134 11 DarkGoldenrod+188 143 143 rosy brown+188 143 143 RosyBrown+205 92 92 indian red+205 92 92 IndianRed+139 69 19 saddle brown+139 69 19 SaddleBrown+160 82 45 sienna+205 133 63 peru+222 184 135 burlywood+245 245 220 beige+245 222 179 wheat+244 164 96 sandy brown+244 164 96 SandyBrown+210 180 140 tan+210 105 30 chocolate+178 34 34 firebrick+165 42 42 brown+233 150 122 dark salmon+233 150 122 DarkSalmon+250 128 114 salmon+255 160 122 light salmon+255 160 122 LightSalmon+255 165 0 orange+255 140 0 dark orange+255 140 0 DarkOrange+255 127 80 coral+240 128 128 light coral+240 128 128 LightCoral+255 99 71 tomato+255 69 0 orange red+255 69 0 OrangeRed+255 0 0 red+255 105 180 hot pink+255 105 180 HotPink+255 20 147 deep pink+255 20 147 DeepPink+255 192 203 pink+255 182 193 light pink+255 182 193 LightPink+219 112 147 pale violet red+219 112 147 PaleVioletRed+176 48 96 maroon+199 21 133 medium violet red+199 21 133 MediumVioletRed+208 32 144 violet red+208 32 144 VioletRed+255 0 255 magenta+238 130 238 violet+221 160 221 plum+218 112 214 orchid+186 85 211 medium orchid+186 85 211 MediumOrchid+153 50 204 dark orchid+153 50 204 DarkOrchid+148 0 211 dark violet+148 0 211 DarkViolet+138 43 226 blue violet+138 43 226 BlueViolet+160 32 240 purple+147 112 219 medium purple+147 112 219 MediumPurple+216 191 216 thistle+255 250 250 snow1+238 233 233 snow2+205 201 201 snow3+139 137 137 snow4+255 245 238 seashell1+238 229 222 seashell2+205 197 191 seashell3+139 134 130 seashell4+255 239 219 AntiqueWhite1+238 223 204 AntiqueWhite2+205 192 176 AntiqueWhite3+139 131 120 AntiqueWhite4+255 228 196 bisque1+238 213 183 bisque2+205 183 158 bisque3+139 125 107 bisque4+255 218 185 PeachPuff1+238 203 173 PeachPuff2+205 175 149 PeachPuff3+139 119 101 PeachPuff4+255 222 173 NavajoWhite1+238 207 161 NavajoWhite2+205 179 139 NavajoWhite3+139 121 94 NavajoWhite4+255 250 205 LemonChiffon1+238 233 191 LemonChiffon2+205 201 165 LemonChiffon3+139 137 112 LemonChiffon4+255 248 220 cornsilk1+238 232 205 cornsilk2+205 200 177 cornsilk3+139 136 120 cornsilk4+255 255 240 ivory1+238 238 224 ivory2+205 205 193 ivory3+139 139 131 ivory4+240 255 240 honeydew1+224 238 224 honeydew2+193 205 193 honeydew3+131 139 131 honeydew4+255 240 245 LavenderBlush1+238 224 229 LavenderBlush2+205 193 197 LavenderBlush3+139 131 134 LavenderBlush4+255 228 225 MistyRose1+238 213 210 MistyRose2+205 183 181 MistyRose3+139 125 123 MistyRose4+240 255 255 azure1+224 238 238 azure2+193 205 205 azure3+131 139 139 azure4+131 111 255 SlateBlue1+122 103 238 SlateBlue2+105 89 205 SlateBlue3+ 71 60 139 SlateBlue4+ 72 118 255 RoyalBlue1+ 67 110 238 RoyalBlue2+ 58 95 205 RoyalBlue3+ 39 64 139 RoyalBlue4+ 0 0 255 blue1+ 0 0 238 blue2+ 0 0 205 blue3+ 0 0 139 blue4+ 30 144 255 DodgerBlue1+ 28 134 238 DodgerBlue2+ 24 116 205 DodgerBlue3+ 16 78 139 DodgerBlue4+ 99 184 255 SteelBlue1+ 92 172 238 SteelBlue2+ 79 148 205 SteelBlue3+ 54 100 139 SteelBlue4+ 0 191 255 DeepSkyBlue1+ 0 178 238 DeepSkyBlue2+ 0 154 205 DeepSkyBlue3+ 0 104 139 DeepSkyBlue4+135 206 255 SkyBlue1+126 192 238 SkyBlue2+108 166 205 SkyBlue3+ 74 112 139 SkyBlue4+176 226 255 LightSkyBlue1+164 211 238 LightSkyBlue2+141 182 205 LightSkyBlue3+ 96 123 139 LightSkyBlue4+198 226 255 SlateGray1+185 211 238 SlateGray2+159 182 205 SlateGray3+108 123 139 SlateGray4+202 225 255 LightSteelBlue1+188 210 238 LightSteelBlue2+162 181 205 LightSteelBlue3+110 123 139 LightSteelBlue4+191 239 255 LightBlue1+178 223 238 LightBlue2+154 192 205 LightBlue3+104 131 139 LightBlue4+224 255 255 LightCyan1+209 238 238 LightCyan2+180 205 205 LightCyan3+122 139 139 LightCyan4+187 255 255 PaleTurquoise1+174 238 238 PaleTurquoise2+150 205 205 PaleTurquoise3+102 139 139 PaleTurquoise4+152 245 255 CadetBlue1+142 229 238 CadetBlue2+122 197 205 CadetBlue3+ 83 134 139 CadetBlue4+ 0 245 255 turquoise1+ 0 229 238 turquoise2+ 0 197 205 turquoise3+ 0 134 139 turquoise4+ 0 255 255 cyan1+ 0 238 238 cyan2+ 0 205 205 cyan3+ 0 139 139 cyan4+151 255 255 DarkSlateGray1+141 238 238 DarkSlateGray2+121 205 205 DarkSlateGray3+ 82 139 139 DarkSlateGray4+127 255 212 aquamarine1+118 238 198 aquamarine2+102 205 170 aquamarine3+ 69 139 116 aquamarine4+193 255 193 DarkSeaGreen1+180 238 180 DarkSeaGreen2+155 205 155 DarkSeaGreen3+105 139 105 DarkSeaGreen4+ 84 255 159 SeaGreen1+ 78 238 148 SeaGreen2+ 67 205 128 SeaGreen3+ 46 139 87 SeaGreen4+154 255 154 PaleGreen1+144 238 144 PaleGreen2+124 205 124 PaleGreen3+ 84 139 84 PaleGreen4+ 0 255 127 SpringGreen1+ 0 238 118 SpringGreen2+ 0 205 102 SpringGreen3+ 0 139 69 SpringGreen4+ 0 255 0 green1+ 0 238 0 green2+ 0 205 0 green3+ 0 139 0 green4+127 255 0 chartreuse1+118 238 0 chartreuse2+102 205 0 chartreuse3+ 69 139 0 chartreuse4+192 255 62 OliveDrab1+179 238 58 OliveDrab2+154 205 50 OliveDrab3+105 139 34 OliveDrab4+202 255 112 DarkOliveGreen1+188 238 104 DarkOliveGreen2+162 205 90 DarkOliveGreen3+110 139 61 DarkOliveGreen4+255 246 143 khaki1+238 230 133 khaki2+205 198 115 khaki3+139 134 78 khaki4+255 236 139 LightGoldenrod1+238 220 130 LightGoldenrod2+205 190 112 LightGoldenrod3+139 129 76 LightGoldenrod4+255 255 224 LightYellow1+238 238 209 LightYellow2+205 205 180 LightYellow3+139 139 122 LightYellow4+255 255 0 yellow1+238 238 0 yellow2+205 205 0 yellow3+139 139 0 yellow4+255 215 0 gold1+238 201 0 gold2+205 173 0 gold3+139 117 0 gold4+255 193 37 goldenrod1+238 180 34 goldenrod2+205 155 29 goldenrod3+139 105 20 goldenrod4+255 185 15 DarkGoldenrod1+238 173 14 DarkGoldenrod2+205 149 12 DarkGoldenrod3+139 101 8 DarkGoldenrod4+255 193 193 RosyBrown1+238 180 180 RosyBrown2+205 155 155 RosyBrown3+139 105 105 RosyBrown4+255 106 106 IndianRed1+238 99 99 IndianRed2+205 85 85 IndianRed3+139 58 58 IndianRed4+255 130 71 sienna1+238 121 66 sienna2+205 104 57 sienna3+139 71 38 sienna4+255 211 155 burlywood1+238 197 145 burlywood2+205 170 125 burlywood3+139 115 85 burlywood4+255 231 186 wheat1+238 216 174 wheat2+205 186 150 wheat3+139 126 102 wheat4+255 165 79 tan1+238 154 73 tan2+205 133 63 tan3+139 90 43 tan4+255 127 36 chocolate1+238 118 33 chocolate2+205 102 29 chocolate3+139 69 19 chocolate4+255 48 48 firebrick1+238 44 44 firebrick2+205 38 38 firebrick3+139 26 26 firebrick4+255 64 64 brown1+238 59 59 brown2+205 51 51 brown3+139 35 35 brown4+255 140 105 salmon1+238 130 98 salmon2+205 112 84 salmon3+139 76 57 salmon4+255 160 122 LightSalmon1+238 149 114 LightSalmon2+205 129 98 LightSalmon3+139 87 66 LightSalmon4+255 165 0 orange1+238 154 0 orange2+205 133 0 orange3+139 90 0 orange4+255 127 0 DarkOrange1+238 118 0 DarkOrange2+205 102 0 DarkOrange3+139 69 0 DarkOrange4+255 114 86 coral1+238 106 80 coral2+205 91 69 coral3+139 62 47 coral4+255 99 71 tomato1+238 92 66 tomato2+205 79 57 tomato3+139 54 38 tomato4+255 69 0 OrangeRed1+238 64 0 OrangeRed2+205 55 0 OrangeRed3+139 37 0 OrangeRed4+255 0 0 red1+238 0 0 red2+205 0 0 red3+139 0 0 red4+255 20 147 DeepPink1+238 18 137 DeepPink2+205 16 118 DeepPink3+139 10 80 DeepPink4+255 110 180 HotPink1+238 106 167 HotPink2+205 96 144 HotPink3+139 58 98 HotPink4+255 181 197 pink1+238 169 184 pink2+205 145 158 pink3+139 99 108 pink4+255 174 185 LightPink1+238 162 173 LightPink2+205 140 149 LightPink3+139 95 101 LightPink4+255 130 171 PaleVioletRed1+238 121 159 PaleVioletRed2+205 104 137 PaleVioletRed3+139 71 93 PaleVioletRed4+255 52 179 maroon1+238 48 167 maroon2+205 41 144 maroon3+139 28 98 maroon4+255 62 150 VioletRed1+238 58 140 VioletRed2+205 50 120 VioletRed3+139 34 82 VioletRed4+255 0 255 magenta1+238 0 238 magenta2+205 0 205 magenta3+139 0 139 magenta4+255 131 250 orchid1+238 122 233 orchid2+205 105 201 orchid3+139 71 137 orchid4+255 187 255 plum1+238 174 238 plum2+205 150 205 plum3+139 102 139 plum4+224 102 255 MediumOrchid1+209 95 238 MediumOrchid2+180 82 205 MediumOrchid3+122 55 139 MediumOrchid4+191 62 255 DarkOrchid1+178 58 238 DarkOrchid2+154 50 205 DarkOrchid3+104 34 139 DarkOrchid4+155 48 255 purple1+145 44 238 purple2+125 38 205 purple3+ 85 26 139 purple4+171 130 255 MediumPurple1+159 121 238 MediumPurple2+137 104 205 MediumPurple3+ 93 71 139 MediumPurple4+255 225 255 thistle1+238 210 238 thistle2+205 181 205 thistle3+139 123 139 thistle4+ 0 0 0 gray0+ 0 0 0 grey0+ 3 3 3 gray1+ 3 3 3 grey1+ 5 5 5 gray2+ 5 5 5 grey2+ 8 8 8 gray3+ 8 8 8 grey3+ 10 10 10 gray4+ 10 10 10 grey4+ 13 13 13 gray5+ 13 13 13 grey5+ 15 15 15 gray6+ 15 15 15 grey6+ 18 18 18 gray7+ 18 18 18 grey7+ 20 20 20 gray8+ 20 20 20 grey8+ 23 23 23 gray9+ 23 23 23 grey9+ 26 26 26 gray10+ 26 26 26 grey10+ 28 28 28 gray11+ 28 28 28 grey11+ 31 31 31 gray12+ 31 31 31 grey12+ 33 33 33 gray13+ 33 33 33 grey13+ 36 36 36 gray14+ 36 36 36 grey14+ 38 38 38 gray15+ 38 38 38 grey15+ 41 41 41 gray16+ 41 41 41 grey16+ 43 43 43 gray17+ 43 43 43 grey17+ 46 46 46 gray18+ 46 46 46 grey18+ 48 48 48 gray19+ 48 48 48 grey19+ 51 51 51 gray20+ 51 51 51 grey20+ 54 54 54 gray21+ 54 54 54 grey21+ 56 56 56 gray22+ 56 56 56 grey22+ 59 59 59 gray23+ 59 59 59 grey23+ 61 61 61 gray24+ 61 61 61 grey24+ 64 64 64 gray25+ 64 64 64 grey25+ 66 66 66 gray26+ 66 66 66 grey26+ 69 69 69 gray27+ 69 69 69 grey27+ 71 71 71 gray28+ 71 71 71 grey28+ 74 74 74 gray29+ 74 74 74 grey29+ 77 77 77 gray30+ 77 77 77 grey30+ 79 79 79 gray31+ 79 79 79 grey31+ 82 82 82 gray32+ 82 82 82 grey32+ 84 84 84 gray33+ 84 84 84 grey33+ 87 87 87 gray34+ 87 87 87 grey34+ 89 89 89 gray35+ 89 89 89 grey35+ 92 92 92 gray36+ 92 92 92 grey36+ 94 94 94 gray37+ 94 94 94 grey37+ 97 97 97 gray38+ 97 97 97 grey38+ 99 99 99 gray39+ 99 99 99 grey39+102 102 102 gray40+102 102 102 grey40+105 105 105 gray41+105 105 105 grey41+107 107 107 gray42+107 107 107 grey42+110 110 110 gray43+110 110 110 grey43+112 112 112 gray44+112 112 112 grey44+115 115 115 gray45+115 115 115 grey45+117 117 117 gray46+117 117 117 grey46+120 120 120 gray47+120 120 120 grey47+122 122 122 gray48+122 122 122 grey48+125 125 125 gray49+125 125 125 grey49+127 127 127 gray50+127 127 127 grey50+130 130 130 gray51+130 130 130 grey51+133 133 133 gray52+133 133 133 grey52+135 135 135 gray53+135 135 135 grey53+138 138 138 gray54+138 138 138 grey54+140 140 140 gray55+140 140 140 grey55+143 143 143 gray56+143 143 143 grey56+145 145 145 gray57+145 145 145 grey57+148 148 148 gray58+148 148 148 grey58+150 150 150 gray59+150 150 150 grey59+153 153 153 gray60+153 153 153 grey60+156 156 156 gray61+156 156 156 grey61+158 158 158 gray62+158 158 158 grey62+161 161 161 gray63+161 161 161 grey63+163 163 163 gray64+163 163 163 grey64+166 166 166 gray65+166 166 166 grey65+168 168 168 gray66+168 168 168 grey66+171 171 171 gray67+171 171 171 grey67+173 173 173 gray68+173 173 173 grey68+176 176 176 gray69+176 176 176 grey69+179 179 179 gray70+179 179 179 grey70+181 181 181 gray71+181 181 181 grey71+184 184 184 gray72+184 184 184 grey72+186 186 186 gray73+186 186 186 grey73+189 189 189 gray74+189 189 189 grey74+191 191 191 gray75+191 191 191 grey75+194 194 194 gray76+194 194 194 grey76+196 196 196 gray77+196 196 196 grey77+199 199 199 gray78+199 199 199 grey78+201 201 201 gray79+201 201 201 grey79+204 204 204 gray80+204 204 204 grey80+207 207 207 gray81+207 207 207 grey81+209 209 209 gray82+209 209 209 grey82+212 212 212 gray83+212 212 212 grey83+214 214 214 gray84+214 214 214 grey84+217 217 217 gray85+217 217 217 grey85+219 219 219 gray86+219 219 219 grey86+222 222 222 gray87+222 222 222 grey87+224 224 224 gray88+224 224 224 grey88+227 227 227 gray89+227 227 227 grey89+229 229 229 gray90+229 229 229 grey90+232 232 232 gray91+232 232 232 grey91+235 235 235 gray92+235 235 235 grey92+237 237 237 gray93+237 237 237 grey93+240 240 240 gray94+240 240 240 grey94+242 242 242 gray95+242 242 242 grey95+245 245 245 gray96+245 245 245 grey96+247 247 247 gray97+247 247 247 grey97+250 250 250 gray98+250 250 250 grey98+252 252 252 gray99+252 252 252 grey99+255 255 255 gray100+255 255 255 grey100+169 169 169 dark grey+169 169 169 DarkGrey+169 169 169 dark gray+169 169 169 DarkGray+0 0 139 dark blue+0 0 139 DarkBlue+0 139 139 dark cyan+0 139 139 DarkCyan+139 0 139 dark magenta+139 0 139 DarkMagenta+139 0 0 dark red+139 0 0 DarkRed+144 238 144 light green+144 238 144 LightGreen
demo/unicode/Arabic.hs view
@@ -1,8 +1,11 @@ -- Example of an international dialog box. import Graphics.UI.Gtk +import Control.Applicative+import Prelude import Data.Char-import Control.Exception+import qualified Data.Text as T+import Data.Text (Text) main :: IO () main = do@@ -10,23 +13,23 @@ dia <- dialogNew dialogAddButton dia stockYes ResponseYes dialogAddButton dia stockNo ResponseNo- contain <- dialogGetUpper dia- theText <- labelNew Nothing - labelSetMarkup theText arabic- boxPackStartDefaults contain theText+ contain <- castToBox <$> dialogGetContentArea dia+ theText <- labelNew (Nothing :: Maybe Text)+ labelSetMarkup theText (T.pack arabic)+ boxPackStart contain theText PackNatural 0 widgetShowAll dia res <- dialogRun dia case res of ResponseNo -> yell _ -> return () -arabic :: Markup+arabic :: String arabic = markSpan [FontSize (SizePoint 36)] $ --"Is Haskell a "++markSpan [FontForeground "red"] "fantastic"++" language?"++ -- Do you find Haskell a fantastic language? (language has a grammatical -- mistake in it) map chr [0x647,0x644,32,0x62A,0x62C,0x62F,0x646,32]++- markSpan [FontForeground "red"] + markSpan [FontForeground "red"] (map chr [0x647,0x622,0x633,0x643,0x622,0x644])++ map chr [32,0x644,0x63A,0x62A,32,0x645,0x62F,0x647,0x634,0x62A,0x61F] @@ -34,9 +37,9 @@ yell = do dia <- dialogNew dialogAddButton dia stockOk ResponseOk- contain <- dialogGetUpper dia+ contain <- castToBox <$> dialogGetContentArea dia msg <- labelNew (Just "This is not an option.")- contain `boxPackStartDefaults` msg+ boxPackStart contain msg PackNatural 0 widgetShow msg dialogRun dia return ()
gtk.cabal view
@@ -1,114 +1,116 @@+cabal-version: 2.2 Name: gtk-Version: 0.11.2-License: LGPL-2.1+Version: 0.15.10+License: LGPL-2.1-only License-file: COPYING Copyright: (c) 2001-2010 The Gtk2Hs Team Author: Axel Simon, Duncan Coutts and many others-Maintainer: gtk2hs-users@sourceforge.net+Maintainer: gtk2hs-users@lists.sourceforge.net Build-Type: Custom-Cabal-Version: >= 1.6.0 Stability: provisional-homepage: http://www.haskell.org/gtk2hs/-bug-reports: http://hackage.haskell.org/trac/gtk2hs/+homepage: http://projects.haskell.org/gtk2hs/+bug-reports: https://github.com/gtk2hs/gtk2hs/issues Synopsis: Binding to the Gtk+ graphical user interface library. Description: This is the core library of the Gtk2Hs suite of libraries for Haskell based on Gtk+. Gtk+ is an extensive and mature multi-platform toolkit for creating graphical user interfaces. Category: Graphics-Tested-With: GHC == 6.10.4-Extra-Source-Files: wingtk.h+Tested-With: GHC == 9.12.2, GHC == 9.10.1, GHC == 9.8.4, GHC == 9.6.6, GHC == 9.4.8, GHC == 9.2.8, GHC==9.0.2, GHC==8.10.7+Extra-Source-Files: hsgtk.h Graphics/UI/Gtk/ModelView/Gtk2HsStore.h Graphics/UI/Gtk/General/hsgthread.h template-hsc-gtk2hs.h- Gtk2HsSetup.hs marshal.list- hierarchy.list- + hierarchy.list+ x-Types-File: Graphics/UI/Gtk/Types.chs x-Types-ModName: Graphics.UI.Gtk.Types x-Types-Forward: *System.Glib.GObject Graphics.UI.Gtk.General.Threading x-Types-Destructor: objectUnrefFromMainloop-x-Types-Hierarchy: hierarchy.list -Data-Dir: demo-Data-Files: actionMenu/ActionMenu.hs+Data-Dir: demo+Data-Files: actionMenu/ActionMenu.hs actionMenu/Makefile- + buttonbox/ButtonBox.hs buttonbox/Makefile- + carsim/CarSim.hs carsim/Makefile- + concurrent/Makefile concurrent/Progress.hs concurrent/ProgressThreadedRTS.hs- + embedded/Embedded.hs embedded/Makefile+ embedded/MPlayer.hs embedded/Notes.txt embedded/Uzbl.hs- + fastdraw/FastDraw.hs fastdraw/Makefile- + filechooser/FileChooserDemo.glade filechooser/FileChooserDemo.hs filechooser/Makefile- + fonts/Fonts.hs fonts/Makefile- + graphic/Drawing.hs graphic/Makefile- + gtkbuilder/GtkBuilderTest.hs gtkbuilder/Makefile gtkbuilder/simple.ui- + hello/Makefile hello/World.hs- + inputmethod/Layout.hs inputmethod/Makefile- + menu/ComboDemo.hs menu/Makefile menu/MenuDemo.hs- ++ notebook/Notebook.hs+ notebook/Makefile+ statusicon/Makefile statusicon/StatusIcon.hs- - treeList/Completion.hs- treeList/DirList.hs- treeList/FilterDemo.hs- treeList/ListDemo.hs- treeList/ListDND.hs- treeList/ListTest.glade- treeList/ListTest.hs- treeList/ListText.hs- treeList/Makefile- treeList/rgb.txt- treeList/TreeDemo.hs- treeList/TreeSort.hs- treeList/TreeTest.glade- treeList/TreeTest.hs- - treeList/resListDND/desktop.png- treeList/resListDND/laptop.png- treeList/resListDND/laptopSmall.png- treeList/resListDND/printer.png- treeList/resListDND/server.png- treeList/resListDND/tower.png- ++ treelist/Completion.hs+ treelist/DirList.hs+ treelist/FilterDemo.hs+ treelist/ListDemo.hs+ treelist/ListDND.hs+ treelist/ListTest.glade+ treelist/ListTest.hs+ treelist/ListText.hs+ treelist/Makefile+ treelist/rgb.txt+ treelist/TreeDemo.hs+ treelist/TreeSort.hs+ treelist/TreeTest.glade+ treelist/TreeTest.hs++ treelist/resListDND/desktop.png+ treelist/resListDND/laptop.png+ treelist/resListDND/laptopSmall.png+ treelist/resListDND/printer.png+ treelist/resListDND/server.png+ treelist/resListDND/tower.png+ unicode/Arabic.hs unicode/Makefile- - demos.txt- ++ demos.txt+ Source-Repository head- type: darcs- location: http://code.haskell.org/gtk2hs/+ type: git+ location: https://github.com/gtk2hs/gtk2hs subdir: gtk Flag deprecated@@ -118,19 +120,39 @@ Flag have-gio Description: Depend on GIO package, thereby enabling certain features.- Default: True+ Default: True +Flag have-quartz-gtk+ Description: Assume that the installed GTK is the version for OS X backend by Quartz, and hence does not provide gdk_x11_drawable_get_xid+ Default: False++Flag fmode-binary+ Description: Set the default file translation mode for file I/O operations to _O_BINARY.+ Some GTK libraries open image files without specifying binary mode.+ If you have trouble loading gtk in ghci, then it may help to turn this+ option off.+ Default: True++custom-setup+ setup-depends: base >= 4.6 && < 5,+ Cabal >= 3.0 && < 3.15,+ gtk2hs-buildtools >= 0.13.2.0 && < 0.14+ Library build-depends: base >= 4 && < 5,- array, containers, haskell98, mtl, bytestring,- glib >= 0.11.1 && < 0.12,- pango >= 0.11.1 && < 0.12,- cairo >= 0.11.1 && < 0.12+ array < 0.6,+ bytestring < 0.13,+ containers < 0.8,+ mtl < 2.4,+ text >= 0.11.0.6 && < 2.2,+ glib >= 0.13.0.0 && < 0.14,+ pango >= 0.13.0.0 && < 0.14,+ cairo >= 0.13.0.0 && < 0.14 if flag(have-gio)- build-depends: gio >= 0.11.1 && < 0.12+ build-depends: gio >= 0.13.0 && < 0.14 cpp-options: -DHAVE_GIO-- build-tools: gtk2hsC2hs, gtk2hsHookGenerator, gtk2hsTypeGen+ if flag(have-quartz-gtk)+ cpp-options: -DHAVE_QUARTZ_GTK exposed-modules: Graphics.UI.Gtk@@ -151,6 +173,7 @@ Graphics.UI.Gtk.ActionMenuToolbar.Action Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup Graphics.UI.Gtk.ActionMenuToolbar.RadioAction+ Graphics.UI.Gtk.ActionMenuToolbar.RecentAction Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction Graphics.UI.Gtk.ActionMenuToolbar.UIManager Graphics.UI.Gtk.Builder@@ -158,24 +181,34 @@ Graphics.UI.Gtk.Buttons.CheckButton Graphics.UI.Gtk.Buttons.RadioButton Graphics.UI.Gtk.Buttons.ToggleButton+ Graphics.UI.Gtk.Buttons.LinkButton+ Graphics.UI.Gtk.Buttons.ScaleButton+ Graphics.UI.Gtk.Buttons.VolumeButton Graphics.UI.Gtk.Cairo Graphics.UI.Gtk.Display.AccelLabel Graphics.UI.Gtk.Display.Image Graphics.UI.Gtk.Display.Label Graphics.UI.Gtk.Display.ProgressBar+ Graphics.UI.Gtk.Display.Spinner Graphics.UI.Gtk.Display.Statusbar Graphics.UI.Gtk.Display.StatusIcon+ Graphics.UI.Gtk.Display.InfoBar Graphics.UI.Gtk.Embedding.Embedding Graphics.UI.Gtk.Embedding.Plug Graphics.UI.Gtk.Embedding.Socket+ Graphics.UI.Gtk.Embedding.Types Graphics.UI.Gtk.Entry.Editable Graphics.UI.Gtk.Entry.Entry+ Graphics.UI.Gtk.Entry.EntryBuffer Graphics.UI.Gtk.Entry.EntryCompletion Graphics.UI.Gtk.Entry.HScale Graphics.UI.Gtk.Entry.SpinButton Graphics.UI.Gtk.Entry.VScale+ Graphics.UI.Gtk.Gdk.AppLaunchContext Graphics.UI.Gtk.Gdk.Cursor+ Graphics.UI.Gtk.Gdk.Keymap Graphics.UI.Gtk.Gdk.Display+ Graphics.UI.Gtk.Gdk.DisplayManager Graphics.UI.Gtk.Gdk.Drawable Graphics.UI.Gtk.Gdk.DrawWindow Graphics.UI.Gtk.Gdk.EventM@@ -195,6 +228,7 @@ Graphics.UI.Gtk.General.IconTheme Graphics.UI.Gtk.General.RcStyle Graphics.UI.Gtk.General.Selection+ Graphics.UI.Gtk.General.Settings Graphics.UI.Gtk.General.StockItems Graphics.UI.Gtk.General.Style Graphics.UI.Gtk.Layout.Alignment@@ -230,6 +264,9 @@ Graphics.UI.Gtk.MenuComboToolbar.Toolbar Graphics.UI.Gtk.MenuComboToolbar.ToolButton Graphics.UI.Gtk.MenuComboToolbar.ToolItem+ Graphics.UI.Gtk.MenuComboToolbar.ToolItemGroup+ Graphics.UI.Gtk.MenuComboToolbar.ToolPalette+ Graphics.UI.Gtk.Misc.Accessible Graphics.UI.Gtk.Misc.Adjustment Graphics.UI.Gtk.Misc.Arrow Graphics.UI.Gtk.Misc.Calendar@@ -237,17 +274,22 @@ Graphics.UI.Gtk.Misc.EventBox Graphics.UI.Gtk.Misc.HandleBox Graphics.UI.Gtk.Misc.IMMulticontext+ Graphics.UI.Gtk.Misc.IMContextSimple Graphics.UI.Gtk.Misc.SizeGroup Graphics.UI.Gtk.Misc.Tooltip Graphics.UI.Gtk.Misc.Tooltips Graphics.UI.Gtk.Misc.Viewport Graphics.UI.Gtk.ModelView+ Graphics.UI.Gtk.ModelView.CellEditable Graphics.UI.Gtk.ModelView.CellLayout Graphics.UI.Gtk.ModelView.CellRenderer+ Graphics.UI.Gtk.ModelView.CellRendererSpinner Graphics.UI.Gtk.ModelView.CellRendererCombo Graphics.UI.Gtk.ModelView.CellRendererPixbuf Graphics.UI.Gtk.ModelView.CellRendererProgress Graphics.UI.Gtk.ModelView.CellRendererText+ Graphics.UI.Gtk.ModelView.CellRendererAccel+ Graphics.UI.Gtk.ModelView.CellRendererSpin Graphics.UI.Gtk.ModelView.CellRendererToggle Graphics.UI.Gtk.ModelView.CellView Graphics.UI.Gtk.ModelView.CustomStore@@ -272,6 +314,17 @@ Graphics.UI.Gtk.Ornaments.Frame Graphics.UI.Gtk.Ornaments.HSeparator Graphics.UI.Gtk.Ornaments.VSeparator+ Graphics.UI.Gtk.Printing.PaperSize+ Graphics.UI.Gtk.Printing.PageSetup+ Graphics.UI.Gtk.Printing.PrintContext+ Graphics.UI.Gtk.Printing.PrintOperation+ Graphics.UI.Gtk.Printing.PrintSettings+ Graphics.UI.Gtk.Recent.RecentChooserMenu+ Graphics.UI.Gtk.Recent.RecentChooserWidget+ Graphics.UI.Gtk.Recent.RecentFilter+ Graphics.UI.Gtk.Recent.RecentManager+ Graphics.UI.Gtk.Recent.RecentInfo+ Graphics.UI.Gtk.Recent.RecentChooser Graphics.UI.Gtk.Scrolling.HScrollbar Graphics.UI.Gtk.Scrolling.ScrolledWindow Graphics.UI.Gtk.Scrolling.VScrollbar@@ -287,11 +340,17 @@ Graphics.UI.Gtk.Selectors.FontButton Graphics.UI.Gtk.Selectors.FontSelection Graphics.UI.Gtk.Selectors.FontSelectionDialog+ Graphics.UI.Gtk.Selectors.HSV+ Graphics.UI.Gtk.Special.Ruler+ Graphics.UI.Gtk.Special.HRuler+ Graphics.UI.Gtk.Special.VRuler Graphics.UI.Gtk.Windows.AboutDialog+ Graphics.UI.Gtk.Windows.Assistant Graphics.UI.Gtk.Windows.Dialog Graphics.UI.Gtk.Windows.Invisible Graphics.UI.Gtk.Windows.MessageDialog Graphics.UI.Gtk.Windows.Window+ Graphics.UI.Gtk.Windows.OffscreenWindow Graphics.UI.Gtk.Windows.WindowGroup Graphics.UI.Gtk.General.Enums other-modules:@@ -306,11 +365,15 @@ Graphics.UI.Gtk.General.Threading Graphics.UI.Gtk.Types Graphics.UI.Gtk.Signals+ autogen-modules:+ Graphics.UI.Gtk.Types+ Graphics.UI.Gtk.Signals - extensions: ForeignFunctionInterface+ default-language: Haskell98+ default-extensions: ForeignFunctionInterface c-sources: Graphics/UI/Gtk/ModelView/Gtk2HsStore.c Graphics/UI/Gtk/General/hsgthread.c- -- Due to http://hackage.haskell.org/trac/ghc/ticket/781+ -- Due to http://hackage.haskell.org/trac/ghc/ticket/781 -- we need to compile the hsgthread.c module with -fPIC to ensure that a global -- variable in GLib that holds the address for the mutex lock and unlock functions -- is accessed correctly. This bug only exists on x86-64 platforms.@@ -324,18 +387,31 @@ -- needs to be imported from this module: x-Signals-Import: Graphics.UI.Gtk.General.Threading include-dirs: .- cpp-options: -DHAVE_NEW_CONTROL_EXCEPTION+ cpp-options: -U__BLOCKS__ -DGLIB_DISABLE_DEPRECATION_WARNINGS+ if os(darwin) || os(freebsd)+ cpp-options: -D_Nullable= -D_Nonnull= -D_Noreturn= -D__attribute__(x)= if !flag(deprecated) cpp-options: -DDISABLE_DEPRECATED else- x-Types-Tag: deprecated + x-Types-Tag: deprecated if os(windows)- x-c2hs-Header: wingtk.h cpp-options: -DWIN32+ cc-options: -fno-exceptions extra-libraries: kernel32++ if os(windows)+ cpp-options: -D__USE_MINGW_ANSI_STDIO=1++ x-c2hs-Header: hsgtk.h+ x-Types-Hierarchy: hierarchy.list++ if os(windows) || flag(have-quartz-gtk)+ x-Types-Tag: default else- x-c2hs-Header: gtk/gtk.h+ x-Types-Tag: default plugNsocket+ cpp-options: -DHAVE_PLUG_AND_SOCKET - x-Types-Tag: default plugNsocket+ if os(windows) && flag(fmode-binary)+ cc-options: -DGTK2HS_SET_FMODE_BINARY pkgconfig-depends: gthread-2.0, gtk+-2.0
hierarchy.list view
@@ -10,7 +10,7 @@ # function is not specified, the <name> is converted to # gtk_<name'>_get_type where <name'> is <name> where each upperscore # letter is converted to an underscore and lowerletter. The underscore-# is omitted if an upperscore letter preceeded: GtkHButtonBox ->+# is omitted if an upperscore letter preceded: GtkHButtonBox -> # gtk_hbutton_box_get_type. The generation of a type can be # conditional by appending 'if <tag>'. Such types are only produces if # --tag=<tag> is given on the command line of TypeGenerator.@@ -22,6 +22,18 @@ # if a different equality instance is manually # defined later GObject + AtkObject+ GtkAccessible if gtk-2.22+ GdkKeymap if gtk-2.2+ GdkDisplayManager if gtk-2.2+ GdkAppLaunchContext if gtk-2.14+ GtkPrintSettings if gtk-2.10+ GtkPrintOperation if gtk-2.10+ GtkPrintOperationPreview if gtk-2.10+ GtkPageSetup if gtk-2.10+ GtkPrintContext if gtk-2.10+ GtkRecentChooser if gtk-2.10+ GtkRecentManager if gtk-2.10 GdkDrawable GdkWindow as DrawWindow, gdk_window_object_get_type # GdkDrawableImplX11@@ -54,7 +66,9 @@ GtkSourceMarker if sourceview GtkSourceMark if gtksourceview2 GtkObject+ GtkRecentFilter if gtk-2.10 GtkWidget+ GtkHSV as HSV, gtk_hsv_get_type if gtk-2.14 GtkMisc GtkLabel GtkAccelLabel@@ -62,12 +76,17 @@ GtkArrow GtkImage GtkContainer+ GtkToolPalette if gtk-2.20+ GtkToolItemGroup if gtk-2.20 WebKitWebView as WebView, webkit_web_view_get_type if webkit GtkBin GtkAlignment GtkFrame GtkAspectFrame GtkButton+ GtkScaleButton if gtk-2.12+ GtkVolumeButton if gtk-2.12+ GtkLinkButton if gtk-2.10 GtkToggleButton GtkCheckButton GtkRadioButton@@ -84,6 +103,8 @@ GtkListItem if deprecated # GtkTreeItem GtkWindow+ GtkAssistant if gtk-2.10+ GtkOffscreenWindow if gtk-2.20 GtkDialog GtkAboutDialog if gtk-2.6 GtkColorSelectionDialog@@ -92,7 +113,6 @@ GtkFontSelectionDialog GtkInputDialog GtkMessageDialog- GtkPlug if plugNsocket GtkEventBox GtkHandleBox GtkScrolledWindow@@ -113,10 +133,12 @@ GtkHButtonBox GtkVButtonBox GtkVBox+ GtkRecentChooserWidget if gtk-2.10 GtkColorSelection GtkFontSelection GtkFileChooserWidget if gtk-2.4 GtkHBox+ GtkInfoBar if gtk-2.18 GtkCombo if deprecated GtkFileChooserButton if gtk-2.6 GtkStatusbar@@ -131,10 +153,10 @@ GtkList if deprecated GtkMenuShell GtkMenu+ GtkRecentChooserMenu if gtk-2.10 GtkMenuBar GtkNotebook # GtkPacker- GtkSocket if plugNsocket GtkTable GtkTextView GtkSourceView if sourceview@@ -144,6 +166,7 @@ GtkCalendar GtkCellView if gtk-2.6 GtkDrawingArea+ GtkSpinner if gtk-2.20 GtkEntry GtkSpinButton GtkRuler@@ -169,6 +192,7 @@ GtkAdjustment GtkIMContext GtkIMMulticontext+ GtkIMContextSimple GtkItemFactory if deprecated GtkTooltips @@ -177,8 +201,11 @@ # These are derived from GtkObject: GtkTreeViewColumn GtkCellRenderer+ GtkCellRendererSpinner if gtk-2.20 GtkCellRendererPixbuf GtkCellRendererText+ GtkCellRendererAccel if gtk-2.10+ GtkCellRendererSpin if gtk-2.10 GtkCellRendererCombo if gtk-2.6 GtkCellRendererToggle GtkCellRendererProgress if gtk-2.6@@ -204,7 +231,9 @@ GtkAccelGroup GtkAccelMap if gtk-2.4 GtkEntryCompletion if gtk-2.4+ GtkEntryBuffer if gtk-2.18 GtkAction if gtk-2.4+ GtkRecentAction if gtk-2.12 GtkToggleAction if gtk-2.4 GtkRadioAction if gtk-2.4 GtkActionGroup if gtk-2.4@@ -216,7 +245,8 @@ GtkSourceLanguageManager if gtksourceview2 GladeXML as GladeXML, glade_xml_get_type if libglade GConfClient as GConf if gconf-# These ones are actualy interfaces, but interface implementations are GObjects+# These ones are actually interfaces, but interface implementations are GObjects+ GtkCellEditable GtkEditable GtkSourceStyle as SourceStyleObject if gtksourceview2 GtkSourceStyleScheme if sourceview
+ hsgtk.h view
@@ -0,0 +1,84 @@+#include <gtk/gtk.h>+/* these are necessary on Win32 to circumvent the structure size check */+#undef gtk_init_check+#undef gtk_init++#if GTK_MAJOR_VERSION >= 3+#include <gtk/gtkx.h>+#endif++#undef Bool+#undef True+#undef False+#undef Button1 +#undef Button2+#undef Button3+#undef Button4+#undef Button5+#undef Button1Mask +#undef Button2Mask+#undef Button3Mask+#undef Button4Mask+#undef Button5Mask++#undef ShiftMask+#undef LockMask+#undef ControlMask+#undef Mod1Mask+#undef Mod2Mask+#undef Mod3Mask+#undef Mod4Mask+#undef Mod5Mask++#undef None+#undef ParentRelative+#undef CopyFromParent+#undef PointerWindow+#undef InputFocus+#undef PointerRoot+#undef AnyPropertyType+#undef AnyKey+#undef AnyButton+#undef AllTemporary+#undef CurrentTime+#undef NoSymbol++#undef NoEventMask+#undef KeyPressMask+#undef KeyReleaseMask+#undef ButtonPressMask+#undef ButtonReleaseMask+#undef EnterWindowMask+#undef LeaveWindowMask+#undef PointerMotionMask+#undef PointerMotionHintMask+#undef Button1MotionMask+#undef Button2MotionMask+#undef Button3MotionMask+#undef Button4MotionMask+#undef Button5MotionMask+#undef ButtonMotionMask+#undef KeymapStateMask+#undef ExposureMask+#undef VisibilityChangeMask+#undef StructureNotifyMask+#undef ResizeRedirectMask+#undef SubstructureNotifyMask+#undef SubstructureRedirectMask+#undef FocusChangeMask+#undef PropertyChangeMask+#undef ColormapChangeMask+#undef OwnerGrabButtonMask++#undef Status+#undef Expose+#undef Below+#undef GrabSuccess+#undef GrabAlreadyGrabbed+#undef GrabInvalidTime+#undef GrabNotViewable+#undef GrabFrozen+#undef OwnerChangeNewOwner+#undef OwnerChangeDestroy+#undef OwnerChangeClose+#undef NULL
marshal.list view
@@ -14,7 +14,7 @@ # FLAGS for flag enumeration types (guint) # FLOAT for single-precision float types (gfloat) # DOUBLE for double-precision float types (gdouble)-# STRING for string types (gchar*)+# GLIBSTRING for string types (gchar*) # BOXED for boxed (anonymous but reference counted) types (GBoxed*) # POINTER for anonymous pointer types (gpointer) # NONE deprecated alias for VOID@@ -41,7 +41,7 @@ # If you add a new signal type, please check that it actually works! # If it is a Boxed type check that the reference counting is right.- + BOOLEAN:BOXED BOOLEAN:POINTER BOOLEAN:BOXED,BOXED@@ -51,10 +51,10 @@ #BOOLEAN:ENUM,INT #BOOLEAN:TOBJECT,UINT,FLAGS #BOOLEAN:TOBJECT,INT,INT,UINT-#BOOLEAN:TOBJECT,STRING,STRING,BOXED+#BOOLEAN:TOBJECT,GLIBSTRING,GLIBSTRING,BOXED BOOLEAN:TOBJECT,BOXED #BOOLEAN:TOBJECT,BOXED,BOXED-#BOOLEAN:TOBJECT,STRING,STRING+#BOOLEAN:TOBJECT,GLIBSTRING,GLIBSTRING BOOLEAN:INT,INT BOOLEAN:INT,INT,INT BOOLEAN:UINT@@ -70,15 +70,15 @@ #VOID:INT,BOOLEAN VOID:INT,INT VOID:VOID-#VOID:STRING,INT,POINTER-#STRING:DOUBLE+#VOID:GLIBSTRING,INT,POINTER+#GLIBSTRING:DOUBLE VOID:DOUBLE #VOID:BOOLEAN,BOOLEAN,BOOLEAN VOID:BOXED VOID:BOXED,BOXED VOID:BOXED,BOXED,POINTER VOID:BOXED,TOBJECT-#VOID:BOXED,STRING,INT+#VOID:BOXED,GLIBSTRING,INT VOID:BOXED,UINT #VOID:BOXED,UINT,FLAGS #VOID:BOXED,UINT,UINT@@ -101,7 +101,7 @@ #VOID:TOBJECT,INT,INT #VOID:TOBJECT,INT,INT,BOXED,UINT,UINT VOID:TOBJECT,TOBJECT-#VOID:TOBJECT,STRING,STRING+#VOID:TOBJECT,GLIBSTRING,GLIBSTRING #VOID:TOBJECT,UINT #VOID:TOBJECT,UINT,FLAGS VOID:POINTER@@ -109,14 +109,14 @@ #VOID:POINTER,BOOLEAN #VOID:POINTER,POINTER,POINTER VOID:POINTER,UINT-VOID:STRING+VOID:GLIBSTRING # This is for the "edited" signal in CellRendererText:-VOID:STRING,STRING-#VOID:STRING,INT,POINTER-#VOID:STRING,UINT,FLAGS+VOID:GLIBSTRING,GLIBSTRING+#VOID:GLIBSTRING,INT,POINTER+#VOID:GLIBSTRING,UINT,FLAGS #VOID:UINT,FLAGS,BOXED VOID:UINT,UINT-VOID:UINT,STRING+VOID:UINT,GLIBSTRING #VOID:UINT,BOXED,UINT,FLAGS,FLAGS #VOID:UINT,TOBJECT,UINT,FLAGS,FLAGS @@ -126,9 +126,9 @@ # This one is needed in TextView: VOID:INT,BOOLEAN # This is for the "editing-started" in CellRenderer-VOID:TOBJECT,STRING+VOID:TOBJECT,GLIBSTRING # This is for GtkMozEmbed-BOOLEAN:STRING+BOOLEAN:GLIBSTRING # This makes it possible to catch events on TextTags BOOLEAN:TOBJECT,POINTER,BOXED BOOLEAN:POINTER,BOXED,BOXED@@ -146,12 +146,22 @@ # for Drag.dragFailed BOOLEAN:TOBJECT,ENUM # for TextBuffer-NONE:BOXED,STRING+NONE:BOXED,GLIBSTRING # for Notebook NONE:TOBJECT,INT BOOLEAN:ENUM,BOOLEAN NONE:BOXED,INT # for TextBuffer-NONE:BOXED,STRING+NONE:BOXED,GLIBSTRING # For queryTooltip BOOLEAN:TOBJECT,INT,INT,BOOLEAN,TOBJECT+# For EntryBuffer+NONE:INT,GLIBSTRING,INT+# For CellRendererAccel+NONE:GLIBSTRING,INT,ENUM,INT+# For PrintOperation+BOOLEAN:OBJECT+NONE:OBJECT,INT,OBJECT+NONE:OBJECT,OBJECT,OBJECT+BOOLEAN:OBJECT,OBJECT,OBJECT+VOID:ENUM,POINTER
− wingtk.h
@@ -1,5 +0,0 @@-#include <gtk/gtk.h>-/* these are necessary on Win32 to circumvent the strcuture size check */-#undef gtk_init_check-#undef gtk_init-