KiCad PCB EDA Suite
paged_dialog.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 #ifndef PAGED_DIALOG_H
22 #define PAGED_DIALOG_H
23 
24 #include <dialog_shim.h>
25 #include <wx/treebook.h>
26 
27 
28 class PAGED_DIALOG : public DIALOG_SHIM
29 {
30 private:
31  wxString m_title;
32 
33  wxString m_errorMessage;
34  wxObject* m_errorCtrl; // the control associated with m_errorMessage
35  int m_errorRow; // the row if m_errorCtrl is a grid
36  int m_errorCol; // the column if m_errorCtrl is a grid
37 
38 public:
39  PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
40  const wxString& aAuxiliaryAction = wxEmptyString );
41  ~PAGED_DIALOG() override;
42 
43  wxTreebook* GetTreebook() { return m_treebook; }
44 
45  void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString );
46 
47  void SetError( const wxString& aMessage, wxWindow* aPage, wxObject* aCtrl,
48  int aRow = -1, int aCol = -1 );
49 
50 protected:
51  void finishInitialization();
52 
53  bool TransferDataToWindow() override;
54  bool TransferDataFromWindow() override;
55 
56  virtual void OnAuxiliaryAction( wxCommandEvent& event ) { event.Skip(); }
57  void OnUpdateUI( wxUpdateUIEvent& event );
58 
59  wxTreebook* m_treebook;
60  wxButton* m_auxiliaryButton;
61 };
62 
63 
64 #endif //PAGED_DIALOG_H
void SetInitialPage(const wxString &aPage, const wxString &aParentPage=wxEmptyString)
~PAGED_DIALOG() override
Class DIALOG_SHIM may sit in the inheritance tree between wxDialog and any class written by wxFormBui...
Definition: dialog_shim.h:82
bool TransferDataToWindow() override
wxTreebook * GetTreebook()
Definition: paged_dialog.h:43
wxButton * m_auxiliaryButton
Definition: paged_dialog.h:60
bool TransferDataFromWindow() override
PAGED_DIALOG(wxWindow *aParent, const wxString &aTitle, const wxString &aAuxiliaryAction=wxEmptyString)
void OnUpdateUI(wxUpdateUIEvent &event)
wxTreebook * m_treebook
Definition: paged_dialog.h:59
void SetError(const wxString &aMessage, wxWindow *aPage, wxObject *aCtrl, int aRow=-1, int aCol=-1)
wxString m_errorMessage
Definition: paged_dialog.h:33
virtual void OnAuxiliaryAction(wxCommandEvent &event)
Definition: paged_dialog.h:56
wxObject * m_errorCtrl
Definition: paged_dialog.h:34
void finishInitialization()
wxString m_title
Definition: paged_dialog.h:31