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