#ifndef _WX_EVENT_H__
#define _WX_EVENT_H__
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) && !defined(__EMX__)
-// Some older compilers (such as EMX) cannot handle
-// #pragma interface/implementation correctly, iff
-// #pragma implementation is used in _two_ translation
-// units (as created by e.g. event.cpp compiled for
-// libwx_base and event.cpp compiled for libwx_gui_core).
-// So we must not use those pragmas for those compilers in
-// such files.
- #pragma interface "event.h"
-#endif
-
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/clntdata.h"
// change the switch()es to if()s
//
// if these are real problems for you, define WXWIN_COMPATIBILITY_EVENT_TYPES
-// to get 100% old behaviour, however you won't be able to use the libraries
-// using the new dynamic event type allocation in such case, so avoid it if
-// possible.
+// as 1 to get 100% old behaviour, however you won't be able to use the
+// libraries using the new dynamic event type allocation in such case, so avoid
+// it if possible.
+#ifndef WXWIN_COMPATIBILITY_EVENT_TYPES
+ #define WXWIN_COMPATIBILITY_EVENT_TYPES 0
+#endif
#if WXWIN_COMPATIBILITY_EVENT_TYPES
#ifdef __VISUALC__
// 'this' : used in base member initializer list (for m_commandString)
- #pragma warning(push)
+ #if _MSC_VER > 1100
+ #pragma warning(push)
+ #endif
#pragma warning(disable:4355)
#endif
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent)
};
-#ifdef __VISUALC__
+#if defined(__VISUALC__) && (_MSC_VER > 1100)
#pragma warning(pop)
#endif
wxSize GetSize() const { return m_size; }
wxRect GetRect() const { return m_rect; }
- void SetRect(wxRect rect) { m_rect = rect; }
+ void SetRect(const wxRect& rect) { m_rect = rect; }
virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
wxPoint GetPosition() const { return m_pos; }
void SetPosition(const wxPoint& pos) { m_pos = pos; }
wxRect GetRect() const { return m_rect; }
- void SetRect(wxRect rect) { m_rect = rect; }
+ void SetRect(const wxRect& rect) { m_rect = rect; }
virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
// wxEvtHandler: the base class for all objects handling wxWidgets events
// ----------------------------------------------------------------------------
-typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
-
class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject
{
public:
bool ProcessThreadEvent(wxEvent& event);
#endif
-#if wxUSE_EXCEPTIONS
- // call the specified handler with the given event
- //
- // this method only exists to allow catching the exceptions thrown by any
- // event handler, it would lead to an extra (useless) virtual function call
- // if the exceptions were not used, so it doesn't even exist in that case
- virtual void DoHandleEvent(wxEventFunction func, wxEvent& event);
-#endif // wxUSE_EXCEPTIONS
-
// Dynamic association of a member function handler with the event handler,
// winid and event type
void Connect(int winid,
dest->AddPendingEvent(event);
}
+typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
+
#define wxEventHandler(func) \
(wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func)
EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
EVT_COMMAND_SCROLL_CHANGED(winid, func)
-// this is the old name of this event, to be deprecated in 2.8
+// 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