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.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "vgui_controls/WizardPanel.h"
  8. #include "vgui_controls/WizardSubPanel.h"
  9. #include "vgui_controls/BuildGroup.h"
  10. #include "keyvalues.h"
  11. // memdbgon must be the last include file in a .cpp file!!!
  12. #include <tier0/memdbgon.h>
  13. #include <stdio.h>
  14. using namespace vgui;
  15. //-----------------------------------------------------------------------------
  16. // Purpose: Constructor
  17. //-----------------------------------------------------------------------------
  18. WizardSubPanel::WizardSubPanel(Panel *parent, const char *panelName) : EditablePanel(parent, panelName), _wizardPanel(NULL)
  19. {
  20. SetVisible(false);
  21. m_iDesiredWide = 0;
  22. m_iDesiredTall = 0;
  23. SetBuildGroup(GetBuildGroup());
  24. }
  25. //-----------------------------------------------------------------------------
  26. // Purpose: Destructor
  27. //-----------------------------------------------------------------------------
  28. WizardSubPanel::~WizardSubPanel()
  29. {
  30. }
  31. //-----------------------------------------------------------------------------
  32. // Purpose:
  33. //-----------------------------------------------------------------------------
  34. void WizardSubPanel::ApplySchemeSettings(IScheme *pScheme)
  35. {
  36. BaseClass::ApplySchemeSettings(pScheme);
  37. SetBgColor(GetSchemeColor("WizardSubPanel.BgColor",pScheme));
  38. }
  39. //-----------------------------------------------------------------------------
  40. // Purpose:
  41. //-----------------------------------------------------------------------------
  42. void WizardSubPanel::GetSettings( KeyValues *outResourceData )
  43. {
  44. BaseClass::GetSettings(outResourceData);
  45. outResourceData->SetInt("WizardWide", m_iDesiredWide);
  46. outResourceData->SetInt("WizardTall", m_iDesiredTall);
  47. }
  48. //-----------------------------------------------------------------------------
  49. // Purpose:
  50. //-----------------------------------------------------------------------------
  51. void WizardSubPanel::ApplySettings(KeyValues *inResourceData)
  52. {
  53. // don't adjust visiblity during settings application (since it's our parent who really controls it)
  54. bool bVisible = IsVisible();
  55. BaseClass::ApplySettings(inResourceData);
  56. m_iDesiredWide = inResourceData->GetInt("WizardWide", 0);
  57. m_iDesiredTall = inResourceData->GetInt("WizardTall", 0);
  58. if (GetWizardPanel() && m_iDesiredWide && m_iDesiredTall)
  59. {
  60. GetWizardPanel()->SetSize(m_iDesiredWide, m_iDesiredTall);
  61. }
  62. SetVisible(bVisible);
  63. }
  64. //-----------------------------------------------------------------------------
  65. // Purpose: build mode description
  66. //-----------------------------------------------------------------------------
  67. const char *WizardSubPanel::GetDescription()
  68. {
  69. static char buf[1024];
  70. _snprintf(buf, sizeof(buf), "%s, int WizardWide, int WizardTall", BaseClass::GetDescription());
  71. return buf;
  72. }
  73. //-----------------------------------------------------------------------------
  74. // Purpose: gets the size this subpanel would like the wizard to be
  75. //-----------------------------------------------------------------------------
  76. bool WizardSubPanel::GetDesiredSize(int &wide, int &tall)
  77. {
  78. wide = m_iDesiredWide;
  79. tall = m_iDesiredTall;
  80. return (m_iDesiredWide && m_iDesiredTall);
  81. }
  82. //-----------------------------------------------------------------------------
  83. // Purpose:
  84. //-----------------------------------------------------------------------------
  85. KeyValues *WizardSubPanel::GetWizardData()
  86. {
  87. return GetWizardPanel()->GetWizardData();
  88. }
  89. //-----------------------------------------------------------------------------
  90. // Purpose:
  91. //-----------------------------------------------------------------------------
  92. WizardSubPanel *WizardSubPanel::GetSiblingSubPanelByName(const char *pageName)
  93. {
  94. return GetWizardPanel()->GetSubPanelByName(pageName);
  95. }