1 | // Copyright (C) 2016 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 QPLATFORMTHEME_H |
5 | #define QPLATFORMTHEME_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is part of the QPA API and is not meant to be used |
12 | // in applications. Usage of this API may make your code |
13 | // source and binary incompatible with future versions of Qt. |
14 | // |
15 | |
16 | #include <QtGui/qtguiglobal.h> |
17 | #include <QtCore/QObject> |
18 | #include <QtCore/QScopedPointer> |
19 | #if QT_CONFIG(shortcut) |
20 | # include <QtGui/QKeySequence> |
21 | #endif |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class QIcon; |
26 | class QIconEngine; |
27 | class ; |
28 | class ; |
29 | class ; |
30 | class ; |
31 | class ; |
32 | class QPlatformDialogHelper; |
33 | class QPlatformSystemTrayIcon; |
34 | class QPlatformThemePrivate; |
35 | class QVariant; |
36 | class QPalette; |
37 | class QFont; |
38 | class QPixmap; |
39 | class QSizeF; |
40 | class QFileInfo; |
41 | |
42 | class Q_GUI_EXPORT QPlatformTheme |
43 | { |
44 | Q_GADGET |
45 | Q_DECLARE_PRIVATE(QPlatformTheme) |
46 | |
47 | public: |
48 | Q_DISABLE_COPY_MOVE(QPlatformTheme) |
49 | |
50 | enum ThemeHint { |
51 | CursorFlashTime, |
52 | KeyboardInputInterval, |
53 | MouseDoubleClickInterval, |
54 | StartDragDistance, |
55 | StartDragTime, |
56 | KeyboardAutoRepeatRate, |
57 | PasswordMaskDelay, |
58 | StartDragVelocity, |
59 | TextCursorWidth, |
60 | DropShadow, |
61 | MaximumScrollBarDragDistance, |
62 | ToolButtonStyle, |
63 | ToolBarIconSize, |
64 | ItemViewActivateItemOnSingleClick, |
65 | SystemIconThemeName, |
66 | SystemIconFallbackThemeName, |
67 | IconThemeSearchPaths, |
68 | StyleNames, |
69 | WindowAutoPlacement, |
70 | DialogButtonBoxLayout, |
71 | DialogButtonBoxButtonsHaveIcons, |
72 | , |
73 | KeyboardScheme, |
74 | UiEffects, |
75 | SpellCheckUnderlineStyle, |
76 | TabFocusBehavior, |
77 | IconPixmapSizes, |
78 | PasswordMaskCharacter, |
79 | DialogSnapToDefaultButton, |
80 | , |
81 | MousePressAndHoldInterval, |
82 | MouseDoubleClickDistance, |
83 | WheelScrollLines, |
84 | TouchDoubleTapDistance, |
85 | , |
86 | IconFallbackSearchPaths, |
87 | MouseQuickSelectionThreshold, |
88 | InteractiveResizeAcrossScreens, |
89 | ShowDirectoriesFirst, |
90 | PreselectFirstFileInDirectory, |
91 | ButtonPressKeys, |
92 | SetFocusOnTouchRelease, |
93 | FlickStartDistance, |
94 | FlickMaximumVelocity, |
95 | FlickDeceleration, |
96 | , |
97 | MouseCursorTheme, |
98 | MouseCursorSize, |
99 | UnderlineShortcut, |
100 | }; |
101 | Q_ENUM(ThemeHint) |
102 | |
103 | enum DialogType { |
104 | FileDialog, |
105 | ColorDialog, |
106 | FontDialog, |
107 | MessageDialog |
108 | }; |
109 | Q_ENUM(DialogType); |
110 | |
111 | enum Palette { |
112 | SystemPalette, |
113 | ToolTipPalette, |
114 | ToolButtonPalette, |
115 | ButtonPalette, |
116 | CheckBoxPalette, |
117 | RadioButtonPalette, |
118 | , |
119 | ComboBoxPalette, |
120 | ItemViewPalette, |
121 | MessageBoxLabelPelette, |
122 | MessageBoxLabelPalette = MessageBoxLabelPelette, |
123 | TabBarPalette, |
124 | LabelPalette, |
125 | GroupBoxPalette, |
126 | , |
127 | , |
128 | TextEditPalette, |
129 | TextLineEditPalette, |
130 | NPalettes |
131 | }; |
132 | Q_ENUM(Palette) |
133 | |
134 | enum Font { |
135 | SystemFont, |
136 | , |
137 | , |
138 | , |
139 | MessageBoxFont, |
140 | LabelFont, |
141 | TipLabelFont, |
142 | StatusBarFont, |
143 | TitleBarFont, |
144 | MdiSubWindowTitleFont, |
145 | DockWidgetTitleFont, |
146 | PushButtonFont, |
147 | CheckBoxFont, |
148 | RadioButtonFont, |
149 | ToolButtonFont, |
150 | ItemViewFont, |
151 | ListViewFont, |
152 | , |
153 | ListBoxFont, |
154 | , |
155 | ComboLineEditFont, |
156 | SmallFont, |
157 | MiniFont, |
158 | FixedFont, |
159 | GroupBoxTitleFont, |
160 | TabButtonFont, |
161 | EditorFont, |
162 | NFonts |
163 | }; |
164 | Q_ENUM(Font) |
165 | |
166 | enum StandardPixmap { // Keep in sync with QStyle::StandardPixmap |
167 | , |
168 | TitleBarMinButton, |
169 | TitleBarMaxButton, |
170 | TitleBarCloseButton, |
171 | TitleBarNormalButton, |
172 | TitleBarShadeButton, |
173 | TitleBarUnshadeButton, |
174 | TitleBarContextHelpButton, |
175 | DockWidgetCloseButton, |
176 | MessageBoxInformation, |
177 | MessageBoxWarning, |
178 | MessageBoxCritical, |
179 | MessageBoxQuestion, |
180 | DesktopIcon, |
181 | TrashIcon, |
182 | ComputerIcon, |
183 | DriveFDIcon, |
184 | DriveHDIcon, |
185 | DriveCDIcon, |
186 | DriveDVDIcon, |
187 | DriveNetIcon, |
188 | DirOpenIcon, |
189 | DirClosedIcon, |
190 | DirLinkIcon, |
191 | DirLinkOpenIcon, |
192 | FileIcon, |
193 | FileLinkIcon, |
194 | ToolBarHorizontalExtensionButton, |
195 | ToolBarVerticalExtensionButton, |
196 | FileDialogStart, |
197 | FileDialogEnd, |
198 | FileDialogToParent, |
199 | FileDialogNewFolder, |
200 | FileDialogDetailedView, |
201 | FileDialogInfoView, |
202 | FileDialogContentsView, |
203 | FileDialogListView, |
204 | FileDialogBack, |
205 | DirIcon, |
206 | DialogOkButton, |
207 | DialogCancelButton, |
208 | DialogHelpButton, |
209 | DialogOpenButton, |
210 | DialogSaveButton, |
211 | DialogCloseButton, |
212 | DialogApplyButton, |
213 | DialogResetButton, |
214 | DialogDiscardButton, |
215 | DialogYesButton, |
216 | DialogNoButton, |
217 | ArrowUp, |
218 | ArrowDown, |
219 | ArrowLeft, |
220 | ArrowRight, |
221 | ArrowBack, |
222 | ArrowForward, |
223 | DirHomeIcon, |
224 | CommandLink, |
225 | VistaShield, |
226 | BrowserReload, |
227 | BrowserStop, |
228 | MediaPlay, |
229 | MediaStop, |
230 | MediaPause, |
231 | MediaSkipForward, |
232 | MediaSkipBackward, |
233 | MediaSeekForward, |
234 | MediaSeekBackward, |
235 | MediaVolume, |
236 | MediaVolumeMuted, |
237 | LineEditClearButton, |
238 | DialogYesToAllButton, |
239 | DialogNoToAllButton, |
240 | DialogSaveAllButton, |
241 | DialogAbortButton, |
242 | DialogRetryButton, |
243 | DialogIgnoreButton, |
244 | RestoreDefaultsButton, |
245 | TabCloseButton, |
246 | NStandardPixmap, // assertion value for sync with QStyle::StandardPixmap |
247 | |
248 | // do not add any values below/greater than this |
249 | CustomBase = 0xf0000000 |
250 | }; |
251 | Q_ENUM(StandardPixmap) |
252 | |
253 | enum KeyboardSchemes |
254 | { |
255 | WindowsKeyboardScheme, |
256 | MacKeyboardScheme, |
257 | X11KeyboardScheme, |
258 | KdeKeyboardScheme, |
259 | GnomeKeyboardScheme, |
260 | CdeKeyboardScheme |
261 | }; |
262 | Q_ENUM(KeyboardSchemes) |
263 | |
264 | enum UiEffect |
265 | { |
266 | GeneralUiEffect = 0x1, |
267 | = 0x2, |
268 | = 0x4, |
269 | AnimateComboUiEffect = 0x8, |
270 | AnimateTooltipUiEffect = 0x10, |
271 | FadeTooltipUiEffect = 0x20, |
272 | AnimateToolBoxUiEffect = 0x40, |
273 | HoverEffect = 0x80 |
274 | }; |
275 | Q_ENUM(UiEffect) |
276 | |
277 | enum IconOption { |
278 | DontUseCustomDirectoryIcons = 0x01 |
279 | }; |
280 | Q_DECLARE_FLAGS(IconOptions, IconOption) |
281 | |
282 | explicit QPlatformTheme(); |
283 | virtual ~QPlatformTheme(); |
284 | |
285 | virtual QPlatformMenuItem* () const; |
286 | virtual QPlatformMenu* () const; |
287 | virtual QPlatformMenuBar* () const; |
288 | virtual void () {} |
289 | |
290 | virtual bool usePlatformNativeDialog(DialogType type) const; |
291 | virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const; |
292 | |
293 | #ifndef QT_NO_SYSTEMTRAYICON |
294 | virtual QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const; |
295 | #endif |
296 | |
297 | virtual Qt::ColorScheme colorScheme() const; |
298 | |
299 | virtual const QPalette *palette(Palette type = SystemPalette) const; |
300 | |
301 | virtual const QFont *font(Font type = SystemFont) const; |
302 | |
303 | virtual QVariant themeHint(ThemeHint hint) const; |
304 | |
305 | virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const; |
306 | virtual QIcon fileIcon(const QFileInfo &fileInfo, |
307 | QPlatformTheme::IconOptions iconOptions = { }) const; |
308 | virtual QIconEngine *createIconEngine(const QString &iconName) const; |
309 | |
310 | #if QT_CONFIG(shortcut) |
311 | virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const; |
312 | #endif |
313 | |
314 | virtual QString standardButtonText(int button) const; |
315 | #if QT_CONFIG(shortcut) |
316 | virtual QKeySequence standardButtonShortcut(int button) const; |
317 | #endif |
318 | |
319 | static QVariant defaultThemeHint(ThemeHint hint); |
320 | static QString defaultStandardButtonText(int button); |
321 | static QString removeMnemonics(const QString &original); |
322 | QString name() const; |
323 | |
324 | protected: |
325 | explicit QPlatformTheme(QPlatformThemePrivate *priv); |
326 | QScopedPointer<QPlatformThemePrivate> d_ptr; |
327 | |
328 | private: |
329 | friend class QPlatformThemeFactory; |
330 | }; |
331 | |
332 | QT_END_NAMESPACE |
333 | |
334 | #endif // QPLATFORMTHEME_H |
335 | |