VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxMiniToolBar.h@ 20757

Last change on this file since 20757 was 20757, checked in by vboxsync, 16 years ago

FE/Qt4: 3948: Mini-ToolBar for Full-screen & Seamless modes: Fixed bug when toolbar geometry was not updated if snapshot is taken (e.g. toolbar's label changed).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
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
32class QLabel;
33class 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 */
39class VBoxMiniToolBar : public VBoxToolBar
40{
41 Q_OBJECT;
42
43public:
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
62signals:
63
64 void exitAction();
65 void closeAction();
66 void geometryUpdated();
67
68protected:
69
70 void mouseMoveEvent (QMouseEvent *aEvent);
71 void timerEvent (QTimerEvent *aEvent);
72 void showEvent (QShowEvent *aEvent);
73 void paintEvent (QPaintEvent *aEvent);
74
75private slots:
76
77 void togglePushpin (bool aOn);
78
79private:
80
81 void initialize();
82 void recreateMask();
83 void moveToBase();
84 QPoint mapFromScreen (const QPoint &aPoint);
85
86 QAction *mAutoHideAct;
87 QLabel *mDisplayLabel;
88
89 QBasicTimer mScrollTimer;
90 QBasicTimer mAutoScrollTimer;
91
92 bool mActive;
93 bool mPolished;
94 bool mSeamless;
95 bool mAutoHide;
96 bool mSlideToScreen;
97 bool mHideAfterSlide;
98
99 int mAutoHideCounter;
100 int mPositionX;
101 int mPositionY;
102
103 /* Lists of used spacers */
104 QList <QWidget*> mMargins;
105 QList <QWidget*> mSpacings;
106 QList <QWidget*> mLabelMargins;
107
108 /* Menu insert position */
109 QAction *mInsertPosition;
110
111 /* Tool-bar alignment */
112 Alignment mAlignment;
113
114 /* Wether to animate showing/hiding the toolbar */
115 bool mAnimated;
116
117 /* Interval (in milli seconds) for scrolling the toolbar, default is 20 msec */
118 int mScrollDelay;
119
120 /* The wait time while the cursor is not over the window after this amount of time (in msec),
121 * the toolbar will auto hide if autohide is on. The default is 100msec. */
122 int mAutoScrollDelay;
123
124 /* Number of total steps before hiding. If it is 10 then wait 10 (steps) * 100ms (mAutoScrollDelay) = 1000ms delay.
125 * The default is 10. */
126 int mAutoHideTotalCounter;
127};
128
129#endif // __VBoxMiniToolBar_h__
130
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