fixes for wxEvent and wxKeyEvent operator=()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12482 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-11-18 23:08:00 +00:00
parent 14fca7389a
commit f97500b80d

View File

@@ -372,6 +372,9 @@ public:
bool m_isCommandEvent; bool m_isCommandEvent;
private: private:
// normally copying the events is a bad idea, so disable this
wxEvent& operator=(const wxEvent&);
DECLARE_ABSTRACT_CLASS(wxEvent) DECLARE_ABSTRACT_CLASS(wxEvent)
}; };
@@ -440,7 +443,7 @@ public:
long m_extraLong; // Additional information (e.g. select/deselect) long m_extraLong; // Additional information (e.g. select/deselect)
void* m_clientData; // Arbitrary client data void* m_clientData; // Arbitrary client data
wxClientData* m_clientObject; // Arbitrary client object wxClientData* m_clientObject; // Arbitrary client object
private: private:
DECLARE_DYNAMIC_CLASS(wxCommandEvent) DECLARE_DYNAMIC_CLASS(wxCommandEvent)
}; };
@@ -494,9 +497,9 @@ public:
int GetPosition() const { return m_commandInt ; } int GetPosition() const { return m_commandInt ; }
void SetOrientation(int orient) { m_extraLong = (long) orient; } void SetOrientation(int orient) { m_extraLong = (long) orient; }
void SetPosition(int pos) { m_commandInt = pos; } void SetPosition(int pos) { m_commandInt = pos; }
virtual wxEvent *Clone() const { return new wxScrollEvent(*this); } virtual wxEvent *Clone() const { return new wxScrollEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxScrollEvent) DECLARE_DYNAMIC_CLASS(wxScrollEvent)
}; };
@@ -743,11 +746,11 @@ public:
bool HasCursor() const { return m_cursor.Ok(); } bool HasCursor() const { return m_cursor.Ok(); }
virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); } virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); }
private: private:
wxCoord m_x, m_y; wxCoord m_x, m_y;
wxCursor m_cursor; wxCursor m_cursor;
private: private:
DECLARE_DYNAMIC_CLASS(wxSetCursorEvent) DECLARE_DYNAMIC_CLASS(wxSetCursorEvent)
}; };
@@ -808,7 +811,25 @@ public:
long KeyCode() const { return m_keyCode; } long KeyCode() const { return m_keyCode; }
virtual wxEvent *Clone() const { return new wxKeyEvent(*this); } virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
// we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
// example)
wxKeyEvent& operator=(const wxKeyEvent& evt)
{
m_x = evt.m_x;
m_y = evt.m_y;
m_keyCode = evt.m_keyCode;
m_controlDown = evt.m_controlDown;
m_shiftDown = evt.m_shiftDown;
m_altDown = evt.m_altDown;
m_metaDown = evt.m_metaDown;
m_scanCode = evt.m_scanCode;
return *this;
}
public: public:
wxCoord m_x, m_y; wxCoord m_x, m_y;
@@ -819,7 +840,7 @@ public:
bool m_altDown; bool m_altDown;
bool m_metaDown; bool m_metaDown;
bool m_scanCode; bool m_scanCode;
private: private:
DECLARE_DYNAMIC_CLASS(wxKeyEvent) DECLARE_DYNAMIC_CLASS(wxKeyEvent)
}; };
@@ -844,7 +865,7 @@ public:
public: public:
wxSize m_size; wxSize m_size;
private: private:
DECLARE_DYNAMIC_CLASS(wxSizeEvent) DECLARE_DYNAMIC_CLASS(wxSizeEvent)
}; };
@@ -865,9 +886,9 @@ public:
wxPoint GetPosition() const { return m_pos; } wxPoint GetPosition() const { return m_pos; }
virtual wxEvent *Clone() const { return new wxMoveEvent(*this); } virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
wxPoint m_pos; wxPoint m_pos;
private: private:
DECLARE_DYNAMIC_CLASS(wxMoveEvent) DECLARE_DYNAMIC_CLASS(wxMoveEvent)
}; };
@@ -906,7 +927,7 @@ public:
#endif // debug #endif // debug
virtual wxEvent *Clone() const { return new wxPaintEvent(*this); } virtual wxEvent *Clone() const { return new wxPaintEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxPaintEvent) DECLARE_DYNAMIC_CLASS(wxPaintEvent)
}; };
@@ -915,7 +936,7 @@ class WXDLLEXPORT wxNcPaintEvent : public wxEvent
{ {
public: public:
wxNcPaintEvent(int id = 0) : wxEvent(id) { SetEventType(wxEVT_NC_PAINT); } wxNcPaintEvent(int id = 0) : wxEvent(id) { SetEventType(wxEVT_NC_PAINT); }
virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); } virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); }
private: private:
@@ -932,11 +953,11 @@ class WXDLLEXPORT wxEraseEvent : public wxEvent
public: public:
wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL) wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL)
{ m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; } { m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; }
wxDC *GetDC() const { return m_dc; } wxDC *GetDC() const { return m_dc; }
virtual wxEvent *Clone() const { return new wxEraseEvent(*this); } virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
wxDC *m_dc; wxDC *m_dc;
private: private:
@@ -962,7 +983,7 @@ public:
void SetWindow(wxWindow *win) { m_win = win; } void SetWindow(wxWindow *win) { m_win = win; }
virtual wxEvent *Clone() const { return new wxFocusEvent(*this); } virtual wxEvent *Clone() const { return new wxFocusEvent(*this); }
private: private:
wxWindow *m_win; wxWindow *m_win;
@@ -980,7 +1001,7 @@ public:
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); } virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxChildFocusEvent) DECLARE_DYNAMIC_CLASS(wxChildFocusEvent)
}; };
@@ -996,7 +1017,7 @@ class WXDLLEXPORT wxActivateEvent : public wxEvent
public: public:
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0) wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0)
{ m_eventType = type; m_active = active; m_id = Id; } { m_eventType = type; m_active = active; m_id = Id; }
bool GetActive() const { return m_active; } bool GetActive() const { return m_active; }
virtual wxEvent *Clone() const { return new wxActivateEvent(*this); } virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
@@ -1020,8 +1041,8 @@ public:
{ m_eventType = wxEVT_INIT_DIALOG; m_id = Id; } { m_eventType = wxEVT_INIT_DIALOG; m_id = Id; }
virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); } virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxInitDialogEvent) DECLARE_DYNAMIC_CLASS(wxInitDialogEvent)
}; };
@@ -1042,10 +1063,10 @@ public:
int GetMenuId() const { return m_menuId; } int GetMenuId() const { return m_menuId; }
virtual wxEvent *Clone() const { return new wxMenuEvent(*this); } virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
private: private:
int m_menuId; int m_menuId;
private: private:
DECLARE_DYNAMIC_CLASS(wxMenuEvent) DECLARE_DYNAMIC_CLASS(wxMenuEvent)
}; };
@@ -1147,7 +1168,7 @@ public:
bool Iconized() const { return m_iconized; } bool Iconized() const { return m_iconized; }
virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); } virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
protected: protected:
bool m_iconized; bool m_iconized;
@@ -1165,7 +1186,7 @@ public:
{ m_eventType = wxEVT_MAXIMIZE; m_id = id; } { m_eventType = wxEVT_MAXIMIZE; m_id = id; }
virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); } virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxMaximizeEvent) DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
}; };
@@ -1249,7 +1270,7 @@ public:
((m_buttonState & but) == but)); } ((m_buttonState & but) == but)); }
virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); } virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxJoystickEvent) DECLARE_DYNAMIC_CLASS(wxJoystickEvent)
}; };
@@ -1276,7 +1297,7 @@ public:
wxString *GetFiles() const { return m_files; } wxString *GetFiles() const { return m_files; }
virtual wxEvent *Clone() const { wxFAIL_MSG("error"); return NULL; } virtual wxEvent *Clone() const { wxFAIL_MSG("error"); return NULL; }
private: private:
DECLARE_DYNAMIC_CLASS(wxDropFilesEvent) DECLARE_DYNAMIC_CLASS(wxDropFilesEvent)
}; };
@@ -1321,7 +1342,7 @@ protected:
bool m_setText; bool m_setText;
bool m_setChecked; bool m_setChecked;
wxString m_text; wxString m_text;
private: private:
DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent) DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent)
}; };
@@ -1336,9 +1357,9 @@ class WXDLLEXPORT wxSysColourChangedEvent : public wxEvent
public: public:
wxSysColourChangedEvent() wxSysColourChangedEvent()
{ m_eventType = wxEVT_SYS_COLOUR_CHANGED; } { m_eventType = wxEVT_SYS_COLOUR_CHANGED; }
virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); } virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent) DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
}; };
@@ -1387,7 +1408,7 @@ public:
protected: protected:
bool m_paletteRealized; bool m_paletteRealized;
private: private:
DECLARE_DYNAMIC_CLASS(wxQueryNewPaletteEvent) DECLARE_DYNAMIC_CLASS(wxQueryNewPaletteEvent)
}; };
@@ -1467,9 +1488,9 @@ public:
wxWindowCreateEvent(wxWindow *win = NULL); wxWindowCreateEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); } virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); }
private: private:
DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent) DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent)
}; };
@@ -1480,7 +1501,7 @@ public:
wxWindowDestroyEvent(wxWindow *win = NULL); wxWindowDestroyEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); } virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); }
private: private:
@@ -1518,7 +1539,7 @@ public:
void SetTarget(const wxString& target) { m_target = target; } void SetTarget(const wxString& target) { m_target = target; }
virtual wxEvent *Clone() const { return new wxHelpEvent(*this); } virtual wxEvent *Clone() const { return new wxHelpEvent(*this); }
protected: protected:
wxPoint m_pos; wxPoint m_pos;
wxString m_target; wxString m_target;
@@ -1553,7 +1574,7 @@ public:
void SetPosition(const wxPoint& pos) { m_pos = pos; } void SetPosition(const wxPoint& pos) { m_pos = pos; }
virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); } virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); }
protected: protected:
wxPoint m_pos; wxPoint m_pos;
@@ -1579,7 +1600,7 @@ public:
protected: protected:
bool m_requestMore; bool m_requestMore;
private: private:
DECLARE_DYNAMIC_CLASS(wxIdleEvent) DECLARE_DYNAMIC_CLASS(wxIdleEvent)
}; };