qstyle.h
上传用户:detong
上传日期:2022-06-22
资源大小:20675k
文件大小:26k
源码类别:

系统编程

开发平台:

Unix_Linux

  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
  4. ** Contact: Qt Software Information (qt-info@nokia.com)
  5. **
  6. ** This file is part of the QtGui module of the Qt Toolkit.
  7. **
  8. ** Commercial Usage
  9. ** Licensees holding valid Qt Commercial licenses may use this file in
  10. ** accordance with the Qt Commercial License Agreement provided with the
  11. ** Software or, alternatively, in accordance with the terms contained in
  12. ** a written agreement between you and Nokia.
  13. **
  14. **
  15. ** GNU General Public License Usage
  16. ** Alternatively, this file may be used under the terms of the GNU
  17. ** General Public License versions 2.0 or 3.0 as published by the Free
  18. ** Software Foundation and appearing in the file LICENSE.GPL included in
  19. ** the packaging of this file.  Please review the following information
  20. ** to ensure GNU General Public Licensing requirements will be met:
  21. ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
  22. ** http://www.gnu.org/copyleft/gpl.html.  In addition, as a special
  23. ** exception, Nokia gives you certain additional rights. These rights
  24. ** are described in the Nokia Qt GPL Exception version 1.3, included in
  25. ** the file GPL_EXCEPTION.txt in this package.
  26. **
  27. ** Qt for Windows(R) Licensees
  28. ** As a special exception, Nokia, as the sole copyright holder for Qt
  29. ** Designer, grants users of the Qt/Eclipse Integration plug-in the
  30. ** right for the Qt/Eclipse Integration to link to functionality
  31. ** provided by Qt Designer and its related libraries.
  32. **
  33. ** If you are unsure which license is appropriate for your use, please
  34. ** contact the sales department at qt-sales@nokia.com.
  35. **
  36. ****************************************************************************/
  37. #ifndef QSTYLE_H
  38. #define QSTYLE_H
  39. #include <QtCore/qobject.h>
  40. #include <QtCore/qrect.h>
  41. #include <QtCore/qsize.h>
  42. #include <QtGui/qicon.h>
  43. #include <QtGui/qpixmap.h>
  44. #include <QtGui/qpalette.h>
  45. #include <QtGui/qsizepolicy.h>
  46. QT_BEGIN_HEADER
  47. QT_BEGIN_NAMESPACE
  48. QT_MODULE(Gui)
  49. class QAction;
  50. class QDebug;
  51. class QTab;
  52. class QFontMetrics;
  53. class QStyleHintReturn;
  54. class QStyleOption;
  55. class QStyleOptionComplex;
  56. class QStylePrivate;
  57. class Q_GUI_EXPORT QStyle : public QObject
  58. {
  59.     Q_OBJECT
  60.     Q_DECLARE_PRIVATE(QStyle)
  61. protected:
  62.     QStyle(QStylePrivate &dd);
  63. public:
  64.     QStyle();
  65.     virtual ~QStyle();
  66.     virtual void polish(QWidget *);
  67.     virtual void unpolish(QWidget *);
  68.     virtual void polish(QApplication *);
  69.     virtual void unpolish(QApplication *);
  70.     virtual void polish(QPalette &);
  71.     virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r,
  72.                            int flags, bool enabled,
  73.                            const QString &text) const;
  74.     virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
  75.     virtual void drawItemText(QPainter *painter, const QRect &rect,
  76.                               int flags, const QPalette &pal, bool enabled,
  77.                               const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
  78.     virtual void drawItemPixmap(QPainter *painter, const QRect &rect,
  79.                                 int alignment, const QPixmap &pixmap) const;
  80.     virtual QPalette standardPalette() const;
  81.     enum StateFlag {
  82.         State_None =                0x00000000,
  83. #ifdef QT3_SUPPORT
  84.         State_Default =             State_None,
  85. #endif
  86.         State_Enabled =             0x00000001,
  87.         State_Raised =              0x00000002,
  88.         State_Sunken =              0x00000004,
  89.         State_Off =                 0x00000008,
  90.         State_NoChange =            0x00000010,
  91.         State_On =                  0x00000020,
  92.         State_DownArrow =           0x00000040,
  93.         State_Horizontal =          0x00000080,
  94.         State_HasFocus =            0x00000100,
  95.         State_Top =                 0x00000200,
  96.         State_Bottom =              0x00000400,
  97.         State_FocusAtBorder =       0x00000800,
  98.         State_AutoRaise =           0x00001000,
  99.         State_MouseOver =           0x00002000,
  100.         State_UpArrow =             0x00004000,
  101.         State_Selected =            0x00008000,
  102.         State_Active =              0x00010000,
  103.         State_Window =              0x00020000,
  104.         State_Open =                0x00040000,
  105.         State_Children =            0x00080000,
  106.         State_Item =                0x00100000,
  107.         State_Sibling =             0x00200000,
  108.         State_Editing =             0x00400000,
  109.         State_KeyboardFocusChange = 0x00800000,
  110. #ifdef QT_KEYPAD_NAVIGATION
  111.         State_HasEditFocus =        0x01000000,
  112. #endif
  113.         State_ReadOnly =            0x02000000,
  114.         State_Small =               0x04000000,
  115.         State_Mini =                0x08000000
  116.     };
  117.     Q_DECLARE_FLAGS(State, StateFlag)
  118. #ifdef QT3_SUPPORT
  119.     typedef State SFlags;
  120. #endif
  121.     enum PrimitiveElement {
  122.         PE_Q3CheckListController,
  123.         PE_Q3CheckListExclusiveIndicator,
  124.         PE_Q3CheckListIndicator,
  125.         PE_Q3DockWindowSeparator,
  126.         PE_Q3Separator,
  127.         PE_Frame,
  128.         PE_FrameDefaultButton,
  129.         PE_FrameDockWidget,
  130.         PE_FrameFocusRect,
  131.         PE_FrameGroupBox,
  132.         PE_FrameLineEdit,
  133.         PE_FrameMenu,
  134.         PE_FrameStatusBar, // obsolete
  135.         PE_FrameStatusBarItem = PE_FrameStatusBar,
  136.         PE_FrameTabWidget,
  137.         PE_FrameWindow,
  138.         PE_FrameButtonBevel,
  139.         PE_FrameButtonTool,
  140.         PE_FrameTabBarBase,
  141.         PE_PanelButtonCommand,
  142.         PE_PanelButtonBevel,
  143.         PE_PanelButtonTool,
  144.         PE_PanelMenuBar,
  145.         PE_PanelToolBar,
  146.         PE_PanelLineEdit,
  147.         PE_IndicatorArrowDown,
  148.         PE_IndicatorArrowLeft,
  149.         PE_IndicatorArrowRight,
  150.         PE_IndicatorArrowUp,
  151.         PE_IndicatorBranch,
  152.         PE_IndicatorButtonDropDown,
  153.         PE_IndicatorViewItemCheck,
  154.         PE_IndicatorItemViewItemCheck = PE_IndicatorViewItemCheck,
  155.         PE_IndicatorCheckBox,
  156.         PE_IndicatorDockWidgetResizeHandle,
  157.         PE_IndicatorHeaderArrow,
  158.         PE_IndicatorMenuCheckMark,
  159.         PE_IndicatorProgressChunk,
  160.         PE_IndicatorRadioButton,
  161.         PE_IndicatorSpinDown,
  162.         PE_IndicatorSpinMinus,
  163.         PE_IndicatorSpinPlus,
  164.         PE_IndicatorSpinUp,
  165.         PE_IndicatorToolBarHandle,
  166.         PE_IndicatorToolBarSeparator,
  167.         PE_PanelTipLabel,
  168.         PE_IndicatorTabTear,
  169.         PE_PanelScrollAreaCorner,
  170.         PE_Widget,
  171.         PE_IndicatorColumnViewArrow,
  172.         PE_IndicatorItemViewItemDrop,
  173.         PE_PanelItemViewItem,
  174.         PE_PanelItemViewRow, // ### Qt 5: remove
  175.         PE_PanelStatusBar,
  176.         // do not add any values below/greater this
  177.         PE_CustomBase = 0xf000000
  178.     };
  179.     virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
  180.                                const QWidget *w = 0) const = 0;
  181.     enum ControlElement {
  182.         CE_PushButton,
  183.         CE_PushButtonBevel,
  184.         CE_PushButtonLabel,
  185.         CE_CheckBox,
  186.         CE_CheckBoxLabel,
  187.         CE_RadioButton,
  188.         CE_RadioButtonLabel,
  189.         CE_TabBarTab,
  190.         CE_TabBarTabShape,
  191.         CE_TabBarTabLabel,
  192.         CE_ProgressBar,
  193.         CE_ProgressBarGroove,
  194.         CE_ProgressBarContents,
  195.         CE_ProgressBarLabel,
  196.         CE_MenuItem,
  197.         CE_MenuScroller,
  198.         CE_MenuVMargin,
  199.         CE_MenuHMargin,
  200.         CE_MenuTearoff,
  201.         CE_MenuEmptyArea,
  202.         CE_MenuBarItem,
  203.         CE_MenuBarEmptyArea,
  204.         CE_ToolButtonLabel,
  205.         CE_Header,
  206.         CE_HeaderSection,
  207.         CE_HeaderLabel,
  208.         CE_Q3DockWindowEmptyArea,
  209.         CE_ToolBoxTab,
  210.         CE_SizeGrip,
  211.         CE_Splitter,
  212.         CE_RubberBand,
  213.         CE_DockWidgetTitle,
  214.         CE_ScrollBarAddLine,
  215.         CE_ScrollBarSubLine,
  216.         CE_ScrollBarAddPage,
  217.         CE_ScrollBarSubPage,
  218.         CE_ScrollBarSlider,
  219.         CE_ScrollBarFirst,
  220.         CE_ScrollBarLast,
  221.         CE_FocusFrame,
  222.         CE_ComboBoxLabel,
  223.         CE_ToolBar,
  224.         CE_ToolBoxTabShape,
  225.         CE_ToolBoxTabLabel,
  226.         CE_HeaderEmptyArea,
  227.         CE_ColumnViewGrip,
  228.         CE_ItemViewItem,
  229.         // do not add any values below/greater than this
  230.         CE_CustomBase = 0xf0000000
  231.     };
  232.     virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
  233.                              const QWidget *w = 0) const = 0;
  234.     enum SubElement {
  235.         SE_PushButtonContents,
  236.         SE_PushButtonFocusRect,
  237.         SE_CheckBoxIndicator,
  238.         SE_CheckBoxContents,
  239.         SE_CheckBoxFocusRect,
  240.         SE_CheckBoxClickRect,
  241.         SE_RadioButtonIndicator,
  242.         SE_RadioButtonContents,
  243.         SE_RadioButtonFocusRect,
  244.         SE_RadioButtonClickRect,
  245.         SE_ComboBoxFocusRect,
  246.         SE_SliderFocusRect,
  247.         SE_Q3DockWindowHandleRect,
  248.         SE_ProgressBarGroove,
  249.         SE_ProgressBarContents,
  250.         SE_ProgressBarLabel,
  251.         // ### Qt 5: These values are unused; eliminate them
  252.         SE_DialogButtonAccept,
  253.         SE_DialogButtonReject,
  254.         SE_DialogButtonApply,
  255.         SE_DialogButtonHelp,
  256.         SE_DialogButtonAll,
  257.         SE_DialogButtonAbort,
  258.         SE_DialogButtonIgnore,
  259.         SE_DialogButtonRetry,
  260.         SE_DialogButtonCustom,
  261.         SE_ToolBoxTabContents,
  262.         SE_HeaderLabel,
  263.         SE_HeaderArrow,
  264.         SE_TabWidgetTabBar,
  265.         SE_TabWidgetTabPane,
  266.         SE_TabWidgetTabContents,
  267.         SE_TabWidgetLeftCorner,
  268.         SE_TabWidgetRightCorner,
  269.         SE_ViewItemCheckIndicator,
  270.         SE_ItemViewItemCheckIndicator = SE_ViewItemCheckIndicator,
  271.         SE_TabBarTearIndicator,
  272.         SE_TreeViewDisclosureItem,
  273.         SE_LineEditContents,
  274.         SE_FrameContents,
  275.         SE_DockWidgetCloseButton,
  276.         SE_DockWidgetFloatButton,
  277.         SE_DockWidgetTitleBarText,
  278.         SE_DockWidgetIcon,
  279.         SE_CheckBoxLayoutItem,
  280.         SE_ComboBoxLayoutItem,
  281.         SE_DateTimeEditLayoutItem,
  282.         SE_DialogButtonBoxLayoutItem, // ### remove
  283.         SE_LabelLayoutItem,
  284.         SE_ProgressBarLayoutItem,
  285.         SE_PushButtonLayoutItem,
  286.         SE_RadioButtonLayoutItem,
  287.         SE_SliderLayoutItem,
  288.         SE_SpinBoxLayoutItem,
  289.         SE_ToolButtonLayoutItem,
  290.         SE_FrameLayoutItem,
  291.         SE_GroupBoxLayoutItem,
  292.         SE_TabWidgetLayoutItem,
  293.         SE_ItemViewItemDecoration,
  294.         SE_ItemViewItemText,
  295.         SE_ItemViewItemFocusRect,
  296.         // do not add any values below/greater than this
  297.         SE_CustomBase = 0xf0000000
  298.     };
  299.     virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
  300.                                  const QWidget *widget = 0) const = 0;
  301.     enum ComplexControl {
  302.         CC_SpinBox,
  303.         CC_ComboBox,
  304.         CC_ScrollBar,
  305.         CC_Slider,
  306.         CC_ToolButton,
  307.         CC_TitleBar,
  308.         CC_Q3ListView,
  309.         CC_Dial,
  310.         CC_GroupBox,
  311.         CC_MdiControls,
  312.         // do not add any values below/greater than this
  313.         CC_CustomBase = 0xf0000000
  314.     };
  315.     enum SubControl {
  316.         SC_None =                  0x00000000,
  317.         SC_ScrollBarAddLine =      0x00000001,
  318.         SC_ScrollBarSubLine =      0x00000002,
  319.         SC_ScrollBarAddPage =      0x00000004,
  320.         SC_ScrollBarSubPage =      0x00000008,
  321.         SC_ScrollBarFirst =        0x00000010,
  322.         SC_ScrollBarLast =         0x00000020,
  323.         SC_ScrollBarSlider =       0x00000040,
  324.         SC_ScrollBarGroove =       0x00000080,
  325.         SC_SpinBoxUp =             0x00000001,
  326.         SC_SpinBoxDown =           0x00000002,
  327.         SC_SpinBoxFrame =          0x00000004,
  328.         SC_SpinBoxEditField =      0x00000008,
  329.         SC_ComboBoxFrame =         0x00000001,
  330.         SC_ComboBoxEditField =     0x00000002,
  331.         SC_ComboBoxArrow =         0x00000004,
  332.         SC_ComboBoxListBoxPopup =  0x00000008,
  333.         SC_SliderGroove =          0x00000001,
  334.         SC_SliderHandle =          0x00000002,
  335.         SC_SliderTickmarks =       0x00000004,
  336.         SC_ToolButton =            0x00000001,
  337.         SC_ToolButtonMenu =        0x00000002,
  338.         SC_TitleBarSysMenu =       0x00000001,
  339.         SC_TitleBarMinButton =     0x00000002,
  340.         SC_TitleBarMaxButton =     0x00000004,
  341.         SC_TitleBarCloseButton =   0x00000008,
  342.         SC_TitleBarNormalButton =  0x00000010,
  343.         SC_TitleBarShadeButton =   0x00000020,
  344.         SC_TitleBarUnshadeButton = 0x00000040,
  345.         SC_TitleBarContextHelpButton = 0x00000080,
  346.         SC_TitleBarLabel =         0x00000100,
  347.         SC_Q3ListView =            0x00000001,
  348.         SC_Q3ListViewBranch =      0x00000002,
  349.         SC_Q3ListViewExpand =      0x00000004,
  350.         SC_DialGroove =            0x00000001,
  351.         SC_DialHandle =            0x00000002,
  352.         SC_DialTickmarks =         0x00000004,
  353.         SC_GroupBoxCheckBox =      0x00000001,
  354.         SC_GroupBoxLabel =         0x00000002,
  355.         SC_GroupBoxContents =      0x00000004,
  356.         SC_GroupBoxFrame =         0x00000008,
  357.         SC_MdiMinButton     =      0x00000001,
  358.         SC_MdiNormalButton  =      0x00000002,
  359.         SC_MdiCloseButton   =      0x00000004,
  360.         SC_All =                   0xffffffff
  361.     };
  362.     Q_DECLARE_FLAGS(SubControls, SubControl)
  363. #ifdef QT3_SUPPORT
  364.     typedef SubControls SCFlags;
  365. #endif
  366.     virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
  367.                                     const QWidget *widget = 0) const = 0;
  368.     virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
  369.                                              const QPoint &pt, const QWidget *widget = 0) const = 0;
  370.     virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
  371.                                  SubControl sc, const QWidget *widget = 0) const = 0;
  372.     enum PixelMetric {
  373.         PM_ButtonMargin,
  374.         PM_ButtonDefaultIndicator,
  375.         PM_MenuButtonIndicator,
  376.         PM_ButtonShiftHorizontal,
  377.         PM_ButtonShiftVertical,
  378.         PM_DefaultFrameWidth,
  379.         PM_SpinBoxFrameWidth,
  380.         PM_ComboBoxFrameWidth,
  381.         PM_MaximumDragDistance,
  382.         PM_ScrollBarExtent,
  383.         PM_ScrollBarSliderMin,
  384.         PM_SliderThickness,             // total slider thickness
  385.         PM_SliderControlThickness,      // thickness of the business part
  386.         PM_SliderLength,                // total length of slider
  387.         PM_SliderTickmarkOffset,        //
  388.         PM_SliderSpaceAvailable,        // available space for slider to move
  389.         PM_DockWidgetSeparatorExtent,
  390.         PM_DockWidgetHandleExtent,
  391.         PM_DockWidgetFrameWidth,
  392.         PM_TabBarTabOverlap,
  393.         PM_TabBarTabHSpace,
  394.         PM_TabBarTabVSpace,
  395.         PM_TabBarBaseHeight,
  396.         PM_TabBarBaseOverlap,
  397.         PM_ProgressBarChunkWidth,
  398.         PM_SplitterWidth,
  399.         PM_TitleBarHeight,
  400.         PM_MenuScrollerHeight,
  401.         PM_MenuHMargin,
  402.         PM_MenuVMargin,
  403.         PM_MenuPanelWidth,
  404.         PM_MenuTearoffHeight,
  405.         PM_MenuDesktopFrameWidth,
  406.         PM_MenuBarPanelWidth,
  407.         PM_MenuBarItemSpacing,
  408.         PM_MenuBarVMargin,
  409.         PM_MenuBarHMargin,
  410.         PM_IndicatorWidth,
  411.         PM_IndicatorHeight,
  412.         PM_ExclusiveIndicatorWidth,
  413.         PM_ExclusiveIndicatorHeight,
  414.         PM_CheckListButtonSize,
  415.         PM_CheckListControllerSize,
  416.         PM_DialogButtonsSeparator,
  417.         PM_DialogButtonsButtonWidth,
  418.         PM_DialogButtonsButtonHeight,
  419.         PM_MdiSubWindowFrameWidth,
  420.         PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth,            //obsolete
  421.         PM_MdiSubWindowMinimizedWidth,
  422.         PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth,    //obsolete
  423.         PM_HeaderMargin,
  424.         PM_HeaderMarkSize,
  425.         PM_HeaderGripMargin,
  426.         PM_TabBarTabShiftHorizontal,
  427.         PM_TabBarTabShiftVertical,
  428.         PM_TabBarScrollButtonWidth,
  429.         PM_ToolBarFrameWidth,
  430.         PM_ToolBarHandleExtent,
  431.         PM_ToolBarItemSpacing,
  432.         PM_ToolBarItemMargin,
  433.         PM_ToolBarSeparatorExtent,
  434.         PM_ToolBarExtensionExtent,
  435.         PM_SpinBoxSliderHeight,
  436.         PM_DefaultTopLevelMargin,
  437.         PM_DefaultChildMargin,
  438.         PM_DefaultLayoutSpacing,
  439.         PM_ToolBarIconSize,
  440.         PM_ListViewIconSize,
  441.         PM_IconViewIconSize,
  442.         PM_SmallIconSize,
  443.         PM_LargeIconSize,
  444.         PM_FocusFrameVMargin,
  445.         PM_FocusFrameHMargin,
  446.         PM_ToolTipLabelFrameWidth,
  447.         PM_CheckBoxLabelSpacing,
  448.         PM_TabBarIconSize,
  449.         PM_SizeGripSize,
  450.         PM_DockWidgetTitleMargin,
  451.         PM_MessageBoxIconSize,
  452.         PM_ButtonIconSize,
  453.         PM_DockWidgetTitleBarButtonMargin,
  454.         PM_RadioButtonLabelSpacing,
  455.         PM_LayoutLeftMargin,
  456.         PM_LayoutTopMargin,
  457.         PM_LayoutRightMargin,
  458.         PM_LayoutBottomMargin,
  459.         PM_LayoutHorizontalSpacing,
  460.         PM_LayoutVerticalSpacing,
  461.         PM_TabBar_ScrollButtonOverlap,
  462.         PM_TextCursorWidth,
  463.         // do not add any values below/greater than this
  464.         PM_CustomBase = 0xf0000000
  465.     };
  466.     virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
  467.                             const QWidget *widget = 0) const = 0;
  468.     enum ContentsType {
  469.         CT_PushButton,
  470.         CT_CheckBox,
  471.         CT_RadioButton,
  472.         CT_ToolButton,
  473.         CT_ComboBox,
  474.         CT_Splitter,
  475.         CT_Q3DockWindow,
  476.         CT_ProgressBar,
  477.         CT_MenuItem,
  478.         CT_MenuBarItem,
  479.         CT_MenuBar,
  480.         CT_Menu,
  481.         CT_TabBarTab,
  482.         CT_Slider,
  483.         CT_ScrollBar,
  484.         CT_Q3Header,
  485.         CT_LineEdit,
  486.         CT_SpinBox,
  487.         CT_SizeGrip,
  488.         CT_TabWidget,
  489.         CT_DialogButtons,
  490.         CT_HeaderSection,
  491.         CT_GroupBox,
  492.         CT_MdiControls,
  493.         CT_ItemViewItem,
  494.         // do not add any values below/greater than this
  495.         CT_CustomBase = 0xf0000000
  496.     };
  497.     virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
  498.                                    const QSize &contentsSize, const QWidget *w = 0) const = 0;
  499.     enum StyleHint {
  500.         SH_EtchDisabledText,
  501.         SH_DitherDisabledText,
  502.         SH_ScrollBar_MiddleClickAbsolutePosition,
  503.         SH_ScrollBar_ScrollWhenPointerLeavesControl,
  504.         SH_TabBar_SelectMouseType,
  505.         SH_TabBar_Alignment,
  506.         SH_Header_ArrowAlignment,
  507.         SH_Slider_SnapToValue,
  508.         SH_Slider_SloppyKeyEvents,
  509.         SH_ProgressDialog_CenterCancelButton,
  510.         SH_ProgressDialog_TextLabelAlignment,
  511.         SH_PrintDialog_RightAlignButtons,
  512.         SH_MainWindow_SpaceBelowMenuBar,
  513.         SH_FontDialog_SelectAssociatedText,
  514.         SH_Menu_AllowActiveAndDisabled,
  515.         SH_Menu_SpaceActivatesItem,
  516.         SH_Menu_SubMenuPopupDelay,
  517.         SH_ScrollView_FrameOnlyAroundContents,
  518.         SH_MenuBar_AltKeyNavigation,
  519.         SH_ComboBox_ListMouseTracking,
  520.         SH_Menu_MouseTracking,
  521.         SH_MenuBar_MouseTracking,
  522.         SH_ItemView_ChangeHighlightOnFocus,
  523.         SH_Widget_ShareActivation,
  524.         SH_Workspace_FillSpaceOnMaximize,
  525.         SH_ComboBox_Popup,
  526.         SH_TitleBar_NoBorder,
  527.         SH_Slider_StopMouseOverSlider,
  528.         SH_ScrollBar_StopMouseOverSlider = SH_Slider_StopMouseOverSlider, // obsolete
  529.         SH_BlinkCursorWhenTextSelected,
  530.         SH_RichText_FullWidthSelection,
  531.         SH_Menu_Scrollable,
  532.         SH_GroupBox_TextLabelVerticalAlignment,
  533.         SH_GroupBox_TextLabelColor,
  534.         SH_Menu_SloppySubMenus,
  535.         SH_Table_GridLineColor,
  536.         SH_LineEdit_PasswordCharacter,
  537.         SH_DialogButtons_DefaultButton,
  538.         SH_ToolBox_SelectedPageTitleBold,
  539.         SH_TabBar_PreferNoArrows,
  540.         SH_ScrollBar_LeftClickAbsolutePosition,
  541.         SH_Q3ListViewExpand_SelectMouseType,
  542.         SH_UnderlineShortcut,
  543.         SH_SpinBox_AnimateButton,
  544.         SH_SpinBox_KeyPressAutoRepeatRate,
  545.         SH_SpinBox_ClickAutoRepeatRate,
  546.         SH_Menu_FillScreenWithScroll,
  547.         SH_ToolTipLabel_Opacity,
  548.         SH_DrawMenuBarSeparator,
  549.         SH_TitleBar_ModifyNotification,
  550.         SH_Button_FocusPolicy,
  551.         SH_MenuBar_DismissOnSecondClick,
  552.         SH_MessageBox_UseBorderForButtonSpacing,
  553.         SH_TitleBar_AutoRaise,
  554.         SH_ToolButton_PopupDelay,
  555.         SH_FocusFrame_Mask,
  556.         SH_RubberBand_Mask,
  557.         SH_WindowFrame_Mask,
  558.         SH_SpinControls_DisableOnBounds,
  559.         SH_Dial_BackgroundRole,
  560.         SH_ComboBox_LayoutDirection,
  561.         SH_ItemView_EllipsisLocation,
  562.         SH_ItemView_ShowDecorationSelected,
  563.         SH_ItemView_ActivateItemOnSingleClick,
  564.         SH_ScrollBar_ContextMenu,
  565.         SH_ScrollBar_RollBetweenButtons,
  566.         SH_Slider_AbsoluteSetButtons,
  567.         SH_Slider_PageSetButtons,
  568.         SH_Menu_KeyboardSearch,
  569.         SH_TabBar_ElideMode,
  570.         SH_DialogButtonLayout,
  571.         SH_ComboBox_PopupFrameStyle,
  572.         SH_MessageBox_TextInteractionFlags,
  573.         SH_DialogButtonBox_ButtonsHaveIcons,
  574.         SH_SpellCheckUnderlineStyle,
  575.         SH_MessageBox_CenterButtons,
  576.         SH_Menu_SelectionWrap,
  577.         SH_ItemView_MovementWithoutUpdatingSelection,
  578.         SH_ToolTip_Mask,
  579.         SH_FocusFrame_AboveWidget,
  580.         SH_TextControl_FocusIndicatorTextCharFormat,
  581.         SH_WizardStyle,
  582.         SH_ItemView_ArrowKeysNavigateIntoChildren,
  583.         SH_Menu_Mask,
  584.         SH_Menu_FlashTriggeredItem,
  585.         SH_Menu_FadeOutOnHide,
  586.         SH_SpinBox_ClickAutoRepeatThreshold,
  587.         SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
  588.     SH_FormLayoutWrapPolicy,
  589.         SH_TabWidget_DefaultTabPosition,
  590.         SH_ToolBar_Movable,
  591.         SH_FormLayoutFieldGrowthPolicy,
  592.         SH_FormLayoutFormAlignment,
  593.         SH_FormLayoutLabelAlignment,
  594.         // Add new style hint values here
  595. #ifdef QT3_SUPPORT
  596.         SH_GUIStyle = 0x00000100,
  597.         SH_ScrollBar_BackgroundMode,
  598.         // Add other compat values here
  599.         SH_UnderlineAccelerator = SH_UnderlineShortcut,
  600. #endif
  601.         SH_CustomBase = 0xf0000000
  602.     };
  603.     virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = 0,
  604.                           const QWidget *widget = 0, QStyleHintReturn* returnData = 0) const = 0;
  605.     enum StandardPixmap {
  606.         SP_TitleBarMenuButton,
  607.         SP_TitleBarMinButton,
  608.         SP_TitleBarMaxButton,
  609.         SP_TitleBarCloseButton,
  610.         SP_TitleBarNormalButton,
  611.         SP_TitleBarShadeButton,
  612.         SP_TitleBarUnshadeButton,
  613.         SP_TitleBarContextHelpButton,
  614.         SP_DockWidgetCloseButton,
  615.         SP_MessageBoxInformation,
  616.         SP_MessageBoxWarning,
  617.         SP_MessageBoxCritical,
  618.         SP_MessageBoxQuestion,
  619.         SP_DesktopIcon,
  620.         SP_TrashIcon,
  621.         SP_ComputerIcon,
  622.         SP_DriveFDIcon,
  623.         SP_DriveHDIcon,
  624.         SP_DriveCDIcon,
  625.         SP_DriveDVDIcon,
  626.         SP_DriveNetIcon,
  627.         SP_DirOpenIcon,
  628.         SP_DirClosedIcon,
  629.         SP_DirLinkIcon,
  630.         SP_FileIcon,
  631.         SP_FileLinkIcon,
  632.         SP_ToolBarHorizontalExtensionButton,
  633.         SP_ToolBarVerticalExtensionButton,
  634.         SP_FileDialogStart,
  635.         SP_FileDialogEnd,
  636.         SP_FileDialogToParent,
  637.         SP_FileDialogNewFolder,
  638.         SP_FileDialogDetailedView,
  639.         SP_FileDialogInfoView,
  640.         SP_FileDialogContentsView,
  641.         SP_FileDialogListView,
  642.         SP_FileDialogBack,
  643.         SP_DirIcon,
  644.         SP_DialogOkButton,
  645.         SP_DialogCancelButton,
  646.         SP_DialogHelpButton,
  647.         SP_DialogOpenButton,
  648.         SP_DialogSaveButton,
  649.         SP_DialogCloseButton,
  650.         SP_DialogApplyButton,
  651.         SP_DialogResetButton,
  652.         SP_DialogDiscardButton,
  653.         SP_DialogYesButton,
  654.         SP_DialogNoButton,
  655.         SP_ArrowUp,
  656.         SP_ArrowDown,
  657.         SP_ArrowLeft,
  658.         SP_ArrowRight,
  659.         SP_ArrowBack,
  660.         SP_ArrowForward,
  661.         SP_DirHomeIcon,
  662.         SP_CommandLink,
  663.         SP_VistaShield,
  664.         SP_BrowserReload,
  665.         SP_BrowserStop,
  666.         SP_MediaPlay,
  667.         SP_MediaStop,
  668.         SP_MediaPause,
  669.         SP_MediaSkipForward,
  670.         SP_MediaSkipBackward,
  671.         SP_MediaSeekForward,
  672.         SP_MediaSeekBackward,
  673.         SP_MediaVolume,
  674.         SP_MediaVolumeMuted,
  675.         // do not add any values below/greater than this
  676.         SP_CustomBase = 0xf0000000
  677.     };
  678.     virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0,
  679.                                    const QWidget *widget = 0) const = 0;
  680.     QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
  681.                        const QWidget *widget = 0) const;
  682.     virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
  683.                                         const QStyleOption *opt) const = 0;
  684.     static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect,
  685.                             const QRect &logicalRect);
  686.     static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect,
  687.                             const QPoint &logicalPos);
  688.     static int sliderPositionFromValue(int min, int max, int val, int space,
  689.                                        bool upsideDown = false);
  690.     static int sliderValueFromPosition(int min, int max, int pos, int space,
  691.                                        bool upsideDown = false);
  692.     static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment);
  693.     static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment,
  694.                              const QSize &size, const QRect &rectangle);
  695.     int layoutSpacing(QSizePolicy::ControlType control1,
  696.                       QSizePolicy::ControlType control2, Qt::Orientation orientation,
  697.                       const QStyleOption *option = 0, const QWidget *widget = 0) const;
  698.     int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
  699.                               QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
  700.                               QStyleOption *option = 0, QWidget *widget = 0) const;
  701. protected Q_SLOTS:
  702.     QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0,
  703.                                      const QWidget *widget = 0) const;
  704.     int layoutSpacingImplementation(QSizePolicy::ControlType control1,
  705.                                     QSizePolicy::ControlType control2,
  706.                                     Qt::Orientation orientation,
  707.                                     const QStyleOption *option = 0,
  708.                                     const QWidget *widget = 0) const;
  709. private:
  710.     Q_DISABLE_COPY(QStyle)
  711.     friend class QWidget;
  712.     friend class QWidgetPrivate;
  713.     friend class QApplication;
  714. };
  715. Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
  716. Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
  717. #if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_NO_DEBUG)
  718. Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
  719. #endif
  720. QT_END_NAMESPACE
  721. QT_END_HEADER
  722. #endif // QSTYLE_H