Maintainer | gtk2hs-users@lists.sourceforge.net |
---|---|
Stability | provisional |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
The base class for all widgets.
- data Widget
- class GObjectClass o => WidgetClass o
- castToWidget :: GObjectClass obj => obj -> Widget
- gTypeWidget :: GType
- toWidget :: WidgetClass o => o -> Widget
- data EventMask
- = ExposureMask
- | PointerMotionMask
- | PointerMotionHintMask
- | ButtonMotionMask
- | Button1MotionMask
- | Button2MotionMask
- | Button3MotionMask
- | ButtonPressMask
- | ButtonReleaseMask
- | KeyPressMask
- | KeyReleaseMask
- | EnterNotifyMask
- | LeaveNotifyMask
- | FocusChangeMask
- | StructureMask
- | PropertyChangeMask
- | VisibilityNotifyMask
- | ProximityInMask
- | ProximityOutMask
- | SubstructureMask
- | ScrollMask
- | TouchMask
- | SmoothScrollMask
- | AllEventsMask
- type GType = CULong
- type KeyVal = Word32
- data Requisition = Requisition Int Int
- data Rectangle :: * = Rectangle Int Int Int Int
- data Color :: *
- data IconSize
- data StateType
- data TextDirection
- data AccelFlags
- data DirectionType
- type StockId = DefaultGlibString
- data WidgetHelpType
- type Allocation = Rectangle
- widgetShow :: WidgetClass self => self -> IO ()
- widgetShowNow :: WidgetClass self => self -> IO ()
- widgetHide :: WidgetClass self => self -> IO ()
- widgetShowAll :: WidgetClass self => self -> IO ()
- widgetDestroy :: WidgetClass self => self -> IO ()
- widgetDraw :: WidgetClass self => self -> Cairo -> IO ()
- widgetQueueDraw :: WidgetClass self => self -> IO ()
- widgetQueueResize :: WidgetClass self => self -> IO ()
- widgetQueueResizeNoRedraw :: WidgetClass self => self -> IO ()
- widgetGetFrameClock :: WidgetClass self => self -> IO FrameClock
- widgetGetScaleFactor :: WidgetClass self => self -> IO Int
- widgetSizeRequest :: WidgetClass self => self -> IO Requisition
- widgetGetChildRequisition :: WidgetClass self => self -> IO Requisition
- widgetSizeAllocate :: WidgetClass self => self -> Allocation -> IO ()
- widgetSizeAllocateWithBaseline :: WidgetClass self => self -> Allocation -> Int -> IO ()
- widgetAddAccelerator :: (WidgetClass self, GlibString string) => self -> string -> AccelGroup -> KeyVal -> [Modifier] -> [AccelFlags] -> IO ()
- widgetRemoveAccelerator :: WidgetClass self => self -> AccelGroup -> KeyVal -> [Modifier] -> IO Bool
- widgetSetAccelPath :: (WidgetClass self, GlibString string) => self -> string -> AccelGroup -> IO ()
- widgetCanActivateAccel :: WidgetClass self => ConnectId self -> IO Bool
- widgetActivate :: WidgetClass self => self -> IO Bool
- widgetIntersect :: WidgetClass self => self -> Rectangle -> IO (Maybe Rectangle)
- widgetHasIntersection :: WidgetClass self => self -> Rectangle -> IO Bool
- widgetGetIsFocus :: WidgetClass self => self -> IO Bool
- widgetGrabFocus :: WidgetClass self => self -> IO ()
- widgetGrabDefault :: WidgetClass self => self -> IO ()
- widgetSetName :: (WidgetClass self, GlibString string) => self -> string -> IO ()
- widgetGetName :: (WidgetClass self, GlibString string) => self -> IO string
- widgetSetSensitive :: WidgetClass self => self -> Bool -> IO ()
- widgetSetSensitivity :: WidgetClass self => self -> Bool -> IO ()
- widgetGetParentWindow :: WidgetClass self => self -> IO DrawWindow
- widgetDelEvents :: WidgetClass self => self -> [EventMask] -> IO ()
- widgetAddEvents :: WidgetClass self => self -> [EventMask] -> IO ()
- widgetGetEvents :: WidgetClass self => self -> IO [EventMask]
- widgetSetEvents :: WidgetClass self => self -> [EventMask] -> IO ()
- widgetGetToplevel :: WidgetClass self => self -> IO Widget
- widgetGetAncestor :: WidgetClass self => self -> GType -> IO (Maybe Widget)
- widgetGetPointer :: WidgetClass self => self -> IO (Int, Int)
- widgetIsAncestor :: (WidgetClass self, WidgetClass ancestor) => self -> ancestor -> IO Bool
- widgetTranslateCoordinates :: (WidgetClass self, WidgetClass destWidget) => self -> destWidget -> Int -> Int -> IO (Maybe (Int, Int))
- widgetSetStyle :: WidgetClass self => self -> Maybe Style -> IO ()
- widgetGetStyle :: WidgetClass widget => widget -> IO Style
- widgetGetDefaultStyle :: IO Style
- widgetSetDirection :: WidgetClass self => self -> TextDirection -> IO ()
- widgetGetDirection :: WidgetClass self => self -> IO TextDirection
- widgetSetDefaultDirection :: TextDirection -> IO ()
- widgetGetDefaultDirection :: IO TextDirection
- widgetShapeCombineRegion :: WidgetClass self => self -> Maybe Region -> IO ()
- widgetInputShapeCombineRegion :: WidgetClass self => self -> Maybe Region -> IO ()
- widgetPath :: (WidgetClass self, GlibString string) => self -> IO (Int, string, string)
- widgetClassPath :: (WidgetClass self, GlibString string) => self -> IO (Int, string, string)
- widgetGetCompositeName :: (WidgetClass self, GlibString string) => self -> IO (Maybe string)
- widgetOverrideBackgroundColor :: WidgetClass self => self -> StateType -> Maybe Color -> IO ()
- widgetOverrideColor :: WidgetClass self => self -> StateType -> Maybe Color -> IO ()
- widgetOverrideFont :: WidgetClass self => self -> Maybe FontDescription -> IO ()
- widgetOverrideSymbolicColor :: (WidgetClass self, GlibString string) => self -> string -> Maybe Color -> IO ()
- widgetOverrideCursor :: WidgetClass self => self -> Maybe Color -> Maybe Color -> IO ()
- widgetModifyStyle :: (WidgetClass self, RcStyleClass style) => self -> style -> IO ()
- widgetGetModifierStyle :: WidgetClass self => self -> IO RcStyle
- widgetModifyFg :: WidgetClass self => self -> StateType -> Color -> IO ()
- widgetModifyBg :: WidgetClass self => self -> StateType -> Color -> IO ()
- widgetModifyText :: WidgetClass self => self -> StateType -> Color -> IO ()
- widgetModifyBase :: WidgetClass self => self -> StateType -> Color -> IO ()
- widgetModifyFont :: WidgetClass self => self -> Maybe FontDescription -> IO ()
- widgetRestoreFg :: WidgetClass self => self -> StateType -> IO ()
- widgetRestoreBg :: WidgetClass self => self -> StateType -> IO ()
- widgetRestoreText :: WidgetClass self => self -> StateType -> IO ()
- widgetRestoreBase :: WidgetClass self => self -> StateType -> IO ()
- widgetCreatePangoContext :: WidgetClass self => self -> IO PangoContext
- widgetGetPangoContext :: WidgetClass self => self -> IO PangoContext
- widgetCreateLayout :: (WidgetClass self, GlibString string) => self -> string -> IO PangoLayout
- widgetRenderIcon :: (WidgetClass self, GlibString string) => self -> string -> IconSize -> string -> IO (Maybe Pixbuf)
- widgetQueueDrawArea :: WidgetClass self => self -> Int -> Int -> Int -> Int -> IO ()
- widgetQueueDrawRegion :: WidgetClass self => self -> Region -> IO ()
- widgetSetAppPaintable :: WidgetClass self => self -> Bool -> IO ()
- widgetSetDoubleBuffered :: WidgetClass self => self -> Bool -> IO ()
- widgetSetRedrawOnAllocate :: WidgetClass self => self -> Bool -> IO ()
- widgetSetCompositeName :: (WidgetClass self, GlibString string) => self -> string -> IO ()
- widgetMnemonicActivate :: WidgetClass self => self -> Bool -> IO Bool
- widgetGetAccessible :: WidgetClass self => self -> IO GObject
- widgetChildFocus :: WidgetClass self => self -> DirectionType -> IO Bool
- widgetGetChildVisible :: WidgetClass self => self -> IO Bool
- widgetGetParent :: WidgetClass self => self -> IO (Maybe Widget)
- widgetGetSettings :: WidgetClass self => self -> IO Settings
- widgetGetClipboard :: WidgetClass self => self -> SelectionTag -> IO Clipboard
- widgetGetDisplay :: WidgetClass self => self -> IO Display
- widgetGetRootWindow :: WidgetClass self => self -> IO DrawWindow
- widgetGetScreen :: WidgetClass self => self -> IO Screen
- widgetHasScreen :: WidgetClass self => self -> IO Bool
- widgetGetSizeRequest :: WidgetClass self => self -> IO (Int, Int)
- widgetSetChildVisible :: WidgetClass self => self -> Bool -> IO ()
- widgetSetSizeRequest :: WidgetClass self => self -> Int -> Int -> IO ()
- widgetSetNoShowAll :: WidgetClass self => self -> Bool -> IO ()
- widgetGetNoShowAll :: WidgetClass self => self -> IO Bool
- widgetListMnemonicLabels :: WidgetClass self => self -> IO [Widget]
- widgetAddMnemonicLabel :: (WidgetClass self, WidgetClass label) => self -> label -> IO ()
- widgetRemoveMnemonicLabel :: (WidgetClass self, WidgetClass label) => self -> label -> IO ()
- widgetIsComposited :: WidgetClass self => self -> IO Bool
- widgetErrorBell :: WidgetClass self => self -> IO ()
- widgetKeynavFailed :: WidgetClass self => self -> DirectionType -> IO Bool
- widgetGetTooltipMarkup :: (WidgetClass self, GlibString markup) => self -> IO (Maybe markup)
- widgetSetTooltipMarkup :: (WidgetClass self, GlibString markup) => self -> Maybe markup -> IO ()
- widgetGetTooltipText :: (WidgetClass self, GlibString text) => self -> IO (Maybe text)
- widgetSetTooltipText :: (WidgetClass widget, GlibString text) => widget -> Maybe text -> IO ()
- widgetGetTooltipWindow :: WidgetClass self => self -> IO Window
- widgetSetTooltipWindow :: (WidgetClass self, WindowClass customWindow) => self -> Maybe customWindow -> IO ()
- widgetGetHasTooltip :: WidgetClass widget => widget -> IO Bool
- widgetSetHasTooltip :: WidgetClass widget => widget -> Bool -> IO ()
- widgetTriggerTooltipQuery :: WidgetClass self => self -> IO ()
- widgetGetWindow :: WidgetClass self => self -> IO (Maybe DrawWindow)
- widgetRegisterWindow :: (WidgetClass widget, DrawWindowClass window) => widget -> window -> IO ()
- widgetUnregisterWindow :: (WidgetClass widget, DrawWindowClass window) => widget -> window -> IO ()
- cairoShouldDrawWindow :: DrawWindowClass window => Cairo -> window -> IO Bool
- cairoTransformToWindow :: (WidgetClass widget, DrawWindowClass window) => Cairo -> widget -> window -> IO ()
- widgetReparent :: (WidgetClass self, WidgetClass newParent) => self -> newParent -> IO ()
- widgetGetCanFocus :: WidgetClass self => self -> IO Bool
- widgetSetCanFocus :: WidgetClass self => self -> Bool -> IO ()
- widgetGetAllocation :: WidgetClass self => self -> IO Allocation
- widgetGetAllocatedWidth :: WidgetClass self => self -> IO Int
- widgetGetAllocatedHeight :: WidgetClass self => self -> IO Int
- widgetGetAllocatedBaseline :: WidgetClass self => self -> IO Int
- widgetGetAppPaintable :: WidgetClass widget => widget -> IO Bool
- widgetGetCanDefault :: WidgetClass widget => widget -> IO Bool
- widgetSetCanDefault :: WidgetClass widget => widget -> Bool -> IO ()
- widgetGetHasWindow :: WidgetClass widget => widget -> IO Bool
- widgetSetHasWindow :: WidgetClass widget => widget -> Bool -> IO ()
- widgetGetSensitive :: WidgetClass widget => widget -> IO Bool
- widgetIsSensitive :: WidgetClass widget => widget -> IO Bool
- widgetGetState :: WidgetClass self => self -> IO StateType
- widgetGetVisible :: WidgetClass widget => widget -> IO Bool
- widgetIsVisible :: WidgetClass widget => widget -> IO Bool
- widgetSetStateFlags :: WidgetClass widget => widget -> [StateFlags] -> Bool -> IO ()
- widgetUnsetStateFlags :: WidgetClass widget => widget -> [StateFlags] -> IO ()
- widgetGetStateFlags :: WidgetClass widget => widget -> IO [StateFlags]
- widgetGetHasDefault :: WidgetClass widget => widget -> IO Bool
- widgetGetHasFocus :: WidgetClass widget => widget -> IO Bool
- widgetHasVisibleFocus :: WidgetClass widget => widget -> IO Bool
- widgetHasGrab :: WidgetClass widget => widget -> IO Bool
- widgetIsDrawable :: WidgetClass widget => widget -> IO Bool
- widgetIsToplevel :: WidgetClass widget => widget -> IO Bool
- widgetSetWindow :: (WidgetClass widget, DrawWindowClass window) => widget -> window -> IO ()
- widgetSetReceivesDefault :: WidgetClass widget => widget -> Bool -> IO ()
- widgetGetReceivesDefault :: WidgetClass widget => widget -> IO Bool
- widgetDeviceIsShadowed :: (WidgetClass widget, DeviceClass device) => widget -> device -> IO Bool
- widgetGetModifierMask :: WidgetClass widget => widget -> ModifierIntent -> IO [Modifier]
- widgetSetSupportMultidevice :: WidgetClass widget => widget -> Bool -> IO ()
- widgetGetSupportMultidevice :: WidgetClass widget => widget -> IO Bool
- widgetSetState :: WidgetClass self => self -> StateType -> IO ()
- widgetEvent :: WidgetClass self => self -> EventM t Bool
- widgetGetHAlign :: WidgetClass self => self -> IO Align
- widgetSetHAlign :: WidgetClass self => self -> Align -> IO ()
- widgetGetVAlign :: WidgetClass self => self -> IO Align
- widgetGetVAlignWithBaseline :: WidgetClass self => self -> IO Align
- widgetSetVAlign :: WidgetClass self => self -> Align -> IO ()
- widgetName :: (WidgetClass self, GlibString string) => Attr self (Maybe string)
- widgetParent :: (WidgetClass self, ContainerClass container) => ReadWriteAttr self (Maybe Container) (Maybe container)
- widgetWidthRequest :: WidgetClass self => Attr self Int
- widgetHeightRequest :: WidgetClass self => Attr self Int
- widgetMarginLeft :: WidgetClass self => Attr self Int
- widgetMarginRight :: WidgetClass self => Attr self Int
- widgetMarginTop :: WidgetClass self => Attr self Int
- widgetMarginBottom :: WidgetClass self => Attr self Int
- widgetVisible :: WidgetClass self => Attr self Bool
- widgetOpacity :: WidgetClass self => Attr self Double
- widgetSensitive :: WidgetClass self => Attr self Bool
- widgetAppPaintable :: WidgetClass self => Attr self Bool
- widgetCanFocus :: WidgetClass self => Attr self Bool
- widgetHasFocus :: WidgetClass self => Attr self Bool
- widgetIsFocus :: WidgetClass self => Attr self Bool
- widgetCanDefault :: WidgetClass self => Attr self Bool
- widgetHasDefault :: WidgetClass self => Attr self Bool
- widgetReceivesDefault :: WidgetClass self => Attr self Bool
- widgetCompositeChild :: WidgetClass self => ReadAttr self Bool
- widgetStyle :: WidgetClass self => Attr self Style
- widgetState :: WidgetClass self => Attr self StateType
- widgetEvents :: WidgetClass self => Attr self [EventMask]
- widgetExpand :: WidgetClass self => Attr self Bool
- widgetHExpand :: WidgetClass self => Attr self Bool
- widgetHExpandSet :: WidgetClass self => Attr self Bool
- widgetVExpand :: WidgetClass self => Attr self Bool
- widgetVExpandSet :: WidgetClass self => Attr self Bool
- widgetNoShowAll :: WidgetClass self => Attr self Bool
- widgetChildVisible :: WidgetClass self => Attr self Bool
- widgetCompositeName :: (WidgetClass self, GlibString string) => ReadWriteAttr self (Maybe string) string
- widgetDirection :: WidgetClass self => Attr self TextDirection
- widgetTooltipMarkup :: (WidgetClass self, GlibString markup) => Attr self (Maybe markup)
- widgetTooltipText :: (WidgetClass self, GlibString string) => Attr self (Maybe string)
- widgetHasTooltip :: WidgetClass self => Attr self Bool
- widgetHasRcStyle :: WidgetClass self => self -> IO Bool
- widgetGetRealized :: WidgetClass self => self -> IO Bool
- widgetGetMapped :: WidgetClass self => self -> IO Bool
- widgetSetRealized :: WidgetClass widget => widget -> Bool -> IO ()
- widgetSetMapped :: WidgetClass widget => widget -> Bool -> IO ()
- widgetGetStyleContext :: WidgetClass widget => widget -> IO StyleContext
- realize :: WidgetClass self => Signal self (IO ())
- unrealize :: WidgetClass self => Signal self (IO ())
- mapSignal :: WidgetClass self => Signal self (IO ())
- unmapSignal :: WidgetClass self => Signal self (IO ())
- sizeRequest :: WidgetClass self => Signal self (IO Requisition)
- sizeAllocate :: WidgetClass self => Signal self (Allocation -> IO ())
- showSignal :: WidgetClass self => Signal self (IO ())
- hideSignal :: WidgetClass self => Signal self (IO ())
- focus :: WidgetClass self => Signal self (DirectionType -> IO Bool)
- stateChanged :: WidgetClass self => Signal self (StateType -> IO ())
- stateFlagsChanged :: WidgetClass self => Signal self ([StateFlags] -> IO ())
- parentSet :: WidgetClass self => Signal self (Maybe Widget -> IO ())
- hierarchyChanged :: WidgetClass self => Signal self (Maybe Widget -> IO ())
- styleSet :: WidgetClass self => Signal self (Style -> IO ())
- directionChanged :: WidgetClass self => Signal self (TextDirection -> IO ())
- grabNotify :: WidgetClass self => Signal self (Bool -> IO ())
- popupMenuSignal :: WidgetClass self => Signal self (IO Bool)
- showHelp :: WidgetClass self => Signal self (WidgetHelpType -> IO Bool)
- accelClosuresChanged :: WidgetClass self => Signal self (IO ())
- screenChanged :: WidgetClass self => Signal self (Screen -> IO ())
- queryTooltip :: WidgetClass self => Signal self (Widget -> Maybe Point -> Tooltip -> IO Bool)
- draw :: WidgetClass self => Signal self (Render ())
- buttonPressEvent :: WidgetClass self => Signal self (EventM EButton Bool)
- buttonReleaseEvent :: WidgetClass self => Signal self (EventM EButton Bool)
- configureEvent :: WidgetClass self => Signal self (EventM EConfigure Bool)
- deleteEvent :: WidgetClass self => Signal self (EventM EAny Bool)
- destroyEvent :: WidgetClass self => Signal self (EventM EAny Bool)
- enterNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool)
- exposeEvent :: WidgetClass self => Signal self (EventM EExpose Bool)
- focusInEvent :: WidgetClass self => Signal self (EventM EFocus Bool)
- focusOutEvent :: WidgetClass self => Signal self (EventM EFocus Bool)
- grabBrokenEvent :: WidgetClass self => Signal self (EventM EGrabBroken Bool)
- keyPressEvent :: WidgetClass self => Signal self (EventM EKey Bool)
- keyReleaseEvent :: WidgetClass self => Signal self (EventM EKey Bool)
- leaveNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool)
- mapEvent :: WidgetClass self => Signal self (EventM EAny Bool)
- motionNotifyEvent :: WidgetClass self => Signal self (EventM EMotion Bool)
- noExposeEvent :: WidgetClass self => Signal self (EventM EAny Bool)
- proximityInEvent :: WidgetClass self => Signal self (EventM EProximity Bool)
- proximityOutEvent :: WidgetClass self => Signal self (EventM EProximity Bool)
- scrollEvent :: WidgetClass self => Signal self (EventM EScroll Bool)
- unmapEvent :: WidgetClass self => Signal self (EventM EAny Bool)
- visibilityNotifyEvent :: WidgetClass self => Signal self (EventM EVisibility Bool)
- windowStateEvent :: WidgetClass self => Signal self (EventM EWindowState Bool)
Detail
The base class for all widgets. While a widget cannot be created directly,
this module contains many useful methods common to all widgets. In
particular, these functions are needed to add functionality to
blank widgets such as DrawingArea
or Layout
.
Widget
introduces style properties - these are basically object
properties that are stored not on the object, but in the style object
associated to the widget. Style properties are set in resource files. This
mechanism is used for configuring such things as the location of the
scrollbar arrows through the theme, giving theme authors more control over
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
class GObjectClass o => WidgetClass o Source
castToWidget :: GObjectClass obj => obj -> Widget Source
toWidget :: WidgetClass o => o -> Widget Source
Specify which events a widget will emit signals on.
Key values are the codes which are sent whenever a key is pressed or released.
data Requisition Source
Requisition
- For
widgetSizeRequest
. The values represent the desired width and height of the widget.
data Rectangle :: *
Rectangle
- Specifies x, y, width and height
data Color :: *
Color
- Specifies a color with three integer values for red, green and blue. All values range from 0 (least intense) to 65535 (highest intensity).
The size of an icon in pixels.
- This enumeration contains one case that is not exported and which
is used when new sizes are registered using
iconSizeRegister
. - Applying
show
to this type will reveal the name of the size that is registered with Gtk+.
IconSizeInvalid | Don't scale but use any of the available sizes. |
IconSizeMenu | Icon size to use in next to menu items in drop-down menus. |
IconSizeSmallToolbar | Icon size for small toolbars. |
IconSizeLargeToolbar | Icon size for larger toolbars. |
IconSizeButton | Icon size for icons in buttons, next to the label. |
IconSizeDnd | Icon size for icons in drag-and-drop. |
IconSizeDialog | Icon size for icons next to dialog text. |
IconSizeUser Int |
data TextDirection Source
data AccelFlags Source
State of an accelerator
data DirectionType Source
Editing direction
type StockId = DefaultGlibString Source
A synonym for a standard button or icon.
data WidgetHelpType Source
Specify what kind of help the user wants.
type Allocation = Rectangle Source
Allocation
- For Widget's
sizeAllocate
signal. Thex
andy
values of the rectangle refer to the widgets position relative to its parent window.
Methods
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.
widgetShowNow :: WidgetClass self => self -> IO () Source
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.
widgetHide :: WidgetClass self => self -> IO () Source
Reverses the effects of widgetShow
, causing the widget to be hidden
(invisible to the user).
widgetShowAll :: WidgetClass self => self -> IO () Source
Recursively shows a widget, and any child widgets (if the widget is a container).
widgetDestroy :: WidgetClass self => self -> IO () Source
Destroys a widget. Equivalent to
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.
:: WidgetClass self | |
=> self | the widget to draw. It must be drawable (see |
-> Cairo | a cairo context to draw to |
-> IO () |
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 setOperator
or the line
width using setLineWidth
might have unwanted
side effects. You may however change the context’s transform matrix - like
with scale
, translate
or setMatrix
and clip region with
clip
prior to calling this function. Also, it
is fine to modify the context with 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
.
widgetQueueDraw :: WidgetClass self => self -> IO () Source
Send a redraw request to a widget. Equivalent to calling
widgetQueueDrawArea
for the entire area of a widget.
widgetQueueResize :: WidgetClass self => self -> IO () Source
widgetQueueResizeNoRedraw :: WidgetClass self => self -> IO () Source
This function works like widgetQueueResize
, except that the widget is
not invalidated.
- Available since Gtk+ version 2.4
widgetGetFrameClock :: WidgetClass self => self -> IO FrameClock Source
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.
widgetGetScaleFactor :: WidgetClass self => self -> IO Int Source
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
.
widgetSizeRequest :: WidgetClass self => self -> IO Requisition Source
This function is typically used when implementing a
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.
widgetGetChildRequisition :: WidgetClass self => self -> IO Requisition Source
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
.
:: WidgetClass self | |
=> self | |
-> Allocation | The |
-> IO () |
This function is only used by
Container
subclasses, to assign a
size and position to their child widgets.
widgetSizeAllocateWithBaseline Source
:: WidgetClass self | |
=> self | |
-> Allocation | The |
-> Int | The baseline of the child, or -1 |
-> IO () |
This function is only used by
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.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> string |
|
-> AccelGroup |
|
-> KeyVal |
|
-> [Modifier] |
|
-> [AccelFlags] |
|
-> IO () |
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.
widgetRemoveAccelerator Source
:: WidgetClass self | |
=> self | |
-> AccelGroup |
|
-> KeyVal |
|
-> [Modifier] |
|
-> IO Bool | returns whether an accelerator was installed and could be removed |
Removes an accelerator from widget
, previously installed with
widgetAddAccelerator
.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> string |
|
-> AccelGroup |
|
-> IO () |
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.
:: WidgetClass self | |
=> ConnectId self |
|
-> IO Bool | returns |
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
:: WidgetClass self | |
=> self | |
-> IO Bool | returns |
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
.
:: WidgetClass self | |
=> self | |
-> Rectangle |
|
-> IO (Maybe Rectangle) | returns the intersection or |
Computes the intersection of a widget's area and area
, returning the
intersection, and returns Nothing
if there was no intersection.
:: WidgetClass self | |
=> self | |
-> Rectangle |
|
-> IO Bool | returns |
Check if the widget intersects with a given area.
:: WidgetClass self | |
=> self | |
-> IO Bool | returns |
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.)
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
Entry
; something like
Frame
won't work. (More precisely, it must have
the widgetCanFocus
flag set.)
widgetGrabDefault :: WidgetClass self => self -> IO () Source
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.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> string |
|
-> 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.
widgetGetName :: (WidgetClass self, GlibString string) => self -> IO string Source
Retrieves the name of a widget. See widgetSetName
for the significance
of widget names.
:: WidgetClass self | |
=> self | |
-> Bool |
|
-> IO () |
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.
widgetSetSensitivity :: WidgetClass self => self -> Bool -> IO () Source
widgetGetParentWindow :: WidgetClass self => self -> IO DrawWindow Source
Gets the widget's parent window.
widgetDelEvents :: WidgetClass self => self -> [EventMask] -> IO () Source
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 anEvent
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 anEvent
have been disconnected.
widgetAddEvents :: WidgetClass self => self -> [EventMask] -> IO () Source
Enable event signals.
- See
widgetDelEvents
.
widgetGetEvents :: WidgetClass self => self -> IO [EventMask] Source
Get enabled event signals.
- See
widgetDelEvents
.
:: WidgetClass self | |
=> self | |
-> [EventMask] |
|
-> IO () |
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
EventBox
and receive events on the event box.
:: WidgetClass self | |
=> self |
|
-> IO Widget | returns the topmost ancestor of |
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.
:: WidgetClass self | |
=> self | |
-> GType |
|
-> IO (Maybe Widget) | returns the ancestor widget, or |
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.
:: WidgetClass self | |
=> self | |
-> IO (Int, Int) |
|
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.
:: (WidgetClass self, WidgetClass ancestor) | |
=> self |
|
-> ancestor |
|
-> IO Bool | returns |
Determines whether widget
is somewhere inside ancestor
, possibly with
intermediate containers.
widgetTranslateCoordinates Source
:: (WidgetClass self, WidgetClass destWidget) | |
=> self |
|
-> destWidget |
|
-> Int |
|
-> Int |
|
-> IO (Maybe (Int, Int)) |
|
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.
:: WidgetClass self | |
=> self | |
-> Maybe Style |
|
-> IO () |
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
.
widgetGetStyle :: WidgetClass widget => widget -> IO Style Source
Retrieve the Style
associated with the widget.
Returns the default style used by all widgets initially.
widgetSetDirection :: WidgetClass self => self -> TextDirection -> IO () Source
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.
widgetGetDirection :: WidgetClass self => self -> IO TextDirection Source
Gets the reading direction for a particular widget. See
widgetSetDirection
.
widgetSetDefaultDirection Source
:: TextDirection |
|
-> IO () |
Sets the default reading direction for widgets where the direction has
not been explicitly set by widgetSetDirection
.
widgetGetDefaultDirection :: IO TextDirection Source
Obtains the current default reading direction. See
widgetSetDefaultDirection
.
widgetShapeCombineRegion :: WidgetClass self => self -> Maybe Region -> IO () Source
Sets a shape for this widget’s GDK window. This allows for transparent
windows etc., see drawWindowShapeCombineRegion
for more information.
widgetInputShapeCombineRegion :: WidgetClass self => self -> Maybe Region -> IO () Source
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.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> IO (Int, string, string) |
|
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.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> IO (Int, string, string) |
|
Same as widgetPath
, but always uses the name of a widget's type, never
uses a custom name set with widgetSetName
.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> IO (Maybe string) | returns the composite name of |
Obtains the composite name of a widget.
widgetOverrideBackgroundColor Source
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> Maybe Color |
|
-> IO () |
Sets the background color to use for a widget.
All other style values are left untouched. See widgetOverrideColor
.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> Maybe Color |
|
-> IO () |
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
1 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 600 priority.
:: WidgetClass self | |
=> self | |
-> Maybe FontDescription |
|
-> IO () |
Sets the font to use for a widget. All other style values are left untouched.
See widgetOverrideColor
.
widgetOverrideSymbolicColor Source
:: (WidgetClass self, GlibString string) | |
=> self | |
-> string |
|
-> Maybe Color |
|
-> IO () |
Sets the symbolic color to use for a widget.
All other style values are left untouched. See widgetOverrideColor
.
:: WidgetClass self | |
=> self | |
-> Maybe Color |
|
-> Maybe Color |
|
-> IO () |
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.
:: (WidgetClass self, RcStyleClass style) | |
=> self | |
-> style |
|
-> IO () |
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.
widgetGetModifierStyle :: WidgetClass self => self -> IO RcStyle Source
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.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> Color |
|
-> IO () |
Sets the foreground color for a widget in a particular state. All other
style values are left untouched. See also widgetModifyStyle
.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> Color |
|
-> IO () |
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.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> Color |
|
-> IO () |
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
.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> Color |
|
-> IO () |
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.
:: WidgetClass self | |
=> self | |
-> Maybe FontDescription |
|
-> IO () |
Sets the font to use for a widget. All other style values are left
untouched. See also widgetModifyStyle
.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> IO () |
Restores the foreground color for a widget in a particular state. This
undoes the effects of previous calls to widgetModifyFg
.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> IO () |
Restores the background color for a widget in a particular state. This
undoes the effects of previous calls to widgetModifyBg
.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> IO () |
Restores the text color for a widget in a particular state. This
undoes the effects of previous calls to widgetModifyText
.
:: WidgetClass self | |
=> self | |
-> StateType |
|
-> IO () |
Restores the base color for a widget in a particular state. This undoes the effects of previous calls to widgetModifyBase.
widgetCreatePangoContext Source
:: WidgetClass self | |
=> self | |
-> IO PangoContext | returns the new |
Creates a new PangoContext
with the appropriate colormap, font description,
and base direction for drawing text for this widget. See also
widgetGetPangoContext
.
:: WidgetClass self | |
=> self | |
-> IO PangoContext | returns the |
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.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> string |
|
-> IO PangoLayout |
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
:: (WidgetClass self, GlibString string) | |
=> self | |
-> string |
|
-> IconSize |
|
-> string |
|
-> IO (Maybe Pixbuf) | returns a new pixbuf, or |
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
Pixbuf
.
The icon should be one of the stock id constants such as
stockOpen
. size
should be a
size such as 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 Pixbuf
are
shared with the rest of the
application and should not be modified.
:: WidgetClass self | |
=> self | |
-> Int |
|
-> Int |
|
-> Int |
|
-> Int |
|
-> IO () |
Invalidates the rectangular area of widget
defined by x
, y
, width
and height
by calling
drawWindowInvalidateRect
on the widget's
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
drawWindowInvalidateRect
directly, to
schedule a redraw of a DrawingArea
or some
portion thereof.
Frequently you can just call
windowInvalidateRect
or
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.
widgetQueueDrawRegion :: WidgetClass self => self -> Region -> IO () Source
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.
:: WidgetClass self | |
=> self | |
-> Bool |
|
-> IO () |
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
andWindow
, 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.
widgetSetDoubleBuffered Source
:: WidgetClass self | |
=> self | |
-> Bool |
|
-> IO () |
Widgets are double buffered by default; you can use this function to turn
off the buffering. "Double buffered" simply means that
drawWindowBeginPaintRegion
and
drawWindowEndPaint
are called automatically
around expose events sent to the widget.
drawWindowBeginPaintRegion
diverts all
drawing to a widget's window to an offscreen buffer, and
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
drawWindowBeginPaint
).
widgetSetRedrawOnAllocate Source
:: WidgetClass self | |
=> self | |
-> Bool |
|
-> IO () |
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.
:: (WidgetClass self, GlibString string) | |
=> self | |
-> string |
|
-> IO () |
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.
widgetMnemonicActivate :: WidgetClass self => self -> Bool -> IO Bool Source
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
.
:: WidgetClass self | |
=> self | |
-> IO GObject | returns the |
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.
:: WidgetClass self | |
=> self | |
-> DirectionType |
|
-> IO Bool | returns |
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.
:: WidgetClass self | |
=> self | |
-> IO Bool | returns |
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.
widgetGetParent :: WidgetClass self => self -> IO (Maybe Widget) Source
Returns the parent container of widget
.
- Returns the parent container of
widget
if it has one.
:: WidgetClass self | |
=> self | |
-> IO Settings | returns the relevant |
:: WidgetClass self | |
=> self | |
-> SelectionTag |
|
-> IO Clipboard | returns the appropriate clipboard object. If no clipboard already exists, a new one will be created. |
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.
:: WidgetClass self | |
=> self | |
-> IO Display | returns the |
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
:: WidgetClass self | |
=> self | |
-> IO DrawWindow | returns the |
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
:: WidgetClass self | |
=> self | |
-> IO Screen | returns the |
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
:: WidgetClass self | |
=> self | |
-> IO Bool | returns |
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
:: WidgetClass self | |
=> self | |
-> IO (Int, Int) | (width, height) |
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.
:: WidgetClass self | |
=> self | |
-> Bool |
|
-> IO () |
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.
:: WidgetClass self | |
=> self | |
-> Int |
|
-> Int |
|
-> 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, 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, 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."
:: WidgetClass self | |
=> self | |
-> Bool |
|
-> IO () |
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
:: WidgetClass self | |
=> self | |
-> IO Bool | returns the current value of the "no_show_all" property. |
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
widgetListMnemonicLabels Source
:: WidgetClass self | |
=> self | |
-> IO [Widget] | returns the list of mnemonic labels |
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
:: (WidgetClass self, WidgetClass label) | |
=> self | |
-> label |
|
-> IO () |
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
widgetRemoveMnemonicLabel Source
:: (WidgetClass self, WidgetClass label) | |
=> self | |
-> label |
|
-> IO () |
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
:: WidgetClass self | |
=> self | |
-> IO Bool | returns |
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
widgetErrorBell :: WidgetClass self => self -> IO () Source
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.
:: WidgetClass self | |
=> self | |
-> DirectionType |
|
-> IO Bool | returns |
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 andor there is nowhere we canshould 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.
widgetGetTooltipMarkup :: (WidgetClass self, GlibString markup) => self -> IO (Maybe markup) Source
Gets the contents of the tooltip for widget.
:: (WidgetClass self, GlibString markup) | |
=> self | |
-> Maybe markup | the contents of the tooltip for widget, or |
-> IO () |
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
.
widgetGetTooltipText :: (WidgetClass self, GlibString text) => self -> IO (Maybe text) Source
Gets the contents of the tooltip for widget.
:: (WidgetClass widget, GlibString text) | |
=> widget | |
-> Maybe text | the contents of the tooltip for widget, or |
-> IO () |
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
.
:: WidgetClass self | |
=> self | |
-> IO Window | returns The |
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
:: (WidgetClass self, WindowClass customWindow) | |
=> self | |
-> Maybe customWindow | |
-> IO () |
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
:: WidgetClass widget | |
=> widget | |
-> IO Bool | current value of |
Returns the current value of the has-tooltip property.
See widgetHasTooltip
for more information.
:: WidgetClass widget | |
=> widget | |
-> Bool |
|
-> IO () |
Sets the has-tooltip property on widget
to hasTooltip
.
See widgetHasTooltip
for more information.
widgetTriggerTooltipQuery :: WidgetClass self => self -> IO () Source
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
widgetGetWindow :: WidgetClass self => self -> IO (Maybe DrawWindow) Source
Returns the widget's window if it is realized, Nothing otherwise
- Available since Gtk+ version 2.14
widgetRegisterWindow :: (WidgetClass widget, DrawWindowClass window) => widget -> window -> IO () Source
Registers a DrawWindow
with the widget and sets it up so that the
widget receives events for it. Call widgetUnregisterWindow
when
destroying the window.
widgetUnregisterWindow :: (WidgetClass widget, DrawWindowClass window) => widget -> window -> IO () Source
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.
:: DrawWindowClass window | |
=> Cairo |
|
-> window |
|
-> IO Bool |
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.
:: (WidgetClass widget, DrawWindowClass window) | |
=> Cairo |
|
-> widget |
|
-> window |
|
-> IO () |
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.
:: (WidgetClass self, WidgetClass newParent) | |
=> self | |
-> newParent |
|
-> IO () |
Moves a widget from one Container
to another.
widgetGetCanFocus :: WidgetClass self => self -> IO Bool Source
Check if this widget can receive keyboard input.
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.
widgetGetAllocation :: WidgetClass self => self -> IO Allocation Source
Retrieves the widget's allocation.
- Available since Gtk+ version 2.18
widgetGetAllocatedWidth :: WidgetClass self => self -> IO Int Source
Returns the width 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 Source
Returns the height that has currently been allocated to widget. This function is intended | to be used when implementing handlers for the "draw" function.
widgetGetAllocatedBaseline :: WidgetClass self => self -> IO Int Source
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”.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Determines whether the application intends to draw on the widget in an
"draw" handler.
See widgetSetAppPaintable
.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Determines whether widget
can be a default widget.
See widgetSetCanDefault
.
:: WidgetClass widget | |
=> widget | |
-> Bool |
|
-> IO () |
Specifies whether widget
can be a default widget.
See widgetGrabDefault
for details about the meaning of "default".
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Determines whether widget
has a DrawWindow
of its own. See widgetSetHasWindow
.
:: WidgetClass widget | |
=> widget | |
-> Bool |
|
-> IO () |
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.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
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
.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Returns the widget’s effective sensitivity, which means it is sensitive itself and also its parent widget is sensitive.
widgetGetState :: WidgetClass self => self -> IO StateType Source
Retrieve the current state of the widget.
- The state refers to different modes of user interaction, see
StateType
for more information.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
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
.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
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
:: WidgetClass widget | |
=> widget | |
-> [StateFlags] |
|
-> Bool |
|
-> IO () |
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.
:: WidgetClass widget | |
=> widget | |
-> [StateFlags] |
|
-> IO () |
This function is for use in widget implementations. Turns off flag
values for the current widget state (insensitive, prelighted, etc.).
See widgetSetStateFlags
.
:: WidgetClass widget | |
=> widget | |
-> IO [StateFlags] | Returns the state flags for |
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.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Determines whether widget
is the current default widget within its
toplevel. See widgetSetCanDefault
.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
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.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
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
.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Determines whether the widget is currently grabbing events, so it is the only widget receiving input events (keyboard and mouse).
See also grabAdd
.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Determines whether widget
can be drawn to. A widget can be drawn to if
it is mapped and visible.
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
widgetSetWindow :: (WidgetClass widget, DrawWindowClass window) => widget -> window -> IO () Source
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.
widgetSetReceivesDefault Source
:: WidgetClass widget | |
=> widget | |
-> Bool |
|
-> IO () |
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”.
widgetGetReceivesDefault Source
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
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.
:: (WidgetClass widget, DeviceClass device) | |
=> widget | |
-> device | |
-> IO Bool | Returns |
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
.
:: WidgetClass widget | |
=> widget | |
-> ModifierIntent |
|
-> IO [Modifier] | Returns the modifier mask used for |
Returns the modifier mask the widget
’s windowing system backend uses
for a particular purpose.
See keymapGetModifierMask
.
widgetSetSupportMultidevice Source
:: WidgetClass widget | |
=> widget | |
-> Bool |
|
-> IO () |
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.
widgetGetSupportMultidevice Source
:: WidgetClass widget | |
=> widget | |
-> IO Bool | Returns |
Returns True
if widget
is multiple pointer aware.
See widgetSetSupportMultidevice
for more information.
widgetSetState :: WidgetClass self => self -> StateType -> IO () Source
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
.
widgetEvent :: WidgetClass self => self -> EventM t Bool Source
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.
widgetGetHAlign :: WidgetClass self => self -> IO Align Source
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.
widgetSetHAlign :: WidgetClass self => self -> Align -> IO () Source
Sets the horizontal alignment of widget. See the widgetHAlign
property.
widgetGetVAlign :: WidgetClass self => self -> IO Align Source
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.
widgetGetVAlignWithBaseline :: WidgetClass self => self -> IO Align Source
Gets the value of the widgetVAlign
property, including AlignBaseline.
widgetSetVAlign :: WidgetClass self => self -> Align -> IO () Source
Sets the vertical alignment of widget . See the widgetVAlign
property.
Attributes
widgetName :: (WidgetClass self, GlibString string) => Attr self (Maybe string) Source
The name of the widget.
Default value: Nothing
widgetParent :: (WidgetClass self, ContainerClass container) => ReadWriteAttr self (Maybe Container) (Maybe container) Source
The parent widget of this widget. Must be a Container widget.
widgetWidthRequest :: WidgetClass self => Attr self Int Source
Override for width request of the widget, or -1 if natural request should be used.
Allowed values: >= -1
Default value: -1
widgetHeightRequest :: WidgetClass self => Attr self Int Source
Override for height request of the widget, or -1 if natural request should be used.
Allowed values: >= -1
Default value: -1
widgetMarginLeft :: WidgetClass self => Attr self Int Source
widgetMarginRight :: WidgetClass self => Attr self Int Source
widgetMarginTop :: WidgetClass self => Attr self Int Source
widgetMarginBottom :: WidgetClass self => Attr self Int Source
widgetVisible :: WidgetClass self => Attr self Bool Source
Whether the widget is visible.
Default value: False
widgetOpacity :: WidgetClass self => Attr self Double Source
The opacity of the widget
Default value: 1.0
widgetSensitive :: WidgetClass self => Attr self Bool Source
Whether the widget responds to input.
Default value: True
widgetAppPaintable :: WidgetClass self => Attr self Bool Source
Whether the application will paint directly on the widget.
Default value: False
widgetCanFocus :: WidgetClass self => Attr self Bool Source
Whether the widget can accept the input focus.
Default value: False
widgetHasFocus :: WidgetClass self => Attr self Bool Source
Whether the widget has the input focus.
Default value: False
widgetIsFocus :: WidgetClass self => Attr self Bool Source
Whether the widget is the focus widget within the toplevel.
Default value: False
widgetCanDefault :: WidgetClass self => Attr self Bool Source
Whether the widget can be the default widget.
Default value: False
widgetHasDefault :: WidgetClass self => Attr self Bool Source
Whether the widget is the default widget.
Default value: False
widgetReceivesDefault :: WidgetClass self => Attr self Bool Source
If True
, the widget will receive the default action when it is focused.
Default value: False
widgetCompositeChild :: WidgetClass self => ReadAttr self Bool Source
Whether the widget is part of a composite widget.
Default value: False
widgetStyle :: WidgetClass self => Attr self Style Source
The style of the widget, which contains information about how it will look (colors etc).
widgetState :: WidgetClass self => Attr self StateType Source
The current visual user interaction state of the widget (insensitive,
prelighted, selected etc). See StateType
for more information.
widgetEvents :: WidgetClass self => Attr self [EventMask] Source
The event mask that decides what kind of GdkEvents this widget gets.
Default value: StructureMask
widgetExpand :: WidgetClass self => Attr self Bool Source
Whether to expand in both directions. Setting this sets both widgetHExpand
and widgetVExpand
Default value: False
widgetHExpand :: WidgetClass self => Attr self Bool Source
Whether to expand horizontally. See widgetSetHExpand
Default value: False
widgetHExpandSet :: WidgetClass self => Attr self Bool Source
Whether to use the “hexpand” property. See widgetGetHExpandSet
.
Default value: False
widgetVExpand :: WidgetClass self => Attr self Bool Source
Whether to expand vertically. See widgetSetVExpand
.
Default value: False
widgetVExpandSet :: WidgetClass self => Attr self Bool Source
Whether to use the “vexpand” property. See widgetGetVExpandSet
.
Default value: False
widgetNoShowAll :: WidgetClass self => Attr self Bool Source
Whether widgetShowAll
should not affect this widget.
Default value: False
widgetChildVisible :: WidgetClass self => Attr self Bool Source
'childVisible' property. See widgetGetChildVisible
and
widgetSetChildVisible
widgetCompositeName :: (WidgetClass self, GlibString string) => ReadWriteAttr self (Maybe string) string Source
'compositeName' property. See widgetGetCompositeName
and
widgetSetCompositeName
widgetDirection :: WidgetClass self => Attr self TextDirection Source
'direction' property. See widgetGetDirection
and widgetSetDirection
widgetTooltipMarkup :: (WidgetClass self, GlibString markup) => Attr self (Maybe markup) Source
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
widgetTooltipText :: (WidgetClass self, GlibString string) => Attr self (Maybe string) Source
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
widgetHasTooltip :: WidgetClass self => Attr self Bool Source
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
:: WidgetClass self | |
=> self | |
-> IO Bool | returns |
Determines if the widget style has been looked up through the rc mechanism.
:: WidgetClass self | |
=> self | |
-> IO Bool |
Determines whether widget is realized.
:: WidgetClass self | |
=> self | |
-> IO Bool |
Whether the widget is mapped.
:: WidgetClass widget | |
=> widget | |
-> Bool |
|
-> IO () |
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.
:: WidgetClass widget | |
=> widget | |
-> Bool |
|
-> IO () |
Marks the widget
as being realized.
This function should only ever be called in a derived widget's “map” or “unmap” implementation.
:: WidgetClass widget | |
=> widget |
|
-> IO StyleContext | a |
Returns the style context associated to widget
.
Signals
realize :: WidgetClass self => Signal self (IO ()) Source
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
after
.
unrealize :: WidgetClass self => Signal self (IO ()) Source
The widget should deallocate any resources. This signal is emitted before the widget is destroyed.
mapSignal :: WidgetClass self => Signal self (IO ()) Source
The widget appears on screen.
unmapSignal :: WidgetClass self => Signal self (IO ()) Source
The widget disappears from the screen.
sizeRequest :: WidgetClass self => Signal self (IO Requisition) Source
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.
sizeAllocate :: WidgetClass self => Signal self (Allocation -> IO ()) Source
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.
showSignal :: WidgetClass self => Signal self (IO ()) Source
The widget is shown.
hideSignal :: WidgetClass self => Signal self (IO ()) Source
The widget is hidden.
focus :: WidgetClass self => Signal self (DirectionType -> IO Bool) Source
The widget gains focus via the given user action.
stateChanged :: WidgetClass self => Signal self (StateType -> IO ()) Source
The state of the widget (input focus, insensitive, etc.) has changed.
stateFlagsChanged :: WidgetClass self => Signal self ([StateFlags] -> IO ()) Source
The state of the widget (input focus, insensitive, etc.) has changed.
parentSet :: WidgetClass self => Signal self (Maybe Widget -> IO ()) Source
The parentSet
signal is emitted when a new parent has been set on a
widget. The parameter is the new parent.
hierarchyChanged :: WidgetClass self => Signal self (Maybe Widget -> IO ()) Source
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.
styleSet :: WidgetClass self => Signal self (Style -> IO ()) Source
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.
directionChanged :: WidgetClass self => Signal self (TextDirection -> IO ()) Source
The default direction of text writing has changed.
grabNotify :: WidgetClass self => Signal self (Bool -> IO ()) Source
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.
popupMenuSignal :: WidgetClass self => Signal self (IO Bool) Source
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.
showHelp :: WidgetClass self => Signal self (WidgetHelpType -> IO Bool) Source
Tell the widget to show an explanatory help text. Should return True
if help has been shown.
accelClosuresChanged :: WidgetClass self => Signal self (IO ()) Source
The set of keyboard accelerators has changed.
screenChanged :: WidgetClass self => Signal self (Screen -> IO ()) Source
The widget moved to a new screen.
queryTooltip :: WidgetClass self => Signal self (Widget -> Maybe Point -> Tooltip -> IO Bool) Source
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
draw :: WidgetClass self => Signal self (Render ()) Source
Events
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.
buttonReleaseEvent :: WidgetClass self => Signal self (EventM EButton Bool) Source
A mouse button has been released. Sets the widget's ButtonReleaseMask
flag.
configureEvent :: WidgetClass self => Signal self (EventM EConfigure Bool) Source
The size of the window has changed.
deleteEvent :: WidgetClass self => Signal self (EventM EAny Bool) Source
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.
destroyEvent :: WidgetClass self => Signal self (EventM EAny Bool) Source
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
.
enterNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool) Source
The mouse pointer has entered the widget. Sets the widget's
EnterNotifyMask
flag.
exposeEvent :: WidgetClass self => Signal self (EventM EExpose Bool) Source
Instructs the widget to redraw.
- The
DrawWindow
that needs to be redrawn is available viaeventWindow
. - The part that needs to be redrawn is available via
eventArea
andeventRegion
. The options are, in order of efficiency: (a) redraw the entire window, (b) ask for theeventArea
and redraw that rectangle, (c) ask for theeventRegion
and redraw each of those rectangles.
Only the exposed region will be updated; see also
drawWindowBeginPaintRegion
.
focusInEvent :: WidgetClass self => Signal self (EventM EFocus Bool) Source
The widget gets the input focus. Sets the widget's FocusChangeMask
flag.
focusOutEvent :: WidgetClass self => Signal self (EventM EFocus Bool) Source
The widget lost the input focus. Sets the widget's FocusChangeMask
flag.
grabBrokenEvent :: WidgetClass self => Signal self (EventM EGrabBroken Bool) Source
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
keyPressEvent :: WidgetClass self => Signal self (EventM EKey Bool) Source
A key has been depressed. Sets the widget's KeyPressMask
flag.
keyReleaseEvent :: WidgetClass self => Signal self (EventM EKey Bool) Source
A key has been released. Sets the widget's KeyReleaseMask
flag.
leaveNotifyEvent :: WidgetClass self => Signal self (EventM ECrossing Bool) Source
The mouse pointer has left the widget. Sets the widget's
LeaveNotifyMask
flag.
mapEvent :: WidgetClass self => Signal self (EventM EAny Bool) Source
The window is put onto the screen.
motionNotifyEvent :: WidgetClass self => Signal self (EventM EMotion Bool) Source
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 ofmotionNotifyEvent
s received. Normally amotionNotifyEvent
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 usingPointerMotionHintMask
, fewermotionNotifyEvent
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 callingeventRequestMotions
. 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 aseventRequestMotions
does so automatically.)
noExposeEvent :: WidgetClass self => Signal self (EventM EAny Bool) Source
Generated when the area of a Drawable
being copied using, e.g.
drawDrawable
, is completely available.
proximityInEvent :: WidgetClass self => Signal self (EventM EProximity Bool) Source
The pen of a graphics tablet was put down. Sets the widget's
ProximityInMask
flag.
proximityOutEvent :: WidgetClass self => Signal self (EventM EProximity Bool) Source
The pen of a graphics tablet was lifted off the tablet. Sets the widget's
ProximityOutMask
flag.
scrollEvent :: WidgetClass self => Signal self (EventM EScroll Bool) Source
The scroll wheel of the mouse has been used. Sets the widget's
ScrollMask
flag.
unmapEvent :: WidgetClass self => Signal self (EventM EAny Bool) Source
The window is taken off the screen.
visibilityNotifyEvent :: WidgetClass self => Signal self (EventM EVisibility Bool) Source
Emitted when the window visibility status has changed. Sets the widget's
VisibilityNotifyMask
flag.
windowStateEvent :: WidgetClass self => Signal self (EventM EWindowState Bool) Source
Emitted when the state of the window changes, i.e. when it is minimized, moved to the top, etc.