1 | /* $Id: QIToolBar.h 102269 2023-11-22 18:50:08Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - QIToolBar class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-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_extensions_QIToolBar_h
|
---|
29 | #define FEQT_INCLUDED_SRC_extensions_QIToolBar_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QToolBar>
|
---|
36 | #ifdef VBOX_WS_MAC
|
---|
37 | # include <QColor>
|
---|
38 | # include <QIcon>
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | /* GUI includes: */
|
---|
42 | #include "UILibraryDefs.h"
|
---|
43 |
|
---|
44 | /* Forward declarations: */
|
---|
45 | class QMainWindow;
|
---|
46 | class QResizeEvent;
|
---|
47 | class QWidget;
|
---|
48 | #ifdef VBOX_WS_MAC
|
---|
49 | class QPaintEvent;
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | /** QToolBar extension with few settings presets. */
|
---|
53 | class SHARED_LIBRARY_STUFF QIToolBar : public QToolBar
|
---|
54 | {
|
---|
55 | Q_OBJECT;
|
---|
56 |
|
---|
57 | signals:
|
---|
58 |
|
---|
59 | /** Notifies listeners about @a newSize. */
|
---|
60 | void sigResized(const QSize &newSize);
|
---|
61 |
|
---|
62 | public:
|
---|
63 |
|
---|
64 | /** Constructs tool-bar passing @a pParent to the base-class. */
|
---|
65 | QIToolBar(QWidget *pParent = 0);
|
---|
66 |
|
---|
67 | /** Defines whether tool-bar should use text-labels. */
|
---|
68 | void setUseTextLabels(bool fEnable);
|
---|
69 | /** Returns whether tool-bar should use text-labels. */
|
---|
70 | bool useTextLabels() const;
|
---|
71 |
|
---|
72 | #ifdef VBOX_WS_MAC
|
---|
73 | /** Mac OS X: Defines whether native tool-bar should be enabled. */
|
---|
74 | void enableMacToolbar();
|
---|
75 | /** Mac OS X: Defines whether native tool-bar should be emulated. */
|
---|
76 | void emulateMacToolbar();
|
---|
77 |
|
---|
78 | /** Mac OS X: Defines whether native tool-bar button should be shown. */
|
---|
79 | void setShowToolBarButton(bool fShow);
|
---|
80 |
|
---|
81 | /** Mac OS X: Defines branding stuff to be shown.
|
---|
82 | * @param icnBranding Brings branding icon to be shown.
|
---|
83 | * @param strBranding Brings branding text to be shown.
|
---|
84 | * @param clrBranding Brings branding color to be used.
|
---|
85 | * @param iBrandingWidth Holds the branding stuff width. */
|
---|
86 | void enableBranding(const QIcon &icnBranding,
|
---|
87 | const QString &strBranding,
|
---|
88 | const QColor &clrBranding,
|
---|
89 | int iBrandingWidth);
|
---|
90 | #endif /* VBOX_WS_MAC */
|
---|
91 |
|
---|
92 | protected:
|
---|
93 |
|
---|
94 | /** Handles @a pEvent. */
|
---|
95 | virtual bool event(QEvent *pEvent) RT_OVERRIDE;
|
---|
96 |
|
---|
97 | /** Handles resize @a pEvent. */
|
---|
98 | virtual void resizeEvent(QResizeEvent *pEvent) RT_OVERRIDE;
|
---|
99 |
|
---|
100 | #ifdef VBOX_WS_MAC
|
---|
101 | /** Handles paint @a pEvent. */
|
---|
102 | virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE;
|
---|
103 | #endif
|
---|
104 |
|
---|
105 | private:
|
---|
106 |
|
---|
107 | /** Prepares all. */
|
---|
108 | void prepare();
|
---|
109 |
|
---|
110 | #ifdef VBOX_WS_MAC
|
---|
111 | /** Recalculates overall contents width. */
|
---|
112 | void recalculateOverallContentsWidth();
|
---|
113 | #endif /* VBOX_WS_MAC */
|
---|
114 |
|
---|
115 | /** Holds the parent main-window isntance. */
|
---|
116 | QMainWindow *m_pMainWindow;
|
---|
117 |
|
---|
118 | #ifdef VBOX_WS_MAC
|
---|
119 | /** Mac OS X: Holds whether unified tool-bar should be emulated. */
|
---|
120 | bool m_fEmulateUnifiedToolbar;
|
---|
121 |
|
---|
122 | /** Holds overall contents width. */
|
---|
123 | int m_iOverallContentsWidth;
|
---|
124 |
|
---|
125 | /** Mac OS X: Holds branding icon to be shown. */
|
---|
126 | QIcon m_icnBranding;
|
---|
127 | /** Mac OS X: Holds branding text to be shown. */
|
---|
128 | QString m_strBranding;
|
---|
129 | /** Mac OS X: Holds branding color to be used. */
|
---|
130 | QColor m_clrBranding;
|
---|
131 | /** Mac OS X: Holds the branding stuff width. */
|
---|
132 | int m_iBrandingWidth;
|
---|
133 | #endif /* VBOX_WS_MAC */
|
---|
134 | };
|
---|
135 |
|
---|
136 | #endif /* !FEQT_INCLUDED_SRC_extensions_QIToolBar_h */
|
---|