1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). |
4 | ** Contact: http://www.qt-project.org/legal |
5 | ** |
6 | ** This file is part of the QtGui module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and Digia. For licensing terms and |
14 | ** conditions see http://qt.digia.com/licensing. For further information |
15 | ** use the contact form at http://qt.digia.com/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 2.1 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements |
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
24 | ** |
25 | ** In addition, as a special exception, Digia gives you certain additional |
26 | ** rights. These rights are described in the Digia Qt LGPL Exception |
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
28 | ** |
29 | ** GNU General Public License Usage |
30 | ** Alternatively, this file may be used under the terms of the GNU |
31 | ** General Public License version 3.0 as published by the Free Software |
32 | ** Foundation and appearing in the file LICENSE.GPL included in the |
33 | ** packaging of this file. Please review the following information to |
34 | ** ensure the GNU General Public License version 3.0 requirements will be |
35 | ** met: http://www.gnu.org/copyleft/gpl.html. |
36 | ** |
37 | ** |
38 | ** $QT_END_LICENSE$ |
39 | ** |
40 | ****************************************************************************/ |
41 | |
42 | #ifndef 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 | , |
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 | , |
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 | , |
185 | , |
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 | , |
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 | , |
238 | , |
239 | , |
240 | , |
241 | , |
242 | , |
243 | |
244 | , |
245 | , |
246 | |
247 | CE_ToolButtonLabel, |
248 | |
249 | , |
250 | , |
251 | , |
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 | , |
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 | , |
327 | , |
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 | SE_ToolBarHandle, |
377 | |
378 | // do not add any values below/greater than this |
379 | SE_CustomBase = 0xf0000000 |
380 | }; |
381 | |
382 | virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, |
383 | const QWidget *widget = 0) const = 0; |
384 | |
385 | |
386 | enum ComplexControl { |
387 | CC_SpinBox, |
388 | CC_ComboBox, |
389 | CC_ScrollBar, |
390 | CC_Slider, |
391 | CC_ToolButton, |
392 | CC_TitleBar, |
393 | CC_Q3ListView, |
394 | CC_Dial, |
395 | CC_GroupBox, |
396 | CC_MdiControls, |
397 | |
398 | // do not add any values below/greater than this |
399 | CC_CustomBase = 0xf0000000 |
400 | }; |
401 | |
402 | enum SubControl { |
403 | SC_None = 0x00000000, |
404 | |
405 | SC_ScrollBarAddLine = 0x00000001, |
406 | SC_ScrollBarSubLine = 0x00000002, |
407 | SC_ScrollBarAddPage = 0x00000004, |
408 | SC_ScrollBarSubPage = 0x00000008, |
409 | SC_ScrollBarFirst = 0x00000010, |
410 | SC_ScrollBarLast = 0x00000020, |
411 | SC_ScrollBarSlider = 0x00000040, |
412 | SC_ScrollBarGroove = 0x00000080, |
413 | |
414 | SC_SpinBoxUp = 0x00000001, |
415 | SC_SpinBoxDown = 0x00000002, |
416 | SC_SpinBoxFrame = 0x00000004, |
417 | SC_SpinBoxEditField = 0x00000008, |
418 | |
419 | SC_ComboBoxFrame = 0x00000001, |
420 | SC_ComboBoxEditField = 0x00000002, |
421 | SC_ComboBoxArrow = 0x00000004, |
422 | = 0x00000008, |
423 | |
424 | SC_SliderGroove = 0x00000001, |
425 | SC_SliderHandle = 0x00000002, |
426 | SC_SliderTickmarks = 0x00000004, |
427 | |
428 | SC_ToolButton = 0x00000001, |
429 | = 0x00000002, |
430 | |
431 | = 0x00000001, |
432 | SC_TitleBarMinButton = 0x00000002, |
433 | SC_TitleBarMaxButton = 0x00000004, |
434 | SC_TitleBarCloseButton = 0x00000008, |
435 | SC_TitleBarNormalButton = 0x00000010, |
436 | SC_TitleBarShadeButton = 0x00000020, |
437 | SC_TitleBarUnshadeButton = 0x00000040, |
438 | SC_TitleBarContextHelpButton = 0x00000080, |
439 | SC_TitleBarLabel = 0x00000100, |
440 | |
441 | SC_Q3ListView = 0x00000001, |
442 | SC_Q3ListViewBranch = 0x00000002, |
443 | SC_Q3ListViewExpand = 0x00000004, |
444 | |
445 | SC_DialGroove = 0x00000001, |
446 | SC_DialHandle = 0x00000002, |
447 | SC_DialTickmarks = 0x00000004, |
448 | |
449 | SC_GroupBoxCheckBox = 0x00000001, |
450 | SC_GroupBoxLabel = 0x00000002, |
451 | SC_GroupBoxContents = 0x00000004, |
452 | SC_GroupBoxFrame = 0x00000008, |
453 | |
454 | SC_MdiMinButton = 0x00000001, |
455 | SC_MdiNormalButton = 0x00000002, |
456 | SC_MdiCloseButton = 0x00000004, |
457 | |
458 | SC_CustomBase = 0xf0000000, |
459 | SC_All = 0xffffffff |
460 | }; |
461 | Q_DECLARE_FLAGS(SubControls, SubControl) |
462 | |
463 | #ifdef QT3_SUPPORT |
464 | typedef SubControls SCFlags; |
465 | #endif |
466 | |
467 | virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, |
468 | const QWidget *widget = 0) const = 0; |
469 | virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, |
470 | const QPoint &pt, const QWidget *widget = 0) const = 0; |
471 | virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, |
472 | SubControl sc, const QWidget *widget = 0) const = 0; |
473 | |
474 | enum PixelMetric { |
475 | PM_ButtonMargin, |
476 | PM_ButtonDefaultIndicator, |
477 | , |
478 | PM_ButtonShiftHorizontal, |
479 | PM_ButtonShiftVertical, |
480 | |
481 | PM_DefaultFrameWidth, |
482 | PM_SpinBoxFrameWidth, |
483 | PM_ComboBoxFrameWidth, |
484 | |
485 | PM_MaximumDragDistance, |
486 | |
487 | PM_ScrollBarExtent, |
488 | PM_ScrollBarSliderMin, |
489 | |
490 | PM_SliderThickness, // total slider thickness |
491 | PM_SliderControlThickness, // thickness of the business part |
492 | PM_SliderLength, // total length of slider |
493 | PM_SliderTickmarkOffset, // |
494 | PM_SliderSpaceAvailable, // available space for slider to move |
495 | |
496 | PM_DockWidgetSeparatorExtent, |
497 | PM_DockWidgetHandleExtent, |
498 | PM_DockWidgetFrameWidth, |
499 | |
500 | PM_TabBarTabOverlap, |
501 | PM_TabBarTabHSpace, |
502 | PM_TabBarTabVSpace, |
503 | PM_TabBarBaseHeight, |
504 | PM_TabBarBaseOverlap, |
505 | |
506 | PM_ProgressBarChunkWidth, |
507 | |
508 | PM_SplitterWidth, |
509 | PM_TitleBarHeight, |
510 | |
511 | , |
512 | , |
513 | , |
514 | , |
515 | , |
516 | , |
517 | |
518 | , |
519 | , |
520 | , |
521 | , |
522 | |
523 | PM_IndicatorWidth, |
524 | PM_IndicatorHeight, |
525 | PM_ExclusiveIndicatorWidth, |
526 | PM_ExclusiveIndicatorHeight, |
527 | PM_CheckListButtonSize, |
528 | PM_CheckListControllerSize, |
529 | |
530 | PM_DialogButtonsSeparator, |
531 | PM_DialogButtonsButtonWidth, |
532 | PM_DialogButtonsButtonHeight, |
533 | |
534 | PM_MdiSubWindowFrameWidth, |
535 | PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth, //obsolete |
536 | PM_MdiSubWindowMinimizedWidth, |
537 | PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, //obsolete |
538 | |
539 | , |
540 | , |
541 | , |
542 | PM_TabBarTabShiftHorizontal, |
543 | PM_TabBarTabShiftVertical, |
544 | PM_TabBarScrollButtonWidth, |
545 | |
546 | PM_ToolBarFrameWidth, |
547 | PM_ToolBarHandleExtent, |
548 | PM_ToolBarItemSpacing, |
549 | PM_ToolBarItemMargin, |
550 | PM_ToolBarSeparatorExtent, |
551 | PM_ToolBarExtensionExtent, |
552 | |
553 | PM_SpinBoxSliderHeight, |
554 | |
555 | PM_DefaultTopLevelMargin, |
556 | PM_DefaultChildMargin, |
557 | PM_DefaultLayoutSpacing, |
558 | |
559 | PM_ToolBarIconSize, |
560 | PM_ListViewIconSize, |
561 | PM_IconViewIconSize, |
562 | PM_SmallIconSize, |
563 | PM_LargeIconSize, |
564 | |
565 | PM_FocusFrameVMargin, |
566 | PM_FocusFrameHMargin, |
567 | |
568 | PM_ToolTipLabelFrameWidth, |
569 | PM_CheckBoxLabelSpacing, |
570 | PM_TabBarIconSize, |
571 | PM_SizeGripSize, |
572 | PM_DockWidgetTitleMargin, |
573 | PM_MessageBoxIconSize, |
574 | PM_ButtonIconSize, |
575 | |
576 | PM_DockWidgetTitleBarButtonMargin, |
577 | |
578 | PM_RadioButtonLabelSpacing, |
579 | PM_LayoutLeftMargin, |
580 | PM_LayoutTopMargin, |
581 | PM_LayoutRightMargin, |
582 | PM_LayoutBottomMargin, |
583 | PM_LayoutHorizontalSpacing, |
584 | PM_LayoutVerticalSpacing, |
585 | PM_TabBar_ScrollButtonOverlap, |
586 | |
587 | PM_TextCursorWidth, |
588 | |
589 | PM_TabCloseIndicatorWidth, |
590 | PM_TabCloseIndicatorHeight, |
591 | |
592 | PM_ScrollView_ScrollBarSpacing, |
593 | , |
594 | |
595 | // do not add any values below/greater than this |
596 | PM_CustomBase = 0xf0000000 |
597 | }; |
598 | |
599 | virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, |
600 | const QWidget *widget = 0) const = 0; |
601 | |
602 | enum ContentsType { |
603 | CT_PushButton, |
604 | CT_CheckBox, |
605 | CT_RadioButton, |
606 | CT_ToolButton, |
607 | CT_ComboBox, |
608 | CT_Splitter, |
609 | CT_Q3DockWindow, |
610 | CT_ProgressBar, |
611 | , |
612 | , |
613 | , |
614 | , |
615 | CT_TabBarTab, |
616 | CT_Slider, |
617 | CT_ScrollBar, |
618 | , |
619 | CT_LineEdit, |
620 | CT_SpinBox, |
621 | CT_SizeGrip, |
622 | CT_TabWidget, |
623 | CT_DialogButtons, |
624 | , |
625 | CT_GroupBox, |
626 | CT_MdiControls, |
627 | CT_ItemViewItem, |
628 | // do not add any values below/greater than this |
629 | CT_CustomBase = 0xf0000000 |
630 | }; |
631 | |
632 | virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, |
633 | const QSize &contentsSize, const QWidget *w = 0) const = 0; |
634 | |
635 | enum RequestSoftwareInputPanel { |
636 | RSIP_OnMouseClickAndAlreadyFocused, |
637 | RSIP_OnMouseClick |
638 | }; |
639 | |
640 | enum StyleHint { |
641 | SH_EtchDisabledText, |
642 | SH_DitherDisabledText, |
643 | SH_ScrollBar_MiddleClickAbsolutePosition, |
644 | SH_ScrollBar_ScrollWhenPointerLeavesControl, |
645 | SH_TabBar_SelectMouseType, |
646 | SH_TabBar_Alignment, |
647 | , |
648 | SH_Slider_SnapToValue, |
649 | SH_Slider_SloppyKeyEvents, |
650 | SH_ProgressDialog_CenterCancelButton, |
651 | SH_ProgressDialog_TextLabelAlignment, |
652 | SH_PrintDialog_RightAlignButtons, |
653 | SH_MainWindow_SpaceBelowMenuBar, |
654 | SH_FontDialog_SelectAssociatedText, |
655 | SH_Menu_AllowActiveAndDisabled, |
656 | , |
657 | , |
658 | SH_ScrollView_FrameOnlyAroundContents, |
659 | , |
660 | SH_ComboBox_ListMouseTracking, |
661 | , |
662 | , |
663 | SH_ItemView_ChangeHighlightOnFocus, |
664 | SH_Widget_ShareActivation, |
665 | SH_Workspace_FillSpaceOnMaximize, |
666 | , |
667 | SH_TitleBar_NoBorder, |
668 | SH_Slider_StopMouseOverSlider, |
669 | SH_ScrollBar_StopMouseOverSlider = SH_Slider_StopMouseOverSlider, // obsolete |
670 | SH_BlinkCursorWhenTextSelected, |
671 | SH_RichText_FullWidthSelection, |
672 | , |
673 | SH_GroupBox_TextLabelVerticalAlignment, |
674 | SH_GroupBox_TextLabelColor, |
675 | , |
676 | SH_Table_GridLineColor, |
677 | SH_LineEdit_PasswordCharacter, |
678 | SH_DialogButtons_DefaultButton, |
679 | SH_ToolBox_SelectedPageTitleBold, |
680 | SH_TabBar_PreferNoArrows, |
681 | SH_ScrollBar_LeftClickAbsolutePosition, |
682 | SH_Q3ListViewExpand_SelectMouseType, |
683 | SH_UnderlineShortcut, |
684 | SH_SpinBox_AnimateButton, |
685 | SH_SpinBox_KeyPressAutoRepeatRate, |
686 | SH_SpinBox_ClickAutoRepeatRate, |
687 | , |
688 | SH_ToolTipLabel_Opacity, |
689 | , |
690 | SH_TitleBar_ModifyNotification, |
691 | SH_Button_FocusPolicy, |
692 | , |
693 | SH_MessageBox_UseBorderForButtonSpacing, |
694 | SH_TitleBar_AutoRaise, |
695 | , |
696 | SH_FocusFrame_Mask, |
697 | SH_RubberBand_Mask, |
698 | SH_WindowFrame_Mask, |
699 | SH_SpinControls_DisableOnBounds, |
700 | SH_Dial_BackgroundRole, |
701 | SH_ComboBox_LayoutDirection, |
702 | SH_ItemView_EllipsisLocation, |
703 | SH_ItemView_ShowDecorationSelected, |
704 | SH_ItemView_ActivateItemOnSingleClick, |
705 | , |
706 | SH_ScrollBar_RollBetweenButtons, |
707 | SH_Slider_AbsoluteSetButtons, |
708 | SH_Slider_PageSetButtons, |
709 | , |
710 | SH_TabBar_ElideMode, |
711 | SH_DialogButtonLayout, |
712 | , |
713 | SH_MessageBox_TextInteractionFlags, |
714 | SH_DialogButtonBox_ButtonsHaveIcons, |
715 | SH_SpellCheckUnderlineStyle, |
716 | SH_MessageBox_CenterButtons, |
717 | , |
718 | SH_ItemView_MovementWithoutUpdatingSelection, |
719 | SH_ToolTip_Mask, |
720 | SH_FocusFrame_AboveWidget, |
721 | SH_TextControl_FocusIndicatorTextCharFormat, |
722 | SH_WizardStyle, |
723 | SH_ItemView_ArrowKeysNavigateIntoChildren, |
724 | , |
725 | , |
726 | , |
727 | SH_SpinBox_ClickAutoRepeatThreshold, |
728 | SH_ItemView_PaintAlternatingRowColorsForEmptyArea, |
729 | SH_FormLayoutWrapPolicy, |
730 | SH_TabWidget_DefaultTabPosition, |
731 | SH_ToolBar_Movable, |
732 | SH_FormLayoutFieldGrowthPolicy, |
733 | SH_FormLayoutFormAlignment, |
734 | SH_FormLayoutLabelAlignment, |
735 | SH_ItemView_DrawDelegateFrame, |
736 | SH_TabBar_CloseButtonPosition, |
737 | SH_DockWidget_ButtonsHaveFrame, |
738 | SH_ToolButtonStyle, |
739 | SH_RequestSoftwareInputPanel, |
740 | // Add new style hint values here |
741 | |
742 | #ifdef QT3_SUPPORT |
743 | SH_GUIStyle = 0x00000100, |
744 | SH_ScrollBar_BackgroundMode, |
745 | // Add other compat values here |
746 | |
747 | SH_UnderlineAccelerator = SH_UnderlineShortcut, |
748 | #endif |
749 | SH_CustomBase = 0xf0000000 |
750 | }; |
751 | |
752 | virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = 0, |
753 | const QWidget *widget = 0, QStyleHintReturn* returnData = 0) const = 0; |
754 | |
755 | enum StandardPixmap { |
756 | SP_TitleBarMenuButton, |
757 | SP_TitleBarMinButton, |
758 | SP_TitleBarMaxButton, |
759 | SP_TitleBarCloseButton, |
760 | SP_TitleBarNormalButton, |
761 | SP_TitleBarShadeButton, |
762 | SP_TitleBarUnshadeButton, |
763 | SP_TitleBarContextHelpButton, |
764 | SP_DockWidgetCloseButton, |
765 | SP_MessageBoxInformation, |
766 | SP_MessageBoxWarning, |
767 | SP_MessageBoxCritical, |
768 | SP_MessageBoxQuestion, |
769 | SP_DesktopIcon, |
770 | SP_TrashIcon, |
771 | SP_ComputerIcon, |
772 | SP_DriveFDIcon, |
773 | SP_DriveHDIcon, |
774 | SP_DriveCDIcon, |
775 | SP_DriveDVDIcon, |
776 | SP_DriveNetIcon, |
777 | SP_DirOpenIcon, |
778 | SP_DirClosedIcon, |
779 | SP_DirLinkIcon, |
780 | SP_FileIcon, |
781 | SP_FileLinkIcon, |
782 | SP_ToolBarHorizontalExtensionButton, |
783 | SP_ToolBarVerticalExtensionButton, |
784 | SP_FileDialogStart, |
785 | SP_FileDialogEnd, |
786 | SP_FileDialogToParent, |
787 | SP_FileDialogNewFolder, |
788 | SP_FileDialogDetailedView, |
789 | SP_FileDialogInfoView, |
790 | SP_FileDialogContentsView, |
791 | SP_FileDialogListView, |
792 | SP_FileDialogBack, |
793 | SP_DirIcon, |
794 | SP_DialogOkButton, |
795 | SP_DialogCancelButton, |
796 | SP_DialogHelpButton, |
797 | SP_DialogOpenButton, |
798 | SP_DialogSaveButton, |
799 | SP_DialogCloseButton, |
800 | SP_DialogApplyButton, |
801 | SP_DialogResetButton, |
802 | SP_DialogDiscardButton, |
803 | SP_DialogYesButton, |
804 | SP_DialogNoButton, |
805 | SP_ArrowUp, |
806 | SP_ArrowDown, |
807 | SP_ArrowLeft, |
808 | SP_ArrowRight, |
809 | SP_ArrowBack, |
810 | SP_ArrowForward, |
811 | SP_DirHomeIcon, |
812 | SP_CommandLink, |
813 | SP_VistaShield, |
814 | SP_BrowserReload, |
815 | SP_BrowserStop, |
816 | SP_MediaPlay, |
817 | SP_MediaStop, |
818 | SP_MediaPause, |
819 | SP_MediaSkipForward, |
820 | SP_MediaSkipBackward, |
821 | SP_MediaSeekForward, |
822 | SP_MediaSeekBackward, |
823 | SP_MediaVolume, |
824 | SP_MediaVolumeMuted, |
825 | // do not add any values below/greater than this |
826 | SP_CustomBase = 0xf0000000 |
827 | }; |
828 | |
829 | virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0, |
830 | const QWidget *widget = 0) const = 0; |
831 | |
832 | QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, |
833 | const QWidget *widget = 0) const; |
834 | |
835 | virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, |
836 | const QStyleOption *opt) const = 0; |
837 | |
838 | static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, |
839 | const QRect &logicalRect); |
840 | static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, |
841 | const QPoint &logicalPos); |
842 | static int sliderPositionFromValue(int min, int max, int val, int space, |
843 | bool upsideDown = false); |
844 | static int sliderValueFromPosition(int min, int max, int pos, int space, |
845 | bool upsideDown = false); |
846 | static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment); |
847 | static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, |
848 | const QSize &size, const QRect &rectangle); |
849 | |
850 | int layoutSpacing(QSizePolicy::ControlType control1, |
851 | QSizePolicy::ControlType control2, Qt::Orientation orientation, |
852 | const QStyleOption *option = 0, const QWidget *widget = 0) const; |
853 | int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, |
854 | QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, |
855 | QStyleOption *option = 0, QWidget *widget = 0) const; |
856 | |
857 | const QStyle * proxy() const; |
858 | |
859 | protected Q_SLOTS: |
860 | QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt = 0, |
861 | const QWidget *widget = 0) const; |
862 | int layoutSpacingImplementation(QSizePolicy::ControlType control1, |
863 | QSizePolicy::ControlType control2, |
864 | Qt::Orientation orientation, |
865 | const QStyleOption *option = 0, |
866 | const QWidget *widget = 0) const; |
867 | |
868 | private: |
869 | Q_DISABLE_COPY(QStyle) |
870 | friend class QWidget; |
871 | friend class QWidgetPrivate; |
872 | friend class QApplication; |
873 | friend class QProxyStyle; |
874 | friend class QProxyStylePrivate; |
875 | void setProxy(QStyle *style); |
876 | }; |
877 | |
878 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) |
879 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) |
880 | |
881 | #if !defined(QT_NO_DEBUG_STREAM) |
882 | Q_GUI_EXPORT QDebug operator<<(QDebug debug, QStyle::State state); |
883 | #endif |
884 | |
885 | QT_END_NAMESPACE |
886 | |
887 | QT_END_HEADER |
888 | |
889 | #endif // QSTYLE_H |
890 | |