#include "wx/defs.h"
#include "wx/object.h"
#include "wx/gdicmn.h"
+#if wxUSE_THREADS
+#include "wx/thread.h"
+#endif
/*
* Event types
const wxEventType wxEVT_KEY_UP = wxEVT_FIRST + 216;
/*
- * Scrollbar event identifiers
+ * wxScrollbar and wxSlider event identifiers
*/
const wxEventType wxEVT_SCROLL_TOP = wxEVT_FIRST + 300;
const wxEventType wxEVT_SCROLL_BOTTOM = wxEVT_FIRST + 301;
const wxEventType wxEVT_SCROLL_PAGEDOWN = wxEVT_FIRST + 305;
const wxEventType wxEVT_SCROLL_THUMBTRACK = wxEVT_FIRST + 306;
+ /*
+ * Scroll events from wxWindow
+ */
+const wxEventType wxEVT_SCROLLWIN_TOP = wxEVT_FIRST + 320;
+const wxEventType wxEVT_SCROLLWIN_BOTTOM = wxEVT_FIRST + 321;
+const wxEventType wxEVT_SCROLLWIN_LINEUP = wxEVT_FIRST + 322;
+const wxEventType wxEVT_SCROLLWIN_LINEDOWN = wxEVT_FIRST + 323;
+const wxEventType wxEVT_SCROLLWIN_PAGEUP = wxEVT_FIRST + 324;
+const wxEventType wxEVT_SCROLLWIN_PAGEDOWN = wxEVT_FIRST + 325;
+const wxEventType wxEVT_SCROLLWIN_THUMBTRACK = wxEVT_FIRST + 326;
+
+ /*
+ * System events
+ */
const wxEventType wxEVT_SIZE = wxEVT_FIRST + 400;
const wxEventType wxEVT_MOVE = wxEVT_FIRST + 401;
const wxEventType wxEVT_CLOSE_WINDOW = wxEVT_FIRST + 402;
// exists only for optimization purposes
bool IsCommandEvent() const { return m_isCommandEvent; }
+ void CopyObject(wxObject& object_dest) const;
+
public:
bool m_skipped;
wxObject* m_eventObject;
// Set/Get listbox/choice selection string
void SetString(const wxString& s) { m_commandString = s; }
- const wxString& GetString() const { return m_commandString; }
+ wxString GetString() const { return m_commandString; }
// Get checkbox value
bool Checked() const { return (m_commandInt != 0); }
void SetInt(int i) { m_commandInt = i; }
long GetInt() const { return m_commandInt ; }
+ void CopyObject(wxObject& obj) const;
+
public:
wxString m_commandString; // String event argument
int m_commandInt;
DECLARE_DYNAMIC_CLASS(wxNotifyEvent)
};
-// Scroll event class
+// Scroll event class, derived form wxCommandEvent. wxScrollEvents are
+// sent by wxSlider and wxScrollbar.
/*
wxEVT_SCROLL_TOP
wxEVT_SCROLL_BOTTOM
void SetPosition(int pos) { m_commandInt = pos; }
};
+// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
+// are sent by wxWindow.
+/*
+ wxEVT_SCROLLWIN_TOP
+ wxEVT_SCROLLWIN_BOTTOM
+ wxEVT_SCROLLWIN_LINEUP
+ wxEVT_SCROLLWIN_LINEDOWN
+ wxEVT_SCROLLWIN_PAGEUP
+ wxEVT_SCROLLWIN_PAGEDOWN
+ wxEVT_SCROLLWIN_THUMBTRACK
+*/
+
+class WXDLLEXPORT wxScrollWinEvent : public wxEvent
+{
+ DECLARE_DYNAMIC_CLASS(wxScrollWinEvent)
+
+public:
+ wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
+ int pos = 0, int orient = 0);
+ ~wxScrollWinEvent() {}
+
+ /*
+ * Accessors
+ */
+
+ int GetOrientation() const { return (int) m_extraLong ; }
+ int GetPosition() const { return m_commandInt ; }
+ void SetOrientation(int orient) { m_extraLong = (long) orient; }
+ void SetPosition(int pos) { m_commandInt = pos; }
+
+public:
+ int m_commandInt; // Additional information
+ long m_extraLong;
+};
+
// Mouse event class
/*
// Get Y position
long GetY() const { return m_y; }
+ void CopyObject(wxObject& obj) const;
+
public:
long m_x;
long m_y;
// Get Y position
long GetY() const { return m_y; }
+ void CopyObject(wxObject& obj) const;
+
public:
long m_x;
long m_y;
bool m_shiftDown;
bool m_altDown;
bool m_metaDown;
+ bool m_scanCode;
};
// Size event class
{ m_eventType = wxEVT_SIZE; m_id = id; }
wxSize GetSize() const { return m_size; }
+
+ void CopyObject(wxObject& obj) const;
};
// Move event class
{ m_eventType = wxEVT_MOVE; m_id = id; }
wxPoint GetPosition() const { return m_pos; }
+
+ void CopyObject(wxObject& obj) const;
};
// Paint event class
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; }
+
+ void CopyObject(wxObject& obj) const;
};
// Focus event class
{ m_eventType = type; m_active = active; m_id = Id; }
bool GetActive() const { return m_active; }
+ void CopyObject(wxObject& obj) const;
+
private:
bool m_active;
};
DECLARE_DYNAMIC_CLASS(wxMenuEvent)
public:
- wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0)
- { m_eventType = type; m_menuId = id; }
+ wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0)
+ { m_eventType = type; m_menuId = id; }
- int GetMenuId() const { return m_menuId; }
+ int GetMenuId() const { return m_menuId; }
+ void CopyObject(wxObject& obj) const;
private:
- int m_menuId;
+ int m_menuId;
};
// Window close or session close event class
{
// GetVeto() will return FALSE anyhow...
wxCHECK_RET( m_canVeto,
- "call to Veto() ignored (can't veto this event)" );
+ _T("call to Veto() ignored (can't veto this event)") );
m_veto = veto;
}
bool GetForce() const { return m_force; }
#endif
+ void CopyObject(wxObject& obj) const;
+
protected:
bool m_loggingOff;
bool m_veto, m_canVeto;
void SetShow(bool show) { m_show = show; }
bool GetShow() const { return m_show; }
+ void CopyObject(wxObject& obj) const;
+
protected:
bool m_show;
};
bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
{ return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
((m_buttonState & but) == but)); }
+
+ void CopyObject(wxObject& obj) const;
};
// Drop files event class
wxPoint GetPosition() const { return m_pos; }
int GetNumberOfFiles() const { return m_noFiles; }
wxString *GetFiles() const { return m_files; }
+
+ void CopyObject(wxObject& obj) const;
};
// Idle event
void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; }
bool MoreRequested() const { return m_requestMore; }
+ void CopyObject(wxObject& obj) const;
+
protected:
bool m_requestMore;
};
void Enable(bool enable) { m_enabled = enable; m_setEnabled = TRUE; }
void SetText(const wxString& text) { m_text = text; m_setText = TRUE; }
+ void CopyObject(wxObject& obj) const;
+
protected:
bool m_checked;
bool m_enabled;
void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
wxWindow* GetChangedWindow() const { return m_changedWindow; }
+ void CopyObject(wxObject& obj) const;
+
protected:
wxWindow* m_changedWindow;
};
void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
bool GetPaletteRealized() const { return m_paletteRealized; }
+ void CopyObject(wxObject& obj) const;
+
protected:
bool m_paletteRealized;
};
virtual bool OnClose();
#endif
+#if wxUSE_THREADS
+ bool ProcessThreadEvent(wxEvent& event);
+ void ProcessPendingEvents();
+#endif
virtual bool ProcessEvent(wxEvent& event);
virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
bool SearchDynamicEventTable( wxEvent& event );
+#if wxUSE_THREADS
+ void ClearEventLocker() { delete m_eventsLocker; m_eventsLocker = NULL; };
+#endif
+
private:
static const wxEventTableEntry sm_eventTableEntries[];
virtual const wxEventTable *GetEventTable() const;
protected:
- wxEvtHandler* m_nextHandler;
- wxEvtHandler* m_previousHandler;
- bool m_enabled; // Is event handler enabled?
- wxList* m_dynamicEvents;
+ wxEvtHandler* m_nextHandler;
+ wxEvtHandler* m_previousHandler;
+ bool m_enabled; // Is event handler enabled?
+ wxList* m_dynamicEvents;
+ wxList* m_pendingEvents;
+#if wxUSE_THREADS
+ wxCriticalSection* m_eventsLocker;
+#endif
// optimization: instead of using costly IsKindOf() to decide whether we're
// a window (which is true in 99% of cases), use this flag
- bool m_isWindow;
+ bool m_isWindow;
};
typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
#define EVT_UPDATE_UI(id, func) \
{ wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, (wxObject *) NULL },\
+/*
+ * Helper functions
+ */
+
+// Find a window with the focus, that is also a descendant of the given window.
+// This is used to determine the window to initially send commands to.
+wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
+
#endif
// _WX_EVENTH__