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.

103 lines
2.9 KiB

  1. //====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======
  2. //
  3. // Standard file menu
  4. //
  5. //=============================================================================
  6. #ifndef TOOLFILEMENUBUTTON_H
  7. #define TOOLFILEMENUBUTTON_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "toolutils/toolmenubutton.h"
  12. //-----------------------------------------------------------------------------
  13. // forward declarations
  14. //-----------------------------------------------------------------------------
  15. namespace vgui
  16. {
  17. class Panel;
  18. class Menu;
  19. }
  20. class CToolMenuButton;
  21. //-----------------------------------------------------------------------------
  22. // Called back by the file menu
  23. //-----------------------------------------------------------------------------
  24. class IFileMenuCallbacks
  25. {
  26. public:
  27. enum MenuItems_t
  28. {
  29. FILE_NEW = 0x01,
  30. FILE_OPEN = 0x02,
  31. FILE_SAVE = 0x04,
  32. FILE_SAVEAS = 0x08,
  33. FILE_CLOSE = 0x10,
  34. FILE_RECENT = 0x20,
  35. FILE_EXIT = 0x40,
  36. FILE_ALL = 0xFFFFFFFF
  37. };
  38. // Logically OR together all items that should be enabled
  39. virtual int GetFileMenuItemsEnabled( ) = 0;
  40. // Add recent files to the menu passed in
  41. virtual void AddRecentFilesToMenu( vgui::Menu *menu ) = 0;
  42. // Get the perforce file name (to set the various perforce menu options)
  43. virtual bool GetPerforceFileName( char *pFileName, int nMaxLen ) = 0;
  44. // Gets the root vgui panel
  45. virtual vgui::Panel *GetRootPanel() = 0;
  46. };
  47. //-----------------------------------------------------------------------------
  48. // Standard file menu
  49. //-----------------------------------------------------------------------------
  50. class CToolFileMenuButton : public CToolMenuButton
  51. {
  52. DECLARE_CLASS_SIMPLE( CToolFileMenuButton, CToolMenuButton );
  53. public:
  54. CToolFileMenuButton( vgui::Panel *parent, const char *panelName, const char *text, vgui::Panel *pActionTarget, IFileMenuCallbacks *pFileMenuCallback );
  55. virtual void OnShowMenu( vgui::Menu *menu );
  56. private:
  57. MESSAGE_FUNC( OnPerforceAdd, "OnPerforceAdd" );
  58. MESSAGE_FUNC( OnPerforceOpen, "OnPerforceOpen" );
  59. MESSAGE_FUNC( OnPerforceRevert, "OnPerforceRevert" );
  60. MESSAGE_FUNC( OnPerforceSubmit, "OnPerforceSubmit" );
  61. MESSAGE_FUNC( OnPerforceP4Win, "OnPerforceP4Win" );
  62. MESSAGE_FUNC( OnPerforceListOpenFiles, "OnPerforceListOpenFiles" );
  63. vgui::Menu *m_pRecentFiles;
  64. vgui::Menu *m_pPerforce;
  65. int m_nRecentFiles;
  66. IFileMenuCallbacks *m_pFileMenuCallback;
  67. int m_nPerforceAdd;
  68. int m_nPerforceOpen;
  69. int m_nPerforceRevert;
  70. int m_nPerforceSubmit;
  71. int m_nPerforceP4Win;
  72. int m_nPerforceListOpenFiles;
  73. };
  74. //-----------------------------------------------------------------------------
  75. // Global function to create the switch menu
  76. //-----------------------------------------------------------------------------
  77. CToolMenuButton* CreateToolFileMenuButton( vgui::Panel *parent, const char *panelName,
  78. const char *text, vgui::Panel *pActionTarget, IFileMenuCallbacks *pCallbacks );
  79. #endif // TOOLFILEMENUBUTTON_H