Widget —
* Widget is the base class of all widgets. It provides the methods to attach and detach signals.
type
Allocation |
data
Requisition |
newtype
WidgetId |
type
WidgetName |
widgetActivate:: WidgetClass w => w -> IO Bool |
widgetAddEvents:: WidgetClass w => w -> [EventMask] -> IO () |
widgetCreateLayout:: WidgetClass obj => obj -> String -> IO PangoLayout |
widgetDestroy:: WidgetClass obj => obj -> IO () |
widgetGetDirection:: WidgetClass w => w -> IO TextDirection |
widgetGetEvents:: WidgetClass w => w -> IO [EventMask] |
widgetGetExtensionEvents:: WidgetClass w => w -> IO [ExtensionMode] |
widgetGetName:: WidgetClass w => w -> IO String |
widgetGetSavedState:: WidgetClass w => w -> IO StateType |
widgetGetState:: WidgetClass w => w -> IO StateType |
widgetGetToplevel:: WidgetClass w => w -> IO Widget |
widgetHasIntersection:: WidgetClass w => w -> Rectangle -> IO Bool |
widgetHide:: WidgetClass w => w -> IO () |
widgetHideAll:: WidgetClass w => w -> IO () |
widgetIsAncestor:: (WidgetClass anc, WidgetClass w) => anc -> w -> IO Bool |
widgetIsFocus:: WidgetClass w => w -> IO Bool |
widgetQueueDraw:: WidgetClass w => w -> IO () |
widgetReparent:: (WidgetClass w, WidgetClass par) => w -> par -> IO () |
widgetSetAppPaintable:: WidgetClass w => w -> Bool -> IO () |
widgetSetDirection:: WidgetClass w => w -> TextDirection -> IO () |
widgetSetExtensionEvents:: WidgetClass w => w -> [ExtensionMode] -> IO () |
widgetSetName:: WidgetClass w => w -> String -> IO () |
widgetSetSensitivity:: WidgetClass w => w -> Bool -> IO () |
widgetSetSizeRequest:: WidgetClass w => w -> Int -> Int -> IO () |
widgetShow:: WidgetClass w => w -> IO () |
widgetShowAll:: WidgetClass w => w -> IO () |
widgetShowNow:: WidgetClass w => w -> IO () |
onButtonPress:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onButtonRelease:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onClient:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onConfigure:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onDelete:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onDestroy:: WidgetClass w => w -> (IO ()) -> IO (ConnectId w) |
onDestroyEvent:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onDirectionChanged:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onEnterNotify:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onExpose:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onFocusIn:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onFocusOut:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onGrabFocus:: WidgetClass w => w -> IO () -> IO (ConnectId w) |
onHide:: WidgetClass w => w -> IO () -> IO (ConnectId w) |
onHierarchyChanged:: WidgetClass w => w -> IO () -> IO (ConnectId w) |
onKeyPress:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onKeyRelease:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onLeaveNotify:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onMnemonicActivate:: WidgetClass w => w -> (Bool -> IO Bool) -> IO (ConnectId w) |
onMotionNotify:: WidgetClass w => w -> Bool -> (Event -> IO Bool) -> IO (ConnectId w) |
onParentSet:: (WidgetClass w, WidgetClass old) => w -> (old -> IO ()) -> IO (ConnectId w) |
onPopupMenu:: WidgetClass w => w -> IO () -> IO (ConnectId w) |
onProximityIn:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onProximityOut:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onScroll:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onShow:: WidgetClass w => w -> IO () -> IO (ConnectId w) |
onSizeAllocate:: WidgetClass w => w -> (Allocation -> IO ()) -> IO (ConnectId w) |
onSizeRequest:: WidgetClass w => w -> (IO Requisition) -> IO (ConnectId w) |
onStateChanged:: WidgetClass w => w -> (StateType -> IO ()) -> IO (ConnectId w) |
onUnmap:: WidgetClass w => w -> IO () -> IO (ConnectId w) |
onUnrealize:: WidgetClass w => w -> IO () -> IO (ConnectId w) |
onVisibilityNotify:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
onWindowState:: WidgetClass w => w -> (Event -> IO Bool) -> IO (ConnectId w) |
* This modules reexports everything a normal widget needs from GObject and Object. - TODO * unimplemented methods that seem to be useful in user programs: widgetSizeRequest, widgetAddAccelerator, widgetRemoveAccelerator, widgetAcceleratorSignal, widgetIntersect, widgetGrabDefault, widgetGetPointer, widgetPath, widgetClassPath, getCompositeName, widgetSetCompositeName, widgetModifyStyle, widgetGetModifierStyle, widgetModifyFg, widgetModifyBG, widgetModifyText, widgetModifyBase, widgetModifyFont, widgetPango*, widgetSetAdjustments * implement the following methods in GtkWindow object: widget_set_uposition, widget_set_usize * implement the following methods in GtkDrawingArea object: widgetQueueDrawArea, widgetSetDoubleBufferd, widgetRegionIntersect
Prepare text for display.
| widgetCreateLayout | :: obj | :: String | :: IO PangoLayout |
| obj | txt |
The Layout represents the rendered text. It can be shown on screen by calling drawLayout.
The returned Layout shares the same font information ( Context) as this widget. If this information changes, the Layout 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` updateDestroy a widget.
| widgetDestroy | :: obj | :: IO () |
The widgetDestroy function is used to shutdown an object, i.e. a widget will be removed from the screen and unrealized. Resources will be freed when all references are released.
Retrieve the default direction of text writing.
| widgetGetDirection | :: w | :: IO TextDirection |
| w |
Retrieve the current state of the widget.
| widgetGetSavedState | :: w | :: IO StateType |
| w |
If a widget is turned insensitive, the previous state is stored in a specific location. This function retrieves this previous state.
Retrieve the current state of the widget.
| widgetGetState | :: w | :: IO StateType |
| w |
The state refers to different modes of user interaction, see StateType for more information.
Check if the widget intersects with a given area.
| widgetHasIntersection | :: w | :: Rectangle | :: IO Bool |
| w | r |
Queue a hide request.
| widgetHide | :: w | :: IO () |
Reverses the effects of widgetShow, causing the widget to be hidden (make invisible to the user).
Return True if the second widget is (possibly indirectly) held by the first.
| widgetIsAncestor | :: anc | :: w | :: IO Bool |
| anc | w |
Setting packaging and writing direction.
| widgetSetDirection | :: w | :: TextDirection | :: IO () |
| w | td |
Set extension events.
| widgetSetExtensionEvents | :: w | :: [ExtensionMode] | :: IO () |
| w | em |
Set the widgets sensitivity (Grayed or Usable).
| widgetSetSensitivity | :: w | :: Bool | :: IO () |
| w | b |
Sets the minimum size of a widget.
| widgetSetSizeRequest | :: w | :: Int | :: Int | :: IO () |
| w | width | height |
Queue a show request.
| widgetShow | :: w | :: IO () |
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. Note 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.
Queue a show event and wait for it to be executed.
| widgetShowNow | :: w | :: IO () |
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.
A Button was pressed.
| onButtonPress | :: w | :: (Event -> IO Bool) | :: IO (ConnectId w) |
This widget is part of a button which was just pressed. The event passed to the user function is a Button event.
This signal is emitted when the close icon on the surrounding window is pressed. The default action is to emit the destroy signal.
| onDelete | :: w | :: (Event -> IO Bool) | :: IO (ConnectId w) |
The widget will be destroyed.
| onDestroy | :: w | :: (IO ()) | :: IO (ConnectId w) |
This is the last signal this widget will receive.
The widget will be destroyed.
| onDestroyEvent | :: w | :: (Event -> IO Bool) | :: IO (ConnectId w) |
The widget received a destroy event from the window manager.
The default text direction was changed.
| onDirectionChanged | :: w | :: (Event -> IO Bool) | :: IO (ConnectId w) |
The widget is about to receive all events.
| onGrabFocus | :: w | :: IO () | :: IO (ConnectId w) |
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.
The widget was asked to hide itself.
| onHide | :: w | :: IO () | :: IO (ConnectId w) |
This signal is emitted each time widgetHide is called. Use connectToUnmap when your application needs to be informed when the widget is actually removed from screen.
The toplevel window changed.
| onHierarchyChanged | :: w | :: IO () | :: IO (ConnectId w) |
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.
Track mouse movements.
| onMotionNotify | :: w | :: Bool | :: (Event -> IO Bool) | :: IO (ConnectId w) |
| w | hint |
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 drawWindowGetPointer.
The input device became active.
| onProximityIn | :: w | :: (Event -> IO Bool) | :: IO (ConnectId w) |
This event indicates that a pen of a graphics tablet or similar device is now touching the tablet.
The input device became inactive.
| onProximityOut | :: w | :: (Event -> IO Bool) | :: IO (ConnectId w) |
The pen was removed from the graphics tablet's surface.
The widget was asked to show itself.
| onShow | :: w | :: IO () | :: IO (ConnectId w) |
This signal is emitted each time widgetShow is called. Use connectToMap when your application needs to be informed when the widget is actually shown.
Inform widget about the size it has.
| onSizeAllocate | :: w | :: (Allocation -> IO ()) | :: IO (ConnectId w) |
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.
Query the widget for the size it likes to have.
| onSizeRequest | :: w | :: (IO Requisition) | :: IO (ConnectId w) |
| w | fun |
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.