1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * UIMachineWindow class declaration
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2010 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 | /* Local includes */
|
---|
23 | #include "UIMachineDefs.h"
|
---|
24 |
|
---|
25 | /* Global forwards */
|
---|
26 | class QWidget;
|
---|
27 | class QGridLayout;
|
---|
28 | class QSpacerItem;
|
---|
29 | class QCloseEvent;
|
---|
30 |
|
---|
31 | /* Local forwards */
|
---|
32 | class CSession;
|
---|
33 | class UISession;
|
---|
34 | class UIMachineLogic;
|
---|
35 | class UIMachineView;
|
---|
36 |
|
---|
37 | class UIMachineWindow
|
---|
38 | {
|
---|
39 | public:
|
---|
40 |
|
---|
41 | /* Factory function to create required machine window child: */
|
---|
42 | static UIMachineWindow* create(UIMachineLogic *pMachineLogic, UIVisualStateType visualStateType, ulong uScreenId = 0);
|
---|
43 | static void destroy(UIMachineWindow *pWhichWindow);
|
---|
44 |
|
---|
45 | /* Abstract slot to close machine window: */
|
---|
46 | virtual void sltTryClose();
|
---|
47 |
|
---|
48 | /* Public getters: */
|
---|
49 | virtual UIMachineLogic* machineLogic() const { return m_pMachineLogic; }
|
---|
50 | virtual QWidget* machineWindow() const { return m_pMachineWindow; }
|
---|
51 | virtual UIMachineView* machineView() const { return m_pMachineView; }
|
---|
52 | UISession* uisession() const;
|
---|
53 | CSession& session() const;
|
---|
54 |
|
---|
55 | /* Public members: */
|
---|
56 | virtual void reshow() {}
|
---|
57 | virtual void setMask(const QRegion ®ion) { machineWindow()->setMask(region); }
|
---|
58 |
|
---|
59 | protected:
|
---|
60 |
|
---|
61 | /* Machine window constructor/destructor: */
|
---|
62 | UIMachineWindow(UIMachineLogic *pMachineLogic, ulong uScreenId);
|
---|
63 | virtual ~UIMachineWindow();
|
---|
64 |
|
---|
65 | /* Protected getters: */
|
---|
66 | const QString& defaultWindowTitle() const { return m_strWindowTitlePrefix; }
|
---|
67 |
|
---|
68 | /* Translate routine: */
|
---|
69 | virtual void retranslateUi();
|
---|
70 |
|
---|
71 | /* Common machine window event handlers: */
|
---|
72 | #ifdef Q_WS_X11
|
---|
73 | bool x11Event(XEvent *pEvent);
|
---|
74 | #endif
|
---|
75 | void closeEvent(QCloseEvent *pEvent);
|
---|
76 |
|
---|
77 | /* Prepare helpers: */
|
---|
78 | virtual void prepareWindowIcon();
|
---|
79 | virtual void prepareConsoleConnections();
|
---|
80 | virtual void prepareMachineViewContainer();
|
---|
81 | //virtual void loadWindowSettings() {}
|
---|
82 |
|
---|
83 | /* Cleanup helpers: */
|
---|
84 | //virtual void saveWindowSettings() {}
|
---|
85 | //virtual void cleanupMachineViewContainer() {}
|
---|
86 | //virtual void cleanupConsoleConnections() {}
|
---|
87 | //virtual void cleanupWindowIcon() {}
|
---|
88 |
|
---|
89 | /* Update routines: */
|
---|
90 | virtual void updateAppearanceOf(int iElement);
|
---|
91 | #ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
92 | virtual void updateDbgWindows();
|
---|
93 | #endif /* VBOX_WITH_DEBUGGER_GUI */
|
---|
94 |
|
---|
95 | /* Protected slots: */
|
---|
96 | virtual void sltMachineStateChanged();
|
---|
97 |
|
---|
98 | /* Protected variables: */
|
---|
99 | UIMachineLogic *m_pMachineLogic;
|
---|
100 | QWidget *m_pMachineWindow;
|
---|
101 |
|
---|
102 | /* Virtual screen number: */
|
---|
103 | ulong m_uScreenId;
|
---|
104 |
|
---|
105 | QGridLayout *m_pMachineViewContainer;
|
---|
106 | QSpacerItem *m_pTopSpacer;
|
---|
107 | QSpacerItem *m_pBottomSpacer;
|
---|
108 | QSpacerItem *m_pLeftSpacer;
|
---|
109 | QSpacerItem *m_pRightSpacer;
|
---|
110 |
|
---|
111 | UIMachineView *m_pMachineView;
|
---|
112 | QString m_strWindowTitlePrefix;
|
---|
113 |
|
---|
114 | friend class UIMachineLogic;
|
---|
115 | };
|
---|
116 |
|
---|
117 | #endif // __UIMachineWindow_h__
|
---|
118 |
|
---|