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