1 | // Copyright (C) 2020 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QSTYLE_H |
5 | #define QSTYLE_H |
6 | |
7 | #include <QtCore/qobject.h> |
8 | #include <QtCore/qrect.h> |
9 | #include <QtCore/qsize.h> |
10 | #include <QtGui/qwindow.h> |
11 | #include <QtGui/qicon.h> |
12 | #include <QtGui/qpixmap.h> |
13 | #include <QtGui/qpalette.h> |
14 | |
15 | QT_BEGIN_NAMESPACE |
16 | |
17 | class QAction; |
18 | class QDebug; |
19 | class QFontMetrics; |
20 | |
21 | namespace QQC2 { |
22 | |
23 | class QStyleHintReturn; |
24 | class QStyleOption; |
25 | class QStyleOptionComplex; |
26 | class QStylePrivate; |
27 | |
28 | class QStyle : public QObject |
29 | { |
30 | Q_OBJECT |
31 | Q_DECLARE_PRIVATE(QStyle) |
32 | |
33 | protected: |
34 | QStyle(QStylePrivate &dd); |
35 | |
36 | public: |
37 | QStyle(); |
38 | virtual ~QStyle(); |
39 | |
40 | enum StateFlag { |
41 | State_None = 0x00000000, |
42 | State_Enabled = 0x00000001, |
43 | State_Raised = 0x00000002, |
44 | State_Sunken = 0x00000004, |
45 | State_Off = 0x00000008, |
46 | State_NoChange = 0x00000010, |
47 | State_On = 0x00000020, |
48 | State_DownArrow = 0x00000040, |
49 | State_Horizontal = 0x00000080, |
50 | State_HasFocus = 0x00000100, |
51 | State_Top = 0x00000200, |
52 | State_Bottom = 0x00000400, |
53 | State_FocusAtBorder = 0x00000800, |
54 | State_AutoRaise = 0x00001000, |
55 | State_MouseOver = 0x00002000, |
56 | State_UpArrow = 0x00004000, |
57 | State_Selected = 0x00008000, |
58 | State_Active = 0x00010000, |
59 | State_Window = 0x00020000, |
60 | State_Open = 0x00040000, |
61 | State_Children = 0x00080000, |
62 | State_Item = 0x00100000, |
63 | State_Sibling = 0x00200000, |
64 | State_Editing = 0x00400000, |
65 | State_KeyboardFocusChange = 0x00800000, |
66 | #ifdef QT_KEYPAD_NAVIGATION |
67 | State_HasEditFocus = 0x01000000, |
68 | #endif |
69 | State_ReadOnly = 0x02000000, |
70 | State_Small = 0x04000000, |
71 | State_Mini = 0x08000000 |
72 | }; |
73 | Q_ENUM(StateFlag) |
74 | Q_DECLARE_FLAGS(State, StateFlag) |
75 | |
76 | enum PrimitiveElement { |
77 | PE_Frame, |
78 | PE_FrameDefaultButton, |
79 | PE_FrameDockWidget, |
80 | PE_FrameFocusRect, |
81 | PE_FrameGroupBox, |
82 | PE_FrameLineEdit, |
83 | , |
84 | PE_FrameStatusBarItem, |
85 | PE_FrameTabWidget, |
86 | PE_FrameWindow, |
87 | PE_FrameButtonBevel, |
88 | PE_FrameButtonTool, |
89 | PE_FrameTabBarBase, |
90 | |
91 | PE_PanelButtonCommand, |
92 | PE_PanelButtonBevel, |
93 | PE_PanelButtonTool, |
94 | , |
95 | PE_PanelToolBar, |
96 | PE_PanelLineEdit, |
97 | |
98 | PE_IndicatorArrowDown, |
99 | PE_IndicatorArrowLeft, |
100 | PE_IndicatorArrowRight, |
101 | PE_IndicatorArrowUp, |
102 | PE_IndicatorBranch, |
103 | PE_IndicatorButtonDropDown, |
104 | PE_IndicatorItemViewItemCheck, |
105 | PE_IndicatorCheckBox, |
106 | PE_IndicatorDockWidgetResizeHandle, |
107 | , |
108 | , |
109 | PE_IndicatorProgressChunk, |
110 | PE_IndicatorRadioButton, |
111 | PE_IndicatorSpinDown, |
112 | PE_IndicatorSpinMinus, |
113 | PE_IndicatorSpinPlus, |
114 | PE_IndicatorSpinUp, |
115 | PE_IndicatorToolBarHandle, |
116 | PE_IndicatorToolBarSeparator, |
117 | PE_PanelTipLabel, |
118 | PE_IndicatorTabTear, |
119 | PE_IndicatorTabTearLeft = PE_IndicatorTabTear, |
120 | PE_PanelScrollAreaCorner, |
121 | |
122 | PE_Widget, |
123 | |
124 | PE_IndicatorColumnViewArrow, |
125 | PE_IndicatorItemViewItemDrop, |
126 | |
127 | PE_PanelItemViewItem, |
128 | PE_PanelItemViewRow, // ### Qt 6: remove |
129 | |
130 | PE_PanelStatusBar, |
131 | |
132 | PE_IndicatorTabClose, |
133 | , |
134 | |
135 | PE_IndicatorTabTearRight, |
136 | |
137 | // do not add any values below/greater this |
138 | PE_CustomBase = 0xf000000 |
139 | }; |
140 | Q_ENUM(PrimitiveElement) |
141 | |
142 | enum ControlElement { |
143 | CE_PushButton, |
144 | CE_PushButtonBevel, |
145 | CE_PushButtonLabel, |
146 | |
147 | CE_CheckBox, |
148 | CE_CheckBoxLabel, |
149 | |
150 | CE_RadioButton, |
151 | CE_RadioButtonLabel, |
152 | |
153 | CE_TabBarTab, |
154 | CE_TabBarTabShape, |
155 | CE_TabBarTabLabel, |
156 | |
157 | CE_ProgressBar, |
158 | CE_ProgressBarGroove, |
159 | CE_ProgressBarContents, |
160 | CE_ProgressBarLabel, |
161 | |
162 | , |
163 | , |
164 | , |
165 | , |
166 | , |
167 | , |
168 | |
169 | , |
170 | , |
171 | |
172 | CE_ToolButtonLabel, |
173 | |
174 | , |
175 | , |
176 | , |
177 | |
178 | CE_ToolBoxTab, |
179 | CE_SizeGrip, |
180 | CE_Splitter, |
181 | CE_RubberBand, |
182 | CE_DockWidgetTitle, |
183 | |
184 | CE_ScrollBarAddLine, |
185 | CE_ScrollBarSubLine, |
186 | CE_ScrollBarAddPage, |
187 | CE_ScrollBarSubPage, |
188 | CE_ScrollBarSlider, |
189 | CE_ScrollBarFirst, |
190 | CE_ScrollBarLast, |
191 | |
192 | CE_FocusFrame, |
193 | CE_ComboBoxLabel, |
194 | |
195 | CE_ToolBar, |
196 | CE_ToolBoxTabShape, |
197 | CE_ToolBoxTabLabel, |
198 | , |
199 | |
200 | CE_ColumnViewGrip, |
201 | |
202 | CE_ItemViewItem, |
203 | |
204 | CE_ShapedFrame, |
205 | |
206 | // do not add any values below/greater than this |
207 | CE_CustomBase = 0xf0000000 |
208 | }; |
209 | Q_ENUM(ControlElement) |
210 | |
211 | enum SubElement { |
212 | SE_PushButtonContents, |
213 | SE_PushButtonFocusRect, |
214 | |
215 | SE_CheckBoxIndicator, |
216 | SE_CheckBoxContents, |
217 | SE_CheckBoxFocusRect, |
218 | SE_CheckBoxClickRect, |
219 | |
220 | SE_RadioButtonIndicator, |
221 | SE_RadioButtonContents, |
222 | SE_RadioButtonFocusRect, |
223 | SE_RadioButtonClickRect, |
224 | |
225 | SE_ComboBoxFocusRect, |
226 | |
227 | SE_SliderFocusRect, |
228 | |
229 | SE_ProgressBarGroove, |
230 | SE_ProgressBarContents, |
231 | SE_ProgressBarLabel, |
232 | |
233 | SE_ToolBoxTabContents, |
234 | |
235 | , |
236 | , |
237 | |
238 | SE_TabWidgetTabBar, |
239 | SE_TabWidgetTabPane, |
240 | SE_TabWidgetTabContents, |
241 | SE_TabWidgetLeftCorner, |
242 | SE_TabWidgetRightCorner, |
243 | |
244 | SE_ItemViewItemCheckIndicator, |
245 | SE_TabBarTearIndicator, |
246 | SE_TabBarTearIndicatorLeft = SE_TabBarTearIndicator, |
247 | |
248 | SE_TreeViewDisclosureItem, |
249 | |
250 | SE_LineEditContents, |
251 | SE_FrameContents, |
252 | |
253 | SE_DockWidgetCloseButton, |
254 | SE_DockWidgetFloatButton, |
255 | SE_DockWidgetTitleBarText, |
256 | SE_DockWidgetIcon, |
257 | |
258 | SE_CheckBoxLayoutItem, |
259 | SE_ComboBoxLayoutItem, |
260 | SE_DateTimeEditLayoutItem, |
261 | SE_LabelLayoutItem, |
262 | SE_ProgressBarLayoutItem, |
263 | SE_PushButtonLayoutItem, |
264 | SE_RadioButtonLayoutItem, |
265 | SE_SliderLayoutItem, |
266 | SE_ScrollBarLayoutItem, |
267 | SE_SpinBoxLayoutItem, |
268 | SE_ToolButtonLayoutItem, |
269 | |
270 | SE_FrameLayoutItem, |
271 | SE_GroupBoxLayoutItem, |
272 | SE_TabWidgetLayoutItem, |
273 | |
274 | SE_ItemViewItemDecoration, |
275 | SE_ItemViewItemText, |
276 | SE_ItemViewItemFocusRect, |
277 | |
278 | SE_TabBarTabLeftButton, |
279 | SE_TabBarTabRightButton, |
280 | SE_TabBarTabText, |
281 | |
282 | SE_ShapedFrameContents, |
283 | |
284 | SE_ToolBarHandle, |
285 | |
286 | SE_TabBarScrollLeftButton, |
287 | SE_TabBarScrollRightButton, |
288 | SE_TabBarTearIndicatorRight, |
289 | |
290 | // do not add any values below/greater than this |
291 | SE_CustomBase = 0xf0000000 |
292 | }; |
293 | Q_ENUM(SubElement) |
294 | |
295 | enum ComplexControl { |
296 | CC_SpinBox, |
297 | CC_ComboBox, |
298 | CC_ScrollBar, |
299 | CC_Slider, |
300 | CC_ToolButton, |
301 | CC_TitleBar, |
302 | CC_Dial, |
303 | CC_GroupBox, |
304 | CC_MdiControls, |
305 | |
306 | // do not add any values below/greater than this |
307 | CC_CustomBase = 0xf0000000 |
308 | }; |
309 | Q_ENUM(ComplexControl) |
310 | |
311 | enum SubControl { |
312 | SC_None = 0x00000000, |
313 | |
314 | SC_ScrollBarAddLine = 0x00000001, |
315 | SC_ScrollBarSubLine = 0x00000002, |
316 | SC_ScrollBarAddPage = 0x00000004, |
317 | SC_ScrollBarSubPage = 0x00000008, |
318 | SC_ScrollBarFirst = 0x00000010, |
319 | SC_ScrollBarLast = 0x00000020, |
320 | SC_ScrollBarSlider = 0x00000040, |
321 | SC_ScrollBarGroove = 0x00000080, |
322 | |
323 | SC_SpinBoxUp = 0x00000001, |
324 | SC_SpinBoxDown = 0x00000002, |
325 | SC_SpinBoxFrame = 0x00000004, |
326 | SC_SpinBoxEditField = 0x00000008, |
327 | |
328 | SC_ComboBoxFrame = 0x00000001, |
329 | SC_ComboBoxEditField = 0x00000002, |
330 | SC_ComboBoxArrow = 0x00000004, |
331 | = 0x00000008, |
332 | |
333 | SC_SliderGroove = 0x00000001, |
334 | SC_SliderHandle = 0x00000002, |
335 | SC_SliderTickmarks = 0x00000004, |
336 | |
337 | SC_ToolButton = 0x00000001, |
338 | = 0x00000002, |
339 | |
340 | = 0x00000001, |
341 | SC_TitleBarMinButton = 0x00000002, |
342 | SC_TitleBarMaxButton = 0x00000004, |
343 | SC_TitleBarCloseButton = 0x00000008, |
344 | SC_TitleBarNormalButton = 0x00000010, |
345 | SC_TitleBarShadeButton = 0x00000020, |
346 | SC_TitleBarUnshadeButton = 0x00000040, |
347 | SC_TitleBarContextHelpButton = 0x00000080, |
348 | SC_TitleBarLabel = 0x00000100, |
349 | |
350 | SC_DialGroove = 0x00000001, |
351 | SC_DialHandle = 0x00000002, |
352 | SC_DialTickmarks = 0x00000004, |
353 | |
354 | SC_GroupBoxCheckBox = 0x00000001, |
355 | SC_GroupBoxLabel = 0x00000002, |
356 | SC_GroupBoxContents = 0x00000004, |
357 | SC_GroupBoxFrame = 0x00000008, |
358 | |
359 | SC_MdiMinButton = 0x00000001, |
360 | SC_MdiNormalButton = 0x00000002, |
361 | SC_MdiCloseButton = 0x00000004, |
362 | |
363 | SC_CustomBase = 0xf0000000, |
364 | SC_All = 0xffffffff |
365 | }; |
366 | Q_ENUM(SubControl) |
367 | Q_DECLARE_FLAGS(SubControls, SubControl) |
368 | |
369 | enum PixelMetric { |
370 | PM_ButtonMargin, |
371 | PM_ButtonDefaultIndicator, |
372 | , |
373 | PM_ButtonShiftHorizontal, |
374 | PM_ButtonShiftVertical, |
375 | |
376 | PM_DefaultFrameWidth, |
377 | PM_SpinBoxFrameWidth, |
378 | PM_ComboBoxFrameWidth, |
379 | |
380 | PM_MaximumDragDistance, |
381 | |
382 | PM_ScrollBarExtent, |
383 | PM_ScrollBarSliderMin, |
384 | |
385 | PM_SliderThickness, // total slider thickness |
386 | PM_SliderControlThickness, // thickness of the business part |
387 | PM_SliderLength, // total length of slider |
388 | PM_SliderTickmarkOffset, // |
389 | PM_SliderSpaceAvailable, // available space for slider to move |
390 | |
391 | PM_DockWidgetSeparatorExtent, |
392 | PM_DockWidgetHandleExtent, |
393 | PM_DockWidgetFrameWidth, |
394 | |
395 | PM_TabBarTabOverlap, |
396 | PM_TabBarTabHSpace, |
397 | PM_TabBarTabVSpace, |
398 | PM_TabBarBaseHeight, |
399 | PM_TabBarBaseOverlap, |
400 | |
401 | PM_ProgressBarChunkWidth, |
402 | |
403 | PM_SplitterWidth, |
404 | PM_TitleBarHeight, |
405 | |
406 | , |
407 | , |
408 | , |
409 | , |
410 | , |
411 | , |
412 | |
413 | , |
414 | , |
415 | , |
416 | , |
417 | |
418 | PM_IndicatorWidth, |
419 | PM_IndicatorHeight, |
420 | PM_ExclusiveIndicatorWidth, |
421 | PM_ExclusiveIndicatorHeight, |
422 | |
423 | PM_DialogButtonsSeparator, |
424 | PM_DialogButtonsButtonWidth, |
425 | PM_DialogButtonsButtonHeight, |
426 | |
427 | PM_MdiSubWindowFrameWidth, |
428 | PM_MdiSubWindowMinimizedWidth, |
429 | |
430 | , |
431 | , |
432 | , |
433 | PM_TabBarTabShiftHorizontal, |
434 | PM_TabBarTabShiftVertical, |
435 | PM_TabBarScrollButtonWidth, |
436 | |
437 | PM_ToolBarFrameWidth, |
438 | PM_ToolBarHandleExtent, |
439 | PM_ToolBarItemSpacing, |
440 | PM_ToolBarItemMargin, |
441 | PM_ToolBarSeparatorExtent, |
442 | PM_ToolBarExtensionExtent, |
443 | |
444 | PM_SpinBoxSliderHeight, |
445 | |
446 | PM_DefaultTopLevelMargin, |
447 | PM_DefaultChildMargin, |
448 | PM_DefaultLayoutSpacing, |
449 | |
450 | PM_ToolBarIconSize, |
451 | PM_ListViewIconSize, |
452 | PM_IconViewIconSize, |
453 | PM_SmallIconSize, |
454 | PM_LargeIconSize, |
455 | |
456 | PM_FocusFrameVMargin, |
457 | PM_FocusFrameHMargin, |
458 | |
459 | PM_ToolTipLabelFrameWidth, |
460 | PM_CheckBoxLabelSpacing, |
461 | PM_TabBarIconSize, |
462 | PM_SizeGripSize, |
463 | PM_DockWidgetTitleMargin, |
464 | PM_MessageBoxIconSize, |
465 | PM_ButtonIconSize, |
466 | |
467 | PM_DockWidgetTitleBarButtonMargin, |
468 | |
469 | PM_RadioButtonLabelSpacing, |
470 | PM_LayoutLeftMargin, |
471 | PM_LayoutTopMargin, |
472 | PM_LayoutRightMargin, |
473 | PM_LayoutBottomMargin, |
474 | PM_LayoutHorizontalSpacing, |
475 | PM_LayoutVerticalSpacing, |
476 | PM_TabBar_ScrollButtonOverlap, |
477 | |
478 | PM_TextCursorWidth, |
479 | |
480 | PM_TabCloseIndicatorWidth, |
481 | PM_TabCloseIndicatorHeight, |
482 | |
483 | PM_ScrollView_ScrollBarSpacing, |
484 | PM_ScrollView_ScrollBarOverlap, |
485 | , |
486 | PM_TreeViewIndentation, |
487 | |
488 | , |
489 | , |
490 | |
491 | PM_TitleBarButtonIconSize, |
492 | PM_TitleBarButtonSize, |
493 | |
494 | PM_PushButtonFocusFrameRadius, |
495 | PM_CheckBoxFocusFrameRadius, |
496 | PM_ComboBoxFocusFrameRadius, |
497 | PM_DialFocusFrameRadius, |
498 | PM_RadioButtonFocusFrameRadius, |
499 | PM_SliderFocusFrameRadius, |
500 | PM_SpinBoxFocusFrameRadius, |
501 | PM_TextAreaFocusFrameRadius, |
502 | PM_TextFieldFocusFrameRadius, |
503 | |
504 | // do not add any values below/greater than this |
505 | PM_CustomBase = 0xf0000000 |
506 | }; |
507 | Q_ENUM(PixelMetric) |
508 | |
509 | enum ContentsType { |
510 | CT_PushButton, |
511 | CT_CheckBox, |
512 | CT_RadioButton, |
513 | CT_ToolButton, |
514 | CT_ComboBox, |
515 | CT_Splitter, |
516 | CT_ProgressBar, |
517 | , |
518 | , |
519 | , |
520 | , |
521 | CT_TabBarTab, |
522 | CT_Slider, |
523 | CT_Dial, |
524 | CT_ScrollBar, |
525 | CT_LineEdit, |
526 | CT_SpinBox, |
527 | CT_SizeGrip, |
528 | CT_TabWidget, |
529 | CT_DialogButtons, |
530 | , |
531 | CT_GroupBox, |
532 | CT_MdiControls, |
533 | CT_ItemViewItem, |
534 | CT_Frame, |
535 | // do not add any values below/greater than this |
536 | CT_CustomBase = 0xf0000000 |
537 | }; |
538 | Q_ENUM(ContentsType) |
539 | |
540 | enum RequestSoftwareInputPanel { |
541 | RSIP_OnMouseClickAndAlreadyFocused, |
542 | RSIP_OnMouseClick |
543 | }; |
544 | Q_ENUM(RequestSoftwareInputPanel) |
545 | |
546 | enum StyleHint { |
547 | SH_EtchDisabledText, |
548 | SH_DitherDisabledText, |
549 | SH_ScrollBar_MiddleClickAbsolutePosition, |
550 | SH_ScrollBar_ScrollWhenPointerLeavesControl, |
551 | SH_TabBar_SelectMouseType, |
552 | SH_TabBar_Alignment, |
553 | , |
554 | SH_Slider_SnapToValue, |
555 | SH_Slider_SloppyKeyEvents, |
556 | SH_ProgressDialog_CenterCancelButton, |
557 | SH_ProgressDialog_TextLabelAlignment, |
558 | SH_PrintDialog_RightAlignButtons, |
559 | SH_MainWindow_SpaceBelowMenuBar, |
560 | SH_FontDialog_SelectAssociatedText, |
561 | SH_Menu_AllowActiveAndDisabled, |
562 | , |
563 | , |
564 | SH_ScrollView_FrameOnlyAroundContents, |
565 | , |
566 | SH_ComboBox_ListMouseTracking, |
567 | , |
568 | , |
569 | SH_ItemView_ChangeHighlightOnFocus, |
570 | SH_Widget_ShareActivation, |
571 | SH_Workspace_FillSpaceOnMaximize, |
572 | , |
573 | SH_TitleBar_NoBorder, |
574 | SH_Slider_StopMouseOverSlider, |
575 | SH_BlinkCursorWhenTextSelected, |
576 | SH_RichText_FullWidthSelection, |
577 | , |
578 | SH_GroupBox_TextLabelVerticalAlignment, |
579 | SH_GroupBox_TextLabelColor, |
580 | , |
581 | SH_Table_GridLineColor, |
582 | SH_LineEdit_PasswordCharacter, |
583 | SH_DialogButtons_DefaultButton, |
584 | SH_ToolBox_SelectedPageTitleBold, |
585 | SH_TabBar_PreferNoArrows, |
586 | SH_ScrollBar_LeftClickAbsolutePosition, |
587 | SH_ListViewExpand_SelectMouseType, |
588 | SH_UnderlineShortcut, |
589 | SH_SpinBox_AnimateButton, |
590 | SH_SpinBox_KeyPressAutoRepeatRate, |
591 | SH_SpinBox_ClickAutoRepeatRate, |
592 | , |
593 | SH_ToolTipLabel_Opacity, |
594 | , |
595 | SH_TitleBar_ModifyNotification, |
596 | SH_Button_FocusPolicy, |
597 | SH_MessageBox_UseBorderForButtonSpacing, |
598 | SH_TitleBar_AutoRaise, |
599 | , |
600 | SH_FocusFrame_Mask, |
601 | SH_RubberBand_Mask, |
602 | SH_WindowFrame_Mask, |
603 | SH_SpinControls_DisableOnBounds, |
604 | SH_Dial_BackgroundRole, |
605 | SH_ComboBox_LayoutDirection, |
606 | SH_ItemView_EllipsisLocation, |
607 | SH_ItemView_ShowDecorationSelected, |
608 | SH_ItemView_ActivateItemOnSingleClick, |
609 | , |
610 | SH_ScrollBar_RollBetweenButtons, |
611 | SH_Slider_AbsoluteSetButtons, |
612 | SH_Slider_PageSetButtons, |
613 | , |
614 | SH_TabBar_ElideMode, |
615 | SH_DialogButtonLayout, |
616 | , |
617 | SH_MessageBox_TextInteractionFlags, |
618 | SH_DialogButtonBox_ButtonsHaveIcons, |
619 | SH_SpellCheckUnderlineStyle, |
620 | SH_MessageBox_CenterButtons, |
621 | , |
622 | SH_ItemView_MovementWithoutUpdatingSelection, |
623 | SH_ToolTip_Mask, |
624 | SH_FocusFrame_AboveWidget, |
625 | SH_TextControl_FocusIndicatorTextCharFormat, |
626 | SH_WizardStyle, |
627 | SH_ItemView_ArrowKeysNavigateIntoChildren, |
628 | , |
629 | , |
630 | , |
631 | SH_SpinBox_ClickAutoRepeatThreshold, |
632 | SH_ItemView_PaintAlternatingRowColorsForEmptyArea, |
633 | SH_FormLayoutWrapPolicy, |
634 | SH_TabWidget_DefaultTabPosition, |
635 | SH_ToolBar_Movable, |
636 | SH_FormLayoutFieldGrowthPolicy, |
637 | SH_FormLayoutFormAlignment, |
638 | SH_FormLayoutLabelAlignment, |
639 | SH_ItemView_DrawDelegateFrame, |
640 | SH_TabBar_CloseButtonPosition, |
641 | SH_DockWidget_ButtonsHaveFrame, |
642 | SH_ToolButtonStyle, |
643 | SH_RequestSoftwareInputPanel, |
644 | SH_ScrollBar_Transient, |
645 | , |
646 | SH_ToolTip_WakeUpDelay, |
647 | SH_ToolTip_FallAsleepDelay, |
648 | SH_Widget_Animate, |
649 | SH_Splitter_OpaqueResize, |
650 | // Whether we should use a native popup. |
651 | // Only supported for non-editable combo boxes on Mac OS X so far. |
652 | , |
653 | SH_LineEdit_PasswordMaskDelay, |
654 | SH_TabBar_ChangeCurrentDelay, |
655 | , |
656 | , |
657 | , |
658 | , |
659 | , |
660 | , |
661 | SH_ItemView_ScrollMode, |
662 | SH_TitleBar_ShowToolTipsOnButtons, |
663 | SH_Widget_Animation_Duration, |
664 | SH_ComboBox_AllowWheelScrolling, |
665 | SH_SpinBox_ButtonsInsideFrame, |
666 | SH_SpinBox_StepModifier, |
667 | // Add new style hint values here |
668 | |
669 | SH_CustomBase = 0xf0000000 |
670 | }; |
671 | Q_ENUM(StyleHint) |
672 | |
673 | enum StandardPixmap { |
674 | , |
675 | SP_TitleBarMinButton, |
676 | SP_TitleBarMaxButton, |
677 | SP_TitleBarCloseButton, |
678 | SP_TitleBarNormalButton, |
679 | SP_TitleBarShadeButton, |
680 | SP_TitleBarUnshadeButton, |
681 | SP_TitleBarContextHelpButton, |
682 | SP_DockWidgetCloseButton, |
683 | SP_MessageBoxInformation, |
684 | SP_MessageBoxWarning, |
685 | SP_MessageBoxCritical, |
686 | SP_MessageBoxQuestion, |
687 | SP_DesktopIcon, |
688 | SP_TrashIcon, |
689 | SP_ComputerIcon, |
690 | SP_DriveFDIcon, |
691 | SP_DriveHDIcon, |
692 | SP_DriveCDIcon, |
693 | SP_DriveDVDIcon, |
694 | SP_DriveNetIcon, |
695 | SP_DirOpenIcon, |
696 | SP_DirClosedIcon, |
697 | SP_DirLinkIcon, |
698 | SP_DirLinkOpenIcon, |
699 | SP_FileIcon, |
700 | SP_FileLinkIcon, |
701 | SP_ToolBarHorizontalExtensionButton, |
702 | SP_ToolBarVerticalExtensionButton, |
703 | SP_FileDialogStart, |
704 | SP_FileDialogEnd, |
705 | SP_FileDialogToParent, |
706 | SP_FileDialogNewFolder, |
707 | SP_FileDialogDetailedView, |
708 | SP_FileDialogInfoView, |
709 | SP_FileDialogContentsView, |
710 | SP_FileDialogListView, |
711 | SP_FileDialogBack, |
712 | SP_DirIcon, |
713 | SP_DialogOkButton, |
714 | SP_DialogCancelButton, |
715 | SP_DialogHelpButton, |
716 | SP_DialogOpenButton, |
717 | SP_DialogSaveButton, |
718 | SP_DialogCloseButton, |
719 | SP_DialogApplyButton, |
720 | SP_DialogResetButton, |
721 | SP_DialogDiscardButton, |
722 | SP_DialogYesButton, |
723 | SP_DialogNoButton, |
724 | SP_ArrowUp, |
725 | SP_ArrowDown, |
726 | SP_ArrowLeft, |
727 | SP_ArrowRight, |
728 | SP_ArrowBack, |
729 | SP_ArrowForward, |
730 | SP_DirHomeIcon, |
731 | SP_CommandLink, |
732 | SP_VistaShield, |
733 | SP_BrowserReload, |
734 | SP_BrowserStop, |
735 | SP_MediaPlay, |
736 | SP_MediaStop, |
737 | SP_MediaPause, |
738 | SP_MediaSkipForward, |
739 | SP_MediaSkipBackward, |
740 | SP_MediaSeekForward, |
741 | SP_MediaSeekBackward, |
742 | SP_MediaVolume, |
743 | SP_MediaVolumeMuted, |
744 | SP_LineEditClearButton, |
745 | SP_DialogYesToAllButton, |
746 | SP_DialogNoToAllButton, |
747 | SP_DialogSaveAllButton, |
748 | SP_DialogAbortButton, |
749 | SP_DialogRetryButton, |
750 | SP_DialogIgnoreButton, |
751 | SP_RestoreDefaultsButton, |
752 | // do not add any values below/greater than this |
753 | SP_CustomBase = 0xf0000000 |
754 | }; |
755 | Q_ENUM(StandardPixmap) |
756 | |
757 | virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const; |
758 | virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const; |
759 | virtual QRect subElementRect(SubElement subElement, const QStyleOption *option) const = 0; |
760 | virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc) const = 0; |
761 | |
762 | virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize) const = 0; |
763 | virtual QFont font(ControlElement element, const QStyle::State state) const = 0; |
764 | virtual QMargins ninePatchMargins(ControlElement ce, const QStyleOption *opt, const QSize &imageSize) const = 0; |
765 | virtual QMargins ninePatchMargins(ComplexControl cc, const QStyleOptionComplex *opt, const QSize &imageSize) const = 0; |
766 | |
767 | virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt) const = 0; |
768 | |
769 | virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr) const = 0; |
770 | virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr, QStyleHintReturn* returnData = nullptr) const = 0; |
771 | |
772 | virtual void drawItemText(QPainter *painter, const QRect &rect, |
773 | int flags, const QPalette &pal, bool enabled, |
774 | const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const; |
775 | virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const; |
776 | virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p) const = 0; |
777 | virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p) const = 0; |
778 | virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p) const = 0; |
779 | |
780 | virtual QPalette standardPalette() const; |
781 | virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr) const = 0; |
782 | virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr) const = 0; |
783 | virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const = 0; |
784 | virtual void polish() { } |
785 | |
786 | static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect); |
787 | static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos); |
788 | static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown = false); |
789 | static int sliderValueFromPosition(int min, int max, int pos, int space, bool upsideDown = false); |
790 | static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment); |
791 | static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle); |
792 | |
793 | // TODO: Remove the concept of proxy (but keep it for now until everything builds) |
794 | const QStyle *proxy() const { return this; } |
795 | |
796 | private: |
797 | Q_DISABLE_COPY(QStyle) |
798 | }; |
799 | |
800 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State) |
801 | Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls) |
802 | |
803 | } // namespace QQC2 |
804 | |
805 | QT_END_NAMESPACE |
806 | |
807 | #endif // QSTYLE_H |
808 | |