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: mbarman.h 27408 2004-05-23 20:53:33Z JS $
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
19DECLARE_WXCOCOA_OBJC_CLASS(wxMenuBarManagerObserver);
20
21// ========================================================================
22// wxMenuBarManager
23// ========================================================================
24class WXDLLEXPORT wxMenuBarManager : public wxObject
25{
26// ------------------------------------------------------------------------
27// initialization/destruction
28// ------------------------------------------------------------------------
29public:
30    wxMenuBarManager();
31    virtual ~wxMenuBarManager();
32// ------------------------------------------------------------------------
33// Single instance
34// ------------------------------------------------------------------------
35public:
36    static wxMenuBarManager *GetInstance() { return sm_mbarmanInstance; }
37    static void CreateInstance();
38    static void DestroyInstance();
39protected:
40    static wxMenuBarManager *sm_mbarmanInstance;
41// ------------------------------------------------------------------------
42// Implementation
43// ------------------------------------------------------------------------
44public:
45    void SetMainMenuBar(wxMenuBar* menubar);
46    void WindowDidBecomeKey(NSNotification *notification);
47#if 0
48    void WindowDidResignKey(NSNotification *notification);
49    void WindowDidBecomeMain(NSNotification *notification);
50    void WindowDidResignMain(NSNotification *notification);
51    void WindowWillClose(NSNotification *notification);
52#endif // 0
53    void UpdateMenuBar();
54protected:
55    void SetMenuBar(wxMenuBar* menubar);
56    void InstallMenuBarForWindow(wxCocoaNSWindow *win);
57    void InstallMainMenu();
58    WX_NSMenu m_menuApp;
59    WX_NSMenu m_menuServices;
60    WX_NSMenu m_menuWindows;
61    WX_NSMenu m_menuMain;
62    // Is main menu bar the current one
63    bool m_mainMenuBarInstalled;
64    // Main menu (if app provides one)
65    wxMenuBar *m_mainMenuBar;
66    wxMenuBarManagerObserver *m_observer;
67    WX_NSWindow m_currentNSWindow;
68};
69
70#endif // wxUSE_MENUS
71#endif // _WX_COCOA_MBARMAN_H_
72