VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h

Last change on this file was 104880, checked in by vboxsync, 4 months ago

FE/Qt: Reworking UIMediumEnumerator a bit to represent it as singleton, which will be that way separated from UICommon registry to simplify dependencies; The intention is to get rid of media related code in UICommon.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/* $Id: UIWindowMenuManager.h 104880 2024-06-10 16:24:42Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIWindowMenuManager class declaration.
4 */
5
6/*
7 * Copyright (C) 2010-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_platform_darwin_UIWindowMenuManager_h
29#define FEQT_INCLUDED_SRC_platform_darwin_UIWindowMenuManager_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QHash>
36#include <QObject>
37
38/* GUI includes: */
39#include "UILibraryDefs.h"
40
41/* Forward declarations: */
42class QMenu;
43class UIMenuHelper;
44
45/** Singleton QObject extension
46 * used as Mac OS X 'Window' menu Manager. */
47class SHARED_LIBRARY_STUFF UIWindowMenuManager : public QObject
48{
49 Q_OBJECT;
50
51public:
52
53 /** Creates instance. */
54 static void create();
55 /** Destroys instance. */
56 static void destroy();
57 /** Returns current instance. */
58 static UIWindowMenuManager *instance() { return s_pInstance; }
59
60 /** Creates 'Window' menu for passed @a pWindow. */
61 QMenu *createMenu(QWidget *pWindow);
62 /** Destroys 'Window' menu for passed @a pWindow. */
63 void destroyMenu(QWidget *pWindow);
64
65 /** Adds @a pWindow to all 'Window' menus. */
66 void addWindow(QWidget *pWindow);
67 /** Removes @a pWindow from all 'Window' menus. */
68 void removeWindow(QWidget *pWindow);
69
70protected:
71
72 /** Constructs 'Window' menu Manager. */
73 UIWindowMenuManager();
74 /** Destructs 'Window' menu Manager. */
75 ~UIWindowMenuManager();
76
77 /** Preprocesses any Qt @a pEvent for passed @a pObject. */
78 virtual bool eventFilter(QObject *pObject, QEvent *pEvent) RT_OVERRIDE;
79
80private slots:
81
82 /** Handles translation event. */
83 virtual void sltRetranslateUI();
84
85private:
86
87 /** Holds the static instance. */
88 static UIWindowMenuManager *s_pInstance;
89
90 /** Holds the list of the registered window references. */
91 QList<QWidget*> m_windows;
92
93 /** Holds the hash of the registered menu-helper instances. */
94 QHash<QWidget*, UIMenuHelper*> m_helpers;
95};
96
97/** Singleton 'Window' menu Manager 'official' name. */
98#define gpWindowMenuManager UIWindowMenuManager::instance()
99
100#endif /* !FEQT_INCLUDED_SRC_platform_darwin_UIWindowMenuManager_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette