Changeset 57890 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 25, 2015 12:12:40 PM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.cpp
r52730 r57890 5 5 6 6 /* 7 * Copyright (C) 2010-201 2Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 20 20 #else /* !VBOX_WITH_PRECOMPILED_HEADERS */ 21 21 22 /* Local includes*/22 /* GUI includes: */ 23 23 # include "UIWindowMenuManager.h" 24 24 25 /* Global includes*/25 /* Qt includes: */ 26 26 # include <QApplication> 27 27 # include <QMenu> … … 29 29 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 30 30 31 31 /** QObject extension 32 * used as Mac OS X 'Window' menu helper. */ 32 33 class UIMenuHelper: public QObject 33 34 { … … 35 36 36 37 public: 38 39 /** Constructs menu-helper on the basis of passed @a winList. */ 37 40 UIMenuHelper(const QList<QWidget*> &winList) 38 41 { … … 51 54 retranslateUi(); 52 55 } 56 57 /** Destructs menu-helper. */ 53 58 ~UIMenuHelper() 54 59 { … … 57 62 } 58 63 64 /** Returns 'Window' menu. */ 59 65 QMenu *menu() const { return m_pWindowMenu; } 60 66 67 /** Adds window into 'Window' menu. */ 61 68 QAction* addWindow(QWidget *pWindow) 62 69 { … … 84 91 return pAction; 85 92 } 93 94 /** Removes window from 'Window' menu. */ 86 95 void removeWindow(QWidget *pWindow) 87 96 { … … 93 102 } 94 103 104 /** Handles translation event. */ 95 105 void retranslateUi() 96 106 { … … 100 110 } 101 111 112 /** Updates toggle action states according to passed @a pActive. */ 102 113 void updateStatus(QWidget *pActive) 103 114 { … … 118 129 private slots: 119 130 131 /** Handles request to minimize active-window. */ 120 132 void minimizeActive(bool /* fToggle */) 121 133 { … … 123 135 pActive->showMinimized(); 124 136 } 137 138 /** Handles request to raise sender window. */ 125 139 void raiseSender(bool /* fToggle */) 126 140 { … … 138 152 private: 139 153 140 /* Private member vars*/154 /** Holds the 'Window' menu instance. */ 141 155 QMenu *m_pWindowMenu; 156 /** Holds the action group instance. */ 142 157 QActionGroup *m_pGroup; 158 /** Holds the 'Minimize' action instance. */ 143 159 QAction *m_pMinimizeAction; 160 /** Holds the hash of the registered menu-helper instances. */ 144 161 QHash<QString, QAction*> m_regWindows; 145 162 }; 146 163 164 /* static */ 147 165 UIWindowMenuManager *UIWindowMenuManager::m_pInstance = 0; 148 166 167 /* static */ 149 168 UIWindowMenuManager *UIWindowMenuManager::instance(QWidget *pParent /* = 0 */) 150 169 { … … 155 174 } 156 175 176 /* static */ 157 177 void UIWindowMenuManager::destroy() 158 178 { -
trunk/src/VBox/Frontends/VirtualBox/src/platform/darwin/UIWindowMenuManager.h
r55401 r57890 5 5 6 6 /* 7 * Copyright (C) 2010 Oracle Corporation7 * Copyright (C) 2010-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 16 16 */ 17 17 18 #ifndef __ UIWindowMenuManager_h__19 #define __ UIWindowMenuManager_h__18 #ifndef ___UIWindowMenuManager_h___ 19 #define ___UIWindowMenuManager_h___ 20 20 21 /* Global includes*/21 /* Qt includes: */ 22 22 #include <QObject> 23 23 #include <QHash> 24 24 25 /* Local forward declarations*/25 /* Forward declarations: */ 26 26 class UIMenuHelper; 27 28 /* Global forward declarations */29 27 class QMenu; 30 28 29 /** Singleton QObject extension 30 * used as Mac OS X 'Window' menu Manager. */ 31 31 class UIWindowMenuManager: public QObject 32 32 { … … 35 35 public: 36 36 37 /** Static constructor and instance provider. */ 37 38 static UIWindowMenuManager *instance(QWidget *pParent = 0); 39 /** Static destructor. */ 38 40 static void destroy(); 39 41 42 /** Creates 'Window' menu for passed @a pWindow. */ 40 43 QMenu *createMenu(QWidget *pWindow); 44 /** Destroys 'Window' menu for passed @a pWindow. */ 41 45 void destroyMenu(QWidget *pWindow); 42 46 47 /** Adds @a pWindow to all 'Window' menus. */ 43 48 void addWindow(QWidget *pWindow); 49 /** Removes @a pWindow from all 'Window' menus. */ 44 50 void removeWindow(QWidget *pWindow); 45 51 52 /** Handles translation event. */ 46 53 void retranslateUi(); 47 54 48 55 protected: 49 56 57 /** Preprocesses any Qt @a pEvent for passed @a pObject. */ 50 58 bool eventFilter(QObject *pObj, QEvent *pEvent); 51 59 52 60 private: 53 61 62 /** Constructs 'Window' menu Manager. */ 54 63 UIWindowMenuManager(QWidget *pParent = 0); 64 /** Destructs 'Window' menu Manager. */ 55 65 ~UIWindowMenuManager(); 56 66 57 /* Private member vars*/67 /** Holds the static instance. */ 58 68 static UIWindowMenuManager *m_pInstance; 69 70 /** Holds the passed parent reference. */ 59 71 QWidget *m_pParent; 72 73 /** Holds the list of the registered window references. */ 60 74 QList<QWidget*> m_regWindows; 75 76 /** Holds the hash of the registered menu-helper instances. */ 61 77 QHash<QWidget*, UIMenuHelper*> m_helpers; 62 78 }; 63 79 64 #endif /* __UIWindowMenuManager_h__ */80 #endif /* !___UIWindowMenuManager_h___ */ 65 81
Note:
See TracChangeset
for help on using the changeset viewer.