VirtualBox

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

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

FE/Qt: Seamless mode splitted into two #ifdef implementations - Masked and Translucent. Windows uses Masked, Mac OS X uses Translucent, X11 uses both.

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

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