#include <uon.hpp>
Inheritance diagram for ubit::UOn:
Public Member Functions | |
UOn (short id) | |
!CAUTION: NEVER delete UOn instances. | |
virtual int | getID () const |
virtual bool | operator== (const UCond &) const |
virtual bool | operator!= (const UCond &) const |
virtual const UCond * | matches (const UCond &) const |
virtual bool | verifies (const UContext &, const UControl *) const |
virtual UOn * | onCast () |
virtual const UOn * | onCast () const |
virtual void | setParentModes (UControl *parent) const |
UOn (short id, UMask bmodes) | |
UOn (short id, UMask bmodes, UMask cmodes, short state) | |
Public Attributes | |
const short | ID |
Static Public Attributes | |
static UOn | idle |
no event condition. | |
static UOn | action |
fires callbacks when the box is "activated". | |
static UOn | arm |
static UOn | disarm |
fire callbacks when the box is "armed" or "disarmed". | |
static UOn | enter |
static UOn | leave |
fire callbacks when the mouse enter or leaves the box. | |
static UOn | click |
static UOn | doubleClick |
fire callbacks when the mouse is clicked or double clicked in the box. | |
static UOn | mpress |
static UOn | mrelease |
static UOn | mdrag |
static UOn | mmove |
fire callbacks when the mouse is pressed, released, dragged, moved in a box. | |
static UOn | wheel |
fires callbacks when the mouse wheel is rotated. | |
static UOn | kpress |
static UOn | krelease |
fire callbacks when a key is pressed or released. | |
static UOn | ktype |
fire callbacks when a text is entered by pressing a key. | |
static UOn | dragStart |
static UOn | dragDone |
static UOn | dropEnter |
static UOn | dropLeave |
static UOn | dropDone |
drag and drop. | |
static UOn | show |
static UOn | hide |
fires callbacks when a box is shown or hidden. | |
static UOn | paint |
static UOn | resize |
fires callbacks when a box view is repainted or resized. | |
static UOn | select |
static UOn | deselect |
fire callbacks when a "selectable" box is selected or deselected. | |
static UOn | change |
fires callbacks when the value of an object is changed. | |
static UOn | propChange |
static UOn | dataChange |
static UOn | strChange |
static UOn | addChild |
< child change conditions. | |
static UOn | removeChild |
fire callbacks when a child is added to / removed from an object. | |
static UOn | destruct |
fires callbacks when an object is destructed. | |
static UOn | close |
fires callbacks when a window is closed externally. | |
static UOn | winConfigure |
fires callbacks when a window is configured. | |
static UOn | winProperty |
fires callbacks when a window property is changed. | |
static UOn | winMessage |
fires callbacks when a window receives a message. | |
static UOn | filterEvent |
intercepts events *before* they reach their final target. | |
static UOn | userEvent |
user events | |
static UOn | miscEvent |
other events | |
static UOn | mrelax |
obsolete. | |
Friends | |
class | UControl |
class | UGroup |
class | UEvent |
specify when callback functions are fired or when conditionnal objects are activated. Examples:
ubutton("Click Me" + UOn::action / ucall(arg, myfunc)) uhbox("Press Me" + UOn::mpress / ucall(obj, &Myclass::mymethod)) ucheckbox("Select Me" + UOn::select / UColor::red + UOn::unselect / UColor::blue)Notes:
Implements ubit::UCond.
UOn ubit::UOn::action [static] |
fires callbacks when the box is "activated".
"activated" depends on the semantics of the box. For instance, UButton instances are activated by clicking on them or by typing the SPACE key when they have the focus while UTextfield instances are activated by typing on the ENTER or RETURN key. No action occur if the widget is disabled (
UOn ubit::UOn::addChild [static] |
< child change conditions.
these conditions detects when a child of a box is changed:
UOn ubit::UOn::change [static] |
fires callbacks when the value of an object is changed.
this condition detects when:
Notes for UChoice, UListbox, UCombobox:
UOn ubit::UOn::close [static] |
fires callbacks when a window is closed externally.
this condition only apply for windows and menus (ie. objects that derive from UWin such as UFrame, UDialog, UMenu). A window is closed when its UWin::close() method is called. In most cases, close() just hides the window, but some subclasses redefine it to perform specifir behaviors (e.g. the UFrame::close() method of the main frame quits the application)
UOn ubit::UOn::deselect [static] |
fire callbacks when a "selectable" box is selected or deselected.
Boxes must be "selectable" to receive these events. UCheckbox instances and UListbox children are "selectable" by default. Adding UMode::canSelect to any box makes it "selectable". Callbacks can have an optional UEvent parameter.
UOn ubit::UOn::destruct [static] |
fires callbacks when an object is destructed.
these callbacks are fired by the object destructor.
UOn ubit::UOn::disarm [static] |
fire callbacks when the box is "armed" or "disarmed".
as for UOn::action, these conditions depends on the semantics of the box. For instance, a UButton is armed when it is pressed then disarmed when it is released or if the mouse leaves this button. It is armed again if the mouse is moved back inside the button (and if the mouse remains pressed), and so on.
In lists and menu systems, a button is armed if the mouse is pressed somewhere in the menu or the list then moved inside this button. This specific way of arming (and activating) menu and list buttons is called "browsing".
Boxes must be "armable" to receive these events. Most interactors are armable by default. Adding UMode::canArm to any box makes it "armable".
Callbacks can have an optional UEvent parameter: see UOn::action for details.
UOn ubit::UOn::doubleClick [static] |
fire callbacks when the mouse is clicked or double clicked in the box.
Callbacks may have an optional UMouseEvent parameter. Its getClickCount() method returns the number of clicks. The radius and the delay for detecting mouse clicks is set by UConf::click_radius, UConf::click_delay.
UOn ubit::UOn::filterEvent [static] |
intercepts events *before* they reach their final target.
This makes it possible to detect, filter and modify events while they are traversing the widget graph. The final target receives the events as usual, except if the filterEvent callback function calls UEvent::ignore() or UEvent::consume() or if its changes its coordinates. filterEvent callbacks are especially useful for implementing transparent tools and for sophisticated event management
Notes:
UOn ubit::UOn::hide [static] |
fires callbacks when a box is shown or hidden.
these callbacks are fired when show(true) or show(false) is applied to an object. Note that they are not called recursively on children.
UOn ubit::UOn::idle [static] |
no event condition.
this condition is useful for Style specs.
UOn ubit::UOn::krelease [static] |
fire callbacks when a key is pressed or released.
these are low-level conditions that do not compose characters. For instance, typing SHIFT 'A' produces 2 kpress and 2 krelease events. UOn::ktype, that composes characters, should be used in most cases. Callbacks can have an optional UKeyEvent parameter. Its getKeyCode() method returns a code that identifies the key.
The box that gets these events is the one that has the input focus (which is the box where the mouse is currenly located in the current version of the toolkit) Note that mouse and key these conditions only apply to boxes (ie. objects that derive from UBox)
UOn ubit::UOn::ktype [static] |
fire callbacks when a text is entered by pressing a key.
in constrast with kpress, ktype composes characters and it is only fired when printable characters are typed. For instance, typing SHIFT 'A' produce only one ktype event. Callbacks can have an optional UKeyEvent parameter. Its getChar() method returns the composed character (for instance, if SHIFT was pressed, it will return 'uppercase A' rather than 'lowercase A')
The box that gets these events is the one that has the input focus (which is the box where the mouse is currenly located in the current version of the toolkit) Note that mouse and key these conditions only apply to boxes (ie. objects that derive from UBox)
UOn ubit::UOn::leave [static] |
fire callbacks when the mouse enter or leaves the box.
Callbacks may have an optional UMouseEvent parameter.
UOn ubit::UOn::mmove [static] |
fire callbacks when the mouse is pressed, released, dragged, moved in a box.
the box that gets mpress and mmove events is the one where the mouse is currenly located. The box that gets mrelease and mdrag events is the one that got the mpress (which is not necessarily the box where the mouse is now located!). Callbacks can have an optional UMouseEvent parameter. Its coordinates are relative to the box that got the event.
mpress, mrelease events are repeated if the box is in auto repeat mode (
UOn ubit::UOn::removeChild [static] |
UOn ubit::UOn::resize [static] |
fires callbacks when a box view is repainted or resized.
these conditions only apply to boxes. They are fired when a box view is repainted or resized (note that boxes can have several views)
UOn ubit::UOn::wheel [static] |
fires callbacks when the mouse wheel is rotated.
the box that gets wheel events is the one where the mouse is currenly located. Callbacks can have an optional UWheelEvent parameter. Its getWheelDelta() method returns the amount of wheel movement
UOn ubit::UOn::winConfigure [static] |
fires callbacks when a window is configured.
this condition only apply for windows. It is fired by map, unmap and window state events.
UOn ubit::UOn::winMessage [static] |
fires callbacks when a window receives a message.
this condition only apply for windows. It is fired by X client message events.
UOn ubit::UOn::winProperty [static] |
fires callbacks when a window property is changed.
this condition only apply for windows. It is fired by X property events.