nux-1.14.0
nux::Event Class Reference

Nux event class. More...

#include <NuxGraphics/Events.h>

List of all members.

Public Member Functions

void Reset ()
int GetX () const
int GetY () const
int GetRootX () const
int GetRootY () const
int GetDeltaX () const
int GetDeltaY () const
unsigned long GetKeyState () const
unsigned long GetMouseState () const
MouseButton GetEventButton () const
 Returns index of the mouse button that triggered this event.
bool GetButtonState (MouseButton button) const
 Returns the state of a mouse button: pressed or released.
bool GetKeyModifierState (KeyModifier key_modifier) const
 Returns the state of a special key: CTRL, Shift, Alt, NumLock...
unsigned long GetKeySym () const
 Return virtual key code of the key that has triggered the last event.
unsigned short GetKeyRepeatCount () const
const TCHAR * GetText () const
unsigned long GetVirtualKeyState (unsigned long VirtualKey) const
 Return the state of the Virtual key.

Public Attributes

unsigned long VirtualKeycodeState [NUX_MAX_VK]
int width
int height
unsigned int ascii_code
int virtual_code
int e_x
int e_y
int e_x_root
int e_y_root
int e_dx
int e_dy
int e_clicks
int e_is_click
int e_x11_keycode
 X11 raw keycode.
int e_keysym
 Key symbol.
int e_wheeldelta
TCHAR e_text [NUX_EVENT_TEXT_BUFFER_SIZE]
unsigned long e_key_modifiers
unsigned long e_mouse_state
unsigned short e_key_repeat_count
int e_length
NuxEventType e_event

Detailed Description

Nux event class.

Definition at line 254 of file Events.h.


Member Function Documentation

bool nux::Event::GetButtonState ( MouseButton  button) const

Returns the state of a mouse button: pressed or released.

Returns the state of a mouse button. True is the button is pressed. False otherwise.

Parameters:
button_indexButton index to query (1 for left mouse button).
Returns:
True is the button is pressed. False otherwise.

Definition at line 153 of file Events.cpp.

  {
    if (button == 1)
      return (e_mouse_state & NUX_STATE_BUTTON1_DOWN) ? true : false;
    else if (button == 2)
      return (e_mouse_state & NUX_STATE_BUTTON2_DOWN) ? true : false;
    else if (button == 3)
      return (e_mouse_state & NUX_STATE_BUTTON3_DOWN) ? true : false;
    else if (button == 4)
      return (e_mouse_state & NUX_STATE_BUTTON4_DOWN) ? true : false;

    return false;
  }
MouseButton nux::Event::GetEventButton ( ) const

Returns index of the mouse button that triggered this event.

Returns the index of the button that triggered this event. The index of the left mouse button is 1 and the index for the right mouse button is 2. If 0 is returned, then a mouse button didn't triggered the event.

Returns:
The button that triggered the event.

Definition at line 139 of file Events.cpp.

  {
    if ((e_mouse_state & NUX_EVENT_BUTTON1_DOWN) || (e_mouse_state & NUX_EVENT_BUTTON1_UP))
      return NUX_MOUSE_BUTTON1;
    else if ((e_mouse_state & NUX_EVENT_BUTTON2_DOWN) || (e_mouse_state & NUX_EVENT_BUTTON2_UP))
      return NUX_MOUSE_BUTTON2;
    else if ((e_mouse_state & NUX_EVENT_BUTTON3_DOWN) || (e_mouse_state & NUX_EVENT_BUTTON3_UP))
      return NUX_MOUSE_BUTTON3;
    else if ((e_mouse_state & NUX_EVENT_BUTTON4_DOWN) || (e_mouse_state & NUX_EVENT_BUTTON4_UP))
      return NUX_MOUSE_BUTTON4;

    return NUX_INVALID_MOUSE_BUTTON;
  }
bool nux::Event::GetKeyModifierState ( KeyModifier  key_modifier) const

Returns the state of a special key: CTRL, Shift, Alt, NumLock...

Returns the state of a key modifier. True is the key is pressed. False otherwise.

Parameters:
key_modifierKey modifier be query.
Returns:
True is the key is pressed. False otherwise.

Definition at line 167 of file Events.cpp.

  {
    return ((e_key_modifiers & key_modifier) != 0);
  }
unsigned long nux::Event::GetKeySym ( ) const

Return virtual key code of the key that has triggered the last event.

Return virtual key code of the key that has triggered the last event.

Returns:
the virtual key code.

Definition at line 177 of file Events.cpp.

References e_keysym.

  {
    return e_keysym;
  }
unsigned long nux::Event::GetVirtualKeyState ( unsigned long  VirtualKey) const

Return the state of the Virtual key.

Return the state of the Virtual key.

Parameters:
VirtualKeyvirtual key code.
Returns:
1 if the key is pressed, 0 if the key is released.

Definition at line 198 of file Events.cpp.

  {
    if (VirtualKey >= NUX_MAX_VK)
      return 0;

    if (VirtualKey <= 0)
      return 0;

    return VirtualKeycodeState[VirtualKey];
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends