Back to index

nux  3.0.0
Public Member Functions | Public Attributes
nux::Event Class Reference

Nux event class. More...

#include <Events.h>

List of all members.

Public Member Functions

 Event ()
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
bool IsShiftDown () const
bool IsControlDown () const
bool IsCapsLockDown () const
bool IsAltDown () const
bool IsNumLockDown () const
bool IsScrollLockDown () const
bool IsSuperKeyDown () 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 char * 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 x
int y
int x_root
int y_root
int dx
int dy
int clicks
int is_click
int wheel_delta
 Wheel delta.
char text [NUX_EVENT_TEXT_BUFFER_SIZE]
unsigned long key_modifiers
 Key modifiers.
unsigned long mouse_state
unsigned short key_repeat_count
 Number of time a key is repeated;.
EventType type

Detailed Description

Nux event class.

Definition at line 302 of file Events.h.


Constructor & Destructor Documentation

Definition at line 61 of file Events.cpp.

  {
    Memset(text, 0, sizeof(text));

    for (int i = 0; i < NUX_MAX_VK; i++)
    {
      VirtualKeycodeState[i] = 0;
    }

    ascii_code = 0;
    virtual_code = 0;
    key_modifiers = 0;
    key_repeat_count = 0;
    mouse_state = 0;
    x = -1;
    y = -1;
    x_root = 0;
    y_root = 0;
    dx = 0;
    dy = 0;
    clicks = 0;
    is_click = 0;
    wheel_delta = 0;

#if defined(NUX_OS_WINDOWS)
    win32_keycode = 0;
    win32_keysym = 0;
#endif

#if defined(NUX_OS_LINUX)
    x11_keycode = 0;
    x11_keysym = 0;
    x11_timestamp = 0;
    x11_window = 0;
    x11_key_state = 0;
#endif

    //Application = 0;
  }

Here is the call graph for this function:


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 170 of file Events.cpp.

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

    return false;
  }
int nux::Event::GetDeltaX ( ) const

Definition at line 137 of file Events.cpp.

  {
    return dx;
  }
int nux::Event::GetDeltaY ( ) const

Definition at line 141 of file Events.cpp.

  {
    return dy;
  }

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 156 of file Events.cpp.

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 184 of file Events.cpp.

  {
    return((key_modifiers & key_modifier) != 0);
  }

Here is the caller graph for this function:

unsigned short nux::Event::GetKeyRepeatCount ( ) const

Definition at line 206 of file Events.cpp.

  {
    return key_repeat_count;
  }
unsigned long nux::Event::GetKeyState ( ) const

Definition at line 146 of file Events.cpp.

  {
    return key_modifiers;
  }
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 194 of file Events.cpp.

  {
#if defined(NUX_OS_WINDOWS)
    return win32_keysym;
#endif

#if defined(NUX_OS_LINUX)
    return x11_keysym;
#endif

    return 0;
  }

Here is the caller graph for this function:

unsigned long nux::Event::GetMouseState ( ) const

Definition at line 151 of file Events.cpp.

  {
    return mouse_state;
  }

Here is the caller graph for this function:

int nux::Event::GetRootX ( ) const

Definition at line 129 of file Events.cpp.

  {
    return x_root;
  }
int nux::Event::GetRootY ( ) const

Definition at line 133 of file Events.cpp.

  {
    return y_root;
  }
const char * nux::Event::GetText ( ) const

Definition at line 211 of file Events.cpp.

  {
    return text;
  }
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 223 of file Events.cpp.

  {
    if (VirtualKey >= NUX_MAX_VK)
      return 0;

    if (VirtualKey <= 0)
      return 0;

    return VirtualKeycodeState[VirtualKey];
  }

Here is the caller graph for this function:

int nux::Event::GetX ( ) const

Definition at line 121 of file Events.cpp.

  {
    return x;
  }
int nux::Event::GetY ( ) const

Definition at line 125 of file Events.cpp.

  {
    return y;
  }
bool nux::Event::IsAltDown ( ) const

Definition at line 249 of file Events.cpp.

  {
    return (key_modifiers & NUX_STATE_ALT) ? true : false;
  }

Definition at line 244 of file Events.cpp.

  {
    return (key_modifiers & NUX_STATE_CAPS_LOCK) ? true : false;
  }
bool nux::Event::IsControlDown ( ) const

Definition at line 239 of file Events.cpp.

  {
    return (key_modifiers & NUX_STATE_CTRL) ? true : false;
  }
bool nux::Event::IsNumLockDown ( ) const

Definition at line 254 of file Events.cpp.

  {
    return (key_modifiers & NUX_STATE_NUMLOCK) ? true : false;
  }

Definition at line 259 of file Events.cpp.

  {
    return (key_modifiers & NUX_STATE_SCROLLLOCK) ? true : false;
  }
bool nux::Event::IsShiftDown ( ) const

Definition at line 234 of file Events.cpp.

  {
    return (key_modifiers & NUX_STATE_SHIFT) ? true : false;
  }

Definition at line 264 of file Events.cpp.

  {
    return (key_modifiers & NUX_STATE_SCROLLLOCK) ? true : false;
  }
void nux::Event::Reset ( void  )

Definition at line 101 of file Events.cpp.

  {
    type = NUX_NO_EVENT;
    Memset(text, 0, sizeof(text));
#if defined(NUX_OS_WINDOWS)
    win32_keycode = 0;
    win32_keysym = 0;
#endif

#if defined(NUX_OS_LINUX)
    x11_keycode = 0;
    x11_keysym = 0;
    x11_key_state = 0;
#endif

    key_repeat_count = 0;
    key_modifiers = 0;
    wheel_delta = 0;
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

unsigned int nux::Event::ascii_code

Definition at line 377 of file Events.h.

Definition at line 386 of file Events.h.

Definition at line 384 of file Events.h.

Definition at line 385 of file Events.h.

Definition at line 376 of file Events.h.

Definition at line 387 of file Events.h.

Key modifiers.

A bitwise inclusive OR of values in KeyModifier.

Definition at line 405 of file Events.h.

Number of time a key is repeated;.

Definition at line 407 of file Events.h.

unsigned long nux::Event::mouse_state

Definition at line 406 of file Events.h.

Definition at line 404 of file Events.h.

Definition at line 408 of file Events.h.

Definition at line 378 of file Events.h.

Definition at line 375 of file Events.h.

Wheel delta.

Definition at line 402 of file Events.h.

Definition at line 376 of file Events.h.

Definition at line 380 of file Events.h.

Definition at line 382 of file Events.h.

Definition at line 381 of file Events.h.

Definition at line 383 of file Events.h.


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