author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 18 Aug 2010 10:37:55 +0300 | |
changeset 33 | 3e2da88830cd |
parent 18 | 2f34d5167611 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
18
2f34d5167611
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the documentation of the Qt Toolkit. |
|
8 |
** |
|
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
9 |
** $QT_BEGIN_LICENSE:FDL$ |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
10 |
** Commercial Usage |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
11 |
** Licensees holding valid Qt Commercial licenses may use this file in |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
12 |
** accordance with the Qt Commercial License Agreement provided with the |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
13 |
** Software or, alternatively, in accordance with the terms contained in a |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
14 |
** written agreement between you and Nokia. |
0 | 15 |
** |
33
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
16 |
** GNU Free Documentation License |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
17 |
** Alternatively, this file may be used under the terms of the GNU Free |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
18 |
** Documentation License version 1.3 as published by the Free Software |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
19 |
** Foundation and appearing in the file included in the packaging of this |
3e2da88830cd
Revision: 201031
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
18
diff
changeset
|
20 |
** file. |
0 | 21 |
** |
22 |
** If you have questions regarding the use of this file, please contact |
|
23 |
** Nokia at qt-info@nokia.com. |
|
24 |
** $QT_END_LICENSE$ |
|
25 |
** |
|
26 |
****************************************************************************/ |
|
27 |
||
28 |
||
29 |
/*! |
|
30 |
\class QMacStyle |
|
31 |
\brief The QMacStyle class provides a Mac OS X style using the Apple Appearance Manager. |
|
32 |
||
33 |
\ingroup appearance |
|
34 |
||
35 |
This class is implemented as a wrapper to the HITheme |
|
36 |
APIs, allowing applications to be styled according to the current |
|
37 |
theme in use on Mac OS X. This is done by having primitives |
|
38 |
in QStyle implemented in terms of what Mac OS X would normally theme. |
|
39 |
||
40 |
\warning This style is only available on Mac OS X because it relies on the |
|
41 |
HITheme APIs. |
|
42 |
||
43 |
There are additional issues that should be taken |
|
44 |
into consideration to make an application compatible with the |
|
45 |
\link http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html |
|
46 |
Apple Human Interface Guidelines \endlink. Some of these issues are outlined |
|
47 |
below. |
|
48 |
||
49 |
\list |
|
50 |
||
51 |
\i Layout - The restrictions on window layout are such that some |
|
52 |
aspects of layout that are style-dependent cannot be achieved |
|
53 |
using QLayout. Changes are being considered (and feedback would be |
|
54 |
appreciated) to make layouts QStyle-able. Some of the restrictions |
|
55 |
involve horizontal and vertical widget alignment and widget size |
|
56 |
(covered below). |
|
57 |
||
58 |
\i Widget size - Mac OS X allows widgets to have specific fixed sizes. Qt |
|
59 |
does not fully implement this behavior so as to maintain cross-platform |
|
60 |
compatibility. As a result some widgets sizes may be inappropriate (and |
|
61 |
subsequently not rendered correctly by the HITheme APIs).The |
|
62 |
QWidget::sizeHint() will return the appropriate size for many |
|
63 |
managed widgets (widgets enumerated in \l QStyle::ContentsType). |
|
64 |
||
65 |
\i Effects - QMacStyle uses HITheme for performing most of the drawing, but |
|
66 |
also uses emulation in a few cases where HITheme does not provide the |
|
67 |
required functionality (for example, tab bars on Panther, the toolbar |
|
68 |
separator, etc). We tried to make the emulation as close to the original as |
|
69 |
possible. Please report any issues you see in effects or non-standard |
|
70 |
widgets. |
|
71 |
||
72 |
\endlist |
|
73 |
||
74 |
There are other issues that need to be considered in the feel of |
|
75 |
your application (including the general color scheme to match the |
|
76 |
Aqua colors). The Guidelines mentioned above will remain current |
|
77 |
with new advances and design suggestions for Mac OS X. |
|
78 |
||
79 |
Note that the functions provided by QMacStyle are |
|
80 |
reimplementations of QStyle functions; see QStyle for their |
|
81 |
documentation. |
|
82 |
||
83 |
\img qmacstyle.png |
|
84 |
\sa QWindowsXPStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle |
|
85 |
*/ |
|
86 |
||
87 |
||
88 |
/*! |
|
89 |
\enum QMacStyle::WidgetSizePolicy |
|
90 |
||
91 |
\value SizeSmall |
|
92 |
\value SizeLarge |
|
93 |
\value SizeMini |
|
94 |
\value SizeDefault |
|
95 |
\omitvalue SizeNone |
|
96 |
*/ |
|
97 |
||
98 |
/*! \fn QMacStyle::QMacStyle() |
|
99 |
Constructs a QMacStyle object. |
|
100 |
*/ |
|
101 |
||
102 |
/*! \fn QMacStyle::~QMacStyle() |
|
103 |
Destructs a QMacStyle object. |
|
104 |
*/ |
|
105 |
||
106 |
/*! \fn void QMacStyle::polish(QPalette &pal) |
|
107 |
\reimp |
|
108 |
*/ |
|
109 |
||
110 |
/*! \fn void QMacStyle::polish(QApplication *) |
|
111 |
\reimp |
|
112 |
*/ |
|
113 |
||
114 |
/*! \fn void QMacStyle::unpolish(QApplication *) |
|
115 |
\reimp |
|
116 |
*/ |
|
117 |
||
118 |
/*! \fn void QMacStyle::polish(QWidget* w) |
|
119 |
\reimp |
|
120 |
*/ |
|
121 |
||
122 |
/*! \fn void QMacStyle::unpolish(QWidget* w) |
|
123 |
\reimp |
|
124 |
*/ |
|
125 |
||
126 |
/*! \fn int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const |
|
127 |
\reimp |
|
128 |
*/ |
|
129 |
||
130 |
/*! \fn QPalette QMacStyle::standardPalette() const |
|
131 |
\reimp |
|
132 |
*/ |
|
133 |
||
134 |
/*! \fn int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const |
|
135 |
\reimp |
|
136 |
*/ |
|
137 |
||
138 |
/*! \fn QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const |
|
139 |
\reimp |
|
140 |
*/ |
|
141 |
||
142 |
/*! \fn QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const |
|
143 |
\reimp |
|
144 |
*/ |
|
145 |
||
146 |
/*! |
|
147 |
\enum QMacStyle::FocusRectPolicy |
|
148 |
||
149 |
This type is used to signify a widget's focus rectangle policy. |
|
150 |
||
151 |
\value FocusEnabled show a focus rectangle when the widget has focus. |
|
152 |
\value FocusDisabled never show a focus rectangle for the widget. |
|
153 |
\value FocusDefault show a focus rectangle when the widget has |
|
154 |
focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit, |
|
155 |
QListBox, QListView, editable QTextEdit, or one of their |
|
156 |
subclasses. |
|
157 |
*/ |
|
158 |
||
159 |
/*! \fn void QMacStyle::setFocusRectPolicy(QWidget *w, FocusRectPolicy policy) |
|
160 |
\obsolete |
|
161 |
Sets the focus rectangle policy of \a w. The \a policy can be one of |
|
162 |
\l{QMacStyle::FocusRectPolicy}. |
|
163 |
||
164 |
This is now simply an interface to the Qt::WA_MacShowFocusRect attribute and the |
|
165 |
FocusDefault value does nothing anymore. If you want to set a widget back |
|
166 |
to its default value, you must save the old value of the attribute before |
|
167 |
you change it. |
|
168 |
||
169 |
\sa focusRectPolicy() QWidget::setAttribute() |
|
170 |
*/ |
|
171 |
||
172 |
/*! \fn QMacStyle::FocusRectPolicy QMacStyle::focusRectPolicy(const QWidget *w) |
|
173 |
\obsolete |
|
174 |
Returns the focus rectangle policy for the widget \a w. |
|
175 |
||
176 |
The focus rectangle policy can be one of \l{QMacStyle::FocusRectPolicy}. |
|
177 |
||
178 |
In 4.3 and up this function will simply test for the |
|
179 |
Qt::WA_MacShowFocusRect attribute and will never return |
|
180 |
QMacStyle::FocusDefault. |
|
181 |
||
182 |
\sa setFocusRectPolicy(), QWidget::testAttribute() |
|
183 |
*/ |
|
184 |
||
185 |
/*! \fn void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy) |
|
186 |
||
187 |
\obsolete |
|
188 |
||
189 |
Call QWidget::setAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, |
|
190 |
or Qt::WA_MacNormalSize instead. |
|
191 |
*/ |
|
192 |
||
193 |
/*! \fn QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget) |
|
194 |
\obsolete |
|
195 |
||
196 |
Call QWidget::testAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, |
|
197 |
or Qt::WA_MacNormalSize instead. |
|
198 |
*/ |
|
199 |
||
200 |
/*! \fn void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const |
|
201 |
||
202 |
\reimp |
|
203 |
*/ |
|
204 |
||
205 |
/*! \fn void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const |
|
206 |
||
207 |
\reimp |
|
208 |
*/ |
|
209 |
||
210 |
/*! \fn QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *widget) const |
|
211 |
||
212 |
\reimp |
|
213 |
*/ |
|
214 |
||
215 |
/*! \fn void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const |
|
216 |
\reimp |
|
217 |
*/ |
|
218 |
||
219 |
/*! \fn QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const |
|
220 |
\reimp |
|
221 |
*/ |
|
222 |
||
223 |
/*! \fn QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const |
|
224 |
\reimp |
|
225 |
*/ |
|
226 |
||
227 |
/*! \fn QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const |
|
228 |
\reimp |
|
229 |
*/ |
|
230 |
||
231 |
/*! \fn void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const |
|
232 |
\reimp |
|
233 |
*/ |
|
234 |
||
235 |
/*! \fn bool QMacStyle::event(QEvent *e) |
|
236 |
\reimp |
|
237 |
*/ |
|
238 |
||
239 |
/*! \fn QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const |
|
240 |
\internal |
|
241 |
*/ |
|
242 |
||
243 |
/*! \fn int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const |
|
244 |
||
245 |
\internal |
|
246 |
*/ |
|
247 |