You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2017-2022 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. #ifndef PAGED_DIALOG_H
  20. #define PAGED_DIALOG_H
  21. #include <dialog_shim.h>
  22. class WX_INFOBAR;
  23. class wxTreebook;
  24. class PAGED_DIALOG : public DIALOG_SHIM
  25. {
  26. public:
  27. PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aShowReset,
  28. const wxString& aAuxiliaryAction = wxEmptyString );
  29. ~PAGED_DIALOG() override;
  30. wxTreebook* GetTreebook() { return m_treebook; }
  31. void SetInitialPage( const wxString& aPage, const wxString& aParentPage = wxEmptyString );
  32. void SetModified() { m_modified = true; }
  33. void SetError( const wxString& aMessage, const wxString& aPageName, int aCtrlId, int aRow = -1,
  34. int aCol = -1 );
  35. void SetError( const wxString& aMessage, wxWindow* aPage, wxWindow* aCtrl, int aRow = -1,
  36. int aCol = -1 );
  37. void UpdateResetButton( int aPage );
  38. protected:
  39. void finishInitialization();
  40. bool TransferDataToWindow() override;
  41. bool TransferDataFromWindow() override;
  42. virtual void onAuxiliaryAction( wxCommandEvent& aEvent ) { aEvent.Skip(); }
  43. virtual void onResetButton( wxCommandEvent& aEvent );
  44. virtual void onPageChanged( wxBookCtrlEvent& aEvent );
  45. virtual void onPageChanging( wxBookCtrlEvent& aEvent );
  46. virtual void onCharHook( wxKeyEvent& aEvent );
  47. wxTreebook* m_treebook;
  48. wxButton* m_auxiliaryButton;
  49. wxButton* m_resetButton;
  50. wxButton* m_cancelButton;
  51. WX_INFOBAR* m_infoBar;
  52. private:
  53. wxString m_title;
  54. wxBoxSizer* m_buttonsSizer;
  55. std::vector<bool> m_macHack;
  56. };
  57. #endif //PAGED_DIALOG_H