Team Fortress 2 Source Code as on 22/4/2020
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.

91 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef WIZARDSUBPANEL_H
  8. #define WIZARDSUBPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/EditablePanel.h>
  13. namespace vgui
  14. {
  15. //-----------------------------------------------------------------------------
  16. // Purpose: Base panel for use in Wizards and in property sheets
  17. //-----------------------------------------------------------------------------
  18. class WizardSubPanel : public EditablePanel
  19. {
  20. DECLARE_CLASS_SIMPLE( WizardSubPanel, EditablePanel );
  21. public:
  22. // constructor
  23. WizardSubPanel(Panel *parent, const char *panelName);
  24. ~WizardSubPanel();
  25. // called when the subpanel is displayed
  26. // All controls & data should be reinitialized at this time
  27. virtual void OnDisplayAsNext() {}
  28. // called anytime the panel is first displayed, whether the user is moving forward or back
  29. // called immediately after OnDisplayAsNext/OnDisplayAsPrev
  30. virtual void OnDisplay() {}
  31. // called when displayed as previous
  32. virtual void OnDisplayAsPrev() {}
  33. // called when one of the wizard buttons are pressed
  34. // returns true if the wizard should advance, false otherwise
  35. virtual bool OnNextButton() { return true; }
  36. virtual bool OnPrevButton() { return true; }
  37. virtual bool OnFinishButton() { return true; }
  38. virtual bool OnCancelButton() { return true; }
  39. // returns true if this panel should be displayed, or if we should just skip over it
  40. virtual bool ShouldDisplayPanel() { return true; }
  41. // return true if this subpanel doesn't need the next/prev/finish/cancel buttons or will do it itself
  42. virtual bool isNonWizardPanel() { return false; }
  43. // returns a pointer to the next subpanel that should be displayed
  44. virtual WizardSubPanel *GetNextSubPanel() = 0;
  45. // returns a pointer to the panel to return to
  46. // it must be a panel that is already in the wizards panel history
  47. // returning NULL tells it to use the immediate previous panel in the history
  48. virtual WizardSubPanel *GetPrevSubPanel() { return NULL; }
  49. virtual WizardPanel *GetWizardPanel() { return _wizardPanel; }
  50. virtual void SetWizardPanel(WizardPanel *wizardPanel) { _wizardPanel = wizardPanel; }
  51. // returns a pointer to the wizard's doc
  52. virtual KeyValues *GetWizardData();
  53. // returns a pointer
  54. virtual WizardSubPanel *GetSiblingSubPanelByName(const char *pageName);
  55. // gets the size this subpanel would like the wizard to be
  56. // returns true if it has a desired size
  57. virtual bool GetDesiredSize(int &wide, int &tall);
  58. protected:
  59. virtual void ApplySettings(KeyValues *inResourceData);
  60. virtual void GetSettings( KeyValues *outResourceData );
  61. virtual void ApplySchemeSettings(IScheme *pScheme);
  62. virtual const char *GetDescription();
  63. private:
  64. WizardPanel *_wizardPanel;
  65. int m_iDesiredWide, m_iDesiredTall;
  66. };
  67. } // namespace vgui
  68. #endif // WIZARDSUBPANEL_H