1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the QtGui module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
38 | ** $QT_END_LICENSE$ |
39 | ** |
40 | ****************************************************************************/ |
41 | |
42 | #ifndef QSTYLEOPTION_H |
43 | #define QSTYLEOPTION_H |
44 | |
45 | #include <QtCore/qvariant.h> |
46 | #include <QtGui/qabstractspinbox.h> |
47 | #include <QtGui/qicon.h> |
48 | #include <QtGui/qmatrix.h> |
49 | #include <QtGui/qslider.h> |
50 | #include <QtGui/qstyle.h> |
51 | #include <QtGui/qtabbar.h> |
52 | #include <QtGui/qtabwidget.h> |
53 | #include <QtGui/qrubberband.h> |
54 | #include <QtGui/qframe.h> |
55 | #ifndef QT_NO_ITEMVIEWS |
56 | # include <QtCore/qabstractitemmodel.h> |
57 | #endif |
58 | |
59 | QT_BEGIN_HEADER |
60 | |
61 | QT_BEGIN_NAMESPACE |
62 | |
63 | QT_MODULE(Gui) |
64 | |
65 | class QDebug; |
66 | |
67 | class Q_GUI_EXPORT QStyleOption |
68 | { |
69 | public: |
70 | enum OptionType { |
71 | SO_Default, SO_FocusRect, SO_Button, SO_Tab, , |
72 | SO_Frame, SO_ProgressBar, SO_ToolBox, , SO_Q3DockWindow, |
73 | SO_DockWidget, SO_Q3ListViewItem, SO_ViewItem, SO_TabWidgetFrame, |
74 | SO_TabBarBase, SO_RubberBand, SO_ToolBar, SO_GraphicsItem, |
75 | |
76 | SO_Complex = 0xf0000, SO_Slider, SO_SpinBox, SO_ToolButton, SO_ComboBox, |
77 | SO_Q3ListView, SO_TitleBar, SO_GroupBox, SO_SizeGrip, |
78 | |
79 | SO_CustomBase = 0xf00, |
80 | SO_ComplexCustomBase = 0xf000000 |
81 | }; |
82 | |
83 | enum StyleOptionType { Type = SO_Default }; |
84 | enum StyleOptionVersion { Version = 1 }; |
85 | |
86 | int version; |
87 | int type; |
88 | QStyle::State state; |
89 | Qt::LayoutDirection direction; |
90 | QRect rect; |
91 | QFontMetrics fontMetrics; |
92 | QPalette palette; |
93 | |
94 | QStyleOption(int version = QStyleOption::Version, int type = SO_Default); |
95 | QStyleOption(const QStyleOption &other); |
96 | ~QStyleOption(); |
97 | |
98 | void init(const QWidget *w); |
99 | inline void initFrom(const QWidget *w) { init(w); } |
100 | QStyleOption &operator=(const QStyleOption &other); |
101 | }; |
102 | |
103 | class Q_GUI_EXPORT QStyleOptionFocusRect : public QStyleOption |
104 | { |
105 | public: |
106 | enum StyleOptionType { Type = SO_FocusRect }; |
107 | enum StyleOptionVersion { Version = 1 }; |
108 | |
109 | QColor backgroundColor; |
110 | |
111 | QStyleOptionFocusRect(); |
112 | QStyleOptionFocusRect(const QStyleOptionFocusRect &other) : QStyleOption(Version, Type) { *this = other; } |
113 | |
114 | protected: |
115 | QStyleOptionFocusRect(int version); |
116 | }; |
117 | |
118 | class Q_GUI_EXPORT QStyleOptionFrame : public QStyleOption |
119 | { |
120 | public: |
121 | enum StyleOptionType { Type = SO_Frame }; |
122 | enum StyleOptionVersion { Version = 1 }; |
123 | |
124 | int lineWidth; |
125 | int midLineWidth; |
126 | |
127 | QStyleOptionFrame(); |
128 | QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; } |
129 | |
130 | protected: |
131 | QStyleOptionFrame(int version); |
132 | }; |
133 | |
134 | class Q_GUI_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame |
135 | { |
136 | public: |
137 | enum StyleOptionVersion { Version = 2 }; |
138 | enum FrameFeature { |
139 | None = 0x00, |
140 | Flat = 0x01 |
141 | }; |
142 | Q_DECLARE_FLAGS(FrameFeatures, FrameFeature) |
143 | FrameFeatures features; |
144 | |
145 | QStyleOptionFrameV2(); |
146 | QStyleOptionFrameV2(const QStyleOptionFrameV2 &other) : QStyleOptionFrame(Version) { *this = other; } |
147 | QStyleOptionFrameV2(const QStyleOptionFrame &other); |
148 | QStyleOptionFrameV2 &operator=(const QStyleOptionFrame &other); |
149 | |
150 | protected: |
151 | QStyleOptionFrameV2(int version); |
152 | }; |
153 | |
154 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrameV2::FrameFeatures) |
155 | |
156 | |
157 | class Q_GUI_EXPORT QStyleOptionFrameV3 : public QStyleOptionFrameV2 |
158 | { |
159 | public: |
160 | enum StyleOptionVersion { Version = 3 }; |
161 | QFrame::Shape frameShape : 4; |
162 | uint unused : 28; |
163 | |
164 | QStyleOptionFrameV3(); |
165 | QStyleOptionFrameV3(const QStyleOptionFrameV3 &other) : QStyleOptionFrameV2(Version) { *this = other; } |
166 | QStyleOptionFrameV3(const QStyleOptionFrame &other); |
167 | QStyleOptionFrameV3 &operator=(const QStyleOptionFrame &other); |
168 | |
169 | protected: |
170 | QStyleOptionFrameV3(int version); |
171 | }; |
172 | |
173 | |
174 | #ifndef QT_NO_TABWIDGET |
175 | class Q_GUI_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption |
176 | { |
177 | public: |
178 | enum StyleOptionType { Type = SO_TabWidgetFrame }; |
179 | enum StyleOptionVersion { Version = 1 }; |
180 | |
181 | int lineWidth; |
182 | int midLineWidth; |
183 | QTabBar::Shape shape; |
184 | QSize tabBarSize; |
185 | QSize rightCornerWidgetSize; |
186 | QSize leftCornerWidgetSize; |
187 | |
188 | QStyleOptionTabWidgetFrame(); |
189 | inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other) |
190 | : QStyleOption(Version, Type) { *this = other; } |
191 | |
192 | protected: |
193 | QStyleOptionTabWidgetFrame(int version); |
194 | }; |
195 | |
196 | class Q_GUI_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame |
197 | { |
198 | public: |
199 | enum StyleOptionVersion { Version = 2 }; |
200 | |
201 | QRect tabBarRect; |
202 | QRect selectedTabRect; |
203 | |
204 | QStyleOptionTabWidgetFrameV2(); |
205 | QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) : |
206 | QStyleOptionTabWidgetFrame(Version) { *this = other; } |
207 | QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other); |
208 | QStyleOptionTabWidgetFrameV2 &operator=(const QStyleOptionTabWidgetFrame &other); |
209 | |
210 | protected: |
211 | QStyleOptionTabWidgetFrameV2(int version); |
212 | }; |
213 | |
214 | #endif |
215 | |
216 | |
217 | #ifndef QT_NO_TABBAR |
218 | class Q_GUI_EXPORT QStyleOptionTabBarBase : public QStyleOption |
219 | { |
220 | public: |
221 | enum StyleOptionType { Type = SO_TabBarBase }; |
222 | enum StyleOptionVersion { Version = 1 }; |
223 | |
224 | QTabBar::Shape shape; |
225 | QRect tabBarRect; |
226 | QRect selectedTabRect; |
227 | |
228 | QStyleOptionTabBarBase(); |
229 | QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; } |
230 | |
231 | protected: |
232 | QStyleOptionTabBarBase(int version); |
233 | }; |
234 | |
235 | class Q_GUI_EXPORT QStyleOptionTabBarBaseV2 : public QStyleOptionTabBarBase |
236 | { |
237 | public: |
238 | enum StyleOptionVersion { Version = 2 }; |
239 | bool documentMode; |
240 | QStyleOptionTabBarBaseV2(); |
241 | QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other) : QStyleOptionTabBarBase(Version) { *this = other; } |
242 | QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other); |
243 | QStyleOptionTabBarBaseV2 &operator=(const QStyleOptionTabBarBase &other); |
244 | |
245 | protected: |
246 | QStyleOptionTabBarBaseV2(int version); |
247 | }; |
248 | |
249 | #endif |
250 | |
251 | class Q_GUI_EXPORT : public QStyleOption |
252 | { |
253 | public: |
254 | enum { = SO_Header }; |
255 | enum { = 1 }; |
256 | |
257 | enum { , , , }; |
258 | enum { , , , |
259 | NextAndPreviousAreSelected }; |
260 | enum { , , }; |
261 | |
262 | int ; |
263 | QString ; |
264 | Qt::Alignment ; |
265 | QIcon ; |
266 | Qt::Alignment ; |
267 | SectionPosition ; |
268 | SelectedPosition ; |
269 | SortIndicator ; |
270 | Qt::Orientation ; |
271 | |
272 | (); |
273 | (const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; } |
274 | |
275 | protected: |
276 | (int version); |
277 | }; |
278 | |
279 | class Q_GUI_EXPORT QStyleOptionButton : public QStyleOption |
280 | { |
281 | public: |
282 | enum StyleOptionType { Type = SO_Button }; |
283 | enum StyleOptionVersion { Version = 1 }; |
284 | |
285 | enum ButtonFeature { None = 0x00, Flat = 0x01, = 0x02, DefaultButton = 0x04, |
286 | AutoDefaultButton = 0x08, CommandLinkButton = 0x10 }; |
287 | Q_DECLARE_FLAGS(ButtonFeatures, ButtonFeature) |
288 | |
289 | ButtonFeatures features; |
290 | QString text; |
291 | QIcon icon; |
292 | QSize iconSize; |
293 | |
294 | QStyleOptionButton(); |
295 | QStyleOptionButton(const QStyleOptionButton &other) : QStyleOption(Version, Type) { *this = other; } |
296 | |
297 | protected: |
298 | QStyleOptionButton(int version); |
299 | }; |
300 | |
301 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionButton::ButtonFeatures) |
302 | |
303 | #ifndef QT_NO_TABBAR |
304 | class Q_GUI_EXPORT QStyleOptionTab : public QStyleOption |
305 | { |
306 | public: |
307 | enum StyleOptionType { Type = SO_Tab }; |
308 | enum StyleOptionVersion { Version = 1 }; |
309 | |
310 | enum TabPosition { Beginning, Middle, End, OnlyOneTab }; |
311 | enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected }; |
312 | enum CornerWidget { NoCornerWidgets = 0x00, LeftCornerWidget = 0x01, |
313 | RightCornerWidget = 0x02 }; |
314 | Q_DECLARE_FLAGS(CornerWidgets, CornerWidget) |
315 | |
316 | QTabBar::Shape shape; |
317 | QString text; |
318 | QIcon icon; |
319 | int row; |
320 | TabPosition position; |
321 | SelectedPosition selectedPosition; |
322 | CornerWidgets cornerWidgets; |
323 | |
324 | QStyleOptionTab(); |
325 | QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; } |
326 | |
327 | protected: |
328 | QStyleOptionTab(int version); |
329 | }; |
330 | |
331 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets) |
332 | |
333 | class Q_GUI_EXPORT QStyleOptionTabV2 : public QStyleOptionTab |
334 | { |
335 | public: |
336 | enum StyleOptionVersion { Version = 2 }; |
337 | QSize iconSize; |
338 | QStyleOptionTabV2(); |
339 | QStyleOptionTabV2(const QStyleOptionTabV2 &other) : QStyleOptionTab(Version) { *this = other; } |
340 | QStyleOptionTabV2(const QStyleOptionTab &other); |
341 | QStyleOptionTabV2 &operator=(const QStyleOptionTab &other); |
342 | |
343 | protected: |
344 | QStyleOptionTabV2(int version); |
345 | }; |
346 | |
347 | class Q_GUI_EXPORT QStyleOptionTabV3 : public QStyleOptionTabV2 |
348 | { |
349 | public: |
350 | enum StyleOptionVersion { Version = 3 }; |
351 | bool documentMode; |
352 | QSize leftButtonSize; |
353 | QSize rightButtonSize; |
354 | QStyleOptionTabV3(); |
355 | QStyleOptionTabV3(const QStyleOptionTabV3 &other) : QStyleOptionTabV2(Version) { *this = other; } |
356 | QStyleOptionTabV3(const QStyleOptionTabV2 &other) : QStyleOptionTabV2(Version) { *this = other; } |
357 | QStyleOptionTabV3(const QStyleOptionTab &other); |
358 | QStyleOptionTabV3 &operator=(const QStyleOptionTab &other); |
359 | |
360 | protected: |
361 | QStyleOptionTabV3(int version); |
362 | }; |
363 | |
364 | #endif |
365 | |
366 | |
367 | #ifndef QT_NO_TOOLBAR |
368 | |
369 | class Q_GUI_EXPORT QStyleOptionToolBar : public QStyleOption |
370 | { |
371 | public: |
372 | enum StyleOptionType { Type = SO_ToolBar }; |
373 | enum StyleOptionVersion { Version = 1 }; |
374 | enum ToolBarPosition { Beginning, Middle, End, OnlyOne }; |
375 | enum ToolBarFeature { None = 0x0, Movable = 0x1 }; |
376 | Q_DECLARE_FLAGS(ToolBarFeatures, ToolBarFeature) |
377 | ToolBarPosition positionOfLine; // The toolbar line position |
378 | ToolBarPosition positionWithinLine; // The position within a toolbar |
379 | Qt::ToolBarArea toolBarArea; // The toolbar docking area |
380 | ToolBarFeatures features; |
381 | int lineWidth; |
382 | int midLineWidth; |
383 | QStyleOptionToolBar(); |
384 | QStyleOptionToolBar(const QStyleOptionToolBar &other) : QStyleOption(Version, Type) { *this = other; } |
385 | |
386 | protected: |
387 | QStyleOptionToolBar(int version); |
388 | }; |
389 | |
390 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures) |
391 | |
392 | #endif |
393 | |
394 | |
395 | |
396 | class Q_GUI_EXPORT QStyleOptionProgressBar : public QStyleOption |
397 | { |
398 | public: |
399 | enum StyleOptionType { Type = SO_ProgressBar }; |
400 | enum StyleOptionVersion { Version = 1 }; |
401 | |
402 | int minimum; |
403 | int maximum; |
404 | int progress; |
405 | QString text; |
406 | Qt::Alignment textAlignment; |
407 | bool textVisible; |
408 | |
409 | QStyleOptionProgressBar(); |
410 | QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; } |
411 | |
412 | protected: |
413 | QStyleOptionProgressBar(int version); |
414 | }; |
415 | |
416 | // Adds style info for vertical progress bars |
417 | class Q_GUI_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar |
418 | { |
419 | public: |
420 | enum StyleOptionType { Type = SO_ProgressBar }; |
421 | enum StyleOptionVersion { Version = 2 }; |
422 | Qt::Orientation orientation; |
423 | bool invertedAppearance; |
424 | bool bottomToTop; |
425 | |
426 | QStyleOptionProgressBarV2(); |
427 | QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other); |
428 | QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other); |
429 | QStyleOptionProgressBarV2 &operator=(const QStyleOptionProgressBar &other); |
430 | |
431 | protected: |
432 | QStyleOptionProgressBarV2(int version); |
433 | }; |
434 | |
435 | class Q_GUI_EXPORT : public QStyleOption |
436 | { |
437 | public: |
438 | enum { = SO_MenuItem }; |
439 | enum { = 1 }; |
440 | |
441 | enum { , , , , , , , |
442 | }; |
443 | enum { , , }; |
444 | |
445 | MenuItemType ; |
446 | CheckType ; |
447 | bool ; |
448 | bool ; |
449 | QRect ; |
450 | QString ; |
451 | QIcon ; |
452 | int ; |
453 | int ; |
454 | QFont ; |
455 | |
456 | (); |
457 | (const QStyleOptionMenuItem &other) : QStyleOption(Version, Type) { *this = other; } |
458 | |
459 | protected: |
460 | (int version); |
461 | }; |
462 | |
463 | class Q_GUI_EXPORT QStyleOptionQ3ListViewItem : public QStyleOption |
464 | { |
465 | public: |
466 | enum StyleOptionType { Type = SO_Q3ListViewItem }; |
467 | enum StyleOptionVersion { Version = 1 }; |
468 | |
469 | enum Q3ListViewItemFeature { None = 0x00, Expandable = 0x01, MultiLine = 0x02, Visible = 0x04, |
470 | ParentControl = 0x08 }; |
471 | Q_DECLARE_FLAGS(Q3ListViewItemFeatures, Q3ListViewItemFeature) |
472 | |
473 | Q3ListViewItemFeatures features; |
474 | int height; |
475 | int totalHeight; |
476 | int itemY; |
477 | int childCount; |
478 | |
479 | QStyleOptionQ3ListViewItem(); |
480 | QStyleOptionQ3ListViewItem(const QStyleOptionQ3ListViewItem &other) : QStyleOption(Version, Type) { *this = other; } |
481 | |
482 | protected: |
483 | QStyleOptionQ3ListViewItem(int version); |
484 | }; |
485 | |
486 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionQ3ListViewItem::Q3ListViewItemFeatures) |
487 | |
488 | class Q_GUI_EXPORT QStyleOptionQ3DockWindow : public QStyleOption |
489 | { |
490 | public: |
491 | enum StyleOptionType { Type = SO_Q3DockWindow }; |
492 | enum StyleOptionVersion { Version = 1 }; |
493 | |
494 | bool docked; |
495 | bool closeEnabled; |
496 | |
497 | QStyleOptionQ3DockWindow(); |
498 | QStyleOptionQ3DockWindow(const QStyleOptionQ3DockWindow &other) : QStyleOption(Version, Type) { *this = other; } |
499 | |
500 | protected: |
501 | QStyleOptionQ3DockWindow(int version); |
502 | }; |
503 | |
504 | class Q_GUI_EXPORT QStyleOptionDockWidget : public QStyleOption |
505 | { |
506 | public: |
507 | enum StyleOptionType { Type = SO_DockWidget }; |
508 | enum StyleOptionVersion { Version = 1 }; |
509 | |
510 | QString title; |
511 | bool closable; |
512 | bool movable; |
513 | bool floatable; |
514 | |
515 | QStyleOptionDockWidget(); |
516 | QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; } |
517 | |
518 | protected: |
519 | QStyleOptionDockWidget(int version); |
520 | }; |
521 | |
522 | class Q_GUI_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget |
523 | { |
524 | public: |
525 | enum StyleOptionVersion { Version = 2 }; |
526 | |
527 | bool verticalTitleBar; |
528 | |
529 | QStyleOptionDockWidgetV2(); |
530 | QStyleOptionDockWidgetV2(const QStyleOptionDockWidgetV2 &other) |
531 | : QStyleOptionDockWidget(Version) { *this = other; } |
532 | QStyleOptionDockWidgetV2(const QStyleOptionDockWidget &other); |
533 | QStyleOptionDockWidgetV2 &operator = (const QStyleOptionDockWidget &other); |
534 | |
535 | protected: |
536 | QStyleOptionDockWidgetV2(int version); |
537 | }; |
538 | |
539 | class Q_GUI_EXPORT QStyleOptionViewItem : public QStyleOption |
540 | { |
541 | public: |
542 | enum StyleOptionType { Type = SO_ViewItem }; |
543 | enum StyleOptionVersion { Version = 1 }; |
544 | |
545 | enum Position { Left, Right, Top, Bottom }; |
546 | |
547 | Qt::Alignment displayAlignment; |
548 | Qt::Alignment decorationAlignment; |
549 | Qt::TextElideMode textElideMode; |
550 | Position decorationPosition; |
551 | QSize decorationSize; |
552 | QFont font; |
553 | bool showDecorationSelected; |
554 | |
555 | QStyleOptionViewItem(); |
556 | QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; } |
557 | |
558 | protected: |
559 | QStyleOptionViewItem(int version); |
560 | }; |
561 | |
562 | class Q_GUI_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem |
563 | { |
564 | public: |
565 | enum StyleOptionVersion { Version = 2 }; |
566 | |
567 | enum ViewItemFeature { |
568 | None = 0x00, |
569 | WrapText = 0x01, |
570 | Alternate = 0x02, |
571 | HasCheckIndicator = 0x04, |
572 | HasDisplay = 0x08, |
573 | HasDecoration = 0x10 |
574 | }; |
575 | Q_DECLARE_FLAGS(ViewItemFeatures, ViewItemFeature) |
576 | |
577 | ViewItemFeatures features; |
578 | |
579 | QStyleOptionViewItemV2(); |
580 | QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other) : QStyleOptionViewItem(Version) { *this = other; } |
581 | QStyleOptionViewItemV2(const QStyleOptionViewItem &other); |
582 | QStyleOptionViewItemV2 &operator=(const QStyleOptionViewItem &other); |
583 | |
584 | protected: |
585 | QStyleOptionViewItemV2(int version); |
586 | }; |
587 | |
588 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItemV2::ViewItemFeatures) |
589 | |
590 | class Q_GUI_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2 |
591 | { |
592 | public: |
593 | enum StyleOptionVersion { Version = 3 }; |
594 | |
595 | QLocale locale; |
596 | const QWidget *widget; |
597 | |
598 | QStyleOptionViewItemV3(); |
599 | QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other) |
600 | : QStyleOptionViewItemV2(Version) { *this = other; } |
601 | QStyleOptionViewItemV3(const QStyleOptionViewItem &other); |
602 | QStyleOptionViewItemV3 &operator = (const QStyleOptionViewItem &other); |
603 | |
604 | protected: |
605 | QStyleOptionViewItemV3(int version); |
606 | }; |
607 | |
608 | #ifndef QT_NO_ITEMVIEWS |
609 | class Q_GUI_EXPORT QStyleOptionViewItemV4 : public QStyleOptionViewItemV3 |
610 | { |
611 | public: |
612 | enum StyleOptionVersion { Version = 4 }; |
613 | enum ViewItemPosition { Invalid, Beginning, Middle, End, OnlyOne }; |
614 | |
615 | QModelIndex index; |
616 | Qt::CheckState checkState; |
617 | QIcon icon; |
618 | QString text; |
619 | ViewItemPosition viewItemPosition; |
620 | QBrush backgroundBrush; |
621 | |
622 | QStyleOptionViewItemV4(); |
623 | QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other) |
624 | : QStyleOptionViewItemV3(Version) { *this = other; } |
625 | QStyleOptionViewItemV4(const QStyleOptionViewItem &other); |
626 | QStyleOptionViewItemV4 &operator = (const QStyleOptionViewItem &other); |
627 | |
628 | protected: |
629 | QStyleOptionViewItemV4(int version); |
630 | }; |
631 | #endif |
632 | |
633 | class Q_GUI_EXPORT QStyleOptionToolBox : public QStyleOption |
634 | { |
635 | public: |
636 | enum StyleOptionType { Type = SO_ToolBox }; |
637 | enum StyleOptionVersion { Version = 1 }; |
638 | |
639 | QString text; |
640 | QIcon icon; |
641 | |
642 | QStyleOptionToolBox(); |
643 | QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; } |
644 | |
645 | protected: |
646 | QStyleOptionToolBox(int version); |
647 | }; |
648 | |
649 | class Q_GUI_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox |
650 | { |
651 | public: |
652 | enum StyleOptionVersion { Version = 2 }; |
653 | enum TabPosition { Beginning, Middle, End, OnlyOneTab }; |
654 | enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected }; |
655 | |
656 | TabPosition position; |
657 | SelectedPosition selectedPosition; |
658 | |
659 | QStyleOptionToolBoxV2(); |
660 | QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other) : QStyleOptionToolBox(Version) { *this = other; } |
661 | QStyleOptionToolBoxV2(const QStyleOptionToolBox &other); |
662 | QStyleOptionToolBoxV2 &operator=(const QStyleOptionToolBox &other); |
663 | |
664 | protected: |
665 | QStyleOptionToolBoxV2(int version); |
666 | }; |
667 | |
668 | #ifndef QT_NO_RUBBERBAND |
669 | class Q_GUI_EXPORT QStyleOptionRubberBand : public QStyleOption |
670 | { |
671 | public: |
672 | enum StyleOptionType { Type = SO_RubberBand }; |
673 | enum StyleOptionVersion { Version = 1 }; |
674 | |
675 | QRubberBand::Shape shape; |
676 | bool opaque; |
677 | |
678 | QStyleOptionRubberBand(); |
679 | QStyleOptionRubberBand(const QStyleOptionRubberBand &other) : QStyleOption(Version, Type) { *this = other; } |
680 | |
681 | protected: |
682 | QStyleOptionRubberBand(int version); |
683 | }; |
684 | #endif // QT_NO_RUBBERBAND |
685 | |
686 | // -------------------------- Complex style options ------------------------------- |
687 | class Q_GUI_EXPORT QStyleOptionComplex : public QStyleOption |
688 | { |
689 | public: |
690 | enum StyleOptionType { Type = SO_Complex }; |
691 | enum StyleOptionVersion { Version = 1 }; |
692 | |
693 | QStyle::SubControls subControls; |
694 | QStyle::SubControls activeSubControls; |
695 | |
696 | QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = SO_Complex); |
697 | QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; } |
698 | }; |
699 | |
700 | #ifndef QT_NO_SLIDER |
701 | class Q_GUI_EXPORT QStyleOptionSlider : public QStyleOptionComplex |
702 | { |
703 | public: |
704 | enum StyleOptionType { Type = SO_Slider }; |
705 | enum StyleOptionVersion { Version = 1 }; |
706 | |
707 | Qt::Orientation orientation; |
708 | int minimum; |
709 | int maximum; |
710 | QSlider::TickPosition tickPosition; |
711 | int tickInterval; |
712 | bool upsideDown; |
713 | int sliderPosition; |
714 | int sliderValue; |
715 | int singleStep; |
716 | int pageStep; |
717 | qreal notchTarget; |
718 | bool dialWrapping; |
719 | |
720 | QStyleOptionSlider(); |
721 | QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
722 | |
723 | protected: |
724 | QStyleOptionSlider(int version); |
725 | }; |
726 | #endif // QT_NO_SLIDER |
727 | |
728 | #ifndef QT_NO_SPINBOX |
729 | class Q_GUI_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex |
730 | { |
731 | public: |
732 | enum StyleOptionType { Type = SO_SpinBox }; |
733 | enum StyleOptionVersion { Version = 1 }; |
734 | |
735 | QAbstractSpinBox::ButtonSymbols buttonSymbols; |
736 | QAbstractSpinBox::StepEnabled stepEnabled; |
737 | bool frame; |
738 | |
739 | QStyleOptionSpinBox(); |
740 | QStyleOptionSpinBox(const QStyleOptionSpinBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
741 | |
742 | protected: |
743 | QStyleOptionSpinBox(int version); |
744 | }; |
745 | #endif // QT_NO_SPINBOX |
746 | |
747 | class Q_GUI_EXPORT QStyleOptionQ3ListView : public QStyleOptionComplex |
748 | { |
749 | public: |
750 | enum StyleOptionType { Type = SO_Q3ListView }; |
751 | enum StyleOptionVersion { Version = 1 }; |
752 | |
753 | QList<QStyleOptionQ3ListViewItem> items; |
754 | QPalette viewportPalette; |
755 | QPalette::ColorRole viewportBGRole; |
756 | int sortColumn; |
757 | int itemMargin; |
758 | int treeStepSize; |
759 | bool rootIsDecorated; |
760 | |
761 | QStyleOptionQ3ListView(); |
762 | QStyleOptionQ3ListView(const QStyleOptionQ3ListView &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
763 | |
764 | protected: |
765 | QStyleOptionQ3ListView(int version); |
766 | }; |
767 | |
768 | class Q_GUI_EXPORT QStyleOptionToolButton : public QStyleOptionComplex |
769 | { |
770 | public: |
771 | enum StyleOptionType { Type = SO_ToolButton }; |
772 | enum StyleOptionVersion { Version = 1 }; |
773 | |
774 | enum ToolButtonFeature { None = 0x00, Arrow = 0x01, = 0x04, = Menu, = 0x08, |
775 | = 0x10 }; |
776 | Q_DECLARE_FLAGS(ToolButtonFeatures, ToolButtonFeature) |
777 | |
778 | ToolButtonFeatures features; |
779 | QIcon icon; |
780 | QSize iconSize; |
781 | QString text; |
782 | Qt::ArrowType arrowType; |
783 | Qt::ToolButtonStyle toolButtonStyle; |
784 | QPoint pos; |
785 | QFont font; |
786 | |
787 | QStyleOptionToolButton(); |
788 | QStyleOptionToolButton(const QStyleOptionToolButton &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
789 | |
790 | protected: |
791 | QStyleOptionToolButton(int version); |
792 | }; |
793 | |
794 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolButton::ToolButtonFeatures) |
795 | |
796 | class Q_GUI_EXPORT QStyleOptionComboBox : public QStyleOptionComplex |
797 | { |
798 | public: |
799 | enum StyleOptionType { Type = SO_ComboBox }; |
800 | enum StyleOptionVersion { Version = 1 }; |
801 | |
802 | bool editable; |
803 | QRect ; |
804 | bool frame; |
805 | QString currentText; |
806 | QIcon currentIcon; |
807 | QSize iconSize; |
808 | |
809 | QStyleOptionComboBox(); |
810 | QStyleOptionComboBox(const QStyleOptionComboBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
811 | |
812 | protected: |
813 | QStyleOptionComboBox(int version); |
814 | }; |
815 | |
816 | class Q_GUI_EXPORT QStyleOptionTitleBar : public QStyleOptionComplex |
817 | { |
818 | public: |
819 | enum StyleOptionType { Type = SO_TitleBar }; |
820 | enum StyleOptionVersion { Version = 1 }; |
821 | |
822 | QString text; |
823 | QIcon icon; |
824 | int titleBarState; |
825 | Qt::WindowFlags titleBarFlags; |
826 | |
827 | QStyleOptionTitleBar(); |
828 | QStyleOptionTitleBar(const QStyleOptionTitleBar &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
829 | |
830 | protected: |
831 | QStyleOptionTitleBar(int version); |
832 | }; |
833 | |
834 | class Q_GUI_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex |
835 | { |
836 | public: |
837 | enum StyleOptionType { Type = SO_GroupBox }; |
838 | enum StyleOptionVersion { Version = 1 }; |
839 | |
840 | QStyleOptionFrameV2::FrameFeatures features; |
841 | QString text; |
842 | Qt::Alignment textAlignment; |
843 | QColor textColor; |
844 | int lineWidth; |
845 | int midLineWidth; |
846 | |
847 | QStyleOptionGroupBox(); |
848 | QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
849 | protected: |
850 | QStyleOptionGroupBox(int version); |
851 | }; |
852 | |
853 | class Q_GUI_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex |
854 | { |
855 | public: |
856 | enum StyleOptionType { Type = SO_SizeGrip }; |
857 | enum StyleOptionVersion { Version = 1 }; |
858 | |
859 | Qt::Corner corner; |
860 | |
861 | QStyleOptionSizeGrip(); |
862 | QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; } |
863 | protected: |
864 | QStyleOptionSizeGrip(int version); |
865 | }; |
866 | |
867 | class Q_GUI_EXPORT QStyleOptionGraphicsItem : public QStyleOption |
868 | { |
869 | public: |
870 | enum StyleOptionType { Type = SO_GraphicsItem }; |
871 | enum StyleOptionVersion { Version = 1 }; |
872 | |
873 | QRectF exposedRect; |
874 | QMatrix matrix; |
875 | qreal levelOfDetail; |
876 | |
877 | QStyleOptionGraphicsItem(); |
878 | QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; } |
879 | static qreal levelOfDetailFromTransform(const QTransform &worldTransform); |
880 | protected: |
881 | QStyleOptionGraphicsItem(int version); |
882 | }; |
883 | |
884 | template <typename T> |
885 | T qstyleoption_cast(const QStyleOption *opt) |
886 | { |
887 | if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type |
888 | || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default |
889 | || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex |
890 | && opt->type > QStyleOption::SO_Complex))) |
891 | return static_cast<T>(opt); |
892 | return 0; |
893 | } |
894 | |
895 | template <typename T> |
896 | T qstyleoption_cast(QStyleOption *opt) |
897 | { |
898 | if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type |
899 | || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default |
900 | || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex |
901 | && opt->type > QStyleOption::SO_Complex))) |
902 | return static_cast<T>(opt); |
903 | return 0; |
904 | } |
905 | |
906 | // -------------------------- QStyleHintReturn ------------------------------- |
907 | class Q_GUI_EXPORT QStyleHintReturn { |
908 | public: |
909 | enum HintReturnType { |
910 | SH_Default=0xf000, SH_Mask, SH_Variant |
911 | }; |
912 | |
913 | enum StyleOptionType { Type = SH_Default }; |
914 | enum StyleOptionVersion { Version = 1 }; |
915 | |
916 | QStyleHintReturn(int version = QStyleOption::Version, int type = SH_Default); |
917 | ~QStyleHintReturn(); |
918 | |
919 | int version; |
920 | int type; |
921 | }; |
922 | |
923 | class Q_GUI_EXPORT QStyleHintReturnMask : public QStyleHintReturn { |
924 | public: |
925 | enum StyleOptionType { Type = SH_Mask }; |
926 | enum StyleOptionVersion { Version = 1 }; |
927 | |
928 | QStyleHintReturnMask(); |
929 | |
930 | QRegion region; |
931 | }; |
932 | |
933 | class Q_GUI_EXPORT QStyleHintReturnVariant : public QStyleHintReturn { |
934 | public: |
935 | enum StyleOptionType { Type = SH_Variant }; |
936 | enum StyleOptionVersion { Version = 1 }; |
937 | |
938 | QStyleHintReturnVariant(); |
939 | |
940 | QVariant variant; |
941 | }; |
942 | |
943 | template <typename T> |
944 | T qstyleoption_cast(const QStyleHintReturn *hint) |
945 | { |
946 | if (hint && hint->version <= static_cast<T>(0)->Version && |
947 | (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default)) |
948 | return static_cast<T>(hint); |
949 | return 0; |
950 | } |
951 | |
952 | template <typename T> |
953 | T qstyleoption_cast(QStyleHintReturn *hint) |
954 | { |
955 | if (hint && hint->version <= static_cast<T>(0)->Version && |
956 | (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default)) |
957 | return static_cast<T>(hint); |
958 | return 0; |
959 | } |
960 | |
961 | #if !defined(QT_NO_DEBUG_STREAM) |
962 | Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType); |
963 | Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option); |
964 | #endif |
965 | |
966 | QT_END_NAMESPACE |
967 | |
968 | QT_END_HEADER |
969 | |
970 | #endif // QSTYLEOPTION_H |
971 | |