#define _WX_EVENT_H__
#include "wx/defs.h"
+#include "wx/cpp.h"
#include "wx/object.h"
#include "wx/clntdata.h"
#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
wxEventTableEntry(type, winid, idLast, fn, obj)
-#define EMPTY_PARAMETER_VALUE /* Fake macro parameter value */
-
#define BEGIN_DECLARE_EVENT_TYPES()
#define END_DECLARE_EVENT_TYPES()
#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
#define DECLARE_EVENT_TYPE(name, value) \
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
#define DECLARE_LOCAL_EVENT_TYPE(name, value) \
- DECLARE_EXPORTED_EVENT_TYPE(EMPTY_PARAMETER_VALUE, name, value)
+ DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value)
#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403)
DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404)
DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405)
- DECLARE_EVENT_TYPE(wxEVT_POWER, 406)
+ // 406..408 are power events
DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409)
DECLARE_EVENT_TYPE(wxEVT_CREATE, 410)
DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411)
DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413)
DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414)
DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415)
- DECLARE_EVENT_TYPE(wxEVT_PAINT, 416)
- DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 417)
- DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 418)
- DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 419)
- DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 420)
- DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 421)
- DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 422)
- // DECLARE_EVENT_TYPE(wxEVT_POPUP_MENU_INIT, 423) -- free slot
+ DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST, 416)
+ DECLARE_EVENT_TYPE(wxEVT_PAINT, 417)
+ DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 418)
+ DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 419)
+ DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 420)
+ DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 421)
+ DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 422)
+ DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 423)
DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424)
DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425)
DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426)
DECLARE_EVENT_TYPE(wxEVT_SIZING, 441)
DECLARE_EVENT_TYPE(wxEVT_MOVING, 442)
DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443)
+ // more power events follow -- see wx/power.h
+
+ // Clipboard events
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445)
+ DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446)
// Generic command events
// Note: a click is a higher-level event than button down/up
long GetExtraLong() const { return m_extraLong; }
void SetInt(int i) { m_commandInt = i; }
- long GetInt() const { return m_commandInt; }
+ int GetInt() const { return m_commandInt; }
virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
// Get Y position
wxCoord GetY() const { return m_y; }
+#if WXWIN_COMPATIBILITY_2_6
// deprecated, Use GetKeyCode instead.
wxDEPRECATED( long KeyCode() const );
+#endif // WXWIN_COMPATIBILITY_2_6
virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
g_isPainting++;
}
- ~wxPaintEvent()
+ virtual ~wxPaintEvent()
{
g_isPainting--;
}
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent)
};
+/*
+ wxEVT_MOUSE_CAPTURE_LOST
+ The window losing the capture receives this message, unless it released it
+ it itself or unless wxWindow::CaptureMouse was called on another window
+ (and so capture will be restored when the new capturer releases it).
+ */
+
+class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent
+{
+public:
+ wxMouseCaptureLostEvent(wxWindowID winid = 0)
+ : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST)
+ {}
+
+ wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event)
+ : wxEvent(event)
+ {}
+
+ virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); }
+
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent)
+};
+
/*
wxEVT_DISPLAY_CHANGED
*/
class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent
{
public:
+ // how was this help event generated?
+ enum Origin
+ {
+ Origin_Unknown, // unrecognized event source
+ Origin_Keyboard, // event generated from F1 key press
+ Origin_HelpButton // event from [?] button on the title bar (Windows)
+ };
+
wxHelpEvent(wxEventType type = wxEVT_NULL,
wxWindowID winid = 0,
- const wxPoint& pt = wxDefaultPosition)
+ const wxPoint& pt = wxDefaultPosition,
+ Origin origin = Origin_Unknown)
: wxCommandEvent(type, winid),
- m_pos(pt), m_target(), m_link()
+ m_pos(pt),
+ m_origin(GuessOrigin(origin))
{ }
wxHelpEvent(const wxHelpEvent & event)
: wxCommandEvent(event),
m_pos(event.m_pos),
m_target(event.m_target),
- m_link(event.m_link)
+ m_link(event.m_link),
+ m_origin(event.m_origin)
{ }
// Position of event (in screen coordinates)
virtual wxEvent *Clone() const { return new wxHelpEvent(*this); }
+ // optional indication of the event source
+ Origin GetOrigin() const { return m_origin; }
+ void SetOrigin(Origin origin) { m_origin = origin; }
+
protected:
wxPoint m_pos;
wxString m_target;
wxString m_link;
+ Origin m_origin;
+
+ // we can try to guess the event origin ourselves, even if none is
+ // specified in the ctor
+ static Origin GuessOrigin(Origin origin);
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent)
};
+// A Clipboard Text event is sent when a window intercepts text copy/cut/paste
+// message, i.e. the user has cut/copied/pasted data from/into a text control
+// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.
+// NOTE : under windows these events are *NOT* generated automatically
+// for a Rich Edit text control.
+/*
+wxEVT_COMMAND_TEXT_COPY
+wxEVT_COMMAND_TEXT_CUT
+wxEVT_COMMAND_TEXT_PASTE
+*/
+
+class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent
+{
+public:
+ wxClipboardTextEvent(wxEventType type = wxEVT_NULL,
+ wxWindowID winid = 0)
+ : wxCommandEvent(type, winid)
+ { }
+ wxClipboardTextEvent(const wxClipboardTextEvent & event)
+ : wxCommandEvent(event)
+ { }
+
+ virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); }
+
+private:
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent)
+};
+
// A Context event is sent when the user right clicks on a window or
// presses Shift-F10
// NOTE : Under windows this is a repackaged WM_CONTETXMENU message
#endif // wxUSE_GUI
/* TODO
- wxEVT_POWER,
wxEVT_MOUSE_CAPTURE_CHANGED,
wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
// add an event to be processed later
void AddPendingEvent(wxEvent& event);
- // process all pending events
void ProcessPendingEvents();
#if wxUSE_THREADS
typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
+typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&);
+typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&);
// these typedefs don't have the same name structure as the others, keep for
// backwards compatibility only
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func)
#define wxMouseCaptureChangedEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func)
+#define wxMouseCaptureLostEventHandler(func) \
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureLostEventFunction, &func)
+#define wxClipboardTextEventHandler(func) \
+ (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxClipboardTextEventFunction, &func)
#endif // wxUSE_GUI
#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func))
#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func))
#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func))
+#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func))
// Mouse events
#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func))
EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
EVT_COMMAND_SCROLL_CHANGED(winid, func)
-// compatibility macros for the old name, to be deprecated in 2.8
-#define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED
-#define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED
-#define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED
+#if WXWIN_COMPATIBILITY_2_6
+ // compatibility macros for the old name, deprecated in 2.8
+ #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED
+ #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED
+ #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED
+#endif // WXWIN_COMPATIBILITY_2_6
// Convenience macros for commonly-used commands
#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func))
#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
+// Clipboard text Events
+#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_CUT, winid, wxClipboardTextEventHandler(func))
+#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func))
+#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func))
+
// ----------------------------------------------------------------------------
// Global data
// ----------------------------------------------------------------------------
#endif // wxUSE_GUI
#endif // _WX_EVENT_H__
-