Gtk2HsContentsIndex
Graphics.UI.Gtk.Gdk.Events
Portabilityportable (depends on GHC)
Stabilityprovisional
Maintainergtk2hs-users\@lists.sourceforge.net
Description
Synopsis
data Modifier
= Shift
| Control
| Alt
| Apple
| Compose
data Event
= Event {
sent :: Bool
}
| Expose {
sent :: Bool
area :: Rectangle
region :: Region
count :: Int
}
| Motion {
sent :: Bool
time :: Integer
x, y :: Double
modif :: [Modifier]
isHint :: Bool
xRoot, yRoot :: Double
}
| Button {
sent :: Bool
click :: Click
time :: Integer
x, y :: Double
modif :: [Modifier]
button :: Button
xRoot, yRoot :: Double
}
| Key {
release :: Bool
sent :: Bool
time :: Integer
modif :: [Modifier]
withCapsLock :: Bool
withNumLock :: Bool
withScrollLock :: Bool
keyName :: String
keyChar :: (Maybe Char)
}
| Crossing {
sent :: Bool
time :: Integer
x, y :: Double
xRoot, yRoot :: Double
cMode :: CrossingMode
nType :: NotifyType
modif :: [Modifier]
}
| Focus {
sent :: Bool
inFocus :: Bool
}
| Configure {
sent :: Bool
xPar :: Int
yPar :: Int
width :: Int
height :: Int
}
| Visibility {
sent :: Bool
visible :: VisibilityState
}
| Scroll {
sent :: Bool
time :: Integer
x, y :: Double
direc :: ScrollDirection
xRoot, yRoot :: Double
}
| WindowState {
sent :: Bool
wMask :: WindowState
wState :: WindowState
}
| Proximity {
sent :: Bool
time :: Integer
touches :: Bool
}
marshExposeRect :: Ptr Event -> IO Rectangle
marshalEvent :: Ptr Event -> IO Event
data VisibilityState
= VisibilityUnobscured
| VisibilityPartialObscured
| VisibilityFullyObscured
data CrossingMode
= CrossingNormal
| CrossingGrab
| CrossingUngrab
data NotifyType
= NotifyAncestor
| NotifyVirtual
| NotifyInferior
| NotifyNonlinear
| NotifyNonlinearVirtual
| NotifyUnknown
data WindowState
= WindowStateWithdrawn
| WindowStateIconified
| WindowStateMaximized
| WindowStateSticky
| WindowStateFullscreen
| WindowStateAbove
| WindowStateBelow
data ScrollDirection
= ScrollUp
| ScrollDown
| ScrollLeft
| ScrollRight
data Button
= LeftButton
| MiddleButton
| RightButton
data Click
= SingleClick
| DoubleClick
| TripleClick
| ReleaseClick
data Rectangle = Rectangle Int Int Int Int
Documentation
data Modifier

Modifer keys.

  • This data type is used to build lists of modifers that were active during an event.
  • While Apple stands for the Apple key on Macintoshs, it also stands for the Windows key on PC keyboards or the Super key on Unix machines. It's called Apple since it is probably mostly used in the Macintosh environment.
Constructors
Shift
Control
Alt
Apple
ComposeCompose is often labelled Alt Gr.
show/hide Instances
data Event

Events that are delivered to a wdiget.

  • Any given signal only emits one of these variants as described in Widget. Many events share common attributes which are described below.
  • * The sent attribute is True if the event was not created by the user but by another application.
  • * The time attribute contains a time in milliseconds when the event happened.
  • * The x and y attributes contain the coordinates relative to the DrawWindow associated with this widget. The values can contain sub-pixel information if the input device is a graphics tablet or the like.
  • * The modif attribute denotes what modifier key was pressed during the event.
Constructors
Event
sent :: Bool
Expose

The expose event.

  • A region of widget that receives this event needs to be redrawn. This event is the result of revealing part or all of a window or by the application calling functions like widgetQueueDrawArea.
sent :: Bool
area :: RectangleA bounding box denoting what needs to be updated. For a more detailed information on the area that needs redrawing, use the next field.
region :: RegionA set of horizontal stripes that denote the invalid area.
count :: IntThe number of contiguous Expose events following this one. The only use for this is exposure compression, i.e. handling all contiguous Expose events in one go, though Gdk performs some exposure compression so this is not normally needed.
Motion

Mouse motion.

  • Captures the movement of the mouse cursor while it is within the area of the widget.
sent :: Bool
time :: Integer
x, y :: Double
modif :: [Modifier]
isHint :: Bool

Indicate if this event is only a hint of the motion.

  • If the PointerMotionHintMask is set with widgetAddEvents then mouse positions are only generated each time a drawWindowGetPointer is called. In this case isHint is set to True.
xRoot, yRoot :: Double
Button

A mouse button was pressed or released.

  • This event is triggered if the mouse button was pressed or released while the mouse cursor was within the region of the widget.
sent :: Bool
click :: ClickThe kind of button press, see Click. Note that double clicks will trigger this event with click set to SingleClick, ReleaseClick, SingleClick, DoubleClick, ReleaseClick. Triple clicks will produce this sequence followed by SingleClick, DoubleClick, TripleClick, ReleaseClick.
time :: IntegerThe time of the event in milliseconds.
x, y :: Double
modif :: [Modifier]
button :: ButtonThe button that was pressed.
xRoot, yRoot :: DoubleThe coordinates of the click relative the the screen origin.
Key

A key was pressed while the widget had the input focus.

  • If the widget has the current input focus (see widgetSetCanFocus) it will receive key pressed events. Certain key combinations are of no interest to a normal widget like Alt-F to access the file menu. For all these keys, the handler must return False to indicate that the key stroke should be propagated to the parent widget. At the top-level widget, keyboard shortcuts like Alt-F are turned into the corresponding signals.
release :: BoolThis flag is set if the key was released. This flag makes it possible to connect the same handler to onKeyPress and onKeyRelease.
sent :: Bool
time :: Integer
modif :: [Modifier]
withCapsLock :: BoolThis flag is True if Caps Lock is on while this key was pressed.
withNumLock :: BoolThis flag is True if Number Lock is on while this key was pressed.
withScrollLock :: BoolThis flag is True if Scroll Lock is on while this key was pressed.
keyName :: String

A string representing the key that was pressed or released.

  • This string contains a description of the key rather than what should appear on screen. For example, pressing 1 on the keypad results in KP_1. Of particular interest are F1 till F12, for a complete list refer to "gdk/gdkkeysyms.h" where all possible values are defined. The corresponding strings are the constants without the GDK_ prefix.
keyChar :: (Maybe Char)

A character matching the key that was pressed.

  • This entry can be used to build up a whole input string. The character is Nothing if the key does not correspond to a simple unicode character.
Crossing

Mouse cursor crossing event.

  • This event indicates that the mouse cursor is hovering over this widget. It is used to set a widget into the pre-focus state where some GUI elements like buttons on a toolbar change their appearance.
sent :: Bool
time :: Integer
x, y :: Double
xRoot, yRoot :: Double
cMode :: CrossingMode

Kind of enter/leave event.

  • The mouse cursor might enter this widget because it grabs the mouse cursor for e.g. a modal dialog box.
nType :: NotifyType

Information on from what level of the widget hierarchy the mouse cursor came.

modif :: [Modifier]
FocusGaining or loosing input focus.
sent :: Bool
inFocus :: BoolThis flag is True if the widget receives the focus and False if it just lost the input focus.
Configure

The widget's size has changed.

  • In response to this event the application can allocate resources that are specific to the size of the widget. It is emitted when the widget is shown the first time and on every resize.
sent :: Bool
xPar :: IntPosition within the parent window.
yPar :: IntPosition within the parent window.
width :: Int
height :: Int
VisibilityChange of visibility of a widget.
sent :: Bool
visible :: VisibilityStateDenote what portions of the widget is visible.
Scroll

Wheel movement of the mouse.

  • This action denotes that the content of the widget should be scrolled. The event is triggered by the movement of the mouse wheel. Surrounding scroll bars are independant of this signal. Most mice do not have buttons for horizontal scrolling, hence direc will usually not contain ScrollLeft and ScrollRight. Mice with additional buttons may not work on X since only five buttons are supported (the three main buttons and two for the wheel).
  • The handler of this signal should update the scroll bars that surround this widget which in turn tell this widget to update.
sent :: Bool
time :: Integer
x, y :: Double
direc :: ScrollDirection
xRoot, yRoot :: Double
WindowStateIndicate how the appearance of this window has changed.
sent :: Bool
wMask :: WindowStateThe mask indicates which flags have changed.
wState :: WindowStateThe state indicates the current state of the window.
ProximityThe state of the pen of a graphics tablet pen.
sent :: Bool
time :: Integer
touches :: BoolWhether the pen was removed or set onto the tablet.
marshExposeRect :: Ptr Event -> IO Rectangle
marshalEvent :: Ptr Event -> IO Event
data VisibilityState
visibility of a window
Constructors
VisibilityUnobscured
VisibilityPartialObscured
VisibilityFullyObscured
show/hide Instances
data CrossingMode
How focus is crossing the widget.
Constructors
CrossingNormal
CrossingGrab
CrossingUngrab
show/hide Instances
data NotifyType

Information on from what level of the widget hierarchy the mouse cursor came.

NotifyAncestor
The window is entered from an ancestor or left towards an ancestor.
NotifyVirtual
The pointer moves between an ancestor and an inferior of the window.
NotifyInferior
The window is entered from an inferior or left towards an inferior.
NotifyNonlinear
The window is entered from or left towards a window which is neither an ancestor nor an inferior.
NotifyNonlinearVirtual
The pointer moves between two windows which are not ancestors of each other and the window is part of the ancestor chain between one of these windows and their least common ancestor.
NotifyUnknown
The level change does not fit into any of the other categories or could not be determined.
Constructors
NotifyAncestor
NotifyVirtual
NotifyInferior
NotifyNonlinear
NotifyNonlinearVirtual
NotifyUnknown
show/hide Instances
data WindowState
The state a DrawWindow is in.
Constructors
WindowStateWithdrawn
WindowStateIconified
WindowStateMaximized
WindowStateSticky
WindowStateFullscreen
WindowStateAbove
WindowStateBelow
show/hide Instances
data ScrollDirection
in which direction was scrolled?
Constructors
ScrollUp
ScrollDown
ScrollLeft
ScrollRight
show/hide Instances
data Button
Button number
Constructors
LeftButton
MiddleButton
RightButton
show/hide Instances
data Click
Type of mouse click
Constructors
SingleClick
DoubleClick
TripleClick
ReleaseClick
data Rectangle

Rectangle

  • for Events
  • Specifies x, y, width and height
Constructors
Rectangle Int Int Int Int
show/hide Instances
Produced by Haddock version 0.7