Code::Blocks  SVN r11506
configurationpanel.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  *
5  * $Revision: 7964 $
6  * $Id: configurationpanel.cpp 7964 2012-05-11 07:36:28Z mortenmacfly $
7  * $HeadURL: https://svn.code.sf.net/p/codeblocks/code/trunk/src/sdk/configurationpanel.cpp $
8  */
9 
10 #include "configurationpanel.h"
11 #include <wx/intl.h>
12 #include <wx/statline.h>
13 #include <wx/button.h>
14 #include <wx/sizer.h>
15 
18  m_pPanel(0)
19 {
20 }
21 
23 {
24  assert(panel);
25 
26  m_pPanel = panel;
27  m_pPanel->Reparent(this);
28 
29  wxBoxSizer* bs = new wxBoxSizer(wxVERTICAL);
30  bs->Add(m_pPanel, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 8);
31 
32  wxStaticLine* line = new wxStaticLine(this);
33  bs->Add(line, 0, wxGROW | wxLEFT | wxRIGHT, 8);
34 
35  m_pOK = new wxButton(this, wxID_OK, _("&OK"));
36  m_pOK->SetDefault();
37  m_pCancel = new wxButton(this, wxID_CANCEL, _("&Cancel"));
39  but->AddButton(m_pOK);
40  but->AddButton(m_pCancel);
41  but->Realize();
42  bs->Add(but, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 8);
43 
44  SetSizer(bs);
45 
46  bs->SetSizeHints(this);
47  CentreOnParent();
48 }
49 
51 {
52 }
53 
55 {
56  if (retCode == wxID_OK)
57  m_pPanel->OnApply();
58  else
59  m_pPanel->OnCancel();
61 }
void EndModal(int retCode)
Definition: sc_dialog.cpp:112
#define wxMAXIMIZE_BOX
cbConfigurationPanel * m_pPanel
void EndModal(int retCode) override
virtual void OnApply()=0
Called when the user chooses to apply the configuration.
virtual void OnCancel()=0
Called when the user chooses to cancel the configuration.
cbConfigurationDialog(wxWindow *parent, int id, const wxString &title)
void AddButton(wxButton *button)
wxSizerItem * Add(wxWindow *window, const wxSizerFlags &flags)
const wxSize wxDefaultSize
const wxPoint wxDefaultPosition
#define wxDEFAULT_DIALOG_STYLE
const wxString & _(const wxString &string)
Base class for plugin configuration panels.
void SetSizeHints(wxWindow *window)
void AttachConfigurationPanel(cbConfigurationPanel *panel)
#define wxRESIZE_BORDER