Refactor wxKeyEvent copying code.
Avoid duplication between copy ctor and assignment operator. Also extract the assignment of everything not including the event type in a reusable function as this can be useful for key event generation code in wxGTK and possibly other ports. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69890 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1717,16 +1717,7 @@ public:
|
||||
// implicitly defined operator=() so need to do it this way:
|
||||
*static_cast<wxKeyboardState *>(this) = evt;
|
||||
|
||||
m_x = evt.m_x;
|
||||
m_y = evt.m_y;
|
||||
|
||||
m_keyCode = evt.m_keyCode;
|
||||
|
||||
m_rawCode = evt.m_rawCode;
|
||||
m_rawFlags = evt.m_rawFlags;
|
||||
#if wxUSE_UNICODE
|
||||
m_uniChar = evt.m_uniChar;
|
||||
#endif
|
||||
DoAssignMembers(evt);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -1748,6 +1739,22 @@ public:
|
||||
wxUint32 m_rawFlags;
|
||||
|
||||
private:
|
||||
// Copy only the event data present in this class, this is used by
|
||||
// AssignKeyData() and copy ctor.
|
||||
void DoAssignMembers(const wxKeyEvent& evt)
|
||||
{
|
||||
m_x = evt.m_x;
|
||||
m_y = evt.m_y;
|
||||
|
||||
m_keyCode = evt.m_keyCode;
|
||||
|
||||
m_rawCode = evt.m_rawCode;
|
||||
m_rawFlags = evt.m_rawFlags;
|
||||
#if wxUSE_UNICODE
|
||||
m_uniChar = evt.m_uniChar;
|
||||
#endif
|
||||
}
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxKeyEvent)
|
||||
};
|
||||
|
||||
|
@@ -741,16 +741,7 @@ wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt)
|
||||
: wxEvent(evt),
|
||||
wxKeyboardState(evt)
|
||||
{
|
||||
m_x = evt.m_x;
|
||||
m_y = evt.m_y;
|
||||
|
||||
m_keyCode = evt.m_keyCode;
|
||||
m_rawCode = evt.m_rawCode;
|
||||
m_rawFlags = evt.m_rawFlags;
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
m_uniChar = evt.m_uniChar;
|
||||
#endif
|
||||
DoAssignMembers(evt);
|
||||
}
|
||||
|
||||
bool wxKeyEvent::IsKeyInCategory(int category) const
|
||||
|
Reference in New Issue
Block a user