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-2021 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 
26 
27 class WX_INFOBAR;
28 class wxTreebook;
29 
30 class PAGED_DIALOG : public DIALOG_SHIM
31 {
32 public:
33  PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aShowReset,
34  const wxString& aAuxiliaryAction = wxEmptyString );
35  ~PAGED_DIALOG() override;
36 
37  wxTreebook* GetTreebook() { return m_treebook; }
38 
39  void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString );
40 
41  void SetModified() { m_modified = true; }
42 
43  void SetError( const wxString& aMessage, const wxString& aPageName, int aCtrlId, int aRow = -1,
44  int aCol = -1 );
45 
46  void SetError( const wxString& aMessage, wxWindow* aPage, wxWindow* aCtrl, int aRow = -1,
47  int aCol = -1 );
48 
49 protected:
50  void finishInitialization();
51 
52  bool TransferDataToWindow() override;
53  bool TransferDataFromWindow() override;
54 
55  void OnClose( wxCloseEvent& event );
56  void OnCancel( wxCommandEvent& event );
57  virtual void OnAuxiliaryAction( wxCommandEvent& event ) { event.Skip(); }
58  void OnResetButton( wxCommandEvent& aEvent );
59  void OnUpdateUI( wxUpdateUIEvent& event );
60  void OnPageChange( wxBookCtrlEvent& event );
61 
62  wxTreebook* m_treebook;
63  wxButton* m_auxiliaryButton;
64  wxButton* m_resetButton;
65  wxButton* m_cancelButton;
67 
68 private:
69  wxString m_title;
70 
71  bool m_dirty;
72 
73  wxString m_errorMessage;
74  wxWindow* m_errorCtrl; // the control associated with m_errorMessage
75  int m_errorRow; // the row if m_errorCtrl is a grid
76  int m_errorCol; // the column if m_errorCtrl is a grid
77 
78  wxBoxSizer* m_buttonsSizer;
79 
80  std::vector<bool> m_macHack;
81 };
82 
83 
84 #endif //PAGED_DIALOG_H
std::vector< bool > m_macHack
Definition: paged_dialog.h:80
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:82
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:74
wxTreebook * GetTreebook()
Definition: paged_dialog.h:37
wxButton * m_auxiliaryButton
Definition: paged_dialog.h:63
bool TransferDataFromWindow() override
void OnUpdateUI(wxUpdateUIEvent &event)
WX_INFOBAR * m_infoBar
Definition: paged_dialog.h:66
wxTreebook * m_treebook
Definition: paged_dialog.h:62
wxButton * m_cancelButton
Definition: paged_dialog.h:65
wxBoxSizer * m_buttonsSizer
Definition: paged_dialog.h:78
PAGED_DIALOG(wxWindow *aParent, const wxString &aTitle, bool aShowReset, const wxString &aAuxiliaryAction=wxEmptyString)
wxString m_errorMessage
Definition: paged_dialog.h:73
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:73
virtual void OnAuxiliaryAction(wxCommandEvent &event)
Definition: paged_dialog.h:57
void OnCancel(wxCommandEvent &event)
wxButton * m_resetButton
Definition: paged_dialog.h:64
void OnResetButton(wxCommandEvent &aEvent)
void finishInitialization()
void OnClose(wxCloseEvent &event)
wxString m_title
Definition: paged_dialog.h:69
void SetModified()
Definition: paged_dialog.h:41