const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGED = wxEVT_FIRST + 611;
const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGING = wxEVT_FIRST + 612;
const wxEventType wxEVT_COMMAND_TREE_KEY_DOWN = wxEVT_FIRST + 613;
+const wxEventType wxEVT_COMMAND_TREE_ITEM_ACTIVATED = wxEVT_FIRST + 614;
/* List control event types */
const wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG = wxEVT_FIRST + 700;
const wxEventType wxEVT_COMMAND_LIST_KEY_DOWN = wxEVT_FIRST + 710;
const wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM = wxEVT_FIRST + 711;
const wxEventType wxEVT_COMMAND_LIST_COL_CLICK = wxEVT_FIRST + 712;
+const wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = wxEVT_FIRST + 713;
+const wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = wxEVT_FIRST + 714;
+const wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED = wxEVT_FIRST + 715;
/* Tab and notebook control event types */
const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED = wxEVT_FIRST + 800;
const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED = wxEVT_FIRST + 802;
const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING = wxEVT_FIRST + 803;
+const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000;
+
// Compatibility
#if WXWIN_COMPATIBILITY
wxEVT_COMMAND_COMBOBOX_SELECTED
*/
+class WXDLLEXPORT wxClientData;
+
class WXDLLEXPORT wxCommandEvent: public wxEvent
{
DECLARE_DYNAMIC_CLASS(wxCommandEvent)
*
*/
- // Set/Get listbox/choice client data
- inline void SetClientData(char* clientData) { m_clientData = clientData; }
- inline char *GetClientData() const { return m_clientData; }
+ // Set/Get client data from controls
+ inline void SetClientData(void* clientData) { m_clientData = clientData; }
+ inline void *GetClientData() const { return m_clientData; }
+
+ // Set/Get client object from controls
+ inline void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
+ inline void *GetClientObject() const { return m_clientObject; }
// Get listbox selection if single-choice
inline int GetSelection() const { return m_commandInt; }
public:
char* m_commandString; // String event argument
int m_commandInt;
- long m_extraLong; // Additional information (e.g. select/deselect)
- char* m_clientData; // Arbitrary client data
+ long m_extraLong; // Additional information (e.g. select/deselect)
+ void* m_clientData; // Arbitrary client data
+ wxClientData* m_clientObject; // Arbitrary client object
+};
+
+// this class adds a possibility to react (from the user) code to a control
+// notification: allow or veto the operation being reported.
+class WXDLLEXPORT wxNotifyEvent : public wxCommandEvent
+{
+public:
+ wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
+ : wxCommandEvent(commandType, id) { m_bAllow = TRUE; }
+
+ // veto the operation (by default it's allowed)
+ void Veto() { m_bAllow = FALSE; }
+
+ // for implementation code only: is the operation allowed?
+ bool IsAllowed() const { return m_bAllow; }
+
+private:
+ bool m_bAllow;
+
+ DECLARE_DYNAMIC_CLASS(wxNotifyEvent)
};
// Scroll event class
inline bool RightIsDown(void) const { return m_rightDown; }
// True if a button is down and the mouse is moving
- inline bool Dragging(void) const { return ((m_eventType == wxEVENT_TYPE_MOTION) && (LeftIsDown() || MiddleIsDown() || RightIsDown())); }
+ inline bool Dragging(void) const { return ((m_eventType == wxEVT_MOTION) && (LeftIsDown() || MiddleIsDown() || RightIsDown())); }
// True if the mouse is moving, and no button is down
inline bool Moving(void) const { return (m_eventType == wxEVT_MOTION); }
public:
inline wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0)
- { m_eventType = type; m_sessionEnding = TRUE; m_loggingOff = TRUE; m_veto = FALSE;
- m_id = id; m_force = FALSE; }
+ { m_eventType = type; m_loggingOff = TRUE; m_veto = FALSE;
+ m_id = id; m_force = FALSE; m_canVeto = FALSE; }
- inline bool GetSessionEnding(void) const { return m_sessionEnding; }
+ inline void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
inline bool GetLoggingOff(void) const { return m_loggingOff; }
inline void Veto(bool veto = TRUE) { m_veto = veto; }
+ inline void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
+ inline bool CanVeto() const { return m_canVeto; }
inline bool GetVeto(void) const { return m_veto; }
+
+ // This is probably obsolete now, since we use CanVeto instead, in
+ // both OnCloseWindow and OnQueryEndSession.
+ // m_force == ! m_canVeto i.e., can't veto means we must force it to close.
inline void SetForce(bool force) { m_force = force; }
inline bool GetForce(void) const { return m_force; }
protected:
- bool m_sessionEnding;
bool m_loggingOff;
bool m_veto;
bool m_force;
-
+ bool m_canVeto;
};
/*
// the child which has the focus currently (may be NULL - use
// wxWindow::FindFocus then)
wxWindow* GetCurrentFocus() const { return (wxWindow *)m_clientData; }
- void SetCurrentFocus(wxWindow *win) { m_clientData = (char *)win; }
+ void SetCurrentFocus(wxWindow *win) { m_clientData = (void *)win; }
};
/* TODO
virtual bool OnClose(void);
- inline char *GetClientData(void) const { return m_clientData; }
- inline void SetClientData(char *clientData) { m_clientData = clientData; }
-
virtual bool ProcessEvent(wxEvent& event);
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
protected:
wxEvtHandler* m_nextHandler;
wxEvtHandler* m_previousHandler;
- char* m_clientData; // Any user client data
bool m_enabled; // Is event handler enabled?
wxList* m_dynamicEvents;
const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
#define END_EVENT_TABLE() \
- { 0, 0, 0, 0 } };
+ { 0, 0, 0, 0, 0 } };
/*
* Event table macros
#define EVT_SIZE(func) { wxEVT_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSizeEventFunction) & func, (wxObject *) NULL },
#define EVT_MOVE(func) { wxEVT_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMoveEventFunction) & func, (wxObject *) NULL },
#define EVT_CLOSE(func) { wxEVT_CLOSE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL },
+#define EVT_END_SESSION(func) { wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL },
+#define EVT_QUERY_END_SESSION(func) { wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL },
#define EVT_PAINT(func) { wxEVT_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL },
#define EVT_ERASE_BACKGROUND(func) { wxEVT_ERASE_BACKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction) & func, (wxObject *) NULL },
#define EVT_CHAR(func) { wxEVT_CHAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL },
// EVT_COMMAND
#define EVT_COMMAND(id, cmd, fn) { cmd, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
-#define EVT_COMMAND_RANGE(id1, id2, cmd, fn) { cmd, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, N(wxObject *) ULL },
+#define EVT_COMMAND_RANGE(id1, id2, cmd, fn) { cmd, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL },
// Scrolling
#define EVT_SCROLL(func) \