1 | /****************************************************************************
|
---|
2 | ** $Id: qstyle.h 2 2005-11-16 15:49:26Z dmik $
|
---|
3 | **
|
---|
4 | ** Definition of QStyle class
|
---|
5 | **
|
---|
6 | ** Created : 980616
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
|
---|
9 | **
|
---|
10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
23 | ** Agreement provided with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 | #ifndef QSTYLE_H
|
---|
38 | #define QSTYLE_H
|
---|
39 |
|
---|
40 | #ifndef QT_H
|
---|
41 | #include "qobject.h"
|
---|
42 | #endif // QT_H
|
---|
43 |
|
---|
44 |
|
---|
45 | #ifndef QT_NO_STYLE
|
---|
46 |
|
---|
47 | class QPopupMenu;
|
---|
48 | class QStylePrivate;
|
---|
49 | class QMenuItem;
|
---|
50 | class QTab;
|
---|
51 | class QListViewItem;
|
---|
52 | class QCheckListItem;
|
---|
53 |
|
---|
54 | class QStyleOption {
|
---|
55 | public:
|
---|
56 | enum StyleOptionDefault { Default };
|
---|
57 |
|
---|
58 | QStyleOption(StyleOptionDefault=Default) : def(TRUE) {}
|
---|
59 |
|
---|
60 | // Note: we don't use default arguments since that is unnecessary
|
---|
61 | // initialization.
|
---|
62 | QStyleOption(int in1) :
|
---|
63 | def(FALSE), i1(in1) {}
|
---|
64 | QStyleOption(int in1, int in2) :
|
---|
65 | def(FALSE), i1(in1), i2(in2) {}
|
---|
66 | QStyleOption(int in1, int in2, int in3, int in4) :
|
---|
67 | def(FALSE), i1(in1), i2(in2), i3(in3), i4(in4) {}
|
---|
68 | QStyleOption(QMenuItem* m) : def(FALSE), mi(m) {}
|
---|
69 | QStyleOption(QMenuItem* m, int in1) : def(FALSE), mi(m), i1(in1) {}
|
---|
70 | QStyleOption(QMenuItem* m, int in1, int in2) : def(FALSE), mi(m), i1(in1), i2(in2) {}
|
---|
71 | QStyleOption(const QColor& c) : def(FALSE), cl(&c) {}
|
---|
72 | QStyleOption(QTab* t) : def(FALSE), tb(t) {}
|
---|
73 | QStyleOption(QListViewItem* i) : def(FALSE), li(i) {}
|
---|
74 | QStyleOption(QCheckListItem* i) : def(FALSE), cli(i) {}
|
---|
75 | QStyleOption(Qt::ArrowType a) : def(FALSE), i1((int)a) {}
|
---|
76 | QStyleOption(const QRect& r) : def(FALSE), i1(r.x()), i2(r.y()), i3(r.width()),i4(r.height()){}
|
---|
77 | QStyleOption(QWidget *w) : def(FALSE), p1((void*)w) {}
|
---|
78 |
|
---|
79 | bool isDefault() const { return def; }
|
---|
80 |
|
---|
81 | int day() const { return i1; }
|
---|
82 |
|
---|
83 | int lineWidth() const { return i1; }
|
---|
84 | int midLineWidth() const { return i2; }
|
---|
85 | int frameShape() const { return i3; }
|
---|
86 | int frameShadow() const { return i4; }
|
---|
87 |
|
---|
88 | int headerSection() const { return i1; }
|
---|
89 | QMenuItem* menuItem() const { return mi; }
|
---|
90 | int maxIconWidth() const { return i1; }
|
---|
91 | int tabWidth() const { return i2; }
|
---|
92 |
|
---|
93 | const QColor& color() const { return *cl; }
|
---|
94 |
|
---|
95 | QTab* tab() const { return tb; }
|
---|
96 |
|
---|
97 | QCheckListItem* checkListItem() const { return cli; }
|
---|
98 | QListViewItem* listViewItem() const { return li; }
|
---|
99 |
|
---|
100 | Qt::ArrowType arrowType() const { return (Qt::ArrowType)i1; }
|
---|
101 | QRect rect() const { return QRect( i1, i2, i3, i4 ); }
|
---|
102 | QWidget* widget() const { return (QWidget*)p1; }
|
---|
103 |
|
---|
104 | private:
|
---|
105 | // NOTE: none of these components have constructors.
|
---|
106 | bool def;
|
---|
107 | bool b1,b2,b3; // reserved
|
---|
108 | QMenuItem* mi;
|
---|
109 | QTab* tb;
|
---|
110 | QListViewItem* li;
|
---|
111 | const QColor* cl;
|
---|
112 | int i1, i2, i3, i4;
|
---|
113 | int i5, i6; // reserved
|
---|
114 | QCheckListItem* cli;
|
---|
115 | void *p1, *p2, *p3, *p4; // reserved
|
---|
116 | // (padded to 64 bytes on some architectures)
|
---|
117 | };
|
---|
118 |
|
---|
119 | class QStyleHintReturn; // not defined yet
|
---|
120 |
|
---|
121 | class Q_EXPORT QStyle: public QObject
|
---|
122 | {
|
---|
123 | Q_OBJECT
|
---|
124 |
|
---|
125 | public:
|
---|
126 | QStyle();
|
---|
127 | virtual ~QStyle();
|
---|
128 |
|
---|
129 | // New QStyle API - most of these should probably be pure virtual
|
---|
130 |
|
---|
131 | virtual void polish( QWidget * );
|
---|
132 | virtual void unPolish( QWidget * );
|
---|
133 |
|
---|
134 | virtual void polish( QApplication * );
|
---|
135 | virtual void unPolish( QApplication * );
|
---|
136 |
|
---|
137 | virtual void polish( QPalette & );
|
---|
138 |
|
---|
139 | virtual void polishPopupMenu( QPopupMenu* ) = 0;
|
---|
140 |
|
---|
141 | virtual QRect itemRect( QPainter *p, const QRect &r,
|
---|
142 | int flags, bool enabled,
|
---|
143 | const QPixmap *pixmap,
|
---|
144 | const QString &text, int len = -1 ) const;
|
---|
145 |
|
---|
146 | virtual void drawItem( QPainter *p, const QRect &r,
|
---|
147 | int flags, const QColorGroup &g, bool enabled,
|
---|
148 | const QPixmap *pixmap, const QString &text,
|
---|
149 | int len = -1, const QColor *penColor = 0 ) const;
|
---|
150 |
|
---|
151 |
|
---|
152 | enum PrimitiveElement {
|
---|
153 | PE_ButtonCommand,
|
---|
154 | PE_ButtonDefault,
|
---|
155 | PE_ButtonBevel,
|
---|
156 | PE_ButtonTool,
|
---|
157 | PE_ButtonDropDown,
|
---|
158 |
|
---|
159 | PE_FocusRect,
|
---|
160 |
|
---|
161 | PE_ArrowUp,
|
---|
162 | PE_ArrowDown,
|
---|
163 | PE_ArrowRight,
|
---|
164 | PE_ArrowLeft,
|
---|
165 |
|
---|
166 | PE_SpinWidgetUp,
|
---|
167 | PE_SpinWidgetDown,
|
---|
168 | PE_SpinWidgetPlus,
|
---|
169 | PE_SpinWidgetMinus,
|
---|
170 |
|
---|
171 | PE_Indicator,
|
---|
172 | PE_IndicatorMask,
|
---|
173 | PE_ExclusiveIndicator,
|
---|
174 | PE_ExclusiveIndicatorMask,
|
---|
175 |
|
---|
176 | PE_DockWindowHandle,
|
---|
177 | PE_DockWindowSeparator,
|
---|
178 | PE_DockWindowResizeHandle,
|
---|
179 |
|
---|
180 | PE_Splitter,
|
---|
181 |
|
---|
182 | PE_Panel,
|
---|
183 | PE_PanelPopup,
|
---|
184 | PE_PanelMenuBar,
|
---|
185 | PE_PanelDockWindow,
|
---|
186 |
|
---|
187 | PE_TabBarBase,
|
---|
188 |
|
---|
189 | PE_HeaderSection,
|
---|
190 | PE_HeaderArrow,
|
---|
191 | PE_StatusBarSection,
|
---|
192 |
|
---|
193 | PE_GroupBoxFrame,
|
---|
194 |
|
---|
195 | PE_Separator,
|
---|
196 |
|
---|
197 | PE_SizeGrip,
|
---|
198 |
|
---|
199 | PE_CheckMark,
|
---|
200 |
|
---|
201 | PE_ScrollBarAddLine,
|
---|
202 | PE_ScrollBarSubLine,
|
---|
203 | PE_ScrollBarAddPage,
|
---|
204 | PE_ScrollBarSubPage,
|
---|
205 | PE_ScrollBarSlider,
|
---|
206 | PE_ScrollBarFirst,
|
---|
207 | PE_ScrollBarLast,
|
---|
208 |
|
---|
209 | PE_ProgressBarChunk,
|
---|
210 |
|
---|
211 | PE_PanelLineEdit,
|
---|
212 | PE_PanelTabWidget,
|
---|
213 |
|
---|
214 | PE_WindowFrame,
|
---|
215 |
|
---|
216 | PE_CheckListController,
|
---|
217 | PE_CheckListIndicator,
|
---|
218 | PE_CheckListExclusiveIndicator,
|
---|
219 |
|
---|
220 | PE_PanelGroupBox,
|
---|
221 | PE_RubberBand,
|
---|
222 |
|
---|
223 | // do not add any values below/greater this
|
---|
224 | PE_CustomBase = 0xf000000
|
---|
225 | };
|
---|
226 |
|
---|
227 | enum StyleFlags {
|
---|
228 | Style_Default = 0x00000000,
|
---|
229 | Style_Enabled = 0x00000001,
|
---|
230 | Style_Raised = 0x00000002,
|
---|
231 | Style_Sunken = 0x00000004,
|
---|
232 | Style_Off = 0x00000008,
|
---|
233 | Style_NoChange = 0x00000010,
|
---|
234 | Style_On = 0x00000020,
|
---|
235 | Style_Down = 0x00000040,
|
---|
236 | Style_Horizontal = 0x00000080,
|
---|
237 | Style_HasFocus = 0x00000100,
|
---|
238 | Style_Top = 0x00000200,
|
---|
239 | Style_Bottom = 0x00000400,
|
---|
240 | Style_FocusAtBorder = 0x00000800,
|
---|
241 | Style_AutoRaise = 0x00001000,
|
---|
242 | Style_MouseOver = 0x00002000,
|
---|
243 | Style_Up = 0x00004000,
|
---|
244 | Style_Selected = 0x00008000,
|
---|
245 | Style_Active = 0x00010000,
|
---|
246 | Style_ButtonDefault = 0x00020000
|
---|
247 | };
|
---|
248 | typedef uint SFlags;
|
---|
249 |
|
---|
250 | virtual void drawPrimitive( PrimitiveElement pe,
|
---|
251 | QPainter *p,
|
---|
252 | const QRect &r,
|
---|
253 | const QColorGroup &cg,
|
---|
254 | SFlags flags = Style_Default,
|
---|
255 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
256 |
|
---|
257 |
|
---|
258 | enum ControlElement {
|
---|
259 | CE_PushButton,
|
---|
260 | CE_PushButtonLabel,
|
---|
261 |
|
---|
262 | CE_CheckBox,
|
---|
263 | CE_CheckBoxLabel,
|
---|
264 |
|
---|
265 | CE_RadioButton,
|
---|
266 | CE_RadioButtonLabel,
|
---|
267 |
|
---|
268 | CE_TabBarTab,
|
---|
269 | CE_TabBarLabel,
|
---|
270 |
|
---|
271 | CE_ProgressBarGroove,
|
---|
272 | CE_ProgressBarContents,
|
---|
273 | CE_ProgressBarLabel,
|
---|
274 |
|
---|
275 | CE_PopupMenuItem,
|
---|
276 | CE_MenuBarItem,
|
---|
277 |
|
---|
278 | CE_ToolButtonLabel,
|
---|
279 | CE_MenuBarEmptyArea,
|
---|
280 | CE_PopupMenuScroller,
|
---|
281 | CE_DockWindowEmptyArea,
|
---|
282 | CE_PopupMenuVerticalExtra,
|
---|
283 | CE_PopupMenuHorizontalExtra,
|
---|
284 |
|
---|
285 | CE_ToolBoxTab,
|
---|
286 | CE_HeaderLabel,
|
---|
287 |
|
---|
288 | // do not add any values below/greater than this
|
---|
289 | CE_CustomBase = 0xf0000000
|
---|
290 | };
|
---|
291 |
|
---|
292 | virtual void drawControl( ControlElement element,
|
---|
293 | QPainter *p,
|
---|
294 | const QWidget *widget,
|
---|
295 | const QRect &r,
|
---|
296 | const QColorGroup &cg,
|
---|
297 | SFlags how = Style_Default,
|
---|
298 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
299 | virtual void drawControlMask( ControlElement element,
|
---|
300 | QPainter *p,
|
---|
301 | const QWidget *widget,
|
---|
302 | const QRect &r,
|
---|
303 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
304 |
|
---|
305 | enum SubRect {
|
---|
306 | SR_PushButtonContents,
|
---|
307 | SR_PushButtonFocusRect,
|
---|
308 |
|
---|
309 | SR_CheckBoxIndicator,
|
---|
310 | SR_CheckBoxContents,
|
---|
311 | SR_CheckBoxFocusRect,
|
---|
312 |
|
---|
313 | SR_RadioButtonIndicator,
|
---|
314 | SR_RadioButtonContents,
|
---|
315 | SR_RadioButtonFocusRect,
|
---|
316 |
|
---|
317 | SR_ComboBoxFocusRect,
|
---|
318 |
|
---|
319 | SR_SliderFocusRect,
|
---|
320 |
|
---|
321 | SR_DockWindowHandleRect,
|
---|
322 |
|
---|
323 | SR_ProgressBarGroove,
|
---|
324 | SR_ProgressBarContents,
|
---|
325 | SR_ProgressBarLabel,
|
---|
326 |
|
---|
327 | SR_ToolButtonContents,
|
---|
328 |
|
---|
329 | SR_DialogButtonAccept,
|
---|
330 | SR_DialogButtonReject,
|
---|
331 | SR_DialogButtonApply,
|
---|
332 | SR_DialogButtonHelp,
|
---|
333 | SR_DialogButtonAll,
|
---|
334 | SR_DialogButtonAbort,
|
---|
335 | SR_DialogButtonIgnore,
|
---|
336 | SR_DialogButtonRetry,
|
---|
337 | SR_DialogButtonCustom,
|
---|
338 |
|
---|
339 | SR_ToolBoxTabContents,
|
---|
340 |
|
---|
341 | // do not add any values below/greater than this
|
---|
342 | SR_CustomBase = 0xf0000000
|
---|
343 | };
|
---|
344 |
|
---|
345 | virtual QRect subRect( SubRect r, const QWidget *widget ) const = 0;
|
---|
346 |
|
---|
347 |
|
---|
348 | enum ComplexControl{
|
---|
349 | CC_SpinWidget,
|
---|
350 | CC_ComboBox,
|
---|
351 | CC_ScrollBar,
|
---|
352 | CC_Slider,
|
---|
353 | CC_ToolButton,
|
---|
354 | CC_TitleBar,
|
---|
355 | CC_ListView,
|
---|
356 |
|
---|
357 | // do not add any values below/greater than this
|
---|
358 | CC_CustomBase = 0xf0000000
|
---|
359 | };
|
---|
360 |
|
---|
361 | enum SubControl {
|
---|
362 | SC_None = 0x00000000,
|
---|
363 |
|
---|
364 | SC_ScrollBarAddLine = 0x00000001,
|
---|
365 | SC_ScrollBarSubLine = 0x00000002,
|
---|
366 | SC_ScrollBarAddPage = 0x00000004,
|
---|
367 | SC_ScrollBarSubPage = 0x00000008,
|
---|
368 | SC_ScrollBarFirst = 0x00000010,
|
---|
369 | SC_ScrollBarLast = 0x00000020,
|
---|
370 | SC_ScrollBarSlider = 0x00000040,
|
---|
371 | SC_ScrollBarGroove = 0x00000080,
|
---|
372 |
|
---|
373 | SC_SpinWidgetUp = 0x00000001,
|
---|
374 | SC_SpinWidgetDown = 0x00000002,
|
---|
375 | SC_SpinWidgetFrame = 0x00000004,
|
---|
376 | SC_SpinWidgetEditField = 0x00000008,
|
---|
377 | SC_SpinWidgetButtonField = 0x00000010,
|
---|
378 |
|
---|
379 | SC_ComboBoxFrame = 0x00000001,
|
---|
380 | SC_ComboBoxEditField = 0x00000002,
|
---|
381 | SC_ComboBoxArrow = 0x00000004,
|
---|
382 | SC_ComboBoxListBoxPopup = 0x00000008,
|
---|
383 |
|
---|
384 | SC_SliderGroove = 0x00000001,
|
---|
385 | SC_SliderHandle = 0x00000002,
|
---|
386 | SC_SliderTickmarks = 0x00000004,
|
---|
387 |
|
---|
388 | SC_ToolButton = 0x00000001,
|
---|
389 | SC_ToolButtonMenu = 0x00000002,
|
---|
390 |
|
---|
391 | SC_TitleBarLabel = 0x00000001,
|
---|
392 | SC_TitleBarSysMenu = 0x00000002,
|
---|
393 | SC_TitleBarMinButton = 0x00000004,
|
---|
394 | SC_TitleBarMaxButton = 0x00000008,
|
---|
395 | SC_TitleBarCloseButton = 0x00000010,
|
---|
396 | SC_TitleBarNormalButton = 0x00000020,
|
---|
397 | SC_TitleBarShadeButton = 0x00000040,
|
---|
398 | SC_TitleBarUnshadeButton = 0x00000080,
|
---|
399 |
|
---|
400 | SC_ListView = 0x00000001,
|
---|
401 | SC_ListViewBranch = 0x00000002,
|
---|
402 | SC_ListViewExpand = 0x00000004,
|
---|
403 |
|
---|
404 | SC_All = 0xffffffff
|
---|
405 | };
|
---|
406 | typedef uint SCFlags;
|
---|
407 |
|
---|
408 |
|
---|
409 | virtual void drawComplexControl( ComplexControl control,
|
---|
410 | QPainter *p,
|
---|
411 | const QWidget *widget,
|
---|
412 | const QRect &r,
|
---|
413 | const QColorGroup &cg,
|
---|
414 | SFlags how = Style_Default,
|
---|
415 | SCFlags sub = (uint)SC_All,
|
---|
416 | SCFlags subActive = SC_None,
|
---|
417 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
418 | virtual void drawComplexControlMask( ComplexControl control,
|
---|
419 | QPainter *p,
|
---|
420 | const QWidget *widget,
|
---|
421 | const QRect &r,
|
---|
422 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
423 |
|
---|
424 | virtual QRect querySubControlMetrics( ComplexControl control,
|
---|
425 | const QWidget *widget,
|
---|
426 | SubControl sc,
|
---|
427 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
428 | virtual SubControl querySubControl( ComplexControl control,
|
---|
429 | const QWidget *widget,
|
---|
430 | const QPoint &pos,
|
---|
431 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
432 |
|
---|
433 |
|
---|
434 | enum PixelMetric {
|
---|
435 | PM_ButtonMargin,
|
---|
436 | PM_ButtonDefaultIndicator,
|
---|
437 | PM_MenuButtonIndicator,
|
---|
438 | PM_ButtonShiftHorizontal,
|
---|
439 | PM_ButtonShiftVertical,
|
---|
440 |
|
---|
441 | PM_DefaultFrameWidth,
|
---|
442 | PM_SpinBoxFrameWidth,
|
---|
443 |
|
---|
444 | PM_MaximumDragDistance,
|
---|
445 |
|
---|
446 | PM_ScrollBarExtent,
|
---|
447 | PM_ScrollBarSliderMin,
|
---|
448 |
|
---|
449 | PM_SliderThickness, // total slider thickness
|
---|
450 | PM_SliderControlThickness, // thickness of the business part
|
---|
451 | PM_SliderLength, // total length of slider
|
---|
452 | PM_SliderTickmarkOffset, //
|
---|
453 | PM_SliderSpaceAvailable, // available space for slider to move
|
---|
454 |
|
---|
455 | PM_DockWindowSeparatorExtent,
|
---|
456 | PM_DockWindowHandleExtent,
|
---|
457 | PM_DockWindowFrameWidth,
|
---|
458 |
|
---|
459 | PM_MenuBarFrameWidth,
|
---|
460 |
|
---|
461 | PM_TabBarTabOverlap,
|
---|
462 | PM_TabBarTabHSpace,
|
---|
463 | PM_TabBarTabVSpace,
|
---|
464 | PM_TabBarBaseHeight,
|
---|
465 | PM_TabBarBaseOverlap,
|
---|
466 |
|
---|
467 | PM_ProgressBarChunkWidth,
|
---|
468 |
|
---|
469 | PM_SplitterWidth,
|
---|
470 | PM_TitleBarHeight,
|
---|
471 |
|
---|
472 | PM_IndicatorWidth,
|
---|
473 | PM_IndicatorHeight,
|
---|
474 | PM_ExclusiveIndicatorWidth,
|
---|
475 | PM_ExclusiveIndicatorHeight,
|
---|
476 | PM_PopupMenuScrollerHeight,
|
---|
477 | PM_CheckListButtonSize,
|
---|
478 | PM_CheckListControllerSize,
|
---|
479 | PM_PopupMenuFrameHorizontalExtra,
|
---|
480 | PM_PopupMenuFrameVerticalExtra,
|
---|
481 |
|
---|
482 | PM_DialogButtonsSeparator,
|
---|
483 | PM_DialogButtonsButtonWidth,
|
---|
484 | PM_DialogButtonsButtonHeight,
|
---|
485 |
|
---|
486 | PM_MDIFrameWidth,
|
---|
487 | PM_MDIMinimizedWidth,
|
---|
488 | PM_HeaderMargin,
|
---|
489 | PM_HeaderMarkSize,
|
---|
490 | PM_HeaderGripMargin,
|
---|
491 | PM_TabBarTabShiftHorizontal,
|
---|
492 | PM_TabBarTabShiftVertical,
|
---|
493 | PM_TabBarScrollButtonWidth,
|
---|
494 |
|
---|
495 | PM_MenuBarItemSpacing,
|
---|
496 | PM_ToolBarItemSpacing,
|
---|
497 |
|
---|
498 | // do not add any values below/greater than this
|
---|
499 | PM_CustomBase = 0xf0000000
|
---|
500 | };
|
---|
501 |
|
---|
502 | virtual int pixelMetric( PixelMetric metric,
|
---|
503 | const QWidget *widget = 0 ) const = 0;
|
---|
504 |
|
---|
505 |
|
---|
506 | enum ContentsType {
|
---|
507 | CT_PushButton,
|
---|
508 | CT_CheckBox,
|
---|
509 | CT_RadioButton,
|
---|
510 | CT_ToolButton,
|
---|
511 | CT_ComboBox,
|
---|
512 | CT_Splitter,
|
---|
513 | CT_DockWindow,
|
---|
514 | CT_ProgressBar,
|
---|
515 | CT_PopupMenuItem,
|
---|
516 | CT_TabBarTab,
|
---|
517 | CT_Slider,
|
---|
518 | CT_Header,
|
---|
519 | CT_LineEdit,
|
---|
520 | CT_MenuBar,
|
---|
521 | CT_SpinBox,
|
---|
522 | CT_SizeGrip,
|
---|
523 | CT_TabWidget,
|
---|
524 | CT_DialogButtons,
|
---|
525 |
|
---|
526 | // do not add any values below/greater than this
|
---|
527 | CT_CustomBase = 0xf0000000
|
---|
528 | };
|
---|
529 |
|
---|
530 | virtual QSize sizeFromContents( ContentsType contents,
|
---|
531 | const QWidget *widget,
|
---|
532 | const QSize &contentsSize,
|
---|
533 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
534 |
|
---|
535 | enum StyleHint {
|
---|
536 | // ...
|
---|
537 | // the general hints
|
---|
538 | // ...
|
---|
539 | // disabled text should be etched, ala Windows
|
---|
540 | SH_EtchDisabledText,
|
---|
541 |
|
---|
542 | // the GUI style enum, argh!
|
---|
543 | SH_GUIStyle,
|
---|
544 |
|
---|
545 | // ...
|
---|
546 | // widget specific hints
|
---|
547 | // ...
|
---|
548 | SH_ScrollBar_BackgroundMode,
|
---|
549 | SH_ScrollBar_MiddleClickAbsolutePosition,
|
---|
550 | SH_ScrollBar_ScrollWhenPointerLeavesControl,
|
---|
551 |
|
---|
552 | // QEvent::Type - which mouse event to select a tab
|
---|
553 | SH_TabBar_SelectMouseType,
|
---|
554 |
|
---|
555 | SH_TabBar_Alignment,
|
---|
556 |
|
---|
557 | SH_Header_ArrowAlignment,
|
---|
558 |
|
---|
559 | // bool - sliders snap to values while moving, ala Windows
|
---|
560 | SH_Slider_SnapToValue,
|
---|
561 |
|
---|
562 | // bool - key presses handled in a sloppy manner - ie. left on a vertical
|
---|
563 | // slider subtracts a line
|
---|
564 | SH_Slider_SloppyKeyEvents,
|
---|
565 |
|
---|
566 | // bool - center button on progress dialogs, ala Motif, else right aligned
|
---|
567 | // perhaps this should be a Qt::Alignment value
|
---|
568 | SH_ProgressDialog_CenterCancelButton,
|
---|
569 |
|
---|
570 | // Qt::AlignmentFlags - text label alignment in progress dialogs
|
---|
571 | // Center on windows, Auto|VCenter otherwize
|
---|
572 | SH_ProgressDialog_TextLabelAlignment,
|
---|
573 |
|
---|
574 | // bool - right align buttons on print dialog, ala Windows
|
---|
575 | SH_PrintDialog_RightAlignButtons,
|
---|
576 |
|
---|
577 | // bool - 1 or 2 pixel space between the menubar and the dockarea, ala Windows
|
---|
578 | // this *REALLY* needs a better name
|
---|
579 | SH_MainWindow_SpaceBelowMenuBar,
|
---|
580 |
|
---|
581 | // bool - select the text in the line edit about the listbox when selecting
|
---|
582 | // an item from the listbox, or when the line edit receives focus, ala Windows
|
---|
583 | SH_FontDialog_SelectAssociatedText,
|
---|
584 |
|
---|
585 | // bool - allows disabled menu items to be active
|
---|
586 | SH_PopupMenu_AllowActiveAndDisabled,
|
---|
587 |
|
---|
588 | // bool - pressing space activates item, ala Motif
|
---|
589 | SH_PopupMenu_SpaceActivatesItem,
|
---|
590 |
|
---|
591 | // int - number of milliseconds to wait before opening a submenu
|
---|
592 | // 256 on windows, 96 on motif
|
---|
593 | SH_PopupMenu_SubMenuPopupDelay,
|
---|
594 |
|
---|
595 | // bool - should scrollviews draw their frame only around contents (ala Motif),
|
---|
596 | // or around contents, scrollbars and corner widgets (ala Windows) ?
|
---|
597 | SH_ScrollView_FrameOnlyAroundContents,
|
---|
598 |
|
---|
599 | // bool - menubars items are navigatable by pressing alt, followed by using
|
---|
600 | // the arrow keys to select the desired item
|
---|
601 | SH_MenuBar_AltKeyNavigation,
|
---|
602 |
|
---|
603 | // bool - mouse tracking in combobox dropdown lists
|
---|
604 | SH_ComboBox_ListMouseTracking,
|
---|
605 |
|
---|
606 | // bool - mouse tracking in popupmenus
|
---|
607 | SH_PopupMenu_MouseTracking,
|
---|
608 |
|
---|
609 | // bool - mouse tracking in menubars
|
---|
610 | SH_MenuBar_MouseTracking,
|
---|
611 |
|
---|
612 | // bool - gray out selected items when loosing focus
|
---|
613 | SH_ItemView_ChangeHighlightOnFocus,
|
---|
614 |
|
---|
615 | // bool - supports shared activation among modeless widgets
|
---|
616 | SH_Widget_ShareActivation,
|
---|
617 |
|
---|
618 | // bool - workspace should just maximize the client area
|
---|
619 | SH_Workspace_FillSpaceOnMaximize,
|
---|
620 |
|
---|
621 | // bool - supports popup menu comboboxes
|
---|
622 | SH_ComboBox_Popup,
|
---|
623 |
|
---|
624 | // bool - titlebar has no border
|
---|
625 | SH_TitleBar_NoBorder,
|
---|
626 |
|
---|
627 | // bool - stop scrollbar at mouse
|
---|
628 | SH_ScrollBar_StopMouseOverSlider,
|
---|
629 |
|
---|
630 | //bool - blink cursort with selected text
|
---|
631 | SH_BlinkCursorWhenTextSelected,
|
---|
632 |
|
---|
633 | //bool - richtext selections extend the full width of the docuemnt
|
---|
634 | SH_RichText_FullWidthSelection,
|
---|
635 |
|
---|
636 | //bool - popupmenu supports scrolling instead of multicolumn mode
|
---|
637 | SH_PopupMenu_Scrollable,
|
---|
638 |
|
---|
639 | // Qt::AlignmentFlags - text label vertical alignment in groupboxes
|
---|
640 | // Center on windows, Auto|VCenter otherwize
|
---|
641 | SH_GroupBox_TextLabelVerticalAlignment,
|
---|
642 |
|
---|
643 | // Qt::QRgb - text label color in groupboxes
|
---|
644 | SH_GroupBox_TextLabelColor,
|
---|
645 |
|
---|
646 | // bool - popupmenu supports sloppy submenus
|
---|
647 | SH_PopupMenu_SloppySubMenus,
|
---|
648 |
|
---|
649 | // Qt::QRgb - table grid color
|
---|
650 | SH_Table_GridLineColor,
|
---|
651 |
|
---|
652 | // QChar - Unicode character for password char
|
---|
653 | SH_LineEdit_PasswordCharacter,
|
---|
654 |
|
---|
655 | // QDialogButtons::Button - default button
|
---|
656 | SH_DialogButtons_DefaultButton,
|
---|
657 |
|
---|
658 | // QToolBox - Boldness of the selected page title
|
---|
659 | SH_ToolBox_SelectedPageTitleBold,
|
---|
660 |
|
---|
661 | //bool - if a tabbar prefers not to have scroller arrows
|
---|
662 | SH_TabBar_PreferNoArrows,
|
---|
663 |
|
---|
664 | //bool - if left button should cause an absolute position
|
---|
665 | SH_ScrollBar_LeftClickAbsolutePosition,
|
---|
666 |
|
---|
667 | // QEvent::Type - which mouse event to select a list view expansion
|
---|
668 | SH_ListViewExpand_SelectMouseType,
|
---|
669 |
|
---|
670 | //bool - if underline for accelerators
|
---|
671 | SH_UnderlineAccelerator,
|
---|
672 |
|
---|
673 | // bool - QToolButton - if tool buttons should use a 3D frame
|
---|
674 | // when the mouse is over the button
|
---|
675 | SH_ToolButton_Uses3D,
|
---|
676 |
|
---|
677 | // do not add any values below/greater than this
|
---|
678 | SH_CustomBase = 0xf0000000
|
---|
679 | };
|
---|
680 |
|
---|
681 | virtual int styleHint( StyleHint stylehint,
|
---|
682 | const QWidget *widget = 0,
|
---|
683 | const QStyleOption& = QStyleOption::Default,
|
---|
684 | QStyleHintReturn* returnData = 0
|
---|
685 | ) const = 0;
|
---|
686 |
|
---|
687 |
|
---|
688 | enum StylePixmap {
|
---|
689 | SP_TitleBarMinButton,
|
---|
690 | SP_TitleBarMaxButton,
|
---|
691 | SP_TitleBarCloseButton,
|
---|
692 | SP_TitleBarNormalButton,
|
---|
693 | SP_TitleBarShadeButton,
|
---|
694 | SP_TitleBarUnshadeButton,
|
---|
695 | SP_DockWindowCloseButton,
|
---|
696 | SP_MessageBoxInformation,
|
---|
697 | SP_MessageBoxWarning,
|
---|
698 | SP_MessageBoxCritical,
|
---|
699 | SP_MessageBoxQuestion,
|
---|
700 |
|
---|
701 | // do not add any values below/greater than this
|
---|
702 | SP_CustomBase = 0xf0000000
|
---|
703 | };
|
---|
704 |
|
---|
705 | virtual QPixmap stylePixmap( StylePixmap stylepixmap,
|
---|
706 | const QWidget *widget = 0,
|
---|
707 | const QStyleOption& = QStyleOption::Default ) const = 0;
|
---|
708 |
|
---|
709 |
|
---|
710 | static QRect visualRect( const QRect &logical, const QWidget *w );
|
---|
711 |
|
---|
712 | static QRect visualRect( const QRect &logical, const QRect &bounding );
|
---|
713 |
|
---|
714 |
|
---|
715 |
|
---|
716 |
|
---|
717 | // Old 2.x QStyle API
|
---|
718 |
|
---|
719 | #ifndef QT_NO_COMPAT
|
---|
720 | int defaultFrameWidth() const
|
---|
721 | {
|
---|
722 | return pixelMetric( PM_DefaultFrameWidth );
|
---|
723 | }
|
---|
724 | void tabbarMetrics( const QWidget* t,
|
---|
725 | int& hf, int& vf, int& ov ) const
|
---|
726 | {
|
---|
727 | hf = pixelMetric( PM_TabBarTabHSpace, t );
|
---|
728 | vf = pixelMetric( PM_TabBarTabVSpace, t );
|
---|
729 | ov = pixelMetric( PM_TabBarBaseOverlap, t );
|
---|
730 | }
|
---|
731 | QSize scrollBarExtent() const
|
---|
732 | {
|
---|
733 | return QSize(pixelMetric(PM_ScrollBarExtent),
|
---|
734 | pixelMetric(PM_ScrollBarExtent));
|
---|
735 | }
|
---|
736 | #endif
|
---|
737 |
|
---|
738 |
|
---|
739 | private:
|
---|
740 | QStylePrivate * d;
|
---|
741 |
|
---|
742 | #if defined(Q_DISABLE_COPY)
|
---|
743 | QStyle( const QStyle & );
|
---|
744 | QStyle& operator=( const QStyle & );
|
---|
745 | #endif
|
---|
746 | };
|
---|
747 |
|
---|
748 | #endif // QT_NO_STYLE
|
---|
749 | #endif // QSTYLE_H
|
---|