Merge branch 'replace-connect-bind'

Replace almost all occurrences of wxEvtHandler::Connect() with Bind().

See https://github.com/wxWidgets/wxWidgets/pull/820
This commit is contained in:
Vadim Zeitlin
2018-06-01 18:31:59 +02:00
80 changed files with 459 additions and 946 deletions

View File

@@ -205,12 +205,6 @@ wxMenu* SearchCtrlWidgetsPage::CreateTestMenu()
wxString tipText = wxString::Format(wxT("tip %i"),i);
menu->Append(ID_SEARCHMENU+i, itemText, tipText, wxITEM_NORMAL);
}
// target->Connect(
// ID_SEARCHMENU,
// ID_SEARCHMENU+SEARCH_MENU_SIZE,
// wxEVT_MENU,
// wxCommandEventHandler(MySearchCtrl::OnSearchMenu)
// );
return menu;
}

View File

@@ -115,10 +115,8 @@ void StatBmpWidgetsPage::CreateContent()
wxInitAllImageHandlers();
Connect(wxEVT_FILEPICKER_CHANGED,
wxFileDirPickerEventHandler(StatBmpWidgetsPage::OnFileChange));
Connect(wxEVT_RADIOBOX,
wxCommandEventHandler(StatBmpWidgetsPage::OnRadioChange));
Bind(wxEVT_FILEPICKER_CHANGED, &StatBmpWidgetsPage::OnFileChange, this);
Bind(wxEVT_RADIOBOX, &StatBmpWidgetsPage::OnRadioChange, this);
m_statbmp = NULL;
RecreateWidget();
@@ -171,9 +169,8 @@ void StatBmpWidgetsPage::RecreateWidget()
}
m_sbsizer->Add(m_statbmp, wxSizerFlags(1).Expand());
GetSizer()->Layout();
m_statbmp->Connect(wxEVT_LEFT_DOWN,
wxMouseEventHandler(StatBmpWidgetsPage::OnMouseEvent),
NULL, this);
m_statbmp->Bind(wxEVT_LEFT_DOWN, &StatBmpWidgetsPage::OnMouseEvent, this);
// When switching from generic to native control on wxMSW under Wine,
// the explicit Refresh() is necessary
m_statbmp->Refresh();

View File

@@ -310,9 +310,7 @@ void StaticWidgetsPage::CreateContent()
m_textBox = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
wxButton *b1 = new wxButton(this, wxID_ANY, "Change &box label");
b1->Connect(wxEVT_BUTTON,
wxCommandEventHandler(StaticWidgetsPage::OnButtonBoxText),
NULL, this);
b1->Bind(wxEVT_BUTTON, &StaticWidgetsPage::OnButtonBoxText, this);
sizerMiddle->Add(m_textBox, 0, wxEXPAND|wxALL, 5);
sizerMiddle->Add(b1, 0, wxLEFT|wxBOTTOM, 5);
@@ -320,9 +318,7 @@ void StaticWidgetsPage::CreateContent()
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE|wxHSCROLL);
wxButton *b2 = new wxButton(this, wxID_ANY, "Change &text label");
b2->Connect(wxEVT_BUTTON,
wxCommandEventHandler(StaticWidgetsPage::OnButtonLabelText),
NULL, this);
b2->Bind(wxEVT_BUTTON, &StaticWidgetsPage::OnButtonLabelText, this);
sizerMiddle->Add(m_textLabel, 0, wxEXPAND|wxALL, 5);
sizerMiddle->Add(b2, 0, wxLEFT|wxBOTTOM, 5);
@@ -332,9 +328,7 @@ void StaticWidgetsPage::CreateContent()
wxTE_MULTILINE|wxHSCROLL);
wxButton *b3 = new wxButton(this, wxID_ANY, "Change decorated text label");
b3->Connect(wxEVT_BUTTON,
wxCommandEventHandler(StaticWidgetsPage::OnButtonLabelWithMarkupText),
NULL, this);
b3->Bind(wxEVT_BUTTON, &StaticWidgetsPage::OnButtonLabelWithMarkupText, this);
sizerMiddle->Add(m_textLabelWithMarkup, 0, wxEXPAND|wxALL, 5);
sizerMiddle->Add(b3, 0, wxLEFT|wxBOTTOM, 5);
@@ -562,12 +556,8 @@ void StaticWidgetsPage::CreateStatic()
m_sizerStatic->Layout();
m_statText->Connect(wxEVT_LEFT_UP,
wxMouseEventHandler(StaticWidgetsPage::OnMouseEvent),
NULL, this);
staticBox->Connect(wxEVT_LEFT_UP,
wxMouseEventHandler(StaticWidgetsPage::OnMouseEvent),
NULL, this);
m_statText->Bind(wxEVT_LEFT_UP, &StaticWidgetsPage::OnMouseEvent, this);
staticBox->Bind(wxEVT_LEFT_UP, &StaticWidgetsPage::OnMouseEvent, this);
SetUpWidget();
}

View File

@@ -628,9 +628,7 @@ void WidgetsFrame::InitBook()
}
}
Connect( wxID_ANY,
wxEVT_COMMAND_WIDGETS_PAGE_CHANGED,
wxWidgetsbookEventHandler(WidgetsFrame::OnPageChanged) );
Bind(wxEVT_COMMAND_WIDGETS_PAGE_CHANGED, &WidgetsFrame::OnPageChanged, this);
const bool pageSet = wxPersistentRegisterAndRestore(m_book);