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