1 | /* $Id: UIMachineWindowFullscreen.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIMachineWindowFullscreen class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2010-2023 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_runtime_fullscreen_UIMachineWindowFullscreen_h
|
---|
29 | #define FEQT_INCLUDED_SRC_runtime_fullscreen_UIMachineWindowFullscreen_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* GUI includes: */
|
---|
35 | #include "UIMachineWindow.h"
|
---|
36 |
|
---|
37 | #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
|
---|
38 | /* Forward declarations: */
|
---|
39 | class UIMiniToolBar;
|
---|
40 | #endif /* VBOX_WS_WIN || VBOX_WS_X11 */
|
---|
41 |
|
---|
42 | /** UIMachineWindow subclass used as full-screen machine window implementation. */
|
---|
43 | class UIMachineWindowFullscreen : public UIMachineWindow
|
---|
44 | {
|
---|
45 | Q_OBJECT;
|
---|
46 |
|
---|
47 | #ifdef RT_OS_DARWIN
|
---|
48 | signals:
|
---|
49 | /** Mac OS X: Notifies listener about native 'fullscreen' will be entered. */
|
---|
50 | void sigNotifyAboutNativeFullscreenWillEnter();
|
---|
51 | /** Mac OS X: Notifies listener about native 'fullscreen' entered. */
|
---|
52 | void sigNotifyAboutNativeFullscreenDidEnter();
|
---|
53 | /** Mac OS X: Notifies listener about native 'fullscreen' will be exited. */
|
---|
54 | void sigNotifyAboutNativeFullscreenWillExit();
|
---|
55 | /** Mac OS X: Notifies listener about native 'fullscreen' exited. */
|
---|
56 | void sigNotifyAboutNativeFullscreenDidExit();
|
---|
57 | /** Mac OS X: Notifies listener about native 'fullscreen' fail to enter. */
|
---|
58 | void sigNotifyAboutNativeFullscreenFailToEnter();
|
---|
59 | #endif /* RT_OS_DARWIN */
|
---|
60 |
|
---|
61 | public:
|
---|
62 |
|
---|
63 | /** Constructor, passes @a pMachineLogic and @a uScreenId to the UIMachineWindow constructor. */
|
---|
64 | UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId);
|
---|
65 |
|
---|
66 | protected:
|
---|
67 |
|
---|
68 | #ifdef VBOX_WS_MAC
|
---|
69 | /** Mac OS X: Handles native notifications @a strNativeNotificationName for 'fullscreen' window. */
|
---|
70 | void handleNativeNotification(const QString &strNativeNotificationName);
|
---|
71 | /** Mac OS X: Returns whether window is in 'fullscreen' transition. */
|
---|
72 | bool isInFullscreenTransition() const { return m_fIsInFullscreenTransition; }
|
---|
73 | #endif /* VBOX_WS_MAC */
|
---|
74 |
|
---|
75 | private slots:
|
---|
76 |
|
---|
77 | #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
|
---|
78 | /** Handles machine state change event. */
|
---|
79 | void sltMachineStateChanged();
|
---|
80 |
|
---|
81 | /** Revokes window activation. */
|
---|
82 | void sltRevokeWindowActivation();
|
---|
83 |
|
---|
84 | /** Handles signal about mini-toolbar auto-hide toggled.
|
---|
85 | * @param fEnabled Brings whether auto-hide is enabled. */
|
---|
86 | void sltHandleMiniToolBarAutoHideToggled(bool fEnabled);
|
---|
87 | #endif /* VBOX_WS_WIN || VBOX_WS_X11 */
|
---|
88 |
|
---|
89 | #ifdef RT_OS_DARWIN
|
---|
90 | /** Mac OS X: Commands @a pMachineWindow to enter native 'fullscreen' mode if possible. */
|
---|
91 | void sltEnterNativeFullscreen(UIMachineWindow *pMachineWindow);
|
---|
92 | /** Mac OS X: Commands @a pMachineWindow to exit native 'fullscreen' mode if possible. */
|
---|
93 | void sltExitNativeFullscreen(UIMachineWindow *pMachineWindow);
|
---|
94 | #endif /* RT_OS_DARWIN */
|
---|
95 |
|
---|
96 | /** Shows window in minimized state. */
|
---|
97 | void sltShowMinimized();
|
---|
98 |
|
---|
99 | private:
|
---|
100 |
|
---|
101 | /** Prepare notification-center routine. */
|
---|
102 | void prepareNotificationCenter();
|
---|
103 | /** Prepare visual-state routine. */
|
---|
104 | void prepareVisualState();
|
---|
105 | #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
|
---|
106 | /** Prepare mini-toolbar routine. */
|
---|
107 | void prepareMiniToolbar();
|
---|
108 | #endif /* VBOX_WS_WIN || VBOX_WS_X11 */
|
---|
109 |
|
---|
110 | #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
|
---|
111 | /** Cleanup mini-toolbar routine. */
|
---|
112 | void cleanupMiniToolbar();
|
---|
113 | #endif /* VBOX_WS_WIN || VBOX_WS_X11 */
|
---|
114 | /** Cleanup visual-state routine. */
|
---|
115 | void cleanupVisualState();
|
---|
116 | /** Cleanup notification-center routine. */
|
---|
117 | void cleanupNotificationCenter();
|
---|
118 |
|
---|
119 | /** Updates geometry according to visual-state. */
|
---|
120 | void placeOnScreen();
|
---|
121 | /** Updates visibility according to visual-state. */
|
---|
122 | void showInNecessaryMode();
|
---|
123 |
|
---|
124 | #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
|
---|
125 | /** Common update routine. */
|
---|
126 | void updateAppearanceOf(int iElement);
|
---|
127 | #endif /* VBOX_WS_WIN || VBOX_WS_X11 */
|
---|
128 |
|
---|
129 | #ifdef VBOX_WS_X11
|
---|
130 | /** X11: Handles @a pEvent about state change. */
|
---|
131 | void changeEvent(QEvent *pEvent);
|
---|
132 | #endif
|
---|
133 |
|
---|
134 | #ifdef VBOX_WS_WIN
|
---|
135 | /** Win: Handles show @a pEvent. */
|
---|
136 | void showEvent(QShowEvent *pEvent);
|
---|
137 | #endif
|
---|
138 |
|
---|
139 | #if defined(VBOX_WS_WIN) || defined(VBOX_WS_X11)
|
---|
140 | /** Holds the mini-toolbar instance. */
|
---|
141 | UIMiniToolBar *m_pMiniToolBar;
|
---|
142 | #endif /* VBOX_WS_WIN || VBOX_WS_X11 */
|
---|
143 |
|
---|
144 | #ifdef VBOX_WS_MAC
|
---|
145 | /** Mac OS X: Reflects whether window is in 'fullscreen' transition. */
|
---|
146 | bool m_fIsInFullscreenTransition;
|
---|
147 | /** Mac OS X: Allows 'fullscreen' API access: */
|
---|
148 | friend class UIMachineLogicFullscreen;
|
---|
149 | #endif /* VBOX_WS_MAC */
|
---|
150 |
|
---|
151 | /** Holds whether the window was minimized before became hidden.
|
---|
152 | * Used to restore minimized state when the window shown again. */
|
---|
153 | bool m_fWasMinimized;
|
---|
154 | #ifdef VBOX_WS_X11
|
---|
155 | /** X11: Holds whether the window minimization is currently requested.
|
---|
156 | * Used to prevent accidentally restoring to full-screen state. */
|
---|
157 | bool m_fIsMinimizationRequested;
|
---|
158 | /** X11: Holds whether the window is currently minimized.
|
---|
159 | * Used to restore full-screen state when the window restored again. */
|
---|
160 | bool m_fIsMinimized;
|
---|
161 | #endif
|
---|
162 | };
|
---|
163 |
|
---|
164 | #endif /* !FEQT_INCLUDED_SRC_runtime_fullscreen_UIMachineWindowFullscreen_h */
|
---|