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.

84 lines
2.3 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef PROPERTYDIALOG_H
  8. #define PROPERTYDIALOG_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui/VGUI.h>
  13. #include <vgui_controls/Frame.h>
  14. namespace vgui
  15. {
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Simple frame that holds a property sheet
  18. //-----------------------------------------------------------------------------
  19. class PropertyDialog : public Frame
  20. {
  21. DECLARE_CLASS_SIMPLE( PropertyDialog, Frame );
  22. public:
  23. PropertyDialog(Panel *parent, const char *panelName);
  24. ~PropertyDialog();
  25. // returns a pointer to the PropertySheet this dialog encapsulates
  26. virtual PropertySheet *GetPropertySheet();
  27. // wrapper for PropertySheet interface
  28. virtual void AddPage(Panel *page, const char *title);
  29. virtual Panel *GetActivePage();
  30. virtual void ResetAllData();
  31. virtual void ApplyChanges();
  32. // sets the text on the OK/Cancel buttons, overriding the default
  33. void SetOKButtonText(const char *text);
  34. void SetCancelButtonText(const char *text);
  35. void SetApplyButtonText(const char *text);
  36. // changes the visibility of the buttons
  37. void SetOKButtonVisible(bool state);
  38. void SetCancelButtonVisible(bool state);
  39. void SetApplyButtonVisible(bool state);
  40. /* MESSAGES SENT
  41. "ResetData" - sent when page is loaded. Data should be reloaded from document into controls.
  42. "ApplyChanges" - sent when the OK / Apply button is pressed. Changed data should be written into document.
  43. */
  44. protected:
  45. // Called when the OK button is pressed. Simply closes the dialog.
  46. virtual bool OnOK(bool applyOnly);
  47. // called when the Cancel button is pressed
  48. virtual void OnCancel();
  49. // vgui overrides
  50. virtual void PerformLayout();
  51. virtual void OnCommand(const char *command);
  52. virtual void ActivateBuildMode();
  53. virtual void OnKeyCodeTyped(KeyCode code);
  54. virtual void RequestFocus(int direction = 0);
  55. MESSAGE_FUNC( OnApplyButtonEnable, "ApplyButtonEnable" );
  56. void EnableApplyButton(bool bEnable);
  57. private:
  58. PropertySheet *_propertySheet;
  59. Button *_okButton;
  60. Button *_cancelButton;
  61. Button *_applyButton;
  62. CPanelAnimationVar( int, m_iSheetInsetBottom, "sheetinset_bottom", "32" );
  63. };
  64. }; // vgui
  65. #endif // PROPERTYDIALOG_H