1 | /* $Id: UIToolBar.h 76553 2019-01-01 01:45:53Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UIToolBar class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2019 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___UIToolBar_h___
|
---|
19 | #define ___UIToolBar_h___
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | /* Qt includes: */
|
---|
25 | #include <QToolBar>
|
---|
26 |
|
---|
27 | /* GUI includes: */
|
---|
28 | #include "UILibraryDefs.h"
|
---|
29 |
|
---|
30 | /* Forward declarations: */
|
---|
31 | class QMainWindow;
|
---|
32 | class QResizeEvent;
|
---|
33 | class QWidget;
|
---|
34 | #ifdef VBOX_WS_MAC
|
---|
35 | class QPaintEvent;
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /** QToolBar extension with few settings presets. */
|
---|
39 | class SHARED_LIBRARY_STUFF UIToolBar : public QToolBar
|
---|
40 | {
|
---|
41 | Q_OBJECT;
|
---|
42 |
|
---|
43 | signals:
|
---|
44 |
|
---|
45 | /** Notifies listeners about @a newSize. */
|
---|
46 | void sigResized(const QSize &newSize);
|
---|
47 |
|
---|
48 | public:
|
---|
49 |
|
---|
50 | /** Constructs tool-bar passing @a pParent to the base-class. */
|
---|
51 | UIToolBar(QWidget *pParent = 0);
|
---|
52 |
|
---|
53 | /** Defines whether tool-bar should use text-labels. */
|
---|
54 | void setUseTextLabels(bool fEnable);
|
---|
55 |
|
---|
56 | #ifdef VBOX_WS_MAC
|
---|
57 | /** Mac OS X: Defines whether native tool-bar should be enabled. */
|
---|
58 | void enableMacToolbar();
|
---|
59 | /** Mac OS X: Defines whether native tool-bar should be emulated. */
|
---|
60 | void emulateMacToolbar();
|
---|
61 |
|
---|
62 | /** Mac OS X: Defines whether native tool-bar button should be shown. */
|
---|
63 | void setShowToolBarButton(bool fShow);
|
---|
64 | /** Mac OS X: Updates native tool-bar layout. */
|
---|
65 | void updateLayout();
|
---|
66 | #endif
|
---|
67 |
|
---|
68 | protected:
|
---|
69 |
|
---|
70 | /** Handles resize @a pEvent. */
|
---|
71 | virtual void resizeEvent(QResizeEvent *pEvent) /* override */;
|
---|
72 |
|
---|
73 | #ifdef VBOX_WS_MAC
|
---|
74 | /** Handles paint @a pEvent. */
|
---|
75 | virtual void paintEvent(QPaintEvent *pEvent) /* override */;
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | private:
|
---|
79 |
|
---|
80 | /** Prepares all. */
|
---|
81 | void prepare();
|
---|
82 |
|
---|
83 | /** Holds the parent main-window isntance. */
|
---|
84 | QMainWindow *m_pMainWindow;
|
---|
85 |
|
---|
86 | #ifdef VBOX_WS_MAC
|
---|
87 | /** Holds whether unified tool-bar should be emulated. */
|
---|
88 | bool m_fEmulateUnifiedToolbar;
|
---|
89 | #endif
|
---|
90 | };
|
---|
91 |
|
---|
92 | #endif /* !___UIToolBar_h___ */
|
---|