VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/extensions/QIToolBar.h@ 100347

Last change on this file since 100347 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: QIToolBar.h 98103 2023-01-17 14:15:46Z 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: */
45class QMainWindow;
46class QResizeEvent;
47class QWidget;
48#ifdef VBOX_WS_MAC
49class QPaintEvent;
50#endif
51
52/** QToolBar extension with few settings presets. */
53class SHARED_LIBRARY_STUFF QIToolBar : public QToolBar
54{
55 Q_OBJECT;
56
57signals:
58
59 /** Notifies listeners about @a newSize. */
60 void sigResized(const QSize &newSize);
61
62public:
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 /** Mac OS X: Updates native tool-bar layout. */
81 void updateLayout();
82
83 /** Mac OS X: Defines branding stuff to be shown.
84 * @param icnBranding Brings branding icon to be shown.
85 * @param strBranding Brings branding text to be shown.
86 * @param clrBranding Brings branding color to be used.
87 * @param iBrandingWidth Holds the branding stuff width. */
88 void enableBranding(const QIcon &icnBranding,
89 const QString &strBranding,
90 const QColor &clrBranding,
91 int iBrandingWidth);
92#endif /* VBOX_WS_MAC */
93
94protected:
95
96 /** Handles @a pEvent. */
97 virtual bool event(QEvent *pEvent) RT_OVERRIDE;
98
99 /** Handles resize @a pEvent. */
100 virtual void resizeEvent(QResizeEvent *pEvent) RT_OVERRIDE;
101
102#ifdef VBOX_WS_MAC
103 /** Handles paint @a pEvent. */
104 virtual void paintEvent(QPaintEvent *pEvent) RT_OVERRIDE;
105#endif
106
107private:
108
109 /** Prepares all. */
110 void prepare();
111
112#ifdef VBOX_WS_MAC
113 /** Recalculates overall contents width. */
114 void recalculateOverallContentsWidth();
115#endif /* VBOX_WS_MAC */
116
117 /** Holds the parent main-window isntance. */
118 QMainWindow *m_pMainWindow;
119
120#ifdef VBOX_WS_MAC
121 /** Mac OS X: Holds whether unified tool-bar should be emulated. */
122 bool m_fEmulateUnifiedToolbar;
123
124 /** Holds overall contents width. */
125 int m_iOverallContentsWidth;
126
127 /** Mac OS X: Holds branding icon to be shown. */
128 QIcon m_icnBranding;
129 /** Mac OS X: Holds branding text to be shown. */
130 QString m_strBranding;
131 /** Mac OS X: Holds branding color to be used. */
132 QColor m_clrBranding;
133 /** Mac OS X: Holds the branding stuff width. */
134 int m_iBrandingWidth;
135#endif /* VBOX_WS_MAC */
136};
137
138#endif /* !FEQT_INCLUDED_SRC_extensions_QIToolBar_h */
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