m_propagationLevel = propagationLevel;
}
+#if WXWIN_COMPATIBILITY_2_4
public:
+#else
+protected:
+#endif
wxObject* m_eventObject;
wxEventType m_eventType;
long m_timeStamp;
int m_id;
+
+public:
+ // m_callbackUserData is for internal usage only
wxObject* m_callbackUserData;
protected:
// backwards compatibility as it is new
int m_propagationLevel;
+#if WXWIN_COMPATIBILITY_2_4
public:
+#else
+protected:
+#endif
bool m_skipped;
bool m_isCommandEvent;
wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
*/
+#if WXWIN_COMPATIBILITY_2_4
+// Backwards compatibility for wxCommandEvent::m_commandString, will lead to compilation errors in some cases of usage
+class WXDLLIMPEXP_CORE wxCommandEvent;
+
+class WXDLLIMPEXP_CORE wxCommandEventStringHelper
+{
+public:
+ wxCommandEventStringHelper(wxCommandEvent * evt)
+ : m_evt(evt)
+ { }
+
+ void operator=(const wxString &str);
+ operator wxString();
+ const wxChar* c_str() const;
+
+private:
+ wxCommandEvent* m_evt;
+};
+#endif
+
+#ifdef __VISUALC__
+ // 'this' : used in base member initializer list (for m_commandString)
+ #pragma warning(disable:4355)
+#endif
+
class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent
{
public:
wxCommandEvent(const wxCommandEvent& event)
: wxEvent(event),
- m_commandString(event.m_commandString),
+#if WXWIN_COMPATIBILITY_2_4
+ m_commandString(this),
+#endif
+ m_cmdString(event.m_cmdString),
m_commandInt(event.m_commandInt),
m_extraLong(event.m_extraLong),
m_clientData(event.m_clientData),
int GetSelection() const { return m_commandInt; }
// Set/Get listbox/choice selection string
- void SetString(const wxString& s) { m_commandString = s; }
- wxString GetString() const { return m_commandString; }
+ void SetString(const wxString& s) { m_cmdString = s; }
+ wxString GetString() const;
// Get checkbox value
bool IsChecked() const { return m_commandInt != 0; }
virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
+#if WXWIN_COMPATIBILITY_2_4
public:
- wxString m_commandString; // String event argument
+ wxCommandEventStringHelper m_commandString;
+#else
+protected:
+#endif
+ wxString m_cmdString; // String event argument
int m_commandInt;
long m_extraLong; // Additional information (e.g. select/deselect)
void* m_clientData; // Arbitrary client data
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent)
};
+#ifdef __VISUALC__
+ #pragma warning(default:4355)
+#endif
+
+#if WXWIN_COMPATIBILITY_2_4
+inline void wxCommandEventStringHelper::operator=(const wxString &str)
+{
+ m_evt->SetString(str);
+}
+
+inline wxCommandEventStringHelper::operator wxString()
+{
+ return m_evt->GetString();
+}
+
+inline const wxChar* wxCommandEventStringHelper::c_str() const
+{
+ return m_evt->GetString().c_str();
+}
+#endif
+
// this class adds a possibility to react (from the user) code to a control
// notification: allow or veto the operation being reported.
class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent
virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); }
+#if WXWIN_COMPATIBILITY_2_4
public:
+#else
+protected:
+#endif
int m_commandInt;
long m_extraLong;
m_scanCode = evt.m_scanCode;
m_rawCode = evt.m_rawCode;
m_rawFlags = evt.m_rawFlags;
+#if wxUSE_UNICODE
+ m_uniChar = evt.m_uniChar;
+#endif
return *this;
}
virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
public:
+ // For internal usage only. Will be converted to protected members.
wxSize m_size;
wxRect m_rect; // Used for wxEVT_SIZING
virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
+#if WXWIN_COMPATIBILITY_2_4
+public:
+#else
+protected:
+#endif
wxPoint m_pos;
wxRect m_rect;
virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
+#if WXWIN_COMPATIBILITY_2_4
+public:
+#else
+protected:
+#endif
wxDC *m_dc;
private:
class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
{
+#if WXWIN_COMPATIBILITY_2_4
public:
+#else
+protected:
+#endif
wxPoint m_pos;
int m_zPosition;
int m_buttonChange; // Which button changed?
int m_buttonState; // Which buttons are down?
int m_joyStick; // Which joystick?
+public:
wxJoystickEvent(wxEventType type = wxEVT_NULL,
int state = 0,
int joystick = wxJOYSTICK1,
#define EVT_CUSTOM(event, winid, func) DECLARE_EVENT_TABLE_ENTRY( event, winid, wxID_ANY, (wxObjectEventFunction) wxStaticCastEvent( wxEventFunction, & func ), (wxObject *) NULL ),
#define EVT_CUSTOM_RANGE(event, id1, id2, func) DECLARE_EVENT_TABLE_ENTRY( event, id1, id2, (wxObjectEventFunction) wxStaticCastEvent( wxEventFunction, & func ), (wxObject *) NULL ),
+// EVT_COMMAND
+#define EVT_COMMAND(winid, event, fn) DECLARE_EVENT_TABLE_ENTRY( event, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), (wxObject *) NULL ),
+#define EVT_COMMAND_RANGE(id1, id2, event, fn) DECLARE_EVENT_TABLE_ENTRY( event, id1, id2, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), (wxObject *) NULL ),
+
+#define EVT_NOTIFY(event, winid, func) DECLARE_EVENT_TABLE_ENTRY( event, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) wxStaticCastEvent( wxNotifyFunction, & func ), (wxObject *) NULL ),
+#define EVT_NOTIFY_RANGE(event, id1, id2, func) DECLARE_EVENT_TABLE_ENTRY( event, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) wxStaticCastEvent( wxNotifyFunction, & func ), (wxObject *) NULL ),
+
// Miscellaneous
#define EVT_SIZE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SIZE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSizeEventFunction, & func ), (wxObject *) NULL ),
#define EVT_SIZING(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SIZING, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxSizeEventFunction, & func ), (wxObject *) NULL ),
DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEAVE_WINDOW, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMouseEventFunction, & func ), (wxObject *) NULL ),\
DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSEWHEEL, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxMouseEventFunction, & func ), (wxObject *) NULL ),
-// EVT_COMMAND
-#define EVT_COMMAND(winid, event, fn) DECLARE_EVENT_TABLE_ENTRY( event, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), (wxObject *) NULL ),
-#define EVT_COMMAND_RANGE(id1, id2, event, fn) DECLARE_EVENT_TABLE_ENTRY( event, id1, id2, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxCommandEventFunction, & fn ), (wxObject *) NULL ),
-
// Scrolling from wxWindow (sent to wxScrolledWindow)
#define EVT_SCROLLWIN(func) \
DECLARE_EVENT_TABLE_ENTRY( wxEVT_SCROLLWIN_TOP, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxScrollWinEventFunction, & func ), (wxObject *) NULL ),\