DECLARE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT, 423)
DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424)
DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425)
- DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 426)
- DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 427)
- DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 428)
- DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 429)
- DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 430)
- DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 431)
- DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 432)
- DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 433)
- DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 434)
- DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 435)
- DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 436)
- DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 437)
- DECLARE_EVENT_TYPE(wxEVT_IDLE, 438)
- DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 439)
+ DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426)
+ DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427)
+ DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428)
+ DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429)
+ DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430)
+ DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431)
+ DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432)
+ DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433)
+ DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434)
+ DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435)
+ DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436)
+ DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437)
+ DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438)
+ DECLARE_EVENT_TYPE(wxEVT_IDLE, 439)
+ DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
// Generic command events
// Note: a click is a higher-level event than button down/up
// exists only for optimization purposes.
bool IsCommandEvent() const { return m_isCommandEvent; }
- // specialized clone function since it is done a lot
- virtual wxEvent *Clone() const { return new wxEvent(*this); }
+ // this function is used to create a copy of the event polymorphically and
+ // all derived classes must implement it because otherwise wxPostEvent()
+ // for them wouldn't work (it needs to do a copy of the event)
+ virtual wxEvent *Clone() const = 0;
public:
wxObject* m_eventObject;
long m_extraLong; // Additional information (e.g. select/deselect)
void* m_clientData; // Arbitrary client data
wxClientData* m_clientObject; // Arbitrary client object
-
+
private:
DECLARE_DYNAMIC_CLASS(wxCommandEvent)
};
int GetPosition() const { return m_commandInt ; }
void SetOrientation(int orient) { m_extraLong = (long) orient; }
void SetPosition(int pos) { m_commandInt = pos; }
-
+
virtual wxEvent *Clone() const { return new wxScrollEvent(*this); }
-
+
private:
DECLARE_DYNAMIC_CLASS(wxScrollEvent)
};
bool HasCursor() const { return m_cursor.Ok(); }
virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); }
-
+
private:
wxCoord m_x, m_y;
wxCursor m_cursor;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxSetCursorEvent)
};
long KeyCode() const { return m_keyCode; }
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:
wxCoord m_x, m_y;
bool m_altDown;
bool m_metaDown;
bool m_scanCode;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxKeyEvent)
};
public:
wxSize m_size;
-private:
+private:
DECLARE_DYNAMIC_CLASS(wxSizeEvent)
};
wxPoint GetPosition() const { return m_pos; }
virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
-
+
wxPoint m_pos;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxMoveEvent)
};
#endif // debug
virtual wxEvent *Clone() const { return new wxPaintEvent(*this); }
-
+
private:
DECLARE_DYNAMIC_CLASS(wxPaintEvent)
};
{
public:
wxNcPaintEvent(int id = 0) : wxEvent(id) { SetEventType(wxEVT_NC_PAINT); }
-
+
virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); }
private:
public:
wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL)
{ m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; }
-
+
wxDC *GetDC() const { return m_dc; }
virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
-
+
wxDC *m_dc;
private:
void SetWindow(wxWindow *win) { m_win = win; }
virtual wxEvent *Clone() const { return new wxFocusEvent(*this); }
-
+
private:
wxWindow *m_win;
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
-
+
private:
DECLARE_DYNAMIC_CLASS(wxChildFocusEvent)
};
public:
wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0)
{ m_eventType = type; m_active = active; m_id = Id; }
-
+
bool GetActive() const { return m_active; }
virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
{ m_eventType = wxEVT_INIT_DIALOG; m_id = Id; }
virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
-
-private:
+
+private:
DECLARE_DYNAMIC_CLASS(wxInitDialogEvent)
};
int GetMenuId() const { return m_menuId; }
virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
-
+
private:
int m_menuId;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxMenuEvent)
};
bool Iconized() const { return m_iconized; }
virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
-
+
protected:
bool m_iconized;
{ m_eventType = wxEVT_MAXIMIZE; m_id = id; }
virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
-
+
private:
DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
};
((m_buttonState & but) == but)); }
virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
-
+
private:
DECLARE_DYNAMIC_CLASS(wxJoystickEvent)
};
public:
int m_noFiles;
wxPoint m_pos;
- wxString* m_files; // Memory (de)allocated by code calling ProcessEvent
+ wxString* m_files;
wxDropFilesEvent(wxEventType type = wxEVT_NULL,
int noFiles = 0,
wxString *files = (wxString *) NULL)
{ m_eventType = type; m_noFiles = noFiles; m_files = files; }
+ // we need a copy ctor to avoid deleting m_files pointer twice
+ wxDropFilesEvent(const wxDropFilesEvent& other)
+ : m_pos(other.m_pos)
+ {
+ m_noFiles = other.m_noFiles;
+ m_files = new wxString[m_noFiles];
+ for ( int n = 0; n < m_noFiles; n++ )
+ {
+ m_files[n] = other.m_files[n];
+ }
+ }
+
+ virtual ~wxDropFilesEvent()
+ {
+ delete [] m_files;
+ }
+
wxPoint GetPosition() const { return m_pos; }
int GetNumberOfFiles() const { return m_noFiles; }
wxString *GetFiles() const { return m_files; }
- virtual wxEvent *Clone() const { wxFAIL_MSG("error"); return NULL; }
-
+ virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); }
+
private:
DECLARE_DYNAMIC_CLASS(wxDropFilesEvent)
};
bool m_setText;
bool m_setChecked;
wxString m_text;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent)
};
public:
wxSysColourChangedEvent()
{ m_eventType = wxEVT_SYS_COLOUR_CHANGED; }
-
+
virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }
-
+
private:
DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
};
+/*
+ wxEVT_DISPLAY_CHANGED
+ */
+class WXDLLEXPORT wxDisplayChangedEvent : public wxEvent
+{
+private:
+ DECLARE_DYNAMIC_CLASS(wxDisplayChangedEvent)
+
+public:
+ wxDisplayChangedEvent()
+ { m_eventType = wxEVT_DISPLAY_CHANGED; }
+
+ virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); }
+};
+
/*
wxEVT_PALETTE_CHANGED
*/
protected:
bool m_paletteRealized;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxQueryNewPaletteEvent)
};
wxWindowCreateEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
-
+
virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); }
-
+
private:
DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent)
};
wxWindowDestroyEvent(wxWindow *win = NULL);
wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
-
+
virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); }
private:
void SetTarget(const wxString& target) { m_target = target; }
virtual wxEvent *Clone() const { return new wxHelpEvent(*this); }
-
+
protected:
wxPoint m_pos;
wxString m_target;
void SetPosition(const wxPoint& pos) { m_pos = pos; }
virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); }
-
+
protected:
wxPoint m_pos;
protected:
bool m_requestMore;
-
+
private:
DECLARE_DYNAMIC_CLASS(wxIdleEvent)
};
typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
typedef void (wxEvtHandler::*wxSysColourChangedFunction)(wxSysColourChangedEvent&);
+typedef void (wxEvtHandler::*wxDisplayChangedFunction)(wxDisplayChangedEvent&);
typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
#define EVT_DROP_FILES(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_DROP_FILES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDropFilesEventFunction) & func, (wxObject *) NULL ),
#define EVT_INIT_DIALOG(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_INIT_DIALOG, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxInitDialogEventFunction) & func, (wxObject *) NULL ),
#define EVT_SYS_COLOUR_CHANGED(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SYS_COLOUR_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSysColourChangedFunction) & func, (wxObject *) NULL ),
+#define EVT_DISPLAY_CHANGED(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_DISPLAY_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDisplayChangedFunction) & func, (wxObject *) NULL ),
#define EVT_SHOW(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, (wxObject *) NULL ),
#define EVT_MAXIMIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, (wxObject *) NULL ),
#define EVT_ICONIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, (wxObject *) NULL ),