vgui_event Class Reference

#include <vgui_event.h>

List of all members.


Detailed Description

The vgui_event class encapsulates the events handled by the vgui system.

For key presses with modifiers the following standards apply:

           a   modifier = vgui_NULL   key = 'a'  ascii_char = 'a'
      CTRL+a   modifier = vgui_CTRL   key = 'a'  ascii_char = '^A'
     SHIFT+a   modifier = vgui_SHIFT  key = 'a'  ascii_char = 'A'
   

We have decided to make it a standard that key is always lower case for simplicity. In particular people have been defining impossible vgui_event_conditions, eg key='A', modifier=NULL (where NULL is the default modifier) and then wondering why SHIFT+a doesn't work.

A new data type has been added (ascii_char) which holds the actual key stroke pressed by the user.

Definition at line 80 of file vgui_event.h.


Public Member Functions

 vgui_event ()
 Constructor - create a default event.
 vgui_event (vgui_event_type)
 Constructor - create an event of the given type.
void set_key (vgui_key c)
 Convert given key to lower case and use that to set key.
bool modifier_is_down (int) const
double secs_since (vgui_event const &) const
long usecs_since (vgui_event const &) const

Public Attributes

vgui_event_type type
 The type of event (key press, mouse motion, etc).
vgui_button button
 Mouse button used (if it is a mouse event).
vgui_key key
 The key pressed in lower case (if it is a key event).
vgui_modifier modifier
 Which modifiers are pressed during the event (NULL, CTRL, SHIFT).
vgui_key ascii_char
 The actual key stroke pressed by the user.
int wx
 Position of the mouse pointer in viewport coordinates when event occurred.
int wy
int timestamp
 Timestamp in milliseconds since app started.
vgui_adaptororigin
 The adaptor from which the event came.
int timer_id
 If the event is a timer event, this holds the ID.
vcl_string str
 A vcl_string message, for an event of type vgui_STRING.
void const * user
 Type and data for events of type vgui_OTHER.
void const * data

Private Member Functions

void init ()
 Initialise default event.

Constructor & Destructor Documentation

vgui_event::vgui_event (  )  [inline]

Constructor - create a default event.

Definition at line 84 of file vgui_event.h.

vgui_event::vgui_event ( vgui_event_type   ) 

Constructor - create an event of the given type.

Definition at line 49 of file vgui_event.cxx.


Member Function Documentation

void vgui_event::set_key ( vgui_key  c  ) 

Convert given key to lower case and use that to set key.

I added this to avoid the complication of doing this conversion in each GUI impl - kym.

Definition at line 59 of file vgui_event.cxx.

bool vgui_event::modifier_is_down ( int   )  const

Definition at line 73 of file vgui_event.cxx.

double vgui_event::secs_since ( vgui_event const &   )  const

Definition at line 79 of file vgui_event.cxx.

long vgui_event::usecs_since ( vgui_event const &   )  const

Definition at line 85 of file vgui_event.cxx.

void vgui_event::init (  )  [private]

Initialise default event.

Definition at line 22 of file vgui_event.cxx.


Member Data Documentation

vgui_event_type vgui_event::type

The type of event (key press, mouse motion, etc).

Definition at line 90 of file vgui_event.h.

vgui_button vgui_event::button

Mouse button used (if it is a mouse event).

Definition at line 93 of file vgui_event.h.

vgui_key vgui_event::key

The key pressed in lower case (if it is a key event).

Definition at line 96 of file vgui_event.h.

vgui_modifier vgui_event::modifier

Which modifiers are pressed during the event (NULL, CTRL, SHIFT).

Definition at line 102 of file vgui_event.h.

vgui_key vgui_event::ascii_char

The actual key stroke pressed by the user.

Definition at line 105 of file vgui_event.h.

int vgui_event::wx

Position of the mouse pointer in viewport coordinates when event occurred.

Definition at line 108 of file vgui_event.h.

int vgui_event::wy

Definition at line 108 of file vgui_event.h.

int vgui_event::timestamp

Timestamp in milliseconds since app started.

Definition at line 111 of file vgui_event.h.

vgui_adaptor* vgui_event::origin

The adaptor from which the event came.

Definition at line 114 of file vgui_event.h.

int vgui_event::timer_id

If the event is a timer event, this holds the ID.

For an event of type vgui_TIMER, this field holds the name that was given when the timer request was posted.

Definition at line 119 of file vgui_event.h.

vcl_string vgui_event::str

A vcl_string message, for an event of type vgui_STRING.

An event of type vgui_STRING implies that this field contains some sort of textual message. The exact encoding of these messages is unspecified; the sender and the receiver may use any protocol they like. Caveat : as a corollary there is no guarantee that one protocol will not clash with another.

Definition at line 128 of file vgui_event.h.

void const* vgui_event::user

Type and data for events of type vgui_OTHER.

The fields user and data are used only when the event type is vgui_OTHER. The 'user' field must uniquely identify the type of event, in the sense that once the user field is known, the 'data' field can be safely cast to point to the client data (type).

Definition at line 135 of file vgui_event.h.

void const* vgui_event::data

Definition at line 136 of file vgui_event.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 8 05:12:33 2010 for core/vgui by  doxygen 1.5.1