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.

96 lines
2.7 KiB

  1. //===== Copyright � 1996-2006, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Base class for windows that draw vgui in Maya
  4. //
  5. //===========================================================================//
  6. #ifndef VSVGUIWINDOW_H
  7. #define VSVGUIWINDOW_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "imayavgui.h"
  12. //-----------------------------------------------------------------------------
  13. // Forward declarations
  14. //-----------------------------------------------------------------------------
  15. class IMayaVGui;
  16. //-----------------------------------------------------------------------------
  17. // The singleton is defined here twice just so we don't have to include valvemaya.h also
  18. //-----------------------------------------------------------------------------
  19. extern IMayaVGui *g_pMayaVGui;
  20. //-----------------------------------------------------------------------------
  21. // Forward declarations
  22. //-----------------------------------------------------------------------------
  23. namespace vgui
  24. {
  25. class EditablePanel;
  26. }
  27. //-----------------------------------------------------------------------------
  28. // Creates, destroys a maya vgui window
  29. //-----------------------------------------------------------------------------
  30. void CreateMayaVGuiWindow( HWND in_hParent, vgui::EditablePanel *pRootPanel, const char *pPanelName );
  31. void DestroyMayaVGuiWindow( const char *pPanelName );
  32. //-----------------------------------------------------------------------------
  33. // Factory used to install vgui windows easily
  34. //-----------------------------------------------------------------------------
  35. class CVsVguiWindowFactoryBase : public IMayaVguiWindowFactory
  36. {
  37. public:
  38. CVsVguiWindowFactoryBase( const char *pWindowTypeName );
  39. // Registers/deregisters all vgui windows
  40. static void RegisterAllVguiWindows( );
  41. static void UnregisterAllVguiWindows( );
  42. protected:
  43. const char *m_pWindowTypeName;
  44. private:
  45. CVsVguiWindowFactoryBase *m_pNext;
  46. static CVsVguiWindowFactoryBase *s_pFirstCommandFactory;
  47. };
  48. template< class T >
  49. class CVsVguiWindowFactory : public CVsVguiWindowFactoryBase
  50. {
  51. typedef CVsVguiWindowFactoryBase BaseClass;
  52. public:
  53. CVsVguiWindowFactory( const char *pWindowTypeName ) : BaseClass( pWindowTypeName )
  54. {
  55. }
  56. virtual void CreateVguiWindow(HWND in_hParent, const char *pPanelName )
  57. {
  58. T *pVguiPanel = new T;
  59. CreateMayaVGuiWindow( in_hParent, pVguiPanel, pPanelName );
  60. }
  61. virtual void DestroyVguiWindow( const char *pPanelName )
  62. {
  63. DestroyMayaVGuiWindow( pPanelName );
  64. }
  65. private:
  66. };
  67. #define INSTALL_MAYA_VGUI_WINDOW( _className, _windowTypeName ) \
  68. static CVsVguiWindowFactory< _className > s_VsVguiWindowFactory##_className##( _windowTypeName )
  69. #endif // VSVGUIWINDOW_H