Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

mcKeyEntry Class Reference

#include <MathHelpers.h>

Inheritance diagram for mcKeyEntry:

Inheritance graph
[legend]
Collaboration diagram for mcKeyEntry:

Collaboration graph
[legend]
List of all members.

Detailed Description

A simple key entry structure: it contains the information required to recognize a combination of CTRL, META, SHIFT, or ALT + one standard key.

Definition at line 225 of file MathHelpers.h.

Public Member Functions

 mcKeyEntry ()
 Inits the customizable variables of this key entry.
 mcKeyEntry (const wxString &str, long keycode)
 mcKeyEntry (const wxString &str)
 mcKeyEntry (const wxKeyEvent &keyEvent)
 Constructs a mcKeyEntry structure from a wxKeyEvent structure.
virtual ~mcKeyEntry ()
void Reset ()
 Resets the variables of this key entry.
wxString Encode () const
 Encodes this mcKeyEntry in a wxString which can be used to init another mcKeyEntry object with the InitFlags or InitKeyCode functions (or in the constructor).
bool MatchKey (const mcKeyEntry &ke) const
 Returns TRUE if the given mcKeyEntry matches the key entry defined by this class.
bool MatchKey (const wxKeyEvent &ke) const
 Returns TRUE if the given key event matches the key entry defined by this class.
wxKeyEvent GetEvent ()
 Constructs a wxKeyEvent that matches this mcKeyEntry.
wxChar GetKeyCode ()
 Returns the keycode stored in this object.
int GetModifiers ()
 Returns the modifiers associated with this key entry.
void SetAsSpecialKey ()
 Sets this keypress as a "special" keypress (see m_bSpecial).
bool isSpecialKey ()
 Returns TRUE if this is set as a special keypress.

Protected Member Functions

void InitFlags (const wxString &str)
 Initializes this mcKeyEntry's flags with the given string.
void InitKeyCode (const wxString &str)
 Initializes with the given string (which should contain a number) the main keycode of this class.
wxString GetModifiersFrom (const wxString &def)
 Returns the modifiers contained in the given string.

Protected Attributes

int m_nFlags
 The flags which enable/disable the modifiers of this mcKeyEntry.
int m_nKeyCode
 The keycode for this key entry.
bool m_bSpecial
 TRUE if this is a 'special' keypress.


Constructor & Destructor Documentation

mcKeyEntry::mcKeyEntry  )  [inline]
 

Inits the customizable variables of this key entry.

Parameters:
def The default key combination contained in this object; the string should encode it using a string like these: wxT("ca+65") wxT("s+88") wxT("+66") "x+F1" that mean: CTRL+ALT+A SHIFT+X B F1 (special) To build a correct init string, use a '+' to divide modifiers (CTRL, ALT, SHIFT, META, SPECIAL = c, a, s, m, x) from the wxWidgets keycode.

Definition at line 299 of file MathHelpers.h.

References Reset().

mcKeyEntry::mcKeyEntry const wxString &  str,
long  keycode
[inline]
 

Definition at line 303 of file MathHelpers.h.

References InitFlags(), m_nKeyCode, and Reset().

mcKeyEntry::mcKeyEntry const wxString &  str  )  [inline]
 

Definition at line 309 of file MathHelpers.h.

References InitFlags(), InitKeyCode(), and Reset().

mcKeyEntry::mcKeyEntry const wxKeyEvent &  keyEvent  )  [inline]
 

Constructs a mcKeyEntry structure from a wxKeyEvent structure.

Definition at line 316 of file MathHelpers.h.

References ALT_KEY, CTRL_KEY, m_nFlags, m_nKeyCode, META_KEY, Reset(), and SHIFT_KEY.

virtual mcKeyEntry::~mcKeyEntry  )  [inline, virtual]
 

Definition at line 330 of file MathHelpers.h.


Member Function Documentation

wxString mcKeyEntry::Encode  )  const [inline]
 

Encodes this mcKeyEntry in a wxString which can be used to init another mcKeyEntry object with the InitFlags or InitKeyCode functions (or in the constructor).

Definition at line 343 of file MathHelpers.h.

References ALT_KEY, CTRL_KEY, m_nFlags, m_nKeyCode, META_KEY, and SHIFT_KEY.

wxKeyEvent mcKeyEntry::GetEvent  )  [inline]
 

Constructs a wxKeyEvent that matches this mcKeyEntry.

Definition at line 392 of file MathHelpers.h.

References ALT_KEY, CTRL_KEY, m_nFlags, m_nKeyCode, META_KEY, and SHIFT_KEY.

Referenced by mcKey::GetEvent().

wxChar mcKeyEntry::GetKeyCode  )  [inline]
 

Returns the keycode stored in this object.

Definition at line 407 of file MathHelpers.h.

References m_bSpecial, and m_nKeyCode.

Referenced by mcKey::GetKeyCode().

int mcKeyEntry::GetModifiers  )  [inline]
 

Returns the modifiers associated with this key entry.

Definition at line 414 of file MathHelpers.h.

References m_nFlags.

Referenced by mcKey::GetModifiers().

wxString mcKeyEntry::GetModifiersFrom const wxString &  def  )  [inline, protected]
 

Returns the modifiers contained in the given string.

Definition at line 280 of file MathHelpers.h.

Referenced by InitFlags(), and InitKeyCode().

void mcKeyEntry::InitFlags const wxString &  str  )  [inline, protected]
 

Initializes this mcKeyEntry's flags with the given string.

The SHIFT_KEY flag is set if the string contains the "s" character, the CTRL_KEY if it contains wxT("c") and META_KEY if it contains "m".

Definition at line 257 of file MathHelpers.h.

References ALT_KEY, CTRL_KEY, GetModifiersFrom(), m_bSpecial, m_nFlags, META_KEY, and SHIFT_KEY.

Referenced by mcKeyEntry().

void mcKeyEntry::InitKeyCode const wxString &  str  )  [inline, protected]
 

Initializes with the given string (which should contain a number) the main keycode of this class.

Definition at line 270 of file MathHelpers.h.

References GetModifiersFrom(), and m_nKeyCode.

Referenced by mcKeyEntry().

bool mcKeyEntry::isSpecialKey  )  [inline]
 

Returns TRUE if this is set as a special keypress.

Definition at line 427 of file MathHelpers.h.

References m_bSpecial.

Referenced by mcKey::isSpecialKey().

bool mcKeyEntry::MatchKey const wxKeyEvent &  ke  )  const [inline]
 

Returns TRUE if the given key event matches the key entry defined by this class.

Definition at line 376 of file MathHelpers.h.

References ALT_KEY, CTRL_KEY, m_nFlags, m_nKeyCode, META_KEY, and SHIFT_KEY.

bool mcKeyEntry::MatchKey const mcKeyEntry ke  )  const [inline]
 

Returns TRUE if the given mcKeyEntry matches the key entry defined by this class.

Definition at line 361 of file MathHelpers.h.

References m_bSpecial, m_nFlags, and m_nKeyCode.

Referenced by mcKey::MatchKey().

void mcKeyEntry::Reset  )  [inline]
 

Resets the variables of this key entry.

After this call, this key entry won't match any key event.

Definition at line 335 of file MathHelpers.h.

References m_bSpecial, m_nFlags, and m_nKeyCode.

Referenced by mcKeyEntry().

void mcKeyEntry::SetAsSpecialKey  )  [inline]
 

Sets this keypress as a "special" keypress (see m_bSpecial).

This can also be done directly when initializing this object using as key modifier also the wxT("x") character: "x+C" is recognized as a special keypress of "C".

Definition at line 422 of file MathHelpers.h.

References m_bSpecial.

Referenced by mcKey::mcKey(), and mcKey::SetAsSpecialKey().


Member Data Documentation

bool mcKeyEntry::m_bSpecial [protected]
 

TRUE if this is a 'special' keypress.

This information has no special meaning for mcKeyEntry but it has for the mcElementGUI functions. See for example, mcFraction::gui_isBeginKey or mcRadical::gui_isBeginKey->

Definition at line 249 of file MathHelpers.h.

Referenced by GetKeyCode(), InitFlags(), isSpecialKey(), MatchKey(), Reset(), and SetAsSpecialKey().

int mcKeyEntry::m_nFlags [protected]
 

The flags which enable/disable the modifiers of this mcKeyEntry.

Definition at line 239 of file MathHelpers.h.

Referenced by Encode(), GetEvent(), GetModifiers(), InitFlags(), MatchKey(), mcKeyEntry(), and Reset().

int mcKeyEntry::m_nKeyCode [protected]
 

The keycode for this key entry.

See "wxWidgets keycodes" in the wxWidgets manual for more info.

Definition at line 243 of file MathHelpers.h.

Referenced by Encode(), GetEvent(), GetKeyCode(), InitKeyCode(), MatchKey(), mcKeyEntry(), and Reset().


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

Documentation generated with Doxygen on Sun Feb 6 17:12:43 2005
Visit MathStudio home page for more info

[ Top ]