1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxMiniToolBar class declaration & implementation. This is the toolbar shown on fullscreen mode.
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2009 Sun Microsystems, Inc.
|
---|
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 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
19 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
20 | * additional information or have any questions.
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __VBoxMiniToolBar_h__
|
---|
24 | #define __VBoxMiniToolBar_h__
|
---|
25 |
|
---|
26 | /* VBox includes */
|
---|
27 | #include <VBoxToolBar.h>
|
---|
28 |
|
---|
29 | /* Qt includes */
|
---|
30 | #include <QBasicTimer>
|
---|
31 |
|
---|
32 | class QLabel;
|
---|
33 | class QMenu;
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * The VBoxMiniToolBar class is a toolbar shown inside full screen mode or seamless mode.
|
---|
37 | * It supports auto hiding and animated sliding up/down.
|
---|
38 | */
|
---|
39 | class VBoxMiniToolBar : public VBoxToolBar
|
---|
40 | {
|
---|
41 | Q_OBJECT;
|
---|
42 |
|
---|
43 | public:
|
---|
44 |
|
---|
45 | enum Alignment
|
---|
46 | {
|
---|
47 | AlignTop,
|
---|
48 | AlignBottom
|
---|
49 | };
|
---|
50 |
|
---|
51 | VBoxMiniToolBar (QWidget *aParent, Alignment aAlignment, bool aIsActive, bool aAutoHide);
|
---|
52 |
|
---|
53 | VBoxMiniToolBar& operator<< (QList <QMenu*> aMenus);
|
---|
54 |
|
---|
55 | void setSeamlessMode (bool aIsSeamless);
|
---|
56 | void setDisplayText (const QString &aText);
|
---|
57 |
|
---|
58 | bool isAutoHide() const;
|
---|
59 |
|
---|
60 | void updateDisplay (bool aShow, bool aSetHideFlag);
|
---|
61 |
|
---|
62 | signals:
|
---|
63 |
|
---|
64 | void exitAction();
|
---|
65 | void closeAction();
|
---|
66 | void geometryUpdated();
|
---|
67 |
|
---|
68 | protected:
|
---|
69 |
|
---|
70 | void mouseMoveEvent (QMouseEvent *aEvent);
|
---|
71 | void timerEvent (QTimerEvent *aEvent);
|
---|
72 | void showEvent (QShowEvent *aEvent);
|
---|
73 | void paintEvent (QPaintEvent *aEvent);
|
---|
74 |
|
---|
75 | private slots:
|
---|
76 |
|
---|
77 | void togglePushpin (bool aOn);
|
---|
78 |
|
---|
79 | private:
|
---|
80 |
|
---|
81 | void recreateMask();
|
---|
82 | void moveToBase();
|
---|
83 | QPoint mapFromScreen (const QPoint &aPoint);
|
---|
84 |
|
---|
85 | QAction *mAutoHideAct;
|
---|
86 | QLabel *mDisplayLabel;
|
---|
87 |
|
---|
88 | QBasicTimer mScrollTimer;
|
---|
89 | QBasicTimer mAutoScrollTimer;
|
---|
90 |
|
---|
91 | bool mActive;
|
---|
92 | bool mPolished;
|
---|
93 | bool mSeamless;
|
---|
94 | bool mAutoHide;
|
---|
95 | bool mSlideToScreen;
|
---|
96 | bool mHideAfterSlide;
|
---|
97 |
|
---|
98 | int mAutoHideCounter;
|
---|
99 | int mPositionX;
|
---|
100 | int mPositionY;
|
---|
101 |
|
---|
102 | /* Lists of used spacers */
|
---|
103 | QList <QWidget*> mMargins;
|
---|
104 | QList <QWidget*> mSpacings;
|
---|
105 | QList <QWidget*> mLabelMargins;
|
---|
106 |
|
---|
107 | /* Menu insert position */
|
---|
108 | QAction *mInsertPosition;
|
---|
109 |
|
---|
110 | /* Tool-bar alignment */
|
---|
111 | Alignment mAlignment;
|
---|
112 |
|
---|
113 | /* Wether to animate showing/hiding the toolbar */
|
---|
114 | bool mAnimated;
|
---|
115 |
|
---|
116 | /* Interval (in milli seconds) for scrolling the toolbar, default is 20 msec */
|
---|
117 | int mScrollDelay;
|
---|
118 |
|
---|
119 | /* The wait time while the cursor is not over the window after this amount of time (in msec),
|
---|
120 | * the toolbar will auto hide if autohide is on. The default is 100msec. */
|
---|
121 | int mAutoScrollDelay;
|
---|
122 |
|
---|
123 | /* Number of total steps before hiding. If it is 10 then wait 10 (steps) * 100ms (mAutoScrollDelay) = 1000ms delay.
|
---|
124 | * The default is 10. */
|
---|
125 | int mAutoHideTotalCounter;
|
---|
126 | };
|
---|
127 |
|
---|
128 | #endif // __VBoxMiniToolBar_h__
|
---|
129 |
|
---|