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.

140 lines
4.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #include "ZooUI.h"
  9. #include "stdio.h"
  10. #include <VGUI_ISurface.h>
  11. #include <VGUI_Controls.h>
  12. #include <VGUI_KeyValues.h>
  13. #include <VGUI_PropertySheet.h>
  14. #include <VGUI_IVGui.h> // for dprinf statements
  15. using namespace vgui;
  16. //-----------------------------------------------------------------------------
  17. // Purpose:
  18. //-----------------------------------------------------------------------------
  19. CZooUI::CZooUI(): Frame(NULL, "PanelZoo")
  20. {
  21. SetTitle("Panel Zoo", true);
  22. // calculate defaults
  23. int x, y, wide, tall;
  24. vgui::surface()->GetScreenSize(wide, tall);
  25. int dwide, dtall;
  26. dwide = 1400;
  27. dtall = 500;
  28. x = (int)((wide - dwide) * 0.5);
  29. y = (int)((tall - dtall) * 0.5);
  30. SetBounds (x, y, dwide, dtall);
  31. SetVisible(true);
  32. vgui::surface()->CreatePopup(GetVPanel(), false);
  33. //loadControlSettings("PanelZoo.res");
  34. // property sheet
  35. m_pTabPanel = new PropertySheet(this, "ZooTabs");
  36. m_pTabPanel->SetBounds(0,50, 1400, 450);
  37. m_pTabPanel->SetTabWidth(50);
  38. m_pTabPanel->AddPage(ImageDemo_Create(this), "ImageDemo");
  39. m_pTabPanel->AddPage(ImagePanelDemo_Create(this), "ImagePanelDemo");
  40. m_pTabPanel->AddPage(TextImageDemo_Create(this), "TextImageDemo");
  41. m_pTabPanel->AddPage(LabelDemo_Create(this), "LabelDemo");
  42. m_pTabPanel->AddPage(Label2Demo_Create(this), "Label2Demo");
  43. m_pTabPanel->AddPage(TextEntryDemo_Create(this), "TextEntryDemo");
  44. m_pTabPanel->AddPage(TextEntryDemo2_Create(this), "TextEntryDemo2");
  45. m_pTabPanel->AddPage(TextEntryDemo3_Create(this), "TextEntryDemo3");
  46. m_pTabPanel->AddPage(TextEntryDemo4_Create(this), "TextEntryDemo4");
  47. m_pTabPanel->AddPage(ButtonDemo_Create(this), "ButtonDemo");
  48. m_pTabPanel->AddPage(ButtonDemo2_Create(this), "ButtonDemo2");
  49. m_pTabPanel->AddPage(CheckButtonDemo_Create(this), "CheckButtonDemo");
  50. m_pTabPanel->AddPage(ToggleButtonDemo_Create(this), "ToggleButtonDemo");
  51. m_pTabPanel->AddPage(RadioButtonDemo_Create(this), "RadioButtonDemo");
  52. m_pTabPanel->AddPage(MenuDemo_Create(this), "MenuDemo");
  53. m_pTabPanel->AddPage(MenuDemo2_Create(this), "MenuDemo2");
  54. m_pTabPanel->AddPage(CascadingMenuDemo_Create(this), "CascadingMenuDemo");
  55. m_pTabPanel->AddPage(MessageBoxDemo_Create(this), "MessageBoxDemo");
  56. m_pTabPanel->AddPage(QueryBoxDemo_Create(this), "QueryBoxDemo");
  57. m_pTabPanel->AddPage(ComboBoxDemo_Create(this), "ComboBoxDemo");
  58. m_pTabPanel->AddPage(ComboBox2Demo_Create(this), "ComboBox2Demo");
  59. m_pTabPanel->AddPage(FrameDemo_Create(this), "FrameDemo");
  60. m_pTabPanel->AddPage(ProgressBarDemo_Create(this), "ProgressBarDemo");
  61. m_pTabPanel->AddPage(ScrollBarDemo_Create(this), "ScrollBarDemo");
  62. m_pTabPanel->AddPage(ScrollBar2Demo_Create(this), "ScrollBar2Demo");
  63. m_pTabPanel->AddPage(EditablePanelDemo_Create(this), "EditablePanelDemo");
  64. m_pTabPanel->AddPage(EditablePanel2Demo_Create(this), "EditablePanel2Demo");
  65. }
  66. //-----------------------------------------------------------------------------
  67. // Purpose: Destructor
  68. //-----------------------------------------------------------------------------
  69. CZooUI::~CZooUI()
  70. {
  71. }
  72. void CZooUI::OnCommand(const char *command)
  73. {
  74. if (!stricmp(command, "Close"))
  75. {
  76. OnClose();
  77. }
  78. }
  79. //-----------------------------------------------------------------------------
  80. // Purpose: Handles closing of the dialog - shuts down the whole app
  81. //-----------------------------------------------------------------------------
  82. void CZooUI::OnClose()
  83. {
  84. Frame::OnClose();
  85. // stop vgui running
  86. vgui::ivgui()->Stop();
  87. }
  88. //-----------------------------------------------------------------------------
  89. // Purpose: Handles closing of the dialog - shuts down the whole app
  90. //-----------------------------------------------------------------------------
  91. void CZooUI::OnMinimize()
  92. {
  93. Frame::OnMinimize();
  94. }
  95. //-----------------------------------------------------------------------------
  96. // Purpose: Message map
  97. //-----------------------------------------------------------------------------
  98. MessageMapItem_t CZooUI::m_MessageMap[] =
  99. {
  100. MAP_MESSAGE( CZooUI, "Close", OnClose ),
  101. };
  102. IMPLEMENT_PANELMAP(CZooUI, BaseClass);