Added wxMenuBarManager
[wxWidgets.git] / include / wx / cocoa / mbarman.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/mbarman.h
3 // Purpose: wxMenuBarManager class
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/09/04
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_MBARMAN_H__
13 #define __WX_COCOA_MBARMAN_H__
14
15 #if wxUSE_MENUS
16
17 #include "wx/toplevel.h"
18
19 // ========================================================================
20 // wxMenuBarManager
21 // ========================================================================
22 class WXDLLEXPORT wxMenuBarManager : public wxObject
23 {
24 // ------------------------------------------------------------------------
25 // initialization/destruction
26 // ------------------------------------------------------------------------
27 public:
28 wxMenuBarManager();
29 virtual ~wxMenuBarManager();
30 // ------------------------------------------------------------------------
31 // Single instance
32 // ------------------------------------------------------------------------
33 public:
34 static wxMenuBarManager *GetInstance() { return sm_mbarmanInstance; }
35 static void CreateInstance();
36 static void DestroyInstance();
37 protected:
38 static wxMenuBarManager *sm_mbarmanInstance;
39 // ------------------------------------------------------------------------
40 // Implementation
41 // ------------------------------------------------------------------------
42 public:
43 void SetMainMenuBar(wxMenuBar* menubar);
44 void CocoaInternalIdle();
45 void WindowDidBecomeKey(wxTopLevelWindowNative *win);
46 void WindowDidResignKey(wxTopLevelWindowNative *win);
47 void WindowDidBecomeMain(wxTopLevelWindowNative *win);
48 void WindowDidResignMain(wxTopLevelWindowNative *win);
49 void UpdateWindowMenuBar(wxTopLevelWindowNative *win);
50 protected:
51 void SetMenuBar(wxMenuBar* menubar);
52 void InstallMenuBarForWindow(wxTopLevelWindowNative *win);
53 void InstallMainMenu();
54 WX_NSMenu m_menuApp;
55 WX_NSMenu m_menuServices;
56 WX_NSMenu m_menuWindows;
57 WX_NSMenu m_menuMain;
58 // Some menu bar needs to be installed
59 bool m_needMenuBar;
60 // Is main menu bar the current one
61 bool m_mainMenuBarInstalled;
62 // Main menu (if app provides one)
63 wxMenuBar *m_mainMenuBar;
64 wxTopLevelWindowNative *m_windowKey;
65 wxTopLevelWindowNative *m_windowMain;
66 };
67
68 #endif // wxUSE_MENUS
69 #endif // _WX_COCOA_MBARMAN_H_