ubit
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
ubit::UOn Class Reference

Callback conditions. More...

#include <uon.hpp>

Inheritance diagram for ubit::UOn:
ubit::UCond ubit::UOn2

Public Types

enum  Callback {
  DESTRUCT_CB = 1<<12, CONTAINER_CB = 1<<13, CHANGE_CB = 1<<14, CHILD_CHANGE_CB = 1<<15,
  VIEW_PAINT_CB = 1<<16, VIEW_CHANGE_CB = 1<<17, SHOW_HIDE_CB = 1<<18, MOUSE_CB = 1<<19,
  MOUSE_CROSS_CB = 1<<20, MOUSE_DRAG_CB = 1<<21, MOUSE_MOVE_CB = 1<<22, KEY_CB = 1<<23,
  DND_CB = 1<<24, MESSAGE_CB = 1<<25, WIN_STATE_CB = 1<<27, SYSWM_CB = 1<<28,
  USER_EVENT_CB = 1<<29, CALLBACKS
}
 
enum  IState {
  ANY = -1, IDLE = 0, DISABLED, ENTERED,
  ARMED, ACTIONED, DRAGGED, DROP_ENTERED,
  ACTION_COUNT
}
 

Public Member Functions

 UOn (int id, long callback_mask, int istate=-1)
 
virtual int getID () const
 < creates a callback condition. More...
 
virtual bool operator== (const UCond &) const
 
virtual bool operator!= (const UCond &) const
 
virtual const UCondmatches (const UCond &) const
 
virtual bool verifies (const UUpdateContext &, const UElem &) const
 
virtual UOntoOn ()
 
virtual const UOntoOn () const
 

Public Attributes

const int ID
 

Static Public Attributes

static UOn idle
 no event condition. More...
 
static UOn action
 detects that a high-level "action" was performed on a widget. More...
 
static UOnarm
 
static UOndisarm
 detects that a widget was "armed" or "disarmed". More...
 
static UOnselect
 
static UOndeselect
 detects that a widget was "selected" or "deselected". More...
 
static UOn enter
 
static UOn leave
 detects that the mouse entered or left a widget. More...
 
static UOn click
 
static UOn doubleClick
 detects that the mouse was clicked or double-clicked on a widget. More...
 
static UOn mpress
 
static UOn mrelease
 
static UOn mdrag
 
static UOn mmove
 detects that the mouse was pressed, released, dragged or moved. More...
 
static UOn wheel
 detects that the wheel was moved while the mouse was over a widget. More...
 
static UOn kpress
 
static UOn krelease
 fire callbacks when a key is pressed or released. More...
 
static UOn ktype
 fire callbacks when a text is entered by pressing a key. More...
 
static UOndragStart
 
static UOndragDone
 
static UOndropEnter
 
static UOndropLeave
 
static UOndropDone
 detects drag and drop events occuring on a widget. More...
 
static UOn show
 
static UOn hide
 detect that a widget was shown or hidden. More...
 
static UOn close
 fires callbacks when a window (or a menu) is closed by the window manager ( More...
 
static UOn paint
 detect that a widget was repainted. More...
 
static UOn resize
 
static UOn motion
 detect that a widget was resized or moved. More...
 
static UOn addChild
 
static UOn removeChild
 fire callbacks when a child is added to / removed from an object. More...
 
static UOn destruct
 detects when an object is being destructed.
 
static UOn winState
 fires callbacks when a window state is changed. More...
 
static UOn sysWM
 fires callbacks when a platform-dependent window manager event is received. More...
 
static UOn change
 fires callbacks when the value of an object is changed. More...
 
static UOn propChange
 
static UOn dataChange
 
static UOn strChange
 
static UOn userEvent
 < child change conditions. More...
 

Protected Member Functions

virtual void setParentModes (UElem &parent) const
 

Protected Attributes

long callback_mask
 
int istate
 

Friends

class UElem
 

Detailed Description

Callback conditions.

specify when callback functions are fired or when 'conditional' attributes are activated.

See also
:
  • class UCall for learning how to define callback functions and methods
  • the respective documentation of UOn callback conditions (which are UOn class variables such as UOn::action, UOn::mpress...)

Note that:

Member Enumeration Documentation

§ Callback

Enumerator
DESTRUCT_CB 

callbacks this object is sensitive to

Member Function Documentation

§ getID()

virtual int ubit::UOn::getID ( ) const
inlinevirtual

< creates a callback condition.

callback conditions have a unique ID. IDs in the range [0-100] are reserved for standard event conditions. IDs > 100 can be used for custom client conditions. Notes:

  • UOn instances MUST NOT be deleted (this is done automatically by the toolkit)
  • in the current version of the toolkit, mouse and key conditions are ignored by objects that do not derive from UBox

§ verifies()

bool UOn::verifies ( const UUpdateContext ,
const UElem par 
) const
virtual

!!PBM: pas le meme test que pour les callbacks!!

Implements ubit::UCond.

Member Data Documentation

§ action

UOn UOn::action
static

detects that a high-level "action" was performed on a widget.

the semantics of this "action" depends on the widget (e.g. a mouse click or a SPACE key press for a button, an ENTER key press for a textfield).

Callback functions triggered by UOn::action can have an optional UEvent parameter.

See also
also: UOn::arm, UOn::mpress.

§ arm

UOn & UOn::arm
static
Initial value:
=
*new UOn2(21, UMode::MOUSE_CB, UMode::ARMED, &UElem::setArmable)

§ change

UOn UOn::change
static

fires callbacks when the value of an object is changed.

this condition detects when:

Notes for UChoice, UListbox, UCombobox:

§ close

UOn UOn::close
static

fires callbacks when a window (or a menu) is closed by the window manager (

See also
UWin::close()).

§ deselect

UOn & UOn::deselect
static
Initial value:
=
*new UOn2(26, UMode::MOUSE_CB, UMode::ANY, &UElem::_setArmableAndSelectable)

detects that a widget was "selected" or "deselected".

Certain widgets, such as UCheckbox or UListbox items can be selected. Besides, any widget deriving from UBox can be made "selectable" by UElem::setSelectable().

Callback functions triggered by UOn::select and UOn::deselect can have an optional UEvent parameter.

See also
also UOn::action.

§ disarm

UOn & UOn::disarm
static
Initial value:
=
*new UOn2(22, UMode::MOUSE_CB, UMode::ANY, &UElem::setArmable)

detects that a widget was "armed" or "disarmed".

The semantics of 'arm' and 'disarm' depends on the widget. An individual button is armed when it is pressed then disarmed when it is released. It is also disarmed/armed if the mouse moves outside/inside the button while being pressed.

This behavior is slightly different in lists and menus: an item is armed when the mouse enters even if the initial mouse press was performed on another item.

Any widget deriving from UBox can be made "armable" by UElem::setArmable(). Most interactors (e.g. UButton, UCheckbox...) are armable by default.

Callback functions triggered by UOn::arm and UOn::disarm can have an optional UEvent parameter.

See also
also UOn::action, UOn::mpress.

§ doubleClick

UOn UOn::doubleClick
static

detects that the mouse was clicked or double-clicked on a widget.

These conditions are applicable to any widget that derives from UBox.

Callback functions triggered by UOn::click and UOn::doubleClick can have an optional UMouseEvent parameter which has a getClickCount() method.

The radius and the delay for detecting mouse clicks depend on UConf::click_radius and UConf::click_delay.

See also
also UOn::action, UOn::mpress.

§ dragDone

UOn & UOn::dragDone
static
Initial value:
=
*new UOn2(42, UMode::DND_CB, UMode::ANY, &UElem::setDraggable)

§ dragStart

UOn & UOn::dragStart
static
Initial value:
=
*new UOn2(41, UMode::DND_CB, UMode::ANY, &UElem::setDraggable)

§ dropDone

UOn & UOn::dropDone
static
Initial value:
=
*new UOn2(45, UMode::DND_CB, UMode::ANY, &UElem::setDroppable)

detects drag and drop events occuring on a widget.

§ dropEnter

UOn & UOn::dropEnter
static
Initial value:
=
*new UOn2(43, UMode::DND_CB, UMode::ANY, &UElem::setDroppable)

§ dropLeave

UOn & UOn::dropLeave
static
Initial value:
=
*new UOn2(44, UMode::DND_CB, UMode::ANY, &UElem::setDroppable)

§ hide

UOn UOn::hide
static

detect that a widget was shown or hidden.

these callbacks are ONLY fired when show(true) or show(false) is applied to a widget (currently, they are not fired if a parent was shown or hidden)

§ idle

UOn UOn::idle
static

no event condition.

this condition is useful for UStyle specs.

§ krelease

UOn 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. Their 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)

See also
: UOn::ktype

§ ktype

UOn 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. Their 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)

See also
: UOn::kpress, UOn::krelease

§ leave

UOn UOn::leave
static

detects that the mouse entered or left a widget.

These conditions are applicable to any widget that derives from UBox.

Callback functions triggered by UOn::enter and UOn::leave can have an optional UMouseEvent parameter.

§ mmove

UOn UOn::mmove
static

detects that the mouse was pressed, released, dragged or moved.

These conditions are applicable to any widget that derives from UBox.

Callback functions triggered by these conditions can have an optional UMouseEvent parameter which have several useful methods such as getSource(), getX(), getY() that return the corresponding widget and the position of the mouse relatively from its origin.

It is worth noticing that drag and release events are always related to the widget where the mouse press occured, even if the mouse is now located on another widget (this is not the case for move events as no widget was pressed).

Notes:

  • press and release events are repeated if the widget is in auto repeat mode see: UElem::setAutoRepeat()
  • event are produced in the following order (when applicable): mpress / arm / action / click / disarm / mrelease.

§ motion

UOn UOn::motion
static

detect that a widget was resized or moved.

These conditions are applicable to any widget that derives from UBox.

Callback functions triggered by these conditions can have an optional UEvent parameter

A UBox can have multiple views. Callback functions are then fired for each view that has been resized or moved.

§ paint

UOn UOn::paint
static

detect that a widget was repainted.

This condition is applicable to any widget that derives from UBox.

Callback functions triggered by UOn::paint can have an optional UPaintEvent parameter which have several useful methods such as getSource(), getView(), getClip(), etc.

See also
UPaintEvent for details.

A UBox can have multiple views. Callback functions are then fired for each view that has been repainted.

§ removeChild

UOn UOn::removeChild
static

fire callbacks when a child is added to / removed from an object.

objects must derive from UElem. Callbacks can have an optional UEvent parameter. Its getTarget() method returns the child that was added or removed (beware: this child may have been destroyed in the latter case!)

§ select

UOn & UOn::select
static
Initial value:
=
*new UOn2(25, UMode::MOUSE_CB, UMode::ANY, &UElem::_setArmableAndSelectable)

§ sysWM

UOn UOn::sysWM
static

fires callbacks when a platform-dependent window manager event is received.

this condition only apply for windows. When X11 is used, it will be fired when X11 properties are changed and, non-Ubit client messages are received (see UOn::message).

§ userEvent

UOn UOn::userEvent
static

< child change conditions.

these conditions detects when a child of a box is changed:

  • propChange detects if a UAttr child was changed
  • dataChange ... if a UData ..
  • strChange ... if a UStr .. Note that UOn::change is triggered on the child before propChange, dataChange or strChange are triggered on the parents. 'dataChange' then 'strChange' are triggered when UStr(ings) are changed.user event.

§ wheel

UOn UOn::wheel
static

detects that the wheel was moved while the mouse was over a widget.

This condition is applicable to any widget that derives from UBox. The widget that receive the wheel events is the one where the mouse is currenly located.

Callback functions triggered by UOn::wheel can have an optional UWheelEvent parameter which has getWheelDelta() method that returns the amount of wheel movement

§ winState

UOn UOn::winState
static

fires callbacks when a window state is changed.

this condition only applies for windows. It is fired by map, unmap and window state events.


The documentation for this class was generated from the following files: