Use Bind() instead of Connect() in preferences sample
This makes the code shorter and more clear.
This commit is contained in:
@@ -56,14 +56,9 @@ public:
|
|||||||
menuBar->Append(fileMenu, "&File");
|
menuBar->Append(fileMenu, "&File");
|
||||||
SetMenuBar(menuBar);
|
SetMenuBar(menuBar);
|
||||||
|
|
||||||
Connect(wxID_PREFERENCES,
|
Bind(wxEVT_MENU, &MyFrame::OnPref, this, wxID_PREFERENCES);
|
||||||
wxEVT_MENU,
|
Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
|
||||||
wxCommandEventHandler(MyFrame::OnPref), NULL, this);
|
Bind(wxEVT_CLOSE_WINDOW, &MyFrame::OnClose, this);
|
||||||
Connect(wxID_EXIT,
|
|
||||||
wxEVT_MENU,
|
|
||||||
wxCommandEventHandler(MyFrame::OnExit), NULL, this);
|
|
||||||
Connect(wxEVT_CLOSE_WINDOW,
|
|
||||||
wxCloseEventHandler(MyFrame::OnClose), NULL, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -103,12 +98,12 @@ public:
|
|||||||
// immediately rather than after the OK or Apply button is pressed.
|
// immediately rather than after the OK or Apply button is pressed.
|
||||||
if ( wxPreferencesEditor::ShouldApplyChangesImmediately() )
|
if ( wxPreferencesEditor::ShouldApplyChangesImmediately() )
|
||||||
{
|
{
|
||||||
m_useMarkdown->Connect(wxEVT_CHECKBOX,
|
m_useMarkdown->Bind(wxEVT_CHECKBOX,
|
||||||
wxCommandEventHandler(PrefsPageGeneralPanel::ChangedUseMarkdown),
|
&PrefsPageGeneralPanel::ChangedUseMarkdown,
|
||||||
NULL, this);
|
this);
|
||||||
m_spellcheck->Connect(wxEVT_CHECKBOX,
|
m_spellcheck->Bind(wxEVT_CHECKBOX,
|
||||||
wxCommandEventHandler(PrefsPageGeneralPanel::ChangedSpellcheck),
|
&PrefsPageGeneralPanel::ChangedSpellcheck,
|
||||||
NULL, this);
|
this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,9 +167,9 @@ public:
|
|||||||
|
|
||||||
if ( wxPreferencesEditor::ShouldApplyChangesImmediately() )
|
if ( wxPreferencesEditor::ShouldApplyChangesImmediately() )
|
||||||
{
|
{
|
||||||
m_fulltext->Connect(wxEVT_CHECKBOX,
|
m_fulltext->Bind(wxEVT_CHECKBOX,
|
||||||
wxCommandEventHandler(PrefsPageTopicsPanel::ChangedFulltext),
|
&PrefsPageTopicsPanel::ChangedFulltext,
|
||||||
NULL, this);
|
this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user