VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxSpecialControls.h@ 25045

Last change on this file since 25045 was 24182, checked in by vboxsync, 15 years ago

FE/Qt4: Relayout the progress dialog a bit & make the ETA text more user friendly.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.7 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxSpecialButtons declarations
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 ___VBoxSpecialControls_h__
24#define ___VBoxSpecialControls_h__
25
26/* VBox includes */
27#include "QIWithRetranslateUI.h"
28
29/* Qt includes */
30#include <QPushButton>
31
32#ifdef VBOX_DARWIN_USE_NATIVE_CONTROLS
33
34/* VBox includes */
35#include "VBoxCocoaSpecialControls.h"
36
37/********************************************************************************
38 *
39 * A mini cancel button in the native Cocoa version.
40 *
41 ********************************************************************************/
42class VBoxMiniCancelButton: public QAbstractButton
43{
44 Q_OBJECT;
45
46public:
47 VBoxMiniCancelButton (QWidget *aParent = 0);
48
49 void setText (const QString &aText) { mButton->setText (aText); }
50 void setToolTip (const QString &aTip) { mButton->setToolTip (aTip); }
51
52protected:
53 void paintEvent (QPaintEvent * /* aEvent */) {}
54
55private:
56 VBoxCocoaButton *mButton;
57};
58
59/********************************************************************************
60 *
61 * A help button in the native Cocoa version.
62 *
63 ********************************************************************************/
64class VBoxHelpButton: public QPushButton
65{
66 Q_OBJECT;
67
68public:
69 VBoxHelpButton (QWidget *aParent = 0);
70
71 void setToolTip (const QString &aTip) { mButton->setToolTip (aTip); }
72
73 void initFrom (QPushButton * /* aOther */) {}
74
75protected:
76 void paintEvent (QPaintEvent * /* aEvent */) {}
77
78private:
79 VBoxCocoaButton *mButton;
80};
81
82/********************************************************************************
83 *
84 * A segmented button in the native Cocoa version.
85 *
86 ********************************************************************************/
87class VBoxSegmentedButton: public VBoxCocoaSegmentedButton
88{
89 Q_OBJECT;
90
91public:
92 VBoxSegmentedButton (int aCount, QWidget *aParent = 0);
93
94 void setIcon (int /* aSegment */, const QIcon & /* aIcon */) {}
95};
96
97/********************************************************************************
98 *
99 * A search field in the native Cocoa version.
100 *
101 ********************************************************************************/
102class VBoxSearchField: public VBoxCocoaSearchField
103{
104 Q_OBJECT;
105
106public:
107 VBoxSearchField (QWidget *aParent = 0);
108};
109
110#else /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
111
112/* VBox includes */
113#include "QIToolButton.h"
114
115/* Qt includes */
116#include <QLineEdit>
117
118/* Qt forward declarations */
119class QSignalMapper;
120
121/********************************************************************************
122 *
123 * A mini cancel button for the other OS's.
124 *
125 ********************************************************************************/
126class VBoxMiniCancelButton: public QIWithRetranslateUI<QIToolButton>
127{
128 Q_OBJECT;
129
130public:
131 VBoxMiniCancelButton (QWidget *aParent = 0);
132
133protected:
134 void retranslateUi() {};
135};
136
137/********************************************************************************
138 *
139 * A help button for the other OS's.
140 *
141 ********************************************************************************/
142class VBoxHelpButton: public QIWithRetranslateUI<QPushButton>
143{
144 Q_OBJECT;
145
146public:
147 VBoxHelpButton (QWidget *aParent = 0);
148#ifdef Q_WS_MAC
149 ~VBoxHelpButton();
150 QSize sizeHint() const;
151#endif /* Q_WS_MAC */
152
153 void initFrom (QPushButton *aOther);
154
155protected:
156 void retranslateUi();
157
158#ifdef Q_WS_MAC
159 void paintEvent (QPaintEvent *aEvent);
160
161 bool hitButton (const QPoint &pos) const;
162
163 void mousePressEvent (QMouseEvent *aEvent);
164 void mouseReleaseEvent (QMouseEvent *aEvent);
165 void leaveEvent (QEvent *aEvent);
166
167private:
168 /* Private member vars */
169 bool mButtonPressed;
170
171 QSize mSize;
172 QPixmap *mNormalPixmap;
173 QPixmap *mPressedPixmap;
174 QImage *mMask;
175 QRect mBRect;
176#endif /* Q_WS_MAC */
177};
178
179/********************************************************************************
180 *
181 * A segmented button for the other OS's.
182 *
183 ********************************************************************************/
184class VBoxSegmentedButton: public QWidget
185{
186 Q_OBJECT;
187
188public:
189 VBoxSegmentedButton (int aCount, QWidget *aParent = 0);
190 ~VBoxSegmentedButton();
191
192 void setTitle (int aSegment, const QString &aTitle);
193 void setToolTip (int aSegment, const QString &aTip);
194 void setIcon (int aSegment, const QIcon &aIcon);
195 void setEnabled (int aSegment, bool fEnabled);
196
197 void animateClick (int aSegment);
198
199signals:
200 void clicked (int aSegment);
201
202private:
203 /* Private member vars */
204 QList<QIToolButton*> mButtons;
205 QSignalMapper *mSignalMapper;
206};
207
208/********************************************************************************
209 *
210 * A search field for the other OS's.
211 *
212 ********************************************************************************/
213class VBoxSearchField: public QLineEdit
214{
215 Q_OBJECT;
216
217public:
218 VBoxSearchField (QWidget *aParent = 0);
219
220 void markError();
221 void unmarkError();
222
223private:
224 /* Private member vars */
225 QBrush mBaseBrush;
226};
227
228#endif /* VBOX_DARWIN_USE_NATIVE_CONTROLS */
229
230#endif /* ___VBoxSpecialControls_h__ */
231
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