ContentsIndex
Graphics.UI.WX.Events
Contents
Event
Basic events
Selecting
Commanding
Reactive
Event filters
Mouse filters
Keyboard event filters
Types
Modifiers
Mouse events
Calender event
Keyboard events
Internal
Description
Synopsis
data Event w a
on :: Event w a -> Attr w a
mapEvent :: (a -> b) -> (a -> b -> a) -> Event w a -> Event w b
propagateEvent :: IO ()
class Selecting w where
select :: Event w (IO ())
select :: Selecting w => Event w (IO ())
class Commanding w where
command :: Event w (IO ())
command :: Commanding w => Event w (IO ())
class Reactive w where
mouse :: Event w (EventMouse -> IO ())
keyboard :: Event w (EventKey -> IO ())
closing :: Event w (IO ())
idle :: Event w (IO Bool)
resize :: Event w (IO ())
focus :: Event w (Bool -> IO ())
activate :: Event w (Bool -> IO ())
mouse :: Reactive w => Event w (EventMouse -> IO ())
keyboard :: Reactive w => Event w (EventKey -> IO ())
closing :: Reactive w => Event w (IO ())
idle :: Reactive w => Event w (IO Bool)
resize :: Reactive w => Event w (IO ())
focus :: Reactive w => Event w (Bool -> IO ())
activate :: Reactive w => Event w (Bool -> IO ())
class Paint w where
paint :: Event w (DC () -> Rect -> IO ())
paintRaw :: Event w (DC () -> Rect -> [Rect] -> IO ())
repaint :: w -> IO ()
paint :: Paint w => Event w (DC () -> Rect -> IO ())
paintRaw :: Paint w => Event w (DC () -> Rect -> [Rect] -> IO ())
repaint :: Paint w => w -> IO ()
enter :: Reactive w => Event w (Point -> IO ())
leave :: Reactive w => Event w (Point -> IO ())
motion :: Reactive w => Event w (Point -> IO ())
drag :: Reactive w => Event w (Point -> IO ())
click :: Reactive w => Event w (Point -> IO ())
unclick :: Reactive w => Event w (Point -> IO ())
doubleClick :: Reactive w => Event w (Point -> IO ())
clickRight :: Reactive w => Event w (Point -> IO ())
unclickRight :: Reactive w => Event w (Point -> IO ())
anyKey :: Reactive w => Event w (Key -> IO ())
key :: Reactive w => Key -> Event w (IO ())
charKey :: Reactive w => Char -> Event w (IO ())
enterKey :: Reactive w => Event w (IO ())
tabKey :: Reactive w => Event w (IO ())
escKey :: Reactive w => Event w (IO ())
helpKey :: Reactive w => Event w (IO ())
delKey :: Reactive w => Event w (IO ())
homeKey :: Reactive w => Event w (IO ())
endKey :: Reactive w => Event w (IO ())
pgupKey :: Reactive w => Event w (IO ())
pgdownKey :: Reactive w => Event w (IO ())
downKey :: Reactive w => Event w (IO ())
upKey :: Reactive w => Event w (IO ())
leftKey :: Reactive w => Event w (IO ())
rightKey :: Reactive w => Event w (IO ())
rebind :: Event w (IO ()) -> Event w (IO ())
data Modifiers = Modifiers {
altDown :: !Bool
shiftDown :: !Bool
controlDown :: !Bool
metaDown :: !Bool
}
showModifiers :: Modifiers -> String
noneDown :: Modifiers
justShift :: Modifiers
justAlt :: Modifiers
justControl :: Modifiers
justMeta :: Modifiers
isNoneDown :: Modifiers -> Bool
isNoShiftAltControlDown :: Modifiers -> Bool
data EventMouse
= MouseMotion !Point !Modifiers
| MouseEnter !Point !Modifiers
| MouseLeave !Point !Modifiers
| MouseLeftDown !Point !Modifiers
| MouseLeftUp !Point !Modifiers
| MouseLeftDClick !Point !Modifiers
| MouseLeftDrag !Point !Modifiers
| MouseRightDown !Point !Modifiers
| MouseRightUp !Point !Modifiers
| MouseRightDClick !Point !Modifiers
| MouseRightDrag !Point !Modifiers
| MouseMiddleDown !Point !Modifiers
| MouseMiddleUp !Point !Modifiers
| MouseMiddleDClick !Point !Modifiers
| MouseMiddleDrag !Point !Modifiers
| MouseWheel !Bool !Point !Modifiers
showMouse :: EventMouse -> String
mousePos :: EventMouse -> Point
mouseModifiers :: EventMouse -> Modifiers
data EventCalendar
= CalendarDayChanged (DateTime ())
| CalendarDoubleClicked (DateTime ())
| CalendarMonthChanged (DateTime ())
| CalendarSelectionChanged (DateTime ())
| CalendarWeekdayClicked Int
| CalendarYearChanged (DateTime ())
| CalendarUnknown
calendarEvent :: Event (CalendarCtrl a) (EventCalendar -> IO ())
data EventKey = EventKey !Key !Modifiers !Point
data Key
= KeyChar !Char
| KeyOther !KeyCode
| KeyBack
| KeyTab
| KeyReturn
| KeyEscape
| KeySpace
| KeyDelete
| KeyInsert
| KeyPrior
| KeyNext
| KeyEnd
| KeyHome
| KeyLeft
| KeyUp
| KeyRight
| KeyDown
| KeyPageUp
| KeyPageDown
| KeyStart
| KeyClear
| KeyShift
| KeyAlt
| KeyControl
| KeyMenu
| KeyPause
| KeyCapital
| KeyHelp
| KeySelect
| KeyPrint
| KeyExecute
| KeySnapshot
| KeyCancel
| KeyLeftButton
| KeyRightButton
| KeyMiddleButton
| KeyNum0
| KeyNum1
| KeyNum2
| KeyNum3
| KeyNum4
| KeyNum5
| KeyNum6
| KeyNum7
| KeyNum8
| KeyNum9
| KeyMultiply
| KeyAdd
| KeySeparator
| KeySubtract
| KeyDecimal
| KeyDivide
| KeyF1
| KeyF2
| KeyF3
| KeyF4
| KeyF5
| KeyF6
| KeyF7
| KeyF8
| KeyF9
| KeyF10
| KeyF11
| KeyF12
| KeyF13
| KeyF14
| KeyF15
| KeyF16
| KeyF17
| KeyF18
| KeyF19
| KeyF20
| KeyF21
| KeyF22
| KeyF23
| KeyF24
| KeyNumLock
| KeyScroll
keyKey :: EventKey -> Key
keyModifiers :: EventKey -> Modifiers
keyPos :: EventKey -> Point
showKey :: Key -> String
showKeyModifiers :: Key -> Modifiers -> String
newEvent :: String -> (w -> IO a) -> (w -> a -> IO ()) -> Event w a
Event
data Event w a
An event for a widget w that expects an event handler of type a.
on :: Event w a -> Attr w a
Transform an event to an attribute.
mapEvent :: (a -> b) -> (a -> b -> a) -> Event w a -> Event w b
Change the event type.
propagateEvent :: IO ()
Pass the event on the next wxWindows event handler, either on this window or its parent. Always call this method when you do not process the event. (This function just call skipCurrentEvent).
Basic events
Selecting
class Selecting w where
Selecting widgets fire a select event when an item is selected.
Methods
select :: Event w (IO ())
A select event is fired when an item is selected.
show/hide Instances
select :: Selecting w => Event w (IO ())
A select event is fired when an item is selected.
Commanding
class Commanding w where
Commanding widgets fire a command event.
Methods
command :: Event w (IO ())
A commanding event, for example a button press.
show/hide Instances
command :: Commanding w => Event w (IO ())
A commanding event, for example a button press.
Reactive
class Reactive w where
Reactive widgets are almost all visible widgets on the screen.
Methods
mouse :: Event w (EventMouse -> IO ())
keyboard :: Event w (EventKey -> IO ())
closing :: Event w (IO ())
idle :: Event w (IO Bool)
resize :: Event w (IO ())
focus :: Event w (Bool -> IO ())
activate :: Event w (Bool -> IO ())
show/hide Instances
mouse :: Reactive w => Event w (EventMouse -> IO ())
keyboard :: Reactive w => Event w (EventKey -> IO ())
closing :: Reactive w => Event w (IO ())
idle :: Reactive w => Event w (IO Bool)
resize :: Reactive w => Event w (IO ())
focus :: Reactive w => Event w (Bool -> IO ())
activate :: Reactive w => Event w (Bool -> IO ())
class Paint w where
Paint widgets can serve as a canvas. Note: it is illegal to use both a paint and paintRaw event handler at the same widget.
Methods
paint :: Event w (DC () -> Rect -> IO ())
Paint double buffered to a device context. The context is always cleared before drawing. Takes the current view rectangle (adjusted for scrolling) as an argument.
paintRaw :: Event w (DC () -> Rect -> [Rect] -> IO ())
Paint directly to the on-screen device context. Takes the current view rectangle and a list of dirty rectangles as arguments.\
repaint :: w -> IO ()
Emit a paint event to the specified widget.
show/hide Instances
paint :: Paint w => Event w (DC () -> Rect -> IO ())
Paint double buffered to a device context. The context is always cleared before drawing. Takes the current view rectangle (adjusted for scrolling) as an argument.
paintRaw :: Paint w => Event w (DC () -> Rect -> [Rect] -> IO ())
Paint directly to the on-screen device context. Takes the current view rectangle and a list of dirty rectangles as arguments.\
repaint :: Paint w => w -> IO ()
Emit a paint event to the specified widget.
Event filters
Mouse filters
enter :: Reactive w => Event w (Point -> IO ())
leave :: Reactive w => Event w (Point -> IO ())
motion :: Reactive w => Event w (Point -> IO ())
drag :: Reactive w => Event w (Point -> IO ())
click :: Reactive w => Event w (Point -> IO ())
unclick :: Reactive w => Event w (Point -> IO ())
doubleClick :: Reactive w => Event w (Point -> IO ())
clickRight :: Reactive w => Event w (Point -> IO ())
unclickRight :: Reactive w => Event w (Point -> IO ())
Keyboard event filters
anyKey :: Reactive w => Event w (Key -> IO ())
key :: Reactive w => Key -> Event w (IO ())
charKey :: Reactive w => Char -> Event w (IO ())
enterKey :: Reactive w => Event w (IO ())
tabKey :: Reactive w => Event w (IO ())
escKey :: Reactive w => Event w (IO ())
helpKey :: Reactive w => Event w (IO ())
delKey :: Reactive w => Event w (IO ())
homeKey :: Reactive w => Event w (IO ())
endKey :: Reactive w => Event w (IO ())
pgupKey :: Reactive w => Event w (IO ())
pgdownKey :: Reactive w => Event w (IO ())
downKey :: Reactive w => Event w (IO ())
upKey :: Reactive w => Event w (IO ())
leftKey :: Reactive w => Event w (IO ())
rightKey :: Reactive w => Event w (IO ())
rebind :: Event w (IO ()) -> Event w (IO ())
Types
Modifiers
data Modifiers
The Modifiers indicate the meta keys that have been pressed (True) or not (False).
Constructors
Modifiers
altDown :: !Boolalt key down
shiftDown :: !Boolshift key down
controlDown :: !Boolcontrol key down
metaDown :: !Boolmeta key down
show/hide Instances
showModifiers :: Modifiers -> String
Show modifiers, for example for use in menus.
noneDown :: Modifiers
Construct a Modifiers structure with no meta keys pressed.
justShift :: Modifiers
Construct a Modifiers structure with just Shift meta key pressed.
justAlt :: Modifiers
Construct a Modifiers structure with just Alt meta key pressed.
justControl :: Modifiers
Construct a Modifiers structure with just Ctrl meta key pressed.
justMeta :: Modifiers
Construct a Modifiers structure with just Meta meta key pressed.
isNoneDown :: Modifiers -> Bool
Test if no meta key was pressed.
isNoShiftAltControlDown :: Modifiers -> Bool
Test if no shift, alt, or control key was pressed.
Mouse events
data EventMouse
Mouse events. The Point gives the logical (unscrolled) position.
Constructors
MouseMotion !Point !ModifiersMouse was moved over the client area of the window
MouseEnter !Point !ModifiersMouse enters in the client area of the window
MouseLeave !Point !ModifiersMouse leaves the client area of the window
MouseLeftDown !Point !ModifiersMouse left button goes down
MouseLeftUp !Point !ModifiersMouse left button goes up
MouseLeftDClick !Point !ModifiersMouse left button double click
MouseLeftDrag !Point !ModifiersMouse left button drag
MouseRightDown !Point !ModifiersMouse right button goes down
MouseRightUp !Point !ModifiersMouse right button goes up
MouseRightDClick !Point !ModifiersMouse right button double click
MouseRightDrag !Point !ModifiersMouse right button drag (unsupported on most platforms)
MouseMiddleDown !Point !ModifiersMouse middle button goes down
MouseMiddleUp !Point !ModifiersMouse middle button goes up
MouseMiddleDClick !Point !ModifiersMouse middle button double click
MouseMiddleDrag !Point !ModifiersMouse middle button drag (unsupported on most platforms)
MouseWheel !Bool !Point !ModifiersMouse wheel rotation. (Bool is True for a downward rotation)
show/hide Instances
showMouse :: EventMouse -> String
Show an EventMouse in a user friendly way.
mousePos :: EventMouse -> Point
Extract the position from a MouseEvent.
mouseModifiers :: EventMouse -> Modifiers
Extract the modifiers from a MouseEvent.
Calender event
data EventCalendar
Constructors
CalendarDayChanged (DateTime ())
CalendarDoubleClicked (DateTime ())
CalendarMonthChanged (DateTime ())
CalendarSelectionChanged (DateTime ())
CalendarWeekdayClicked Int
CalendarYearChanged (DateTime ())
CalendarUnknown
calendarEvent :: Event (CalendarCtrl a) (EventCalendar -> IO ())
Keyboard events
data EventKey
A keyboard event contains the key, the modifiers and the focus point.
Constructors
EventKey !Key !Modifiers !Point
show/hide Instances
data Key
A Key represents a single key on a keyboard.
Constructors
KeyChar !CharAn ascii code.
KeyOther !KeyCodeAn unknown virtual key.
KeyBack
KeyTab
KeyReturn
KeyEscape
KeySpace
KeyDelete
KeyInsert
KeyPriorPage up.
KeyNextPage down.
KeyEnd
KeyHome
KeyLeft
KeyUp
KeyRight
KeyDown
KeyPageUp
KeyPageDown
KeyStart
KeyClear
KeyShift
KeyAlt
KeyControl
KeyMenu
KeyPause
KeyCapital
KeyHelp
KeySelect
KeyPrint
KeyExecute
KeySnapshot
KeyCancel
KeyLeftButton
KeyRightButton
KeyMiddleButton
KeyNum0
KeyNum1
KeyNum2
KeyNum3
KeyNum4
KeyNum5
KeyNum6
KeyNum7
KeyNum8
KeyNum9
KeyMultiply
KeyAdd
KeySeparator
KeySubtract
KeyDecimal
KeyDivide
KeyF1
KeyF2
KeyF3
KeyF4
KeyF5
KeyF6
KeyF7
KeyF8
KeyF9
KeyF10
KeyF11
KeyF12
KeyF13
KeyF14
KeyF15
KeyF16
KeyF17
KeyF18
KeyF19
KeyF20
KeyF21
KeyF22
KeyF23
KeyF24
KeyNumLock
KeyScroll
show/hide Instances
keyKey :: EventKey -> Key
Extract the key from a keyboard event.
keyModifiers :: EventKey -> Modifiers
Extract the modifiers from a keyboard event.
keyPos :: EventKey -> Point
Extract the position from a keyboard event.
showKey :: Key -> String
Show a key for use in menus for example.
showKeyModifiers :: Key -> Modifiers -> String
Show a key/modifiers combination, for example for use in menus.
Internal
newEvent :: String -> (w -> IO a) -> (w -> a -> IO ()) -> Event w a
Create a new event from a get and set function.
Produced by Haddock version 0.8