mbarman.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/mbarman.h
  3. // Purpose: wxMenuBarManager class
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2003/09/04
  7. // Copyright: (c) 2003 David Elliott
  8. // Licence: wxWindows licence
  9. ///////////////////////////////////////////////////////////////////////////////
  10. #ifndef __WX_COCOA_MBARMAN_H__
  11. #define __WX_COCOA_MBARMAN_H__
  12. #if wxUSE_MENUS
  13. #include "wx/toplevel.h"
  14. DECLARE_WXCOCOA_OBJC_CLASS(wxMenuBarManagerObserver);
  15. // ========================================================================
  16. // wxMenuBarManager
  17. // ========================================================================
  18. class WXDLLIMPEXP_CORE wxMenuBarManager : public wxObject
  19. {
  20. // ------------------------------------------------------------------------
  21. // initialization/destruction
  22. // ------------------------------------------------------------------------
  23. public:
  24. wxMenuBarManager();
  25. virtual ~wxMenuBarManager();
  26. // ------------------------------------------------------------------------
  27. // Single instance
  28. // ------------------------------------------------------------------------
  29. public:
  30. static wxMenuBarManager *GetInstance() { return sm_mbarmanInstance; }
  31. static void CreateInstance();
  32. static void DestroyInstance();
  33. protected:
  34. static wxMenuBarManager *sm_mbarmanInstance;
  35. // ------------------------------------------------------------------------
  36. // Implementation
  37. // ------------------------------------------------------------------------
  38. public:
  39. void SetMainMenuBar(wxMenuBar* menubar);
  40. void WindowDidBecomeKey(NSNotification *notification);
  41. #if 0
  42. void WindowDidResignKey(NSNotification *notification);
  43. void WindowDidBecomeMain(NSNotification *notification);
  44. void WindowDidResignMain(NSNotification *notification);
  45. void WindowWillClose(NSNotification *notification);
  46. #endif // 0
  47. void UpdateMenuBar();
  48. protected:
  49. void SetMenuBar(wxMenuBar* menubar);
  50. void InstallMenuBarForWindow(wxCocoaNSWindow *win);
  51. void InstallMainMenu();
  52. WX_NSMenu m_menuApp;
  53. WX_NSMenu m_menuServices;
  54. WX_NSMenu m_menuWindows;
  55. WX_NSMenu m_menuMain;
  56. // Is main menu bar the current one
  57. bool m_mainMenuBarInstalled;
  58. // Main menu (if app provides one)
  59. wxMenuBar *m_mainMenuBar;
  60. wxMenuBarManagerObserver *m_observer;
  61. WX_NSWindow m_currentNSWindow;
  62. };
  63. #endif // wxUSE_MENUS
  64. #endif // _WX_COCOA_MBARMAN_H_