VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h@ 50492

Last change on this file since 50492 was 50492, checked in by vboxsync, 11 years ago

FE/Qt: Mac OS X: 7016: Runtime UI: Integration part for native notification framework (r92332).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * UIMachineWindow class declaration
5 */
6
7/*
8 * Copyright (C) 2010-2013 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 */
18
19#ifndef __UIMachineWindow_h__
20#define __UIMachineWindow_h__
21
22/* Qt includes: */
23#include <QMainWindow>
24
25/* GUI includes: */
26#include "QIWithRetranslateUI.h"
27#include "UIDefs.h"
28
29/* COM includes: */
30#include "COMEnums.h"
31#include "CMachine.h"
32
33/* Forward declarations: */
34class QGridLayout;
35class QSpacerItem;
36class QCloseEvent;
37class CSession;
38class UISession;
39class UIMachineLogic;
40class UIMachineView;
41
42/* Machine-window interface: */
43class UIMachineWindow : public QIWithRetranslateUI2<QMainWindow>
44{
45 Q_OBJECT;
46
47public:
48
49 /* Factory functions to create/destroy machine-window: */
50 static UIMachineWindow* create(UIMachineLogic *pMachineLogic, ulong uScreenId = 0);
51 static void destroy(UIMachineWindow *pWhichWindow);
52
53 /* Prepare/cleanup machine-window: */
54 void prepare();
55 void cleanup();
56
57 /* Public getters: */
58 UIMachineView* machineView() const { return m_pMachineView; }
59 UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
60 UISession* uisession() const;
61 CSession& session() const;
62 CMachine machine() const;
63
64 /** Adjusts machine-window size to correspond current guest screen size.
65 * @param fAdjustPosition determines whether is it necessary to adjust position too.
66 * @note Reimplemented in sub-classes. Base implementation does nothing. */
67 virtual void normalizeGeometry(bool fAdjustPosition) { Q_UNUSED(fAdjustPosition); }
68
69#ifndef VBOX_WITH_TRANSLUCENT_SEAMLESS
70 /* Virtual caller for base class setMask: */
71 virtual void setMask(const QRegion &region);
72#endif /* !VBOX_WITH_TRANSLUCENT_SEAMLESS */
73
74protected slots:
75
76 /* Session event-handlers: */
77 virtual void sltMachineStateChanged();
78
79protected:
80
81 /* Constructor: */
82 UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId);
83
84 /* Show stuff: */
85 virtual void showInNecessaryMode() = 0;
86
87 /* Translate stuff: */
88 void retranslateUi();
89
90 /* Event handlers: */
91#ifdef Q_WS_X11
92 bool x11Event(XEvent *pEvent);
93#endif /* Q_WS_X11 */
94 void closeEvent(QCloseEvent *pEvent);
95
96#ifdef Q_WS_MAC
97 /** Mac OS X: Handles native notifications.
98 * @param strNativeNotificationName Native notification name. */
99 virtual void handleNativeNotification(const QString & /* strNativeNotificationName */) {}
100#endif /* Q_WS_MAC */
101
102 /* Prepare helpers: */
103 virtual void prepareSessionConnections();
104 virtual void prepareMainLayout();
105 virtual void prepareMenu() {}
106 virtual void prepareStatusBar() {}
107 virtual void prepareMachineView();
108 virtual void prepareVisualState() {}
109 virtual void prepareHandlers();
110 virtual void loadSettings() {}
111
112 /* Cleanup helpers: */
113 virtual void saveSettings() {}
114 virtual void cleanupHandlers();
115 virtual void cleanupVisualState() {}
116 virtual void cleanupMachineView();
117 virtual void cleanupStatusBar() {}
118 virtual void cleanupMenu() {}
119 virtual void cleanupMainLayout() {}
120 virtual void cleanupSessionConnections() {}
121
122 /* Visibility stuff: */
123 void handleScreenCountChange();
124 void handleScreenGeometryChange();
125
126 /* Update stuff: */
127 virtual void updateAppearanceOf(int iElement);
128#ifdef VBOX_WITH_DEBUGGER_GUI
129 void updateDbgWindows();
130#endif /* VBOX_WITH_DEBUGGER_GUI */
131
132 /* Helpers: */
133 const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
134 static Qt::WindowFlags windowFlags(UIVisualStateType visualStateType);
135 static Qt::Alignment viewAlignment(UIVisualStateType visualStateType);
136
137#ifdef Q_WS_MAC
138 /** Mac OS X: Handles native notifications.
139 * @param strNativeNotificationName Native notification name.
140 * @param pWidget Widget, notification related to. */
141 static void handleNativeNotification(const QString &strNativeNotificationName, QWidget *pWidget);
142#endif /* Q_WS_MAC */
143
144 /* Variables: */
145 UIMachineLogic *m_pMachineLogic;
146 UIMachineView *m_pMachineView;
147 QString m_strWindowTitlePrefix;
148 ulong m_uScreenId;
149 QGridLayout *m_pMainLayout;
150 QSpacerItem *m_pTopSpacer;
151 QSpacerItem *m_pBottomSpacer;
152 QSpacerItem *m_pLeftSpacer;
153 QSpacerItem *m_pRightSpacer;
154
155 /* Friend classes: */
156 friend class UIMachineLogic;
157 friend class UIMachineLogicFullscreen;
158 friend class UIMachineLogicSeamless;
159};
160
161#endif // __UIMachineWindow_h__
162
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