Implement wx-prefixed macros versions of DECLARE_EVENT_TABLE, BEGIN_EVENT_TABLE* and END_EVENT_TABLE macros.

Implement compatibility aliases for non-prefixed macro names.
Require a final semicolon where possible.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64533 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2010-06-09 14:28:08 +00:00
parent b19b28c8fc
commit a0e9a5dfde
14 changed files with 158 additions and 140 deletions

View File

@@ -254,13 +254,13 @@ struct wxComboCtrlFeatures
int m_value; // current item index
private:
DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();
};
BEGIN_EVENT_TABLE(wxListViewComboPopup, wxListView)
wxBEGIN_EVENT_TABLE(wxListViewComboPopup, wxListView)
EVT_MOTION(wxListViewComboPopup::OnMouseMove)
EVT_LEFT_UP(wxListViewComboPopup::OnMouseClick)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()
@endcode
Here's how you would create and populate it in a dialog constructor:

View File

@@ -3854,13 +3854,6 @@ typedef int wxEventType;
*/
wxEventType wxEVT_NULL;
/**
Initializes a new event type using wxNewEventType().
@deprecated Use wxDEFINE_EVENT() instead
*/
#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
/**
Generates a new unique event type.
@@ -3957,9 +3950,9 @@ wxEventType wxNewEventType();
...
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MY(wxID_ANY, MyFrame::OnMyEvent)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()
@endcode
@param evt
@@ -3989,38 +3982,39 @@ wxEventType wxNewEventType();
#define wx__DECLARE_EVT0(evt, fn) \
wx__DECLARE_EVT1(evt, wxID_ANY, fn)
/**
Use this macro inside a class declaration to declare a @e static event table
for that class.
In the implementation file you'll need to use the BEGIN_EVENT_TABLE()
and the END_EVENT_TABLE() macros, plus some additional @c EVT_xxx macro
In the implementation file you'll need to use the wxBEGIN_EVENT_TABLE()
and the wxEND_EVENT_TABLE() macros, plus some additional @c EVT_xxx macro
to capture events.
Note that this macro requires a final semicolon.
@see @ref overview_events_eventtables
*/
#define DECLARE_EVENT_TABLE()
#define wxDECLARE_EVENT_TABLE()
/**
Use this macro in a source file to start listing @e static event handlers
for a specific class.
Use END_EVENT_TABLE() to terminate the event-declaration block.
Use wxEND_EVENT_TABLE() to terminate the event-declaration block.
@see @ref overview_events_eventtables
*/
#define BEGIN_EVENT_TABLE(theClass, baseClass)
#define wxBEGIN_EVENT_TABLE(theClass, baseClass)
/**
Use this macro in a source file to end listing @e static event handlers
for a specific class.
Use BEGIN_EVENT_TABLE() to start the event-declaration block.
Use wxBEGIN_EVENT_TABLE() to start the event-declaration block.
@see @ref overview_events_eventtables
*/
#define END_EVENT_TABLE()
#define wxEND_EVENT_TABLE()
/**
In a GUI application, this function posts @a event to the specified @e dest

View File

@@ -309,14 +309,14 @@ public:
char m_data[1024];
wxCriticalSection m_dataCS; // protects field above
DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();
};
wxDEFINE_EVENT(wxEVT_COMMAND_MYTHREAD_UPDATE, wxThreadEvent)
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_MYTHREAD_UPDATE, MyFrame::OnThreadUpdate)
EVT_CLOSE(MyFrame::OnClose)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()
void MyFrame::DoStartALongTask()
{
@@ -687,15 +687,15 @@ enum
MyThread *m_pThread;
wxCriticalSection m_pThreadCS; // protects the m_pThread pointer
DECLARE_EVENT_TABLE()
wxDECLARE_EVENT_TABLE();
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_CLOSE(MyFrame::OnClose)
EVT_MENU(Minimal_Start, MyFrame::DoStartThread)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_MYTHREAD_UPDATE, MyFrame::OnThreadUpdate)
EVT_COMMAND(wxID_ANY, wxEVT_COMMAND_MYTHREAD_COMPLETED, MyFrame::OnThreadCompletion)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()
wxDEFINE_EVENT(wxEVT_COMMAND_MYTHREAD_COMPLETED, wxThreadEvent)
wxDEFINE_EVENT(wxEVT_COMMAND_MYTHREAD_UPDATE, wxThreadEvent)

View File

@@ -149,11 +149,12 @@ public:
private:
wxTimer m_timer;
wxDECLARE_EVENT_TABLE();
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_TIMER(TIMER_ID, MyFrame::OnTimer)
END_EVENT_TABLE()
wxEND_EVENT_TABLE()
MyFrame::MyFrame()
: m_timer(this, TIMER_ID)