Counter Strike : Global Offensive Source Code
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.

114 lines
3.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "vgui/IScheme.h"
  8. #include "vgui/KeyCode.h"
  9. #include "vgui/ISurface.h"
  10. #include "keyvalues.h"
  11. #include "vgui_controls/PropertyPage.h"
  12. #include "vgui_controls/Controls.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include "tier0/memdbgon.h"
  15. using namespace vgui;
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Constructor
  18. //-----------------------------------------------------------------------------
  19. PropertyPage::PropertyPage(Panel *parent, const char *panelName) : EditablePanel(parent, panelName)
  20. {
  21. }
  22. //-----------------------------------------------------------------------------
  23. // Purpose: Destructor
  24. //-----------------------------------------------------------------------------
  25. PropertyPage::~PropertyPage()
  26. {
  27. }
  28. //-----------------------------------------------------------------------------
  29. // Purpose: Called when page is loaded. Data should be reloaded from document into controls.
  30. //-----------------------------------------------------------------------------
  31. void PropertyPage::OnResetData()
  32. {
  33. }
  34. //-----------------------------------------------------------------------------
  35. // Purpose: Called when the OK / Apply button is pressed. Changed data should be written into document.
  36. //-----------------------------------------------------------------------------
  37. void PropertyPage::OnApplyChanges()
  38. {
  39. }
  40. //-----------------------------------------------------------------------------
  41. // Purpose: Designed to be overriden
  42. //-----------------------------------------------------------------------------
  43. void PropertyPage::OnPageShow()
  44. {
  45. }
  46. //-----------------------------------------------------------------------------
  47. // Purpose: Designed to be overriden
  48. //-----------------------------------------------------------------------------
  49. void PropertyPage::OnPageHide()
  50. {
  51. }
  52. //-----------------------------------------------------------------------------
  53. // Purpose:
  54. // Input : *pageTab -
  55. //-----------------------------------------------------------------------------
  56. void PropertyPage::OnPageTabActivated(Panel *pageTab)
  57. {
  58. _pageTab = pageTab;
  59. }
  60. //-----------------------------------------------------------------------------
  61. // Purpose:
  62. //-----------------------------------------------------------------------------
  63. void PropertyPage::OnKeyCodeTyped(KeyCode code)
  64. {
  65. switch (code)
  66. {
  67. // left and right only get propogated to parents if our tab has focus
  68. case KEY_RIGHT:
  69. {
  70. if (_pageTab != NULL && _pageTab->HasFocus())
  71. BaseClass::OnKeyCodeTyped(code);
  72. break;
  73. }
  74. case KEY_LEFT:
  75. {
  76. if (_pageTab != NULL && _pageTab->HasFocus())
  77. BaseClass::OnKeyCodeTyped(code);
  78. break;
  79. }
  80. default:
  81. BaseClass::OnKeyCodeTyped(code);
  82. break;
  83. }
  84. }
  85. //-----------------------------------------------------------------------------
  86. // Purpose:
  87. //-----------------------------------------------------------------------------
  88. void PropertyPage::SetVisible(bool state)
  89. {
  90. if (IsVisible() && !state)
  91. {
  92. // if we're going away and we have a current button, get rid of it
  93. if (GetFocusNavGroup().GetCurrentDefaultButton())
  94. {
  95. GetFocusNavGroup().SetCurrentDefaultButton(NULL);
  96. }
  97. }
  98. BaseClass::SetVisible(state);
  99. }