Provide shorter synonyms for wxEVT_XXX constants.

Use the same short names as are used by the event table macros for the event
type constants themselves. This makes them much more comfortable to use, e.g.
Bind(wxEVT_BUTTON) compared to Bind(wxEVT_COMMAND_BUTTON_CLICKED).

The old long names are still kept for backwards compatibility and shouldn't be
removed as it doesn't really cost anything to continue providing them, but all
new event types should only use the short versions.

Closes #10661.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2013-04-25 10:11:03 +00:00
parent 3f7564f229
commit ce7fe42e84
405 changed files with 2703 additions and 2409 deletions

View File

@@ -278,7 +278,7 @@ void wxButton::Toggle()
void wxButton::Click()
{
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
wxCommandEvent event(wxEVT_BUTTON, GetId());
InitCommandEvent(event);
Command(event);
}

View File

@@ -298,7 +298,7 @@ void wxCheckBox::ChangeValue(bool value)
void wxCheckBox::SendEvent()
{
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, GetId());
wxCommandEvent event(wxEVT_CHECKBOX, GetId());
InitCommandEvent(event);
wxCheckBoxState state = Get3StateValue();

View File

@@ -199,7 +199,7 @@ bool wxCheckListBox::PerformAction(const wxControlAction& action,
{
Check(sel, !IsChecked(sel));
SendEvent(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, sel);
SendEvent(wxEVT_CHECKLISTBOX, sel);
}
}
else

View File

@@ -81,7 +81,7 @@ void wxChoice::OnComboBox(wxCommandEvent& event)
{
if ( event.GetId() == GetId() )
{
event.SetEventType(wxEVT_COMMAND_CHOICE_SELECTED);
event.SetEventType(wxEVT_CHOICE);
event.Skip();
GetEventHandler()->ProcessEvent(event);
}

View File

@@ -180,7 +180,7 @@ void wxComboListBox::OnLeftUp(wxMouseEvent& event)
m_combo->SetValue(wxListBox::GetStringSelection());
// next let the user code have the event
wxCommandEvent evt(wxEVT_COMMAND_COMBOBOX_SELECTED,m_combo->GetId());
wxCommandEvent evt(wxEVT_COMBOBOX,m_combo->GetId());
evt.SetInt(wxListBox::GetSelection());
evt.SetEventObject(m_combo);
m_combo->ProcessWindowEvent(evt);

View File

@@ -129,7 +129,7 @@ void wxDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
s_closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
wxCommandEvent cancelEvent(wxEVT_BUTTON, wxID_CANCEL);
cancelEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(cancelEvent);
s_closing.DeleteObject(this);

View File

@@ -1092,7 +1092,7 @@ void wxListBox::SelectAndNotify(int item)
{
DoSelect(item);
SendEvent(wxEVT_COMMAND_LISTBOX_SELECTED);
SendEvent(wxEVT_LISTBOX);
}
void wxListBox::Activate(int item)
@@ -1111,7 +1111,7 @@ void wxListBox::Activate(int item)
{
DoSelect(item);
SendEvent(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
SendEvent(wxEVT_LISTBOX_DCLICK);
}
}

View File

@@ -63,7 +63,7 @@ public:
virtual bool ProcessEvent(wxEvent& event)
{
// we intercept the command events from radio buttons
if ( event.GetEventType() == wxEVT_COMMAND_RADIOBUTTON_SELECTED )
if ( event.GetEventType() == wxEVT_RADIOBUTTON )
{
m_radio->OnRadioButton(event);
}
@@ -261,7 +261,7 @@ void wxRadioBox::SendRadioEvent()
{
wxCHECK_RET( m_selection != -1, wxT("no active radio button") );
wxCommandEvent event(wxEVT_COMMAND_RADIOBOX_SELECTED, GetId());
wxCommandEvent event(wxEVT_RADIOBOX, GetId());
InitCommandEvent(event);
event.SetInt(m_selection);
event.SetString(GetString(m_selection));

View File

@@ -135,7 +135,7 @@ void wxRadioButton::ClearValue()
void wxRadioButton::SendEvent()
{
wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, GetId());
wxCommandEvent event(wxEVT_RADIOBUTTON, GetId());
InitCommandEvent(event);
event.SetInt(IsChecked());
Command(event);

View File

@@ -220,7 +220,7 @@ bool wxSlider::ChangeValueTo(int value)
eventScroll.SetEventObject( this );
(void)GetEventHandler()->ProcessEvent(eventScroll);
wxCommandEvent event(wxEVT_COMMAND_SLIDER_UPDATED, GetId());
wxCommandEvent event(wxEVT_SLIDER, GetId());
event.SetInt(m_value);
event.SetEventObject(this);
(void)GetEventHandler()->ProcessEvent(event);

View File

@@ -4709,7 +4709,7 @@ bool wxTextCtrl::PerformAction(const wxControlAction& actionOrig,
{
wxASSERT_MSG( IsEditable(), wxT("non editable control changed?") );
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
wxCommandEvent event(wxEVT_TEXT, GetId());
InitCommandEvent(event);
GetEventHandler()->ProcessEvent(event);
@@ -4733,7 +4733,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
{
if ( IsSingleLine() || (GetWindowStyle() & wxTE_PROCESS_ENTER) )
{
wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, GetId());
wxCommandEvent event(wxEVT_TEXT_ENTER, GetId());
InitCommandEvent(event);
event.SetString(GetValue());
GetEventHandler()->ProcessEvent(event);

View File

@@ -19,7 +19,7 @@
#include "wx/tglbtn.h"
wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent );
wxDEFINE_EVENT( wxEVT_TOGGLEBUTTON, wxCommandEvent );
IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxButton)
@@ -83,7 +83,7 @@ void wxToggleButton::Toggle()
void wxToggleButton::Click()
{
wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, GetId());
wxCommandEvent event(wxEVT_TOGGLEBUTTON, GetId());
InitCommandEvent(event);
event.SetInt(GetValue());
Command(event);

View File

@@ -1322,7 +1322,7 @@ void wxWindow::OnKeyDown(wxKeyEvent& event)
int command = win->GetAcceleratorTable()->GetCommand(event);
if ( command != -1 )
{
wxCommandEvent eventCmd(wxEVT_COMMAND_MENU_SELECTED, command);
wxCommandEvent eventCmd(wxEVT_MENU, command);
if ( win->GetEventHandler()->ProcessEvent(eventCmd) )
{
// skip "event.Skip()" below
@@ -1353,7 +1353,7 @@ void wxWindow::OnKeyDown(wxKeyEvent& event)
wxWindow* child = win->FindWindow(command);
if ( child && wxDynamicCast(child, wxButton) )
{
wxCommandEvent eventCmd(wxEVT_COMMAND_BUTTON_CLICKED, command);
wxCommandEvent eventCmd(wxEVT_BUTTON, command);
eventCmd.SetEventObject(child);
if ( child->GetEventHandler()->ProcessEvent(eventCmd) )
{
@@ -1428,7 +1428,7 @@ void wxWindow::OnChar(wxKeyEvent& event)
wxButton *btn = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
if ( btn )
{
wxCommandEvent evt(wxEVT_COMMAND_BUTTON_CLICKED, btn->GetId());
wxCommandEvent evt(wxEVT_BUTTON, btn->GetId());
evt.SetEventObject(btn);
btn->Command(evt);
return;