diff --git a/checkin_notes b/checkin_notes index c8bb1527e8..086b8cb5e6 100644 --- a/checkin_notes +++ b/checkin_notes @@ -7605,3 +7605,11 @@ David 19 Sept 2008 lib/ gui_rpc_client.C parse.C + +Rom 19 Sept 2008 + - MGR: Add support for simulating somebody hitting the cancel button in + the wizards. This is needed for a WCG feature. + + clientgui/ + BOINCBaseWizard.cpp, .h + wizardex.cpp, .h diff --git a/clientgui/BOINCBaseWizard.cpp b/clientgui/BOINCBaseWizard.cpp index 72b8c20204..ec8bf9ec1a 100644 --- a/clientgui/BOINCBaseWizard.cpp +++ b/clientgui/BOINCBaseWizard.cpp @@ -169,3 +169,21 @@ void CBOINCBaseWizard::DisableBackButton() { m_btnPrev->Disable(); } +wxButton* CBOINCBaseWizard::GetCancelButton() const { + return m_btnCancel; +} + +void CBOINCBaseWizard::SimulateCancelButton() { + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_btnCancel->GetId()); + event.SetEventObject(GetCancelButton()); + AddPendingEvent(event); +} + +void CBOINCBaseWizard::EnableCancelButton() { + m_btnCancel->Enable(); +} + +void CBOINCBaseWizard::DisableCancelButton() { + m_btnCancel->Disable(); +} + diff --git a/clientgui/BOINCBaseWizard.h b/clientgui/BOINCBaseWizard.h index 6def08006f..ef5383fb78 100644 --- a/clientgui/BOINCBaseWizard.h +++ b/clientgui/BOINCBaseWizard.h @@ -67,6 +67,10 @@ public: void SimulateBackButton(); void EnableBackButton(); void DisableBackButton(); + wxButton* GetCancelButton() const; + void SimulateCancelButton(); + void EnableCancelButton(); + void DisableCancelButton(); /// Wizard Detection bool IsAttachToProjectWizard; diff --git a/clientgui/wizardex.cpp b/clientgui/wizardex.cpp index 69a097fa12..6297eb7a36 100644 --- a/clientgui/wizardex.cpp +++ b/clientgui/wizardex.cpp @@ -400,10 +400,10 @@ void wxWizardEx::AddButtonRow(wxBoxSizer *mainColumn) #endif m_btnNext = new wxButton(this, wxID_FORWARD, _("&Next >")); - wxButton *btnCancel=new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, buttonStyle); + m_btnCancel = new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, buttonStyle); #ifndef __WXMAC__ if (GetExtraStyle() & wxWIZARD_EX_HELPBUTTON) - btnHelp=new wxButton(this, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, buttonStyle); + btnHelp = new wxButton(this, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, buttonStyle); #endif m_btnPrev = new wxButton(this, wxID_BACKWARD, _("< &Back"), wxDefaultPosition, wxDefaultSize, buttonStyle); @@ -424,7 +424,7 @@ void wxWizardEx::AddButtonRow(wxBoxSizer *mainColumn) AddBackNextPair(buttonRow); buttonRow->Add( - btnCancel, + m_btnCancel, 0, // Horizontally unstretchable wxALL, // Border all around, top aligned 5 // Border width diff --git a/clientgui/wizardex.h b/clientgui/wizardex.h index db36c083cc..b00c523d8c 100644 --- a/clientgui/wizardex.h +++ b/clientgui/wizardex.h @@ -247,7 +247,8 @@ private: // wizard controls protected: wxButton *m_btnPrev, // the "" or "Finish" button + *m_btnNext, // the "Next>" or "Finish" button + *m_btnCancel; // the "Cancel" button private: wxStaticBitmap *m_statbmp; // the control for the bitmap