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  wxWindow* 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  std::vector<bool> m_macHack;
39 
40 public:
41  PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
42  const wxString& aAuxiliaryAction = wxEmptyString );
43  ~PAGED_DIALOG() override;
44 
45  wxTreebook* GetTreebook() { return m_treebook; }
46 
47  void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString );
48 
49  void SetError( const wxString& aMessage, const wxString& aPageName, int aCtrlId, int aRow = -1,
50  int aCol = -1 );
51 
52  void SetError( const wxString& aMessage, wxWindow* aPage, wxWindow* aCtrl, int aRow = -1,
53  int aCol = -1 );
54 
55 protected:
56  void finishInitialization();
57 
58  bool TransferDataToWindow() override;
59  bool TransferDataFromWindow() override;
60 
61  virtual void OnAuxiliaryAction( wxCommandEvent& event ) { event.Skip(); }
62  void OnUpdateUI( wxUpdateUIEvent& event );
63  void OnPageChange( wxBookCtrlEvent& event );
64 
65  wxTreebook* m_treebook;
66  wxButton* m_auxiliaryButton;
67 };
68 
69 
70 #endif //PAGED_DIALOG_H
std::vector< bool > m_macHack
Definition: paged_dialog.h:38
void SetInitialPage(const wxString &aPage, const wxString &aParentPage=wxEmptyString)
~PAGED_DIALOG() override
Dialog helper object to sit in the inheritance tree between wxDialog and any class written by wxFormB...
Definition: dialog_shim.h:83
void SetError(const wxString &aMessage, const wxString &aPageName, int aCtrlId, int aRow=-1, int aCol=-1)
void OnPageChange(wxBookCtrlEvent &event)
bool TransferDataToWindow() override
wxWindow * m_errorCtrl
Definition: paged_dialog.h:34
wxTreebook * GetTreebook()
Definition: paged_dialog.h:45
wxButton * m_auxiliaryButton
Definition: paged_dialog.h:66
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:65
wxString m_errorMessage
Definition: paged_dialog.h:33
virtual void OnAuxiliaryAction(wxCommandEvent &event)
Definition: paged_dialog.h:61
void finishInitialization()
wxString m_title
Definition: paged_dialog.h:31