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.

60 lines
2.3 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: Core Movie Maker UI API
  4. //
  5. //=============================================================================
  6. #include "toolutils/toolswitchmenubutton.h"
  7. #include "vgui_controls/panel.h"
  8. #include "toolutils/toolmenubutton.h"
  9. #include "toolutils/enginetools_int.h"
  10. #include "tier1/keyvalues.h"
  11. #include "vgui_controls/menu.h"
  12. #include "vgui/ILocalize.h"
  13. #include "toolframework/ienginetool.h"
  14. // memdbgon must be the last include file in a .cpp file!!!
  15. #include "tier0/memdbgon.h"
  16. //-----------------------------------------------------------------------------
  17. // Menu to switch between tools
  18. //-----------------------------------------------------------------------------
  19. class CToolHelpMenuButton : public CToolMenuButton
  20. {
  21. DECLARE_CLASS_SIMPLE( CToolHelpMenuButton, CToolMenuButton );
  22. public:
  23. CToolHelpMenuButton( char const *toolName, char const *helpBinding, vgui::Panel *parent, const char *panelName, const char *text, vgui::Panel *pActionTarget );
  24. };
  25. //-----------------------------------------------------------------------------
  26. // Global function to create the help menu
  27. //-----------------------------------------------------------------------------
  28. CToolMenuButton* CreateToolHelpMenuButton( char const *toolName, char const *helpBinding, vgui::Panel *parent, const char *panelName, const char *text, vgui::Panel *pActionTarget )
  29. {
  30. return new CToolHelpMenuButton( toolName, helpBinding, parent, panelName, text, pActionTarget );
  31. }
  32. //-----------------------------------------------------------------------------
  33. // Constructor
  34. //-----------------------------------------------------------------------------
  35. CToolHelpMenuButton::CToolHelpMenuButton( char const *toolName, char const *helpBinding, vgui::Panel *parent, const char *panelName, const char *text, vgui::Panel *pActionTarget ) :
  36. BaseClass( parent, panelName, text, pActionTarget )
  37. {
  38. wchar_t *fmt = g_pVGuiLocalize->Find( "ToolHelpShowHelp" );
  39. if ( fmt )
  40. {
  41. wchar_t desc[ 256 ];
  42. g_pVGuiLocalize->ConvertANSIToUnicode( toolName, desc, sizeof( desc ) );
  43. wchar_t buf[ 512 ];
  44. g_pVGuiLocalize->ConstructString( buf, sizeof( buf ), fmt, 1, desc );
  45. AddMenuItem( "help", buf, new KeyValues( "OnHelp" ), pActionTarget, NULL, helpBinding );
  46. }
  47. SetMenu(m_pMenu);
  48. }