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.

78 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TOOLWINDOW_H
  7. #define TOOLWINDOW_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <vgui/VGUI.h>
  12. #include <vgui_controls/Frame.h>
  13. namespace vgui
  14. {
  15. class ToolWindow;
  16. // So that an app can have a "custom" tool window class created during window drag/drop operations on the property sheet
  17. class IToolWindowFactory
  18. {
  19. public:
  20. virtual ToolWindow *InstanceToolWindow( Panel *parent, bool contextLabel, Panel *firstPage, char const *title, bool contextMenu ) = 0;
  21. };
  22. //-----------------------------------------------------------------------------
  23. // Purpose: Simple frame that holds a property sheet
  24. //-----------------------------------------------------------------------------
  25. class ToolWindow : public Frame
  26. {
  27. DECLARE_CLASS_SIMPLE( ToolWindow, Frame );
  28. public:
  29. ToolWindow(Panel *parent, bool contextLabel, IToolWindowFactory *factory = 0, Panel *page = NULL, char const *title = NULL, bool contextMenu = false, bool inGlobalList = true );
  30. ~ToolWindow();
  31. virtual bool IsDraggableTabContainer() const;
  32. // returns a pointer to the PropertySheet this dialog encapsulates
  33. PropertySheet *GetPropertySheet();
  34. // wrapper for PropertySheet interface
  35. void AddPage(Panel *page, const char *title, bool contextMenu );
  36. void RemovePage( Panel *page );
  37. Panel *GetActivePage();
  38. void SetActivePage( Panel *page );
  39. void SetToolWindowFactory( IToolWindowFactory *factory );
  40. IToolWindowFactory *GetToolWindowFactory();
  41. static int GetToolWindowCount();
  42. static ToolWindow *GetToolWindow( int index );
  43. static CUtlVector< ToolWindow * > s_ToolWindows;
  44. virtual void Grow( int edge = 0, int from_x = -1, int from_y = -1 );
  45. virtual void GrowFromClick();
  46. protected:
  47. // vgui overrides
  48. virtual void PerformLayout();
  49. virtual void ActivateBuildMode();
  50. virtual void RequestFocus(int direction = 0);
  51. virtual void OnMousePressed(MouseCode code);
  52. virtual void OnMouseDoublePressed(MouseCode code);
  53. private:
  54. PropertySheet *m_pPropertySheet;
  55. IToolWindowFactory *m_pFactory;
  56. };
  57. }; // vgui
  58. #endif // TOOLWINDOW_H