Add WXK_NONE symbolic constant indicating absence of a key.
wxKeyEvent::GetKeyCode() and GetUnicodeKey() return 0 to indicate that the key code or Unicode character is not available, give symbolic name to this 0 to make the code using these methods more clear. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2289,9 +2289,11 @@ enum wxDataFormatId
|
|||||||
wxDF_MAX
|
wxDF_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Virtual keycodes */
|
/* Key codes */
|
||||||
enum wxKeyCode
|
enum wxKeyCode
|
||||||
{
|
{
|
||||||
|
WXK_NONE = 0,
|
||||||
|
|
||||||
WXK_BACK = 8, // backspace
|
WXK_BACK = 8, // backspace
|
||||||
WXK_TAB = 9,
|
WXK_TAB = 9,
|
||||||
WXK_RETURN = 13,
|
WXK_RETURN = 13,
|
||||||
|
@@ -486,13 +486,27 @@ enum wxDataFormatId
|
|||||||
/**
|
/**
|
||||||
Virtual keycodes used by wxKeyEvent and some other wxWidgets functions.
|
Virtual keycodes used by wxKeyEvent and some other wxWidgets functions.
|
||||||
|
|
||||||
Note that the range @c 33 - @c 126 is reserved for the standard ASCII
|
Note that the range <code>0..255</code> corresponds to the characters of
|
||||||
characters and that the range @c 128 - @c 255 is reserved for the
|
the current locale, in particular the <code>32..127</code> subrange is for
|
||||||
extended ASCII characters (which are not really standard and thus should
|
the ASCII symbols, and all the special key values such as @c WXK_END lie
|
||||||
be avoid in portable apps!).
|
above this range.
|
||||||
*/
|
*/
|
||||||
enum wxKeyCode
|
enum wxKeyCode
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
No key.
|
||||||
|
|
||||||
|
This value is returned by wxKeyEvent::GetKeyCode() if there is no
|
||||||
|
non-Unicode representation for the pressed key (e.g. a Cyrillic letter
|
||||||
|
was entered when not using a Cyrillic locale) and by
|
||||||
|
wxKeyEvent::GetUnicodeKey() if there is no Unicode representation for
|
||||||
|
the key (this happens for the special, non printable, keys only, e.g.
|
||||||
|
WXK_HOME).
|
||||||
|
|
||||||
|
@since 2.9.2 (you can simply use 0 with previous versions).
|
||||||
|
*/
|
||||||
|
WXK_NONE = 0,
|
||||||
|
|
||||||
WXK_BACK = 8, //!< Backspace.
|
WXK_BACK = 8, //!< Backspace.
|
||||||
WXK_TAB = 9,
|
WXK_TAB = 9,
|
||||||
WXK_RETURN = 13,
|
WXK_RETURN = 13,
|
||||||
@@ -502,9 +516,11 @@ enum wxKeyCode
|
|||||||
WXK_DELETE = 127,
|
WXK_DELETE = 127,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
These are, by design, not compatible with unicode characters.
|
Special key values.
|
||||||
If you want to get a unicode character from a key event, use
|
|
||||||
wxKeyEvent::GetUnicodeKey instead.
|
These are, by design, not compatible with Unicode characters.
|
||||||
|
If you want to get a Unicode character from a key event, use
|
||||||
|
wxKeyEvent::GetUnicodeKey() instead.
|
||||||
*/
|
*/
|
||||||
WXK_START = 300,
|
WXK_START = 300,
|
||||||
WXK_LBUTTON,
|
WXK_LBUTTON,
|
||||||
|
@@ -1323,7 +1323,8 @@ public:
|
|||||||
Returns the Unicode character corresponding to this key event.
|
Returns the Unicode character corresponding to this key event.
|
||||||
|
|
||||||
If the key pressed doesn't have any character value (e.g. a cursor key)
|
If the key pressed doesn't have any character value (e.g. a cursor key)
|
||||||
this method will return 0.
|
this method will return @c WXK_NONE. In this case you should use
|
||||||
|
GetKeyCode() to retrieve the value of the key.
|
||||||
|
|
||||||
This function is only available in Unicode build, i.e. when
|
This function is only available in Unicode build, i.e. when
|
||||||
@c wxUSE_UNICODE is 1.
|
@c wxUSE_UNICODE is 1.
|
||||||
|
@@ -733,9 +733,9 @@ wxPoint wxMouseEvent::GetLogicalPosition(const wxDC& dc) const
|
|||||||
wxKeyEvent::wxKeyEvent(wxEventType type)
|
wxKeyEvent::wxKeyEvent(wxEventType type)
|
||||||
{
|
{
|
||||||
m_eventType = type;
|
m_eventType = type;
|
||||||
m_keyCode = 0;
|
m_keyCode = WXK_NONE;
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
m_uniChar = 0;
|
m_uniChar = WXK_NONE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user