Added wxKeyEvent ctor for creating event of the different type for same key.

This is useful for implementation code in a couple of ports so provide a
higher level ctor doing this instead of having to use a copy ctor and then
manually changing the event type.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2011-12-02 00:50:19 +00:00
parent dfc7216da7
commit e45d90901d
2 changed files with 14 additions and 0 deletions

View File

@ -1661,7 +1661,12 @@ class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent,
{
public:
wxKeyEvent(wxEventType keyType = wxEVT_NULL);
// Normal copy ctor and a ctor creating a new event for the same key as the
// given one but a different event type (this is used in implementation
// code only, do not use outside of the library).
wxKeyEvent(const wxKeyEvent& evt);
wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt);
// get the key code: an ASCII7 char or an element of wxKeyCode enum
int GetKeyCode() const { return (int)m_keyCode; }

View File

@ -744,6 +744,15 @@ wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt)
DoAssignMembers(evt);
}
wxKeyEvent::wxKeyEvent(wxEventType eventType, const wxKeyEvent& evt)
: wxEvent(evt),
wxKeyboardState(evt)
{
DoAssignMembers(evt);
m_eventType = eventType;
}
bool wxKeyEvent::IsKeyInCategory(int category) const
{
switch ( GetKeyCode() )