- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qstyleoption.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtGui module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QSTYLEOPTION_H
    00043 #define QSTYLEOPTION_H
    00044
    00045 #include <QtCore/qvariant.h>
    00046 #include <QtGui/qabstractspinbox.h>
    00047 #include <QtGui/qicon.h>
    00048 #include <QtGui/qmatrix.h>
    00049 #include <QtGui/qslider.h>
    00050 #include <QtGui/qstyle.h>
    00051 #include <QtGui/qtabbar.h>
    00052 #include <QtGui/qtabwidget.h>
    00053 #include <QtGui/qrubberband.h>
    00054 #include <QtGui/qframe.h>
    00055 #ifndef QT_NO_ITEMVIEWS
    00056 #   include <QtCore/qabstractitemmodel.h>
    00057 #endif
    00058
    00059 QT_BEGIN_HEADER
    00060
    00061 QT_BEGIN_NAMESPACE
    00062
    00063 QT_MODULE(Gui)
    00064
    00065 class QDebug;
    00066
    00067 class Q_GUI_EXPORT QStyleOption
    00068 {
    00069 public:
    00070     enum OptionType {
    00071                       SO_Default, SO_FocusRect, SO_Button, SO_Tab, SO_MenuItem,
    00072                       SO_Frame, SO_ProgressBar, SO_ToolBox, SO_Header, SO_Q3DockWindow,
    00073                       SO_DockWidget, SO_Q3ListViewItem, SO_ViewItem, SO_TabWidgetFrame,
    00074                       SO_TabBarBase, SO_RubberBand, SO_ToolBar, SO_GraphicsItem,
    00075
    00076                       SO_Complex = 0xf0000, SO_Slider, SO_SpinBox, SO_ToolButton, SO_ComboBox,
    00077                       SO_Q3ListView, SO_TitleBar, SO_GroupBox, SO_SizeGrip,
    00078
    00079                       SO_CustomBase = 0xf00,
    00080                       SO_ComplexCustomBase = 0xf000000
    00081                     };
    00082
    00083     enum StyleOptionType { Type = SO_Default };
    00084     enum StyleOptionVersion { Version = 1 };
    00085
    00086     int version;
    00087     int type;
    00088     QStyle::State state;
    00089     Qt::LayoutDirection direction;
    00090     QRect rect;
    00091     QFontMetrics fontMetrics;
    00092     QPalette palette;
    00093
    00094     QStyleOption(int version = QStyleOption::Version, int type = SO_Default);
    00095     QStyleOption(const QStyleOption &other);
    00096     ~QStyleOption();
    00097
    00098     void init(const QWidget *w);
    00099     inline void initFrom(const QWidget *w) { init(w); }
    00100     QStyleOption &operator=(const QStyleOption &other);
    00101 };
    00102
    00103 class Q_GUI_EXPORT QStyleOptionFocusRect : public QStyleOption
    00104 {
    00105 public:
    00106     enum StyleOptionType { Type = SO_FocusRect };
    00107     enum StyleOptionVersion { Version = 1 };
    00108
    00109     QColor backgroundColor;
    00110
    00111     QStyleOptionFocusRect();
    00112     QStyleOptionFocusRect(const QStyleOptionFocusRect &other) : QStyleOption(Version, Type) { *this = other; }
    00113
    00114 protected:
    00115     QStyleOptionFocusRect(int version);
    00116 };
    00117
    00118 class Q_GUI_EXPORT QStyleOptionFrame : public QStyleOption
    00119 {
    00120 public:
    00121     enum StyleOptionType { Type = SO_Frame };
    00122     enum StyleOptionVersion { Version = 1 };
    00123
    00124     int lineWidth;
    00125     int midLineWidth;
    00126
    00127     QStyleOptionFrame();
    00128     QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
    00129
    00130 protected:
    00131     QStyleOptionFrame(int version);
    00132 };
    00133
    00134 class Q_GUI_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame
    00135 {
    00136 public:
    00137     enum StyleOptionVersion { Version = 2 };
    00138     enum FrameFeature {
    00139         None = 0x00,
    00140         Flat = 0x01
    00141     };
    00142     Q_DECLARE_FLAGS(FrameFeatures, FrameFeature)
    00143     FrameFeatures features;
    00144
    00145     QStyleOptionFrameV2();
    00146     QStyleOptionFrameV2(const QStyleOptionFrameV2 &other) : QStyleOptionFrame(Version) { *this = other; }
    00147     QStyleOptionFrameV2(const QStyleOptionFrame &other);
    00148     QStyleOptionFrameV2 &operator=(const QStyleOptionFrame &other);
    00149
    00150 protected:
    00151     QStyleOptionFrameV2(int version);
    00152 };
    00153
    00154 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrameV2::FrameFeatures)
    00155
    00156
    00157 class Q_GUI_EXPORT QStyleOptionFrameV3 : public QStyleOptionFrameV2
    00158 {
    00159 public:
    00160     enum StyleOptionVersion { Version = 3 };
    00161     QFrame::Shape frameShape : 4;
    00162     uint unused : 28;
    00163
    00164     QStyleOptionFrameV3();
    00165     QStyleOptionFrameV3(const QStyleOptionFrameV3 &other) : QStyleOptionFrameV2(Version) { *this = other; }
    00166     QStyleOptionFrameV3(const QStyleOptionFrame &other);
    00167     QStyleOptionFrameV3 &operator=(const QStyleOptionFrame &other);
    00168
    00169 protected:
    00170     QStyleOptionFrameV3(int version);
    00171 };
    00172
    00173
    00174 #ifndef QT_NO_TABWIDGET
    00175 class Q_GUI_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption
    00176 {
    00177 public:
    00178     enum StyleOptionType { Type = SO_TabWidgetFrame };
    00179     enum StyleOptionVersion { Version = 1 };
    00180
    00181     int lineWidth;
    00182     int midLineWidth;
    00183     QTabBar::Shape shape;
    00184     QSize tabBarSize;
    00185     QSize rightCornerWidgetSize;
    00186     QSize leftCornerWidgetSize;
    00187
    00188     QStyleOptionTabWidgetFrame();
    00189     inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
    00190         : QStyleOption(Version, Type) { *this = other; }
    00191
    00192 protected:
    00193     QStyleOptionTabWidgetFrame(int version);
    00194 };
    00195
    00196 class Q_GUI_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame
    00197 {
    00198 public:
    00199     enum StyleOptionVersion { Version = 2 };
    00200
    00201     QRect tabBarRect;
    00202     QRect selectedTabRect;
    00203
    00204     QStyleOptionTabWidgetFrameV2();
    00205     QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) :
    00206             QStyleOptionTabWidgetFrame(Version) { *this = other; }
    00207     QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other);
    00208     QStyleOptionTabWidgetFrameV2 &operator=(const QStyleOptionTabWidgetFrame &other);
    00209
    00210 protected:
    00211     QStyleOptionTabWidgetFrameV2(int version);
    00212 };
    00213
    00214 #endif
    00215
    00216
    00217 #ifndef QT_NO_TABBAR
    00218 class Q_GUI_EXPORT QStyleOptionTabBarBase : public QStyleOption
    00219 {
    00220 public:
    00221     enum StyleOptionType { Type = SO_TabBarBase };
    00222     enum StyleOptionVersion { Version = 1 };
    00223
    00224     QTabBar::Shape shape;
    00225     QRect tabBarRect;
    00226     QRect selectedTabRect;
    00227
    00228     QStyleOptionTabBarBase();
    00229     QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; }
    00230
    00231 protected:
    00232     QStyleOptionTabBarBase(int version);
    00233 };
    00234
    00235 class Q_GUI_EXPORT QStyleOptionTabBarBaseV2 : public QStyleOptionTabBarBase
    00236 {
    00237 public:
    00238     enum StyleOptionVersion { Version = 2 };
    00239     bool documentMode;
    00240     QStyleOptionTabBarBaseV2();
    00241     QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other) : QStyleOptionTabBarBase(Version) { *this = other; }
    00242     QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other);
    00243     QStyleOptionTabBarBaseV2 &operator=(const QStyleOptionTabBarBase &other);
    00244
    00245 protected:
    00246     QStyleOptionTabBarBaseV2(int version);
    00247 };
    00248
    00249 #endif
    00250
    00251 class Q_GUI_EXPORT QStyleOptionHeader : public QStyleOption
    00252 {
    00253 public:
    00254     enum StyleOptionType { Type = SO_Header };
    00255     enum StyleOptionVersion { Version = 1 };
    00256
    00257     enum SectionPosition { Beginning, Middle, End, OnlyOneSection };
    00258     enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected,
    00259                             NextAndPreviousAreSelected };
    00260     enum SortIndicator { None, SortUp, SortDown };
    00261
    00262     int section;
    00263     QString text;
    00264     Qt::Alignment textAlignment;
    00265     QIcon icon;
    00266     Qt::Alignment iconAlignment;
    00267     SectionPosition position;
    00268     SelectedPosition selectedPosition;
    00269     SortIndicator sortIndicator;
    00270     Qt::Orientation orientation;
    00271
    00272     QStyleOptionHeader();
    00273     QStyleOptionHeader(const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; }
    00274
    00275 protected:
    00276     QStyleOptionHeader(int version);
    00277 };
    00278
    00279 class Q_GUI_EXPORT QStyleOptionButton : public QStyleOption
    00280 {
    00281 public:
    00282     enum StyleOptionType { Type = SO_Button };
    00283     enum StyleOptionVersion { Version = 1 };
    00284
    00285     enum ButtonFeature { None = 0x00, Flat = 0x01, HasMenu = 0x02, DefaultButton = 0x04,
    00286                          AutoDefaultButton = 0x08, CommandLinkButton = 0x10  };
    00287     Q_DECLARE_FLAGS(ButtonFeatures, ButtonFeature)
    00288
    00289     ButtonFeatures features;
    00290     QString text;
    00291     QIcon icon;
    00292     QSize iconSize;
    00293
    00294     QStyleOptionButton();
    00295     QStyleOptionButton(const QStyleOptionButton &other) : QStyleOption(Version, Type) { *this = other; }
    00296
    00297 protected:
    00298     QStyleOptionButton(int version);
    00299 };
    00300
    00301 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionButton::ButtonFeatures)
    00302
    00303 #ifndef QT_NO_TABBAR
    00304 class Q_GUI_EXPORT QStyleOptionTab : public QStyleOption
    00305 {
    00306 public:
    00307     enum StyleOptionType { Type = SO_Tab };
    00308     enum StyleOptionVersion { Version = 1 };
    00309
    00310     enum TabPosition { Beginning, Middle, End, OnlyOneTab };
    00311     enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
    00312     enum CornerWidget { NoCornerWidgets = 0x00, LeftCornerWidget = 0x01,
    00313                         RightCornerWidget = 0x02 };
    00314     Q_DECLARE_FLAGS(CornerWidgets, CornerWidget)
    00315
    00316     QTabBar::Shape shape;
    00317     QString text;
    00318     QIcon icon;
    00319     int row;
    00320     TabPosition position;
    00321     SelectedPosition selectedPosition;
    00322     CornerWidgets cornerWidgets;
    00323
    00324     QStyleOptionTab();
    00325     QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; }
    00326
    00327 protected:
    00328     QStyleOptionTab(int version);
    00329 };
    00330
    00331 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets)
    00332
    00333 class Q_GUI_EXPORT QStyleOptionTabV2 : public QStyleOptionTab
    00334 {
    00335 public:
    00336     enum StyleOptionVersion { Version = 2 };
    00337     QSize iconSize;
    00338     QStyleOptionTabV2();
    00339     QStyleOptionTabV2(const QStyleOptionTabV2 &other) : QStyleOptionTab(Version) { *this = other; }
    00340     QStyleOptionTabV2(const QStyleOptionTab &other);
    00341     QStyleOptionTabV2 &operator=(const QStyleOptionTab &other);
    00342
    00343 protected:
    00344     QStyleOptionTabV2(int version);
    00345 };
    00346
    00347 class Q_GUI_EXPORT QStyleOptionTabV3 : public QStyleOptionTabV2
    00348 {
    00349 public:
    00350     enum StyleOptionVersion { Version = 3 };
    00351     bool documentMode;
    00352     QSize leftButtonSize;
    00353     QSize rightButtonSize;
    00354     QStyleOptionTabV3();
    00355     QStyleOptionTabV3(const QStyleOptionTabV3 &other) : QStyleOptionTabV2(Version) { *this = other; }
    00356     QStyleOptionTabV3(const QStyleOptionTabV2 &other) : QStyleOptionTabV2(Version) { *this = other; }
    00357     QStyleOptionTabV3(const QStyleOptionTab &other);
    00358     QStyleOptionTabV3 &operator=(const QStyleOptionTab &other);
    00359
    00360 protected:
    00361     QStyleOptionTabV3(int version);
    00362 };
    00363
    00364 #endif
    00365
    00366
    00367 #ifndef QT_NO_TOOLBAR
    00368
    00369 class Q_GUI_EXPORT QStyleOptionToolBar : public QStyleOption
    00370 {
    00371 public:
    00372     enum StyleOptionType { Type = SO_ToolBar };
    00373     enum StyleOptionVersion { Version = 1 };
    00374     enum ToolBarPosition { Beginning, Middle, End, OnlyOne };
    00375     enum ToolBarFeature { None = 0x0, Movable = 0x1 };
    00376     Q_DECLARE_FLAGS(ToolBarFeatures, ToolBarFeature)
    00377     ToolBarPosition positionOfLine; // The toolbar line position
    00378     ToolBarPosition positionWithinLine; // The position within a toolbar
    00379     Qt::ToolBarArea toolBarArea; // The toolbar docking area
    00380     ToolBarFeatures features;
    00381     int lineWidth;
    00382     int midLineWidth;
    00383     QStyleOptionToolBar();
    00384     QStyleOptionToolBar(const QStyleOptionToolBar &other) : QStyleOption(Version, Type) { *this = other; }
    00385
    00386 protected:
    00387     QStyleOptionToolBar(int version);
    00388 };
    00389
    00390 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures)
    00391
    00392 #endif
    00393
    00394
    00395
    00396 class Q_GUI_EXPORT QStyleOptionProgressBar : public QStyleOption
    00397 {
    00398 public:
    00399     enum StyleOptionType { Type = SO_ProgressBar };
    00400     enum StyleOptionVersion { Version = 1 };
    00401
    00402     int minimum;
    00403     int maximum;
    00404     int progress;
    00405     QString text;
    00406     Qt::Alignment textAlignment;
    00407     bool textVisible;
    00408
    00409     QStyleOptionProgressBar();
    00410     QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; }
    00411
    00412 protected:
    00413     QStyleOptionProgressBar(int version);
    00414 };
    00415
    00416 // Adds style info for vertical progress bars
    00417 class Q_GUI_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar
    00418 {
    00419 public:
    00420     enum StyleOptionType { Type = SO_ProgressBar };
    00421     enum StyleOptionVersion { Version = 2 };
    00422     Qt::Orientation orientation;
    00423     bool invertedAppearance;
    00424     bool bottomToTop;
    00425
    00426     QStyleOptionProgressBarV2();
    00427     QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other);
    00428     QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other);
    00429     QStyleOptionProgressBarV2 &operator=(const QStyleOptionProgressBar &other);
    00430
    00431 protected:
    00432     QStyleOptionProgressBarV2(int version);
    00433 };
    00434
    00435 class Q_GUI_EXPORT QStyleOptionMenuItem : public QStyleOption
    00436 {
    00437 public:
    00438     enum StyleOptionType { Type = SO_MenuItem };
    00439     enum StyleOptionVersion { Version = 1 };
    00440
    00441     enum MenuItemType { Normal, DefaultItem, Separator, SubMenu, Scroller, TearOff, Margin,
    00442                         EmptyArea };
    00443     enum CheckType { NotCheckable, Exclusive, NonExclusive };
    00444
    00445     MenuItemType menuItemType;
    00446     CheckType checkType;
    00447     bool checked;
    00448     bool menuHasCheckableItems;
    00449     QRect menuRect;
    00450     QString text;
    00451     QIcon icon;
    00452     int maxIconWidth;
    00453     int tabWidth;
    00454     QFont font;
    00455
    00456     QStyleOptionMenuItem();
    00457     QStyleOptionMenuItem(const QStyleOptionMenuItem &other) : QStyleOption(Version, Type) { *this = other; }
    00458
    00459 protected:
    00460     QStyleOptionMenuItem(int version);
    00461 };
    00462
    00463 class Q_GUI_EXPORT QStyleOptionQ3ListViewItem : public QStyleOption
    00464 {
    00465 public:
    00466     enum StyleOptionType { Type = SO_Q3ListViewItem };
    00467     enum StyleOptionVersion { Version = 1 };
    00468
    00469     enum Q3ListViewItemFeature { None = 0x00, Expandable = 0x01, MultiLine = 0x02, Visible = 0x04,
    00470                                  ParentControl = 0x08 };
    00471     Q_DECLARE_FLAGS(Q3ListViewItemFeatures, Q3ListViewItemFeature)
    00472
    00473     Q3ListViewItemFeatures features;
    00474     int height;
    00475     int totalHeight;
    00476     int itemY;
    00477     int childCount;
    00478
    00479     QStyleOptionQ3ListViewItem();
    00480     QStyleOptionQ3ListViewItem(const QStyleOptionQ3ListViewItem &other) : QStyleOption(Version, Type) { *this = other; }
    00481
    00482 protected:
    00483     QStyleOptionQ3ListViewItem(int version);
    00484 };
    00485
    00486 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionQ3ListViewItem::Q3ListViewItemFeatures)
    00487
    00488 class Q_GUI_EXPORT QStyleOptionQ3DockWindow : public QStyleOption
    00489 {
    00490 public:
    00491     enum StyleOptionType { Type = SO_Q3DockWindow };
    00492     enum StyleOptionVersion { Version = 1 };
    00493
    00494     bool docked;
    00495     bool closeEnabled;
    00496
    00497     QStyleOptionQ3DockWindow();
    00498     QStyleOptionQ3DockWindow(const QStyleOptionQ3DockWindow &other) : QStyleOption(Version, Type) { *this = other; }
    00499
    00500 protected:
    00501     QStyleOptionQ3DockWindow(int version);
    00502 };
    00503
    00504 class Q_GUI_EXPORT QStyleOptionDockWidget : public QStyleOption
    00505 {
    00506 public:
    00507     enum StyleOptionType { Type = SO_DockWidget };
    00508     enum StyleOptionVersion { Version = 1 };
    00509
    00510     QString title;
    00511     bool closable;
    00512     bool movable;
    00513     bool floatable;
    00514
    00515     QStyleOptionDockWidget();
    00516     QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; }
    00517
    00518 protected:
    00519     QStyleOptionDockWidget(int version);
    00520 };
    00521
    00522 class Q_GUI_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget
    00523 {
    00524 public:
    00525     enum StyleOptionVersion { Version = 2 };
    00526
    00527     bool verticalTitleBar;
    00528
    00529     QStyleOptionDockWidgetV2();
    00530     QStyleOptionDockWidgetV2(const QStyleOptionDockWidgetV2 &other)
    00531         : QStyleOptionDockWidget(Version) { *this = other; }
    00532     QStyleOptionDockWidgetV2(const QStyleOptionDockWidget &other);
    00533     QStyleOptionDockWidgetV2 &operator = (const QStyleOptionDockWidget &other);
    00534
    00535 protected:
    00536     QStyleOptionDockWidgetV2(int version);
    00537 };
    00538
    00539 class Q_GUI_EXPORT QStyleOptionViewItem : public QStyleOption
    00540 {
    00541 public:
    00542     enum StyleOptionType { Type = SO_ViewItem };
    00543     enum StyleOptionVersion { Version = 1 };
    00544
    00545     enum Position { Left, Right, Top, Bottom };
    00546
    00547     Qt::Alignment displayAlignment;
    00548     Qt::Alignment decorationAlignment;
    00549     Qt::TextElideMode textElideMode;
    00550     Position decorationPosition;
    00551     QSize decorationSize;
    00552     QFont font;
    00553     bool showDecorationSelected;
    00554
    00555     QStyleOptionViewItem();
    00556     QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
    00557
    00558 protected:
    00559     QStyleOptionViewItem(int version);
    00560 };
    00561
    00562 class Q_GUI_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem
    00563 {
    00564 public:
    00565     enum StyleOptionVersion { Version = 2 };
    00566
    00567     enum ViewItemFeature {
    00568         None = 0x00,
    00569         WrapText = 0x01,
    00570         Alternate = 0x02,
    00571         HasCheckIndicator = 0x04,
    00572         HasDisplay = 0x08,
    00573         HasDecoration = 0x10
    00574     };
    00575     Q_DECLARE_FLAGS(ViewItemFeatures, ViewItemFeature)
    00576
    00577     ViewItemFeatures features;
    00578
    00579     QStyleOptionViewItemV2();
    00580     QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other) : QStyleOptionViewItem(Version) { *this = other; }
    00581     QStyleOptionViewItemV2(const QStyleOptionViewItem &other);
    00582     QStyleOptionViewItemV2 &operator=(const QStyleOptionViewItem &other);
    00583
    00584 protected:
    00585     QStyleOptionViewItemV2(int version);
    00586 };
    00587
    00588 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItemV2::ViewItemFeatures)
    00589
    00590 class Q_GUI_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2
    00591 {
    00592 public:
    00593     enum StyleOptionVersion { Version = 3 };
    00594
    00595     QLocale locale;
    00596     const QWidget *widget;
    00597
    00598     QStyleOptionViewItemV3();
    00599     QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other)
    00600         : QStyleOptionViewItemV2(Version) { *this = other; }
    00601     QStyleOptionViewItemV3(const QStyleOptionViewItem &other);
    00602     QStyleOptionViewItemV3 &operator = (const QStyleOptionViewItem &other);
    00603
    00604 protected:
    00605     QStyleOptionViewItemV3(int version);
    00606 };
    00607
    00608 #ifndef QT_NO_ITEMVIEWS
    00609 class Q_GUI_EXPORT QStyleOptionViewItemV4 : public QStyleOptionViewItemV3
    00610 {
    00611 public:
    00612     enum StyleOptionVersion { Version = 4 };
    00613     enum ViewItemPosition { Invalid, Beginning, Middle, End, OnlyOne };
    00614
    00615     QModelIndex index;
    00616     Qt::CheckState checkState;
    00617     QIcon icon;
    00618     QString text;
    00619     ViewItemPosition viewItemPosition;
    00620     QBrush backgroundBrush;
    00621
    00622     QStyleOptionViewItemV4();
    00623     QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other)
    00624         : QStyleOptionViewItemV3(Version) { *this = other; }
    00625     QStyleOptionViewItemV4(const QStyleOptionViewItem &other);
    00626     QStyleOptionViewItemV4 &operator = (const QStyleOptionViewItem &other);
    00627
    00628 protected:
    00629     QStyleOptionViewItemV4(int version);
    00630 };
    00631 #endif
    00632
    00633 class Q_GUI_EXPORT QStyleOptionToolBox : public QStyleOption
    00634 {
    00635 public:
    00636     enum StyleOptionType { Type = SO_ToolBox };
    00637     enum StyleOptionVersion { Version = 1 };
    00638
    00639     QString text;
    00640     QIcon icon;
    00641
    00642     QStyleOptionToolBox();
    00643     QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
    00644
    00645 protected:
    00646     QStyleOptionToolBox(int version);
    00647 };
    00648
    00649 class Q_GUI_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox
    00650 {
    00651 public:
    00652     enum StyleOptionVersion { Version = 2 };
    00653     enum TabPosition { Beginning, Middle, End, OnlyOneTab };
    00654     enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
    00655
    00656     TabPosition position;
    00657     SelectedPosition selectedPosition;
    00658
    00659     QStyleOptionToolBoxV2();
    00660     QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other) : QStyleOptionToolBox(Version) { *this = other; }
    00661     QStyleOptionToolBoxV2(const QStyleOptionToolBox &other);
    00662     QStyleOptionToolBoxV2 &operator=(const QStyleOptionToolBox &other);
    00663
    00664 protected:
    00665     QStyleOptionToolBoxV2(int version);
    00666 };
    00667
    00668 #ifndef QT_NO_RUBBERBAND
    00669 class Q_GUI_EXPORT QStyleOptionRubberBand : public QStyleOption
    00670 {
    00671 public:
    00672     enum StyleOptionType { Type = SO_RubberBand };
    00673     enum StyleOptionVersion { Version = 1 };
    00674
    00675     QRubberBand::Shape shape;
    00676     bool opaque;
    00677
    00678     QStyleOptionRubberBand();
    00679     QStyleOptionRubberBand(const QStyleOptionRubberBand &other) : QStyleOption(Version, Type) { *this = other; }
    00680
    00681 protected:
    00682     QStyleOptionRubberBand(int version);
    00683 };
    00684 #endif // QT_NO_RUBBERBAND
    00685
    00686 // -------------------------- Complex style options -------------------------------
    00687 class Q_GUI_EXPORT QStyleOptionComplex : public QStyleOption
    00688 {
    00689 public:
    00690     enum StyleOptionType { Type = SO_Complex };
    00691     enum StyleOptionVersion { Version = 1 };
    00692
    00693     QStyle::SubControls subControls;
    00694     QStyle::SubControls activeSubControls;
    00695
    00696     QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = SO_Complex);
    00697     QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
    00698 };
    00699
    00700 #ifndef QT_NO_SLIDER
    00701 class Q_GUI_EXPORT QStyleOptionSlider : public QStyleOptionComplex
    00702 {
    00703 public:
    00704     enum StyleOptionType { Type = SO_Slider };
    00705     enum StyleOptionVersion { Version = 1 };
    00706
    00707     Qt::Orientation orientation;
    00708     int minimum;
    00709     int maximum;
    00710     QSlider::TickPosition tickPosition;
    00711     int tickInterval;
    00712     bool upsideDown;
    00713     int sliderPosition;
    00714     int sliderValue;
    00715     int singleStep;
    00716     int pageStep;
    00717     qreal notchTarget;
    00718     bool dialWrapping;
    00719
    00720     QStyleOptionSlider();
    00721     QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00722
    00723 protected:
    00724     QStyleOptionSlider(int version);
    00725 };
    00726 #endif // QT_NO_SLIDER
    00727
    00728 #ifndef QT_NO_SPINBOX
    00729 class Q_GUI_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex
    00730 {
    00731 public:
    00732     enum StyleOptionType { Type = SO_SpinBox };
    00733     enum StyleOptionVersion { Version = 1 };
    00734
    00735     QAbstractSpinBox::ButtonSymbols buttonSymbols;
    00736     QAbstractSpinBox::StepEnabled stepEnabled;
    00737     bool frame;
    00738
    00739     QStyleOptionSpinBox();
    00740     QStyleOptionSpinBox(const QStyleOptionSpinBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00741
    00742 protected:
    00743     QStyleOptionSpinBox(int version);
    00744 };
    00745 #endif // QT_NO_SPINBOX
    00746
    00747 class Q_GUI_EXPORT QStyleOptionQ3ListView : public QStyleOptionComplex
    00748 {
    00749 public:
    00750     enum StyleOptionType { Type = SO_Q3ListView };
    00751     enum StyleOptionVersion { Version = 1 };
    00752
    00753     QList<QStyleOptionQ3ListViewItem> items;
    00754     QPalette viewportPalette;
    00755     QPalette::ColorRole viewportBGRole;
    00756     int sortColumn;
    00757     int itemMargin;
    00758     int treeStepSize;
    00759     bool rootIsDecorated;
    00760
    00761     QStyleOptionQ3ListView();
    00762     QStyleOptionQ3ListView(const QStyleOptionQ3ListView &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00763
    00764 protected:
    00765     QStyleOptionQ3ListView(int version);
    00766 };
    00767
    00768 class Q_GUI_EXPORT QStyleOptionToolButton : public QStyleOptionComplex
    00769 {
    00770 public:
    00771     enum StyleOptionType { Type = SO_ToolButton };
    00772     enum StyleOptionVersion { Version = 1 };
    00773
    00774     enum ToolButtonFeature { None = 0x00, Arrow = 0x01, Menu = 0x04, MenuButtonPopup = Menu, PopupDelay = 0x08,
    00775                              HasMenu = 0x10 };
    00776     Q_DECLARE_FLAGS(ToolButtonFeatures, ToolButtonFeature)
    00777
    00778     ToolButtonFeatures features;
    00779     QIcon icon;
    00780     QSize iconSize;
    00781     QString text;
    00782     Qt::ArrowType arrowType;
    00783     Qt::ToolButtonStyle toolButtonStyle;
    00784     QPoint pos;
    00785     QFont font;
    00786
    00787     QStyleOptionToolButton();
    00788     QStyleOptionToolButton(const QStyleOptionToolButton &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00789
    00790 protected:
    00791     QStyleOptionToolButton(int version);
    00792 };
    00793
    00794 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolButton::ToolButtonFeatures)
    00795
    00796 class Q_GUI_EXPORT QStyleOptionComboBox : public QStyleOptionComplex
    00797 {
    00798 public:
    00799     enum StyleOptionType { Type = SO_ComboBox };
    00800     enum StyleOptionVersion { Version = 1 };
    00801
    00802     bool editable;
    00803     QRect popupRect;
    00804     bool frame;
    00805     QString currentText;
    00806     QIcon currentIcon;
    00807     QSize iconSize;
    00808
    00809     QStyleOptionComboBox();
    00810     QStyleOptionComboBox(const QStyleOptionComboBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00811
    00812 protected:
    00813     QStyleOptionComboBox(int version);
    00814 };
    00815
    00816 class Q_GUI_EXPORT QStyleOptionTitleBar : public QStyleOptionComplex
    00817 {
    00818 public:
    00819     enum StyleOptionType { Type = SO_TitleBar };
    00820     enum StyleOptionVersion { Version = 1 };
    00821
    00822     QString text;
    00823     QIcon icon;
    00824     int titleBarState;
    00825     Qt::WindowFlags titleBarFlags;
    00826
    00827     QStyleOptionTitleBar();
    00828     QStyleOptionTitleBar(const QStyleOptionTitleBar &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00829
    00830 protected:
    00831     QStyleOptionTitleBar(int version);
    00832 };
    00833
    00834 class Q_GUI_EXPORT QStyleOptionGroupBox : public QStyleOptionComplex
    00835 {
    00836 public:
    00837     enum StyleOptionType { Type = SO_GroupBox };
    00838     enum StyleOptionVersion { Version = 1 };
    00839
    00840     QStyleOptionFrameV2::FrameFeatures features;
    00841     QString text;
    00842     Qt::Alignment textAlignment;
    00843     QColor textColor;
    00844     int lineWidth;
    00845     int midLineWidth;
    00846
    00847     QStyleOptionGroupBox();
    00848     QStyleOptionGroupBox(const QStyleOptionGroupBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00849 protected:
    00850     QStyleOptionGroupBox(int version);
    00851 };
    00852
    00853 class Q_GUI_EXPORT QStyleOptionSizeGrip : public QStyleOptionComplex
    00854 {
    00855 public:
    00856     enum StyleOptionType { Type = SO_SizeGrip };
    00857     enum StyleOptionVersion { Version = 1 };
    00858
    00859     Qt::Corner corner;
    00860
    00861     QStyleOptionSizeGrip();
    00862     QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other) : QStyleOptionComplex(Version, Type) { *this = other; }
    00863 protected:
    00864     QStyleOptionSizeGrip(int version);
    00865 };
    00866
    00867 class Q_GUI_EXPORT QStyleOptionGraphicsItem : public QStyleOption
    00868 {
    00869 public:
    00870     enum StyleOptionType { Type = SO_GraphicsItem };
    00871     enum StyleOptionVersion { Version = 1 };
    00872
    00873     QRectF exposedRect;
    00874     QMatrix matrix;
    00875     qreal levelOfDetail;
    00876
    00877     QStyleOptionGraphicsItem();
    00878     QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; }
    00879     static qreal levelOfDetailFromTransform(const QTransform &worldTransform);
    00880 protected:
    00881     QStyleOptionGraphicsItem(int version);
    00882 };
    00883
    00884 template <typename T>
    00885 T qstyleoption_cast(const QStyleOption *opt)
    00886 {
    00887     if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type
    00888         || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default
    00889         || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex
    00890             && opt->type > QStyleOption::SO_Complex)))
    00891         return static_cast<T>(opt);
    00892     return 0;
    00893 }
    00894
    00895 template <typename T>
    00896 T qstyleoption_cast(QStyleOption *opt)
    00897 {
    00898     if (opt && opt->version >= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type
    00899         || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default
    00900         || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex
    00901             && opt->type > QStyleOption::SO_Complex)))
    00902         return static_cast<T>(opt);
    00903     return 0;
    00904 }
    00905
    00906 // -------------------------- QStyleHintReturn -------------------------------
    00907 class Q_GUI_EXPORT QStyleHintReturn {
    00908 public:
    00909     enum HintReturnType {
    00910         SH_Default=0xf000, SH_Mask, SH_Variant
    00911     };
    00912
    00913     enum StyleOptionType { Type = SH_Default };
    00914     enum StyleOptionVersion { Version = 1 };
    00915
    00916     QStyleHintReturn(int version = QStyleOption::Version, int type = SH_Default);
    00917     ~QStyleHintReturn();
    00918
    00919     int version;
    00920     int type;
    00921 };
    00922
    00923 class Q_GUI_EXPORT QStyleHintReturnMask : public QStyleHintReturn {
    00924 public:
    00925     enum StyleOptionType { Type = SH_Mask };
    00926     enum StyleOptionVersion { Version = 1 };
    00927
    00928     QStyleHintReturnMask();
    00929
    00930     QRegion region;
    00931 };
    00932
    00933 class Q_GUI_EXPORT QStyleHintReturnVariant : public QStyleHintReturn {
    00934 public:
    00935     enum StyleOptionType { Type = SH_Variant };
    00936     enum StyleOptionVersion { Version = 1 };
    00937
    00938     QStyleHintReturnVariant();
    00939
    00940     QVariant variant;
    00941 };
    00942
    00943 template <typename T>
    00944 T qstyleoption_cast(const QStyleHintReturn *hint)
    00945 {
    00946     if (hint && hint->version <= static_cast<T>(0)->Version &&
    00947         (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
    00948         return static_cast<T>(hint);
    00949     return 0;
    00950 }
    00951
    00952 template <typename T>
    00953 T qstyleoption_cast(QStyleHintReturn *hint)
    00954 {
    00955     if (hint && hint->version <= static_cast<T>(0)->Version &&
    00956         (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
    00957         return static_cast<T>(hint);
    00958     return 0;
    00959 }
    00960
    00961 #if !defined(QT_NO_DEBUG_STREAM)
    00962 Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType);
    00963 Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option);
    00964 #endif
    00965
    00966 QT_END_NAMESPACE
    00967
    00968 QT_END_HEADER
    00969
    00970 #endif // QSTYLEOPTION_H