sifflet-lib-1.0: Library of modules shared by sifflet and its tests and its exporters.Source codeContentsIndex
Sifflet.UI.LittleGtk
Description
The purpose of this module is simply to re-export the Gtk functions and types that I use, and avoid those that I don't, particularly those that conflict with names in Sifflet, like Layout. Just hiding these is not enough, because Graphics.UI.Gtk keeps changing what it exports. For example, in 0.10.5 it no longer exports Function, fill, function.
Synopsis
data AttrOp o where
:= :: ReadWriteAttr o a b -> b -> AttrOp o
:~ :: ReadWriteAttr o a b -> (a -> b) -> AttrOp o
:=> :: ReadWriteAttr o a b -> IO b -> AttrOp o
:~> :: ReadWriteAttr o a b -> (a -> IO b) -> AttrOp o
::= :: ReadWriteAttr o a b -> (o -> b) -> AttrOp o
::~ :: ReadWriteAttr o a b -> (o -> a -> b) -> AttrOp o
get :: o -> ReadWriteAttr o a b -> IO a
set :: o -> [AttrOp o] -> IO ()
adjustmentNew :: Double -> Double -> Double -> Double -> Double -> Double -> IO Adjustment
boxPackEnd :: (BoxClass self, WidgetClass child) => self -> child -> Packing -> Int -> IO ()
boxPackStart :: (BoxClass self, WidgetClass child) => self -> child -> Packing -> Int -> IO ()
boxPackStartDefaults :: (BoxClass self, WidgetClass widget) => self -> widget -> IO ()
data Button
buttonNewWithLabel :: String -> IO Button
buttonPressEvent :: WidgetClass self => Signal self (EventM EButton Bool)
data ButtonsType
= ButtonsNone
| ButtonsOk
| ButtonsClose
| ButtonsCancel
| ButtonsYesNo
| ButtonsOkCancel
class WidgetClass o => ContainerClass o
castToContainer :: GObjectClass obj => obj -> Container
containerAdd :: (ContainerClass self, WidgetClass widget) => self -> widget -> IO ()
containerChild :: (ContainerClass self, WidgetClass widget) => WriteAttr self widget
containerForeach :: ContainerClass self => self -> ContainerForeachCB -> IO ()
data CursorType
= XCursor
| Arrow
| BasedArrowDown
| BasedArrowUp
| Boat
| Bogosity
| BottomLeftCorner
| BottomRightCorner
| BottomSide
| BottomTee
| BoxSpiral
| CenterPtr
| Circle
| Clock
| CoffeeMug
| Cross
| CrossReverse
| Crosshair
| DiamondCross
| Dot
| Dotbox
| DoubleArrow
| DraftLarge
| DraftSmall
| DrapedBox
| Exchange
| Fleur
| Gobbler
| Gumby
| Hand1
| Hand2
| Heart
| Icon
| IronCross
| LeftPtr
| LeftSide
| LeftTee
| Leftbutton
| LlAngle
| LrAngle
| Man
| Middlebutton
| Mouse
| Pencil
| Pirate
| Plus
| QuestionArrow
| RightPtr
| RightSide
| RightTee
| Rightbutton
| RtlLogo
| Sailboat
| SbDownArrow
| SbHDoubleArrow
| SbLeftArrow
| SbRightArrow
| SbUpArrow
| SbVDoubleArrow
| Shuttle
| Sizing
| Spider
| Spraycan
| Star
| Target
| Tcross
| TopLeftArrow
| TopLeftCorner
| TopRightCorner
| TopSide
| TopTee
| Trek
| UlAngle
| Umbrella
| UrAngle
| Watch
| Xterm
| LastCursor
| BlankCursor
| CursorIsPixmap
customStoreSetColumn :: TypedTreeModelClass model => model row -> ColumnId row ty -> (row -> ty) -> IO ()
data Dialog
dialogNew :: IO Dialog
dialogAddButton :: DialogClass self => self -> String -> ResponseId -> IO Button
dialogGetActionArea :: DialogClass dc => dc -> IO HBox
dialogGetUpper :: DialogClass dc => dc -> IO VBox
dialogRun :: DialogClass self => self -> IO ResponseId
dialogSetDefaultResponse :: DialogClass self => self -> ResponseId -> IO ()
toDialog :: DialogClass o => o -> Dialog
data DrawWindow
drawWindowInvalidateRect :: DrawWindowClass self => self -> Rectangle -> Bool -> IO ()
entryCompletionInsertPrefix :: EntryCompletion -> IO ()
entryCompletionModel :: TreeModelClass model => ReadWriteAttr EntryCompletion (Maybe TreeModel) (Maybe model)
entryCompletionNew :: IO EntryCompletion
entryCompletionSetTextColumn :: EntryCompletion -> ColumnId row String -> IO ()
data Entry
entryGetText :: EntryClass self => self -> IO String
entryGetCompletion :: EntryClass self => self -> IO EntryCompletion
entryNew :: IO Entry
entrySetCompletion :: EntryClass self => self -> EntryCompletion -> IO ()
entrySetText :: EntryClass self => self -> String -> IO ()
data EventMask
= ExposureMask
| PointerMotionMask
| PointerMotionHintMask
| ButtonMotionMask
| Button1MotionMask
| Button2MotionMask
| Button3MotionMask
| ButtonPressMask
| ButtonReleaseMask
| KeyPressMask
| KeyReleaseMask
| EnterNotifyMask
| LeaveNotifyMask
| FocusChangeMask
| StructureMask
| PropertyChangeMask
| VisibilityNotifyMask
| ProximityInMask
| ProximityOutMask
| SubstructureMask
| ScrollMask
| AllEventsMask
eventBoxNew :: IO EventBox
data Expander
expanderNew :: String -> IO Expander
expanderSetExpanded :: Expander -> Bool -> IO ()
exposeEvent :: WidgetClass self => Signal self (EventM EExpose Bool)
fileChooserDialogNew :: Maybe String -> Maybe Window -> FileChooserAction -> [(String, ResponseId)] -> IO FileChooserDialog
fileChooserGetFilename :: FileChooserClass self => self -> IO (Maybe FilePath)
data FileChooserAction
= FileChooserActionOpen
| FileChooserActionSave
| FileChooserActionSelectFolder
| FileChooserActionCreateFolder
frameNew :: IO Frame
grabAdd :: WidgetClass wd => wd -> IO ()
grabRemove :: WidgetClass w => w -> IO ()
data HBox
hBoxNew :: Bool -> Int -> IO HBox
keyPressEvent :: WidgetClass self => Signal self (EventM EKey Bool)
data Label
labelNew :: Maybe String -> IO Label
labelSetText :: LabelClass self => self -> String -> IO ()
data Layout
layoutGetDrawWindow :: Layout -> IO DrawWindow
layoutNew :: Maybe Adjustment -> Maybe Adjustment -> IO Layout
layoutPut :: (LayoutClass self, WidgetClass childWidget) => self -> childWidget -> Int -> Int -> IO ()
layoutSetSize :: LayoutClass self => self -> Int -> Int -> IO ()
listStoreNew :: [a] -> IO (ListStore a)
makeColumnIdString :: Int -> ColumnId row String
menuPopup :: MenuClass self => self -> Maybe (MouseButton, TimeStamp) -> IO ()
data MessageType
= MessageInfo
| MessageWarning
| MessageQuestion
| MessageError
| MessageOther
messageDialogNew :: Maybe Window -> [DialogFlags] -> MessageType -> ButtonsType -> String -> IO MessageDialog
on :: object -> Signal object callback -> callback -> IO (ConnectId object)
onDestroy :: WidgetClass w => w -> IO () -> IO (ConnectId w)
onSizeRequest :: WidgetClass w => w -> IO Requisition -> IO (ConnectId w)
data Packing
= PackRepel
| PackGrow
| PackNatural
data PolicyType = PolicyAutomatic
data Rectangle = Rectangle Int Int Int Int
renderWithDrawable :: DrawableClass drawable => drawable -> Render a -> IO a
data Requisition = Requisition Int Int
data ResponseId
= ResponseNone
| ResponseReject
| ResponseAccept
| ResponseDeleteEvent
| ResponseOk
| ResponseCancel
| ResponseClose
| ResponseYes
| ResponseNo
| ResponseApply
| ResponseHelp
| ResponseUser Int
data ScrolledWindow
scrolledWindowNew :: Maybe Adjustment -> Maybe Adjustment -> IO ScrolledWindow
scrolledWindowSetPolicy :: ScrolledWindowClass self => self -> PolicyType -> PolicyType -> IO ()
data Statusbar
statusbarGetContextId :: StatusbarClass self => self -> String -> IO ContextId
statusbarNew :: IO Statusbar
statusbarPop :: StatusbarClass self => self -> ContextId -> IO ()
statusbarPush :: StatusbarClass self => self -> ContextId -> String -> IO MessageId
data VBox
vBoxNew :: Bool -> Int -> IO VBox
class ObjectClass o => WidgetClass o
widgetAddEvents :: WidgetClass self => self -> [EventMask] -> IO ()
widgetClassPath :: WidgetClass self => self -> IO (Int, String, String)
widgetDestroy :: WidgetClass self => self -> IO ()
widgetGrabFocus :: WidgetClass self => self -> IO ()
widgetSetCanFocus :: WidgetClass self => self -> Bool -> IO ()
widgetSetDoubleBuffered :: WidgetClass self => self -> Bool -> IO ()
widgetSetName :: WidgetClass self => self -> String -> IO ()
widgetSetSizeRequest :: WidgetClass self => self -> Int -> Int -> IO ()
widgetShow :: WidgetClass self => self -> IO ()
widgetShowAll :: WidgetClass self => self -> IO ()
widgetSizeRequest :: WidgetClass self => self -> IO Requisition
widgetVisible :: WidgetClass self => Attr self Bool
data Window
windowMove :: WindowClass self => self -> Int -> Int -> IO ()
windowNew :: IO Window
windowPresent :: WindowClass self => self -> IO ()
windowSetDefaultSize :: WindowClass self => self -> Int -> Int -> IO ()
windowSetPosition :: WindowClass self => self -> WindowPosition -> IO ()
windowSetTitle :: WindowClass self => self -> String -> IO ()
windowTitle :: WindowClass self => Attr self String
data WindowPosition
= WinPosNone
| WinPosCenter
| WinPosMouse
| WinPosCenterAlways
| WinPosCenterOnParent
initGUI :: IO [String]
mainGUI :: IO ()
mainQuit :: IO ()
type GtkFrame = Frame
type GtkLayout = Layout
Documentation
data AttrOp o whereSource
A set or update operation on an attribute.
Constructors
:= :: ReadWriteAttr o a b -> b -> AttrOp oAssign a value to an attribute.
:~ :: ReadWriteAttr o a b -> (a -> b) -> AttrOp oApply an update function to an attribute.
:=> :: ReadWriteAttr o a b -> IO b -> AttrOp oAssign the result of an IO action to an attribute.
:~> :: ReadWriteAttr o a b -> (a -> IO b) -> AttrOp oApply a IO update function to an attribute.
::= :: ReadWriteAttr o a b -> (o -> b) -> AttrOp oAssign a value to an attribute with the object as an argument.
::~ :: ReadWriteAttr o a b -> (o -> a -> b) -> AttrOp oApply an update function to an attribute with the object as an argument.
get :: o -> ReadWriteAttr o a b -> IO aSource
Get an Attr of an object.
set :: o -> [AttrOp o] -> IO ()Source
Set a number of properties for some object.
adjustmentNewSource
:: Doublevalue - the initial value.
-> Doublelower - the minimum value.
-> Doubleupper - the maximum value.
-> DoublestepIncrement - the step increment.
-> DoublepageIncrement - the page increment.
-> DoublepageSize - the page size.
-> IO Adjustment

Creates a new Adjustment.

The creation function take every value that is contained in the object: value is the initial value and should be between the upper and lower bounds of the slider. Clicking on the arrows increases this value by stepIncrement. Clicking in the slider advances by pageIncrement. The pageSize is needed to determine if the end of the slider is still in the range.

boxPackEndSource
:: (BoxClass self, WidgetClass child)
=> self
-> childchild - the Widget to be added to the box.
-> Packing
-> Intpadding - extra space in pixels to put between this child and its neighbors, over and above the global amount specified by spacing boxSetSpacing. If child is a widget at one of the reference ends of box, then padding pixels are also put between child and the reference edge of box.
-> IO ()

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 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.

boxPackStartSource
:: (BoxClass self, WidgetClass child)
=> self
-> childchild - the Widget to be added to the box.
-> Packing
-> Intpadding - extra space in pixels to put between this child and its neighbors, over and above the global amount specified by spacing boxSetSpacing. If child is a widget at one of the reference ends of box, then padding pixels are also put between child and the reference edge of box.
-> IO ()
Adds the child widget to the box, packed with reference to the start of the box. The child is packed after any other child packed with reference to the start of the box.
boxPackStartDefaultsSource
:: (BoxClass self, WidgetClass widget)
=> self
-> widgetwidget - the Widget to be added to the box.
-> IO ()
Like boxPackStart but uses the default parameters PackRepel and 0 for padding.
data Button Source
show/hide Instances
buttonNewWithLabelSource
:: Stringlabel - The text you want the Label to hold.
-> IO Button
Creates a Button widget with a Label child containing the given text.
buttonPressEvent :: WidgetClass self => Signal self (EventM EButton Bool)Source
A mouse button has been depressed while the mouse pointer was within the widget area. Sets the widget's ButtonPressMask flag.
data ButtonsType Source

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.
Constructors
ButtonsNone
ButtonsOk
ButtonsClose
ButtonsCancel
ButtonsYesNo
ButtonsOkCancel
show/hide Instances
class WidgetClass o => ContainerClass o Source
show/hide Instances
ContainerClass Item
ContainerClass ListItem
ContainerClass InputDialog
ContainerClass CList
ContainerClass CTree
ContainerClass List
ContainerClass Container
ContainerClass Bin
ContainerClass Alignment
ContainerClass Frame
ContainerClass AspectFrame
ContainerClass Button
ContainerClass ToggleButton
ContainerClass CheckButton
ContainerClass RadioButton
ContainerClass ColorButton
ContainerClass FontButton
ContainerClass OptionMenu
ContainerClass MenuItem
ContainerClass CheckMenuItem
ContainerClass RadioMenuItem
ContainerClass TearoffMenuItem
ContainerClass ImageMenuItem
ContainerClass SeparatorMenuItem
ContainerClass Window
ContainerClass Dialog
ContainerClass AboutDialog
ContainerClass ColorSelectionDialog
ContainerClass FileSelection
ContainerClass FileChooserDialog
ContainerClass FontSelectionDialog
ContainerClass MessageDialog
ContainerClass Plug
ContainerClass EventBox
ContainerClass HandleBox
ContainerClass ScrolledWindow
ContainerClass Viewport
ContainerClass Expander
ContainerClass ComboBox
ContainerClass ComboBoxEntry
ContainerClass ToolItem
ContainerClass ToolButton
ContainerClass MenuToolButton
ContainerClass ToggleToolButton
ContainerClass RadioToolButton
ContainerClass SeparatorToolItem
ContainerClass Box
ContainerClass ButtonBox
ContainerClass HButtonBox
ContainerClass VButtonBox
ContainerClass VBox
ContainerClass ColorSelection
ContainerClass FontSelection
ContainerClass FileChooserWidget
ContainerClass HBox
ContainerClass Combo
ContainerClass FileChooserButton
ContainerClass Statusbar
ContainerClass Fixed
ContainerClass Paned
ContainerClass HPaned
ContainerClass VPaned
ContainerClass IconView
ContainerClass Layout
ContainerClass MenuShell
ContainerClass Menu
ContainerClass MenuBar
ContainerClass Notebook
ContainerClass Socket
ContainerClass Table
ContainerClass TextView
ContainerClass Toolbar
ContainerClass TreeView
castToContainer :: GObjectClass obj => obj -> ContainerSource
containerAddSource
:: (ContainerClass self, WidgetClass widget)
=> self
-> widgetwidget - a widget to be placed inside container
-> IO ()
Adds widget to the container. Typically used for simple containers such as Window, Frame, or Button; for more complicated layout containers such as Box or Table, this function will pick default packing parameters that may not be correct. So consider functions such as boxPackStart and tableAttach as an alternative to containerAdd in those cases. A widget may be added to only one container at a time; you can't place the same widget inside two different containers.
containerChild :: (ContainerClass self, WidgetClass widget) => WriteAttr self widgetSource
Can be used to add a new child to the container.
containerForeach :: ContainerClass self => self -> ContainerForeachCB -> IO ()Source
Maps callback over each non-internal child of container. See containerForall for details on what constitutes an "internal" child. Most applications should use containerForeach, rather than containerForall.
data CursorType Source
Cursor types.
Constructors
XCursor
Arrow
BasedArrowDown
BasedArrowUp
Boat
Bogosity
BottomLeftCorner
BottomRightCorner
BottomSide
BottomTee
BoxSpiral
CenterPtr
Circle
Clock
CoffeeMug
Cross
CrossReverse
Crosshair
DiamondCross
Dot
Dotbox
DoubleArrow
DraftLarge
DraftSmall
DrapedBox
Exchange
Fleur
Gobbler
Gumby
Hand1
Hand2
Heart
Icon
IronCross
LeftPtr
LeftSide
LeftTee
Leftbutton
LlAngle
LrAngle
Man
Middlebutton
Mouse
Pencil
Pirate
Plus
QuestionArrow
RightPtr
RightSide
RightTee
Rightbutton
RtlLogo
Sailboat
SbDownArrow
SbHDoubleArrow
SbLeftArrow
SbRightArrow
SbUpArrow
SbVDoubleArrow
Shuttle
Sizing
Spider
Spraycan
Star
Target
Tcross
TopLeftArrow
TopLeftCorner
TopRightCorner
TopSide
TopTee
Trek
UlAngle
Umbrella
UrAngle
Watch
Xterm
LastCursor
BlankCursor
CursorIsPixmap
show/hide Instances
customStoreSetColumnSource
:: TypedTreeModelClass model
=> model rowthe store in which to allocate a new column
-> ColumnId row tythe column that should be set
-> row -> tythe function that sets the property
-> IO ()
Set or update a column mapping. This function should be used before the model is installed into a widget since the number of defined columns are only checked once by widgets.
data Dialog Source
show/hide Instances
dialogNew :: IO DialogSource
Creates a new dialog box. Widgets should not be packed into this Window directly, but into the "upper" and "action area", which are obtained using dialogGetUpper and dialogGetActionArea.
dialogAddButtonSource
:: DialogClass self
=> self
-> StringbuttonText - text of button, or stock ID
-> ResponseIdresponseId - response ID for the button
-> IO Buttonreturns the button widget that was added
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 dialog's action area. The button widget is returned, but usually you don't need it.
dialogGetActionArea :: DialogClass dc => dc -> IO HBoxSource

Extract the action area of a dialog box.

  • This is useful to add some special widgets that cannot be added with dialogAddActionWidget.
dialogGetUpper :: DialogClass dc => dc -> IO VBoxSource

Get the upper part of a dialog.

  • The upper part of a dialog window consists of a VBox. Add the required widgets into this box.
dialogRun :: DialogClass self => self -> IO ResponseIdSource

Blocks in a recursive main loop until the dialog either emits the response signal, or is destroyed. If the dialog is destroyed during the call to dialogRun, it returns ResponseNone. Otherwise, it returns the response ID from the "response" signal emission. Before entering the recursive main loop, dialogRun calls widgetShow on the dialog for you. Note that you still need to show any children of the dialog yourself.

During dialogRun, the default behavior of "delete_event" is disabled; if the dialog receives "delete_event", it will not be destroyed as windows usually are, and dialogRun will return ResponseDeleteEvent. Also, during dialogRun the dialog will be modal. You can force dialogRun to return at any time by calling dialogResponse to emit the "response" signal. Destroying the dialog during dialogRun is a very bad idea, because your post-run code won't know whether the dialog was destroyed or not. Hence, you should not call Graphics.UI.Gtk.Abstract.widgetDestroy before dialogRun has returned.

After dialogRun returns, you are responsible for hiding or destroying the dialog if you wish to do so.

Note that even though the recursive main loop gives the effect of a modal dialog (it prevents the user from interacting with other windows while the dialog is run), callbacks such as timeouts, IO channel watches, DND drops, etc, will be triggered during a dialogRun call.

dialogSetDefaultResponse :: DialogClass self => self -> ResponseId -> IO ()Source

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.

  • The default response is reset once it is triggered. Hence, if you hide the dialog (rather than closing it) and re-display it later, you need to call this function again.
toDialog :: DialogClass o => o -> DialogSource
data DrawWindow Source
show/hide Instances
drawWindowInvalidateRectSource
:: DrawWindowClass self
=> self
-> Rectanglerect - rectangle to invalidate
-> BoolinvalidateChildren - whether to also invalidate child drawWindows
-> IO ()
A convenience wrapper around drawWindowInvalidateRegion which invalidates a rectangular region. See drawWindowInvalidateRegion for details.
entryCompletionInsertPrefix :: EntryCompletion -> IO ()Source

Requests a prefix insertion.

  • Available since Gtk+ version 2.6
entryCompletionModel :: TreeModelClass model => ReadWriteAttr EntryCompletion (Maybe TreeModel) (Maybe model)Source
The model to find matches in.
entryCompletionNew :: IO EntryCompletionSource
Creates a new EntryCompletion object.
entryCompletionSetTextColumnSource
:: EntryCompletion
-> ColumnId row Stringcolumn - The column in the model of completion to get strings from.
-> IO ()

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 column in the model of completion.

This functions creates and adds a CellRendererText for the selected column.

data Entry Source
show/hide Instances
entryGetText :: EntryClass self => self -> IO StringSource
Retrieves the contents of the entry widget. See also Graphics.UI.Gtk.Display.Entry.Editable.editableGetChars.
entryGetCompletionSource
:: EntryClass self
=> self
-> IO EntryCompletionreturns The auxiliary completion object currently in use by entry.

Returns the auxiliary completion object currently in use by the entry.

  • Available since Gtk version 2.4
entryNew :: IO EntrySource
Creates a new Entry widget.
entrySetCompletion :: EntryClass self => self -> EntryCompletion -> IO ()Source

Sets the auxiliary completion object to use with the entry. All further configuration of the completion mechanism is done on completion using the EntryCompletion API.

  • Available since Gtk version 2.4
entrySetText :: EntryClass self => self -> String -> IO ()Source
Sets the text in the widget to the given value, replacing the current contents.
data EventMask Source
Specify which events a widget will emit signals on.
Constructors
ExposureMask
PointerMotionMask
PointerMotionHintMask
ButtonMotionMask
Button1MotionMask
Button2MotionMask
Button3MotionMask
ButtonPressMask
ButtonReleaseMask
KeyPressMask
KeyReleaseMask
EnterNotifyMask
LeaveNotifyMask
FocusChangeMask
StructureMask
PropertyChangeMask
VisibilityNotifyMask
ProximityInMask
ProximityOutMask
SubstructureMask
ScrollMask
AllEventsMask
show/hide Instances
eventBoxNew :: IO EventBoxSource
Creates a new EventBox.
data Expander Source
show/hide Instances
expanderNew :: String -> IO ExpanderSource
Creates a new expander using the given string as the text of the label.
expanderSetExpanded :: Expander -> Bool -> IO ()Source
Sets the state of the expander. Set to True, if you want the child widget to be revealed, and False if you want the child widget to be hidden.
exposeEvent :: WidgetClass self => Signal self (EventM EExpose Bool)Source

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.

fileChooserDialogNewSource
:: Maybe StringTitle of the dialog (or default)
-> Maybe WindowTransient parent of the dialog (or none)
-> FileChooserActionOpen or save mode for the dialog
-> [(String, ResponseId)]Buttons and their response codes
-> IO FileChooserDialog
Creates a new FileChooserDialog.
fileChooserGetFilenameSource
:: FileChooserClass self
=> self
-> IO (Maybe FilePath)returns The currently selected filename, or Nothing if no file is selected, or the selected file can't be represented with a local filename.

Gets the filename for the currently selected file in the file selector. If multiple files are selected, one of the filenames will be returned at random.

If the file chooser is in folder mode, this function returns the selected folder.

data FileChooserAction Source
Describes whether a FileChooser is being used to open existing files or to save to a possibly new file.
Constructors
FileChooserActionOpen
FileChooserActionSave
FileChooserActionSelectFolder
FileChooserActionCreateFolder
show/hide Instances
frameNew :: IO FrameSource

Creates a new Frame without a label.

grabAdd :: WidgetClass wd => wd -> IO ()Source
add a grab widget
grabRemove :: WidgetClass w => w -> IO ()Source
remove a grab widget
data HBox Source
show/hide Instances
hBoxNewSource
:: Boolhomogeneous - True if all children are to be given equal space allotments.
-> Intspacing - the number of pixels to place by default between children.
-> IO HBox
Creates a new HBox.
keyPressEvent :: WidgetClass self => Signal self (EventM EKey Bool)Source
A key has been depressed. Sets the widget's KeyPressMask flag.
data Label Source
show/hide Instances
labelNew :: Maybe String -> IO LabelSource
Creates a new label with the given text inside it. You can pass Nothing to get an empty label widget.
labelSetText :: LabelClass self => self -> String -> IO ()Source

Sets the text within the Label widget. It overwrites any text that was there before.

This will also clear any previously set mnemonic accelerators.

data Layout Source
show/hide Instances
layoutGetDrawWindow :: Layout -> IO DrawWindowSource
Retrieves the Drawable part.
layoutNewSource
:: Maybe Adjustmenthadjustment - horizontal scroll adjustment, or Nothing
-> Maybe Adjustmentvadjustment - vertical scroll adjustment, or Nothing
-> IO Layout
Creates a new Layout. Unless you have a specific adjustment you'd like the layout to use for scrolling, pass Nothing for hadjustment and vadjustment.
layoutPutSource
:: (LayoutClass self, WidgetClass childWidget)
=> self
-> childWidgetchildWidget - child widget
-> Intx - X position of child widget
-> Inty - Y position of child widget
-> IO ()
Adds childWidget to layout, at position (x,y). layout becomes the new parent container of childWidget.
layoutSetSizeSource
:: LayoutClass self
=> self
-> Intwidth - width of entire scrollable area
-> Intheight - height of entire scrollable area
-> IO ()
Sets the size of the scrollable area of the layout.
listStoreNew :: [a] -> IO (ListStore a)Source
Create a new TreeModel that contains a list of elements.
makeColumnIdString :: Int -> ColumnId row StringSource
Create a ColumnId to extract an string.
menuPopupSource
:: MenuClass self
=> selfThe menu to be shown.
-> Maybe (MouseButton, TimeStamp)The mouse button returned by Graphics.UI.Gtk.Gdk.EventM.eventButton and the time of the event returned by Graphics.UI.Gtk.Gdk.eventTime. These values are used to match the corresponding release of the button. If this context menu is shown by programmatic means, supply Nothing.
-> IO ()

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 the requirement that this function is called as response to a button press signal).
data MessageType Source
Constructors
MessageInfo
MessageWarning
MessageQuestion
MessageError
MessageOther
show/hide Instances
messageDialogNewSource
:: Maybe WindowTransient parent of the dialog (or none)
-> [DialogFlags]
-> MessageType
-> ButtonsType
-> StringThe text of the message
-> IO MessageDialog
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.
on :: object -> Signal object callback -> callback -> IO (ConnectId object)Source

Perform an action in response to a signal.

Use it like this:

on obj sig $ do ...

or if the signal handler takes any arguments:

on obj sig $ \args -> do ...
onDestroy :: WidgetClass w => w -> IO () -> IO (ConnectId w)Source
onSizeRequest :: WidgetClass w => w -> IO Requisition -> IO (ConnectId w)Source
data Packing Source

Packing parameters of a widget

  • 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 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 covers the available space. A menu bar, for instance, should always stay at the top of a window and should only occupy as little space as possible. Hence it should be packed at the start of a Graphics.UI.Gtk.Layout.VBox with the packing option PackNatural. The working area of a window (e.g. the text area in an editor) should expand when the window is resized. Here the packing option PackGrow is the right choice and 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.
Constructors
PackRepel
PackGrow
PackNatural
show/hide Instances
data PolicyType Source
Constructors
PolicyAutomatic
show/hide Instances
data Rectangle Source

Rectangle

  • Specifies x, y, width and height
Constructors
Rectangle Int Int Int Int
show/hide Instances
renderWithDrawableSource
:: DrawableClass drawable
=> drawabledrawable - a Drawable
-> Render aA newly created Cairo context.
-> IO a
Creates a Cairo context for drawing to a Drawable.
data Requisition Source

Requisition

  • For Graphics.UI.Gtk.Abstract.Widget.widgetSizeRequest. The values represent the desired width and height of the widget.
Constructors
Requisition Int Int
show/hide Instances
data ResponseId Source
Some constructors that can be used as response numbers for dialogs.
Constructors
ResponseNoneGTK returns this if a response widget has no response_id, or if the dialog gets programmatically hidden or destroyed.
ResponseRejectGTK won't return these unless you pass them in as the response for an action widget. They are for your convenience.
ResponseAccept(as above)
ResponseDeleteEventIf the dialog is deleted.
ResponseOk

"Ok" was pressed.

  • This value is returned from the "Ok" stock dialog button.
ResponseCancel

"Cancel" was pressed.

  • These value is returned from the "Cancel" stock dialog button.
ResponseClose

"Close" was pressed.

  • This value is returned from the "Close" stock dialog button.
ResponseYes

"Yes" was pressed.

  • This value is returned from the "Yes" stock dialog button.
ResponseNo

"No" was pressed.

  • This value is returned from the "No" stock dialog button.
ResponseApply

"Apply" was pressed.

  • This value is returned from the "Apply" stock dialog button.
ResponseHelp

"Help" was pressed.

  • This value is returned from the "Help" stock dialog button.
ResponseUser Int

A user-defined response

  • This value is returned from a user defined button
show/hide Instances
data ScrolledWindow Source
show/hide Instances
scrolledWindowNewSource
:: Maybe Adjustmenthadjustment - Horizontal adjustment.
-> Maybe Adjustmentvadjustment - Vertical adjustment.
-> IO ScrolledWindow
Creates a new scrolled window. The two arguments are the scrolled window's adjustments; these will be shared with the scrollbars and the child widget to keep the bars in sync with the child. Usually you want to pass Nothing for the adjustments, which will cause the scrolled window to create them for you.
scrolledWindowSetPolicySource
:: ScrolledWindowClass self
=> self
-> PolicyTypehscrollbarPolicy - Policy for horizontal bar.
-> PolicyTypevscrollbarPolicy - Policy for vertical bar.
-> IO ()
Sets the scrollbar policy for the horizontal and vertical scrollbars. The policy determines when the scrollbar should appear; it is a value from the 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 larger than the page size).
data Statusbar Source
show/hide Instances
statusbarGetContextIdSource
:: StatusbarClass self
=> self
-> StringcontextDescription - textual description of what context the new message is being used in.
-> IO ContextIdreturns an id that can be used to later remove entries ^ from the Statusbar.
Returns a new context identifier, given a description of the actual context. This id can be used to later remove entries form the Statusbar.
statusbarNew :: IO StatusbarSource
Creates a new Statusbar ready for messages.
statusbarPopSource
:: StatusbarClass self
=> self
-> ContextIdcontextId - the context identifier used when the message was added.
-> IO ()
Removes the topmost message that has the correct context.
statusbarPushSource
:: StatusbarClass self
=> self
-> ContextIdcontextId - the message's context id, as returned by statusbarGetContextId.
-> Stringtext - the message to add to the statusbar.
-> IO MessageIdreturns the message's new message id for use with statusbarRemove.
Pushes a new message onto the Statusbar's stack. It will be displayed as long as it is on top of the stack.
data VBox Source
show/hide Instances
vBoxNewSource
:: Boolhomogeneous - True if all children are to be given equal space allotments.
-> Intspacing - the number of pixels to place by default between children.
-> IO VBox
Creates a new VBox.
class ObjectClass o => WidgetClass o Source
show/hide Instances
WidgetClass TipsQuery
WidgetClass Item
WidgetClass ListItem
WidgetClass InputDialog
WidgetClass CList
WidgetClass CTree
WidgetClass List
WidgetClass Ruler
WidgetClass HRuler
WidgetClass VRuler
WidgetClass Preview
WidgetClass Widget
WidgetClass Misc
WidgetClass Label
WidgetClass AccelLabel
WidgetClass Arrow
WidgetClass Image
WidgetClass Container
WidgetClass Bin
WidgetClass Alignment
WidgetClass Frame
WidgetClass AspectFrame
WidgetClass Button
WidgetClass ToggleButton
WidgetClass CheckButton
WidgetClass RadioButton
WidgetClass ColorButton
WidgetClass FontButton
WidgetClass OptionMenu
WidgetClass MenuItem
WidgetClass CheckMenuItem
WidgetClass RadioMenuItem
WidgetClass TearoffMenuItem
WidgetClass ImageMenuItem
WidgetClass SeparatorMenuItem
WidgetClass Window
WidgetClass Dialog
WidgetClass AboutDialog
WidgetClass ColorSelectionDialog
WidgetClass FileSelection
WidgetClass FileChooserDialog
WidgetClass FontSelectionDialog
WidgetClass MessageDialog
WidgetClass Plug
WidgetClass EventBox
WidgetClass HandleBox
WidgetClass ScrolledWindow
WidgetClass Viewport
WidgetClass Expander
WidgetClass ComboBox
WidgetClass ComboBoxEntry
WidgetClass ToolItem
WidgetClass ToolButton
WidgetClass MenuToolButton
WidgetClass ToggleToolButton
WidgetClass RadioToolButton
WidgetClass SeparatorToolItem
WidgetClass Box
WidgetClass ButtonBox
WidgetClass HButtonBox
WidgetClass VButtonBox
WidgetClass VBox
WidgetClass ColorSelection
WidgetClass FontSelection
WidgetClass FileChooserWidget
WidgetClass HBox
WidgetClass Combo
WidgetClass FileChooserButton
WidgetClass Statusbar
WidgetClass Fixed
WidgetClass Paned
WidgetClass HPaned
WidgetClass VPaned
WidgetClass IconView
WidgetClass Layout
WidgetClass MenuShell
WidgetClass Menu
WidgetClass MenuBar
WidgetClass Notebook
WidgetClass Socket
WidgetClass Table
WidgetClass TextView
WidgetClass Toolbar
WidgetClass TreeView
WidgetClass Calendar
WidgetClass CellView
WidgetClass DrawingArea
WidgetClass Entry
WidgetClass SpinButton
WidgetClass Range
WidgetClass Scale
WidgetClass HScale
WidgetClass VScale
WidgetClass Scrollbar
WidgetClass HScrollbar
WidgetClass VScrollbar
WidgetClass Separator
WidgetClass HSeparator
WidgetClass VSeparator
WidgetClass Invisible
WidgetClass ProgressBar
widgetAddEvents :: WidgetClass self => self -> [EventMask] -> IO ()Source

Enable event signals.

widgetClassPathSource
:: WidgetClass self
=> self
-> IO (Int, String, String)(pathLength, path, pathReversed) - length of the path, path string and reverse path string
Same as widgetPath, but always uses the name of a widget's type, never uses a custom name set with widgetSetName.
widgetDestroy :: WidgetClass self => self -> IO ()Source

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.

widgetGrabFocus :: WidgetClass self => self -> IO ()Source
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.)
widgetSetCanFocus :: WidgetClass self => self -> Bool -> IO ()Source

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.
widgetSetDoubleBufferedSource
:: WidgetClass self
=> self
-> BooldoubleBuffered - True to double-buffer a widget
-> IO ()

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).

widgetSetNameSource
:: WidgetClass self
=> self
-> Stringname - name for the widget
-> IO ()

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.

widgetSetSizeRequestSource
:: WidgetClass self
=> self
-> Intwidth - width widget should request, or -1 to unset
-> Intheight - height widget should request, or -1 to unset
-> IO ()

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."

widgetShow :: WidgetClass self => self -> IO ()Source

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.

widgetShowAll :: WidgetClass self => self -> IO ()Source
Recursively shows a widget, and any child widgets (if the widget is a container).
widgetSizeRequest :: WidgetClass self => self -> IO RequisitionSource

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.

widgetVisible :: WidgetClass self => Attr self BoolSource

Whether the widget is visible.

Default value: False

data Window Source
show/hide Instances
windowMoveSource
:: WindowClass self
=> self
-> Intx - X coordinate to move window to
-> Inty - Y coordinate to move window to
-> IO ()

Asks the window manager to move window to the given position. Window managers are free to ignore this; most window managers ignore requests for initial window positions (instead using a user-defined placement algorithm) and honor requests after the window has already been shown.

Note: the position is the position of the gravity-determined reference point for the window. The gravity determines two things: first, the location of the reference point in root window coordinates; and second, which point on the window is positioned at the reference point.

By default the gravity is GravityNorthWest, so the reference point is simply the x, y supplied to windowMove. The top-left corner of the window decorations (aka window frame or border) will be placed at x, y. Therefore, to position a window at the top left of the screen, you want to use the default gravity (which is GravityNorthWest) and move the window to 0,0.

To position a window at the bottom right corner of the screen, you would set GravitySouthEast, which means that the reference point is at x + the window width and y + the window height, and the bottom-right corner of the window border will be placed at that reference point. So, to place a window in the bottom right corner you would first set gravity to south east, then write: gtk_window_move (window, gdk_screen_width() - window_width, gdk_screen_height() - window_height).

The Extended Window Manager Hints specification at http://www.freedesktop.org/Standards/wm-spec has a nice table of gravities in the "implementation notes" section.

The windowGetPosition documentation may also be relevant.

windowNew :: IO WindowSource
Create a new top level window.
windowPresent :: WindowClass self => self -> IO ()Source

Presents a window to the user. This may mean raising the window in the stacking order, deiconifying it, moving it to the current desktop, and/or giving it the keyboard focus, possibly dependent on the user's platform, window manager, and preferences.

If window is hidden, this function calls widgetShow as well.

This function should be used when the user tries to open a window that's already open. Say for example the preferences dialog is currently open, and the user chooses Preferences from the menu a second time; use windowPresent to move the already-open dialog where the user can see it.

If you are calling this function in response to a user interaction, it is preferable to use windowPresentWithTime.

windowSetDefaultSizeSource
:: WindowClass self
=> self
-> Intheight - height in pixels, or -1 to unset the default height
-> Intwidth - width in pixels, or -1 to unset the default width
-> IO ()

Sets the default size of a window. If the window's "natural" size (its size request) is larger than the default, the default will be ignored. More generally, if the default size does not obey the geometry hints for the window (windowSetGeometryHints can be used to set these explicitly), the default size will be clamped to the nearest permitted size.

Unlike widgetSetSizeRequest, which sets a size request for a widget and thus would keep users from shrinking the window, this function only sets the initial size, just as if the user had resized the window themselves. Users can still shrink the window again as they normally would. Setting a default size of -1 means to use the "natural" default size (the size request of the window).

For more control over a window's initial size and how resizing works, investigate windowSetGeometryHints.

For some uses, windowResize is a more appropriate function. windowResize changes the current size of the window, rather than the size to be used on initial display. windowResize always affects the window itself, not the geometry widget.

The default size of a window only affects the first time a window is shown; if a window is hidden and re-shown, it will remember the size it had prior to hiding, rather than using the default size.

Windows can't actually be 0x0 in size, they must be at least 1x1, but passing 0 for width and height is OK, resulting in a 1x1 default size.

windowSetPosition :: WindowClass self => self -> WindowPosition -> IO ()Source
Sets a position constraint for this window. If the old or new constraint is WinPosCenterAlways, this will also cause the window to be repositioned to satisfy the new constraint.
windowSetTitle :: WindowClass self => self -> String -> IO ()Source
Sets the title of the Window. The title of a window will be displayed in its title bar; on the X Window System, the title bar is rendered by the window manager, so exactly how the title appears to users may vary according to a user's exact configuration. The title should help a user distinguish this window from other windows they may have open. A good title might include the application name and current document filename, for example.
windowTitle :: WindowClass self => Attr self StringSource
The title of the window.
data WindowPosition Source
Window position types
Constructors
WinPosNone
WinPosCenter
WinPosMouse
WinPosCenterAlways
WinPosCenterOnParent
show/hide Instances
initGUI :: IO [String]Source

Initialize the GUI.

This must be called before any other function in the Gtk2Hs library.

This function initializes the GUI toolkit and parses all Gtk specific arguments. The remaining arguments are returned. If the initialization of the toolkit fails for whatever reason, an exception is thrown.

  • Throws: error "Cannot initialize GUI."
  • If you want to use Gtk2Hs and in a multi-threaded application then it is your obligation to ensure that all calls to Gtk+ happen on a single OS thread. If you want to make calls to Gtk2Hs functions from a Haskell thread other than the one that calls this functions and mainGUI then you will have to 'post' your GUI actions to the main GUI thread. You can do this using postGUISync or postGUIAsync. See also threadsEnter.
mainGUI :: IO ()Source
Run the Gtk+ main event loop.
mainQuit :: IO ()Source
Exit the main event loop.
type GtkFrame = FrameSource
type GtkLayout = LayoutSource
Produced by Haddock version 2.6.1