Name

Widget —

* Widget is the base class of all widgets. It provides the methods to attach and detach signals.

Synopsis

type
        Allocation
data
        Requisition
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)

Introduction

* 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

Datatypes

type Allocation

AllocationRectangle

Allocation

for Widget's size_allocate signal

data Requisition

Requisition

data Requisition =Requisition IntInt

for Widget's size_request Requisition

for Widget's size_request

Methods

widgetActivate

Activate the widget (e.g. clicking a button).

widgetActivate:: w:: IO Bool
w

widgetAddEvents

Enable event signals.

widgetAddEvents:: w:: [EventMask]:: IO ()
wem

widgetCreateLayout

Prepare text for display.

widgetCreateLayout:: obj:: String:: IO PangoLayout
objtxt

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` update

widgetDestroy

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

widgetGetDirection

Retrieve the default direction of text writing.

widgetGetDirection:: w:: IO TextDirection
w

widgetGetEvents

Get enabled event signals.

widgetGetEvents:: w:: IO [EventMask]
w

widgetGetExtensionEvents

Get extension events.

widgetGetExtensionEvents:: w:: IO [ExtensionMode]
w

widgetGetName

Get the name of a widget.

widgetGetName:: w:: IO String
w

widgetGetSavedState

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.

widgetGetState

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.

widgetGetToplevel

Retrieves the topmost widget in this tree.

widgetGetToplevel:: w:: IO Widget
w

widgetHasIntersection

Check if the widget intersects with a given area.

widgetHasIntersection:: w:: Rectangle:: IO Bool
wr

widgetHide

Queue a hide request.

widgetHide:: w:: IO ()

Reverses the effects of widgetShow, causing the widget to be hidden (make invisible to the user).

widgetHideAll

Hide this and all child widgets.

widgetHideAll:: w:: IO ()

widgetIsAncestor

Return True if the second widget is (possibly indirectly) held by the first.

widgetIsAncestor:: anc:: w:: IO Bool
ancw

widgetIsFocus

Set and query the input focus of a widget.

widgetIsFocus:: w:: IO Bool
w

widgetQueueDraw

Send a redraw request to a widget.

widgetQueueDraw:: w:: IO ()

widgetReparent

Move a widget to a new parent.

widgetReparent:: w:: par:: IO ()
wpar

widgetSetAppPaintable

Sets some weired flag in the widget.

widgetSetAppPaintable:: w:: Bool:: IO ()
wp

widgetSetDirection

Setting packaging and writing direction.

widgetSetDirection:: w:: TextDirection:: IO ()
wtd

widgetSetExtensionEvents

Set extension events.

widgetSetExtensionEvents:: w:: [ExtensionMode]:: IO ()
wem

widgetSetName

Set the name of a widget.

widgetSetName:: w:: String:: IO ()
wname

widgetSetSensitivity

Set the widgets sensitivity (Grayed or Usable).

widgetSetSensitivity:: w:: Bool:: IO ()
wb

widgetSetSizeRequest

Sets the minimum size of a widget.

widgetSetSizeRequest:: w:: Int:: Int:: IO ()
wwidthheight

widgetShow

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.

widgetShowAll

Show this and all child widgets.

widgetShowAll:: w:: IO ()

widgetShowNow

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.

Signals

onButtonPress

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.

onButtonRelease

A Butten was released.

onButtonRelease:: w:: (Event -> IO Bool):: IO (ConnectId w)

onClient

onClient:: w:: (Event -> IO Bool):: IO (ConnectId w)

onConfigure

The widget's status has changed.

onConfigure:: w:: (Event -> IO Bool):: IO (ConnectId w)

onDelete

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)

onDestroy

The widget will be destroyed.

onDestroy:: w:: (IO ()):: IO (ConnectId w)

This is the last signal this widget will receive.

onDestroyEvent

The widget will be destroyed.

onDestroyEvent:: w:: (Event -> IO Bool):: IO (ConnectId w)

The widget received a destroy event from the window manager.

onDirectionChanged

The default text direction was changed.

onDirectionChanged:: w:: (Event -> IO Bool):: IO (ConnectId w)

onEnterNotify

Mouse cursor entered widget.

onEnterNotify:: w:: (Event -> IO Bool):: IO (ConnectId w)

onExpose

Instructs the widget to redraw.

onExpose:: w:: (Event -> IO Bool):: IO (ConnectId w)

onFocusIn

Widget gains input focus.

onFocusIn:: w:: (Event -> IO Bool):: IO (ConnectId w)

onFocusOut

Widget looses input focus.

onFocusOut:: w:: (Event -> IO Bool):: IO (ConnectId w)

onGrabFocus

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.

onHide

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.

onHierarchyChanged

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.

onKeyPress

A key was pressed.

onKeyPress:: w:: (Event -> IO Bool):: IO (ConnectId w)

onKeyRelease

A key was released.

onKeyRelease:: w:: (Event -> IO Bool):: IO (ConnectId w)

onLeaveNotify

Mouse cursor leaves widget.

onLeaveNotify:: w:: (Event -> IO Bool):: IO (ConnectId w)

onMnemonicActivate

onMnemonicActivate:: w:: (Bool -> IO Bool):: IO (ConnectId w)

onMotionNotify

Track mouse movements.

onMotionNotify:: w:: Bool:: (Event -> IO Bool):: IO (ConnectId w)
whint 

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.

onParentSet

onParentSet:: w:: (old -> IO ()):: IO (ConnectId w)

onPopupMenu

onPopupMenu:: w:: IO ():: IO (ConnectId w)

onProximityIn

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.

onProximityOut

The input device became inactive.

onProximityOut:: w:: (Event -> IO Bool):: IO (ConnectId w)

The pen was removed from the graphics tablet's surface.

onScroll

The mouse wheel has turned.

onScroll:: w:: (Event -> IO Bool):: IO (ConnectId w)

The Event is always Scroll.

onShow

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.

onSizeAllocate

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.

onSizeRequest

Query the widget for the size it likes to have.

onSizeRequest:: w:: (IO Requisition):: IO (ConnectId w)
wfun

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.

onStateChanged

onStateChanged:: w:: (StateType -> IO ()):: IO (ConnectId w)

onUnmap

The widget was removed from screen.

onUnmap:: w:: IO ():: IO (ConnectId w)

onUnrealize

This widget's drawing area is about to be destroyed.

onUnrealize:: w:: IO ():: IO (ConnectId w)

onVisibilityNotify

onVisibilityNotify:: w:: (Event -> IO Bool):: IO (ConnectId w)

onWindowState

onWindowState:: w:: (Event -> IO Bool):: IO (ConnectId w)