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.

136 lines
3.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef BUILDMODEDIALOG_H
  8. #define BUILDMODEDIALOG_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Frame.h>
  13. struct PanelItem_t;
  14. namespace vgui
  15. {
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Dialog for use in build mode editing
  18. //-----------------------------------------------------------------------------
  19. class BuildModeDialog : public Frame
  20. {
  21. DECLARE_CLASS_SIMPLE( BuildModeDialog, Frame );
  22. public:
  23. BuildModeDialog( BuildGroup *buildGroup );
  24. ~BuildModeDialog();
  25. // Set the current control to edit
  26. MESSAGE_FUNC_PTR( SetActiveControl, "SetActiveControl", panelPtr );
  27. // Update the current control with the current resource settings.
  28. MESSAGE_FUNC_PTR( UpdateControlData, "UpdateControlData", panel );
  29. // Store the current settings of all panels in the build group.
  30. virtual KeyValues *StoreSettings();
  31. // Store the current settings of the current panel
  32. MESSAGE_FUNC( StoreUndoSettings, "StoreUndo" );
  33. /* CUSTOM MESSAGE HANDLING
  34. "SetActiveControl"
  35. input: "PanelPtr" - panel to set active control to edit to
  36. */
  37. MESSAGE_FUNC( OnShowNewControlMenu, "ShowNewControlMenu" );
  38. protected:
  39. virtual void PerformLayout();
  40. virtual void OnClose();
  41. virtual void OnCommand( const char *command );
  42. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  43. virtual bool IsBuildGroupEnabled();
  44. private:
  45. void CreateControls();
  46. void OnKeyCodeTyped(KeyCode code);
  47. MESSAGE_FUNC( ApplyDataToControls, "ApplyDataToControls" );
  48. MESSAGE_FUNC_PTR( OnTextChanged, "TextChanged", panel );
  49. MESSAGE_FUNC( OnDeletePanel, "DeletePanel" );
  50. void ExitBuildMode();
  51. Panel *OnNewControl(const char *name, int x = 0, int y = 0);
  52. MESSAGE_FUNC( DoUndo, "Undo" );
  53. MESSAGE_FUNC( DoCopy, "Copy" );
  54. MESSAGE_FUNC( DoPaste, "Paste" );
  55. MESSAGE_FUNC( EnableSaveButton, "EnableSaveButton" );
  56. void RevertToSaved();
  57. void ShowHelp();
  58. MESSAGE_FUNC( ShutdownBuildMode, "Close" );
  59. MESSAGE_FUNC( OnPanelMoved, "PanelMoved" );
  60. MESSAGE_FUNC( OnTextKillFocus, "TextKillFocus" );
  61. MESSAGE_FUNC( OnReloadLocalization, "ReloadLocalization" );
  62. MESSAGE_FUNC_CHARPTR( OnCreateNewControl, "CreateNewControl", text );
  63. MESSAGE_FUNC_CHARPTR( OnSetClipboardText, "SetClipboardText", text );
  64. MESSAGE_FUNC_INT( OnChangeChild, "OnChangeChild", direction );
  65. Panel *m_pCurrentPanel;
  66. BuildGroup *m_pBuildGroup;
  67. Label *m_pStatusLabel;
  68. ComboBox *m_pFileSelectionCombo;
  69. Divider *m_pDivider;
  70. class PanelList;
  71. PanelList *m_pPanelList;
  72. Button *m_pSaveButton;
  73. Button *m_pApplyButton;
  74. Button *m_pExitButton;
  75. Button *m_pDeleteButton;
  76. Button *m_pReloadLocalization;
  77. MenuButton *m_pVarsButton;
  78. bool _autoUpdate;
  79. ComboBox *m_pAddNewControlCombo; // combo box for adding new controls
  80. KeyValues *_undoSettings; // settings for the Undo command
  81. KeyValues *_copySettings; // settings for the Copy/Paste command
  82. char _copyClassName[255];
  83. int m_nClick[ 2 ];
  84. void RemoveAllControls( void );
  85. void UpdateEditControl(PanelItem_t &panelItem, const char *datstring);
  86. enum {
  87. TYPE_STRING,
  88. TYPE_INTEGER,
  89. TYPE_COLOR,
  90. TYPE_ALIGNMENT,
  91. TYPE_AUTORESIZE,
  92. TYPE_CORNER,
  93. TYPE_LOCALIZEDSTRING,
  94. };
  95. vgui::DHANDLE< Menu > m_hContextMenu;
  96. ComboBox *m_pEditableParents;
  97. ComboBox *m_pEditableChildren;
  98. Button *m_pNextChild;
  99. Button *m_pPrevChild;
  100. friend class PanelList;
  101. };
  102. } // namespace vgui
  103. #endif // BUILDMODEDIALOG_H