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#if QT_CONFIG(shortcut)
55# include <QtGui/QKeySequence>
56#endif
57
58QT_BEGIN_NAMESPACE
59
60class QIcon;
61class QIconEngine;
62class QMenu;
63class QMenuBar;
64class QPlatformMenuItem;
65class QPlatformMenu;
66class QPlatformMenuBar;
67class QPlatformDialogHelper;
68class QPlatformSystemTrayIcon;
69class QPlatformThemePrivate;
70class QVariant;
71class QPalette;
72class QFont;
73class QPixmap;
74class QSizeF;
75class QFileInfo;
76
77class Q_GUI_EXPORT QPlatformTheme
78{
79 Q_DECLARE_PRIVATE(QPlatformTheme)
80public:
81 Q_DISABLE_COPY_MOVE(QPlatformTheme)
82
83 enum ThemeHint {
84 CursorFlashTime,
85 KeyboardInputInterval,
86 MouseDoubleClickInterval,
87 StartDragDistance,
88 StartDragTime,
89 KeyboardAutoRepeatRate,
90 PasswordMaskDelay,
91 StartDragVelocity,
92 TextCursorWidth,
93 DropShadow,
94 MaximumScrollBarDragDistance,
95 ToolButtonStyle,
96 ToolBarIconSize,
97 ItemViewActivateItemOnSingleClick,
98 SystemIconThemeName,
99 SystemIconFallbackThemeName,
100 IconThemeSearchPaths,
101 StyleNames,
102 WindowAutoPlacement,
103 DialogButtonBoxLayout,
104 DialogButtonBoxButtonsHaveIcons,
105 UseFullScreenForPopupMenu,
106 KeyboardScheme,
107 UiEffects,
108 SpellCheckUnderlineStyle,
109 TabFocusBehavior,
110 IconPixmapSizes,
111 PasswordMaskCharacter,
112 DialogSnapToDefaultButton,
113 ContextMenuOnMouseRelease,
114 MousePressAndHoldInterval,
115 MouseDoubleClickDistance,
116 WheelScrollLines,
117 TouchDoubleTapDistance,
118 ShowShortcutsInContextMenus,
119 IconFallbackSearchPaths,
120 MouseQuickSelectionThreshold,
121 InteractiveResizeAcrossScreens,
122 };
123
124 enum DialogType {
125 FileDialog,
126 ColorDialog,
127 FontDialog,
128 MessageDialog
129 };
130
131 enum class Appearance {
132 Unknown = 0x0000,
133 Light = 0x0001,
134 Dark = 0x0002
135 };
136
137 enum Palette {
138 SystemPalette,
139 ToolTipPalette,
140 ToolButtonPalette,
141 ButtonPalette,
142 CheckBoxPalette,
143 RadioButtonPalette,
144 HeaderPalette,
145 ComboBoxPalette,
146 ItemViewPalette,
147 MessageBoxLabelPelette,
148 MessageBoxLabelPalette = MessageBoxLabelPelette,
149 TabBarPalette,
150 LabelPalette,
151 GroupBoxPalette,
152 MenuPalette,
153 MenuBarPalette,
154 TextEditPalette,
155 TextLineEditPalette,
156 NPalettes
157 };
158
159 enum Font {
160 SystemFont,
161 MenuFont,
162 MenuBarFont,
163 MenuItemFont,
164 MessageBoxFont,
165 LabelFont,
166 TipLabelFont,
167 StatusBarFont,
168 TitleBarFont,
169 MdiSubWindowTitleFont,
170 DockWidgetTitleFont,
171 PushButtonFont,
172 CheckBoxFont,
173 RadioButtonFont,
174 ToolButtonFont,
175 ItemViewFont,
176 ListViewFont,
177 HeaderViewFont,
178 ListBoxFont,
179 ComboMenuItemFont,
180 ComboLineEditFont,
181 SmallFont,
182 MiniFont,
183 FixedFont,
184 GroupBoxTitleFont,
185 TabButtonFont,
186 EditorFont,
187 NFonts
188 };
189
190 enum StandardPixmap { // Keep in sync with QStyle::StandardPixmap
191 TitleBarMenuButton,
192 TitleBarMinButton,
193 TitleBarMaxButton,
194 TitleBarCloseButton,
195 TitleBarNormalButton,
196 TitleBarShadeButton,
197 TitleBarUnshadeButton,
198 TitleBarContextHelpButton,
199 DockWidgetCloseButton,
200 MessageBoxInformation,
201 MessageBoxWarning,
202 MessageBoxCritical,
203 MessageBoxQuestion,
204 DesktopIcon,
205 TrashIcon,
206 ComputerIcon,
207 DriveFDIcon,
208 DriveHDIcon,
209 DriveCDIcon,
210 DriveDVDIcon,
211 DriveNetIcon,
212 DirOpenIcon,
213 DirClosedIcon,
214 DirLinkIcon,
215 DirLinkOpenIcon,
216 FileIcon,
217 FileLinkIcon,
218 ToolBarHorizontalExtensionButton,
219 ToolBarVerticalExtensionButton,
220 FileDialogStart,
221 FileDialogEnd,
222 FileDialogToParent,
223 FileDialogNewFolder,
224 FileDialogDetailedView,
225 FileDialogInfoView,
226 FileDialogContentsView,
227 FileDialogListView,
228 FileDialogBack,
229 DirIcon,
230 DialogOkButton,
231 DialogCancelButton,
232 DialogHelpButton,
233 DialogOpenButton,
234 DialogSaveButton,
235 DialogCloseButton,
236 DialogApplyButton,
237 DialogResetButton,
238 DialogDiscardButton,
239 DialogYesButton,
240 DialogNoButton,
241 ArrowUp,
242 ArrowDown,
243 ArrowLeft,
244 ArrowRight,
245 ArrowBack,
246 ArrowForward,
247 DirHomeIcon,
248 CommandLink,
249 VistaShield,
250 BrowserReload,
251 BrowserStop,
252 MediaPlay,
253 MediaStop,
254 MediaPause,
255 MediaSkipForward,
256 MediaSkipBackward,
257 MediaSeekForward,
258 MediaSeekBackward,
259 MediaVolume,
260 MediaVolumeMuted,
261 LineEditClearButton,
262 // do not add any values below/greater than this
263 CustomBase = 0xf0000000
264 };
265
266 enum KeyboardSchemes
267 {
268 WindowsKeyboardScheme,
269 MacKeyboardScheme,
270 X11KeyboardScheme,
271 KdeKeyboardScheme,
272 GnomeKeyboardScheme,
273 CdeKeyboardScheme
274 };
275
276 enum UiEffect
277 {
278 GeneralUiEffect = 0x1,
279 AnimateMenuUiEffect = 0x2,
280 FadeMenuUiEffect = 0x4,
281 AnimateComboUiEffect = 0x8,
282 AnimateTooltipUiEffect = 0x10,
283 FadeTooltipUiEffect = 0x20,
284 AnimateToolBoxUiEffect = 0x40,
285 HoverEffect = 0x80
286 };
287
288 enum IconOption {
289 DontUseCustomDirectoryIcons = 0x01
290 };
291 Q_DECLARE_FLAGS(IconOptions, IconOption)
292
293 explicit QPlatformTheme();
294 virtual ~QPlatformTheme();
295
296 virtual QPlatformMenuItem* createPlatformMenuItem() const;
297 virtual QPlatformMenu* createPlatformMenu() const;
298 virtual QPlatformMenuBar* createPlatformMenuBar() const;
299 virtual void showPlatformMenuBar() {}
300
301 virtual bool usePlatformNativeDialog(DialogType type) const;
302 virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
303
304#ifndef QT_NO_SYSTEMTRAYICON
305 virtual QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const;
306#endif
307
308 virtual Appearance appearance() const;
309
310 virtual const QPalette *palette(Palette type = SystemPalette) const;
311
312 virtual const QFont *font(Font type = SystemFont) const;
313
314 virtual QVariant themeHint(ThemeHint hint) const;
315
316 virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
317 virtual QIcon fileIcon(const QFileInfo &fileInfo,
318 QPlatformTheme::IconOptions iconOptions = { }) const;
319 virtual QIconEngine *createIconEngine(const QString &iconName) const;
320
321#if QT_CONFIG(shortcut)
322 virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
323#endif
324
325 virtual QString standardButtonText(int button) const;
326#if QT_CONFIG(shortcut)
327 virtual QKeySequence standardButtonShortcut(int button) const;
328#endif
329
330 static QVariant defaultThemeHint(ThemeHint hint);
331 static QString defaultStandardButtonText(int button);
332 static QString removeMnemonics(const QString &original);
333
334protected:
335 explicit QPlatformTheme(QPlatformThemePrivate *priv);
336 QScopedPointer<QPlatformThemePrivate> d_ptr;
337};
338
339QT_END_NAMESPACE
340
341#endif // QPLATFORMTHEME_H
342

source code of qtbase/src/gui/kernel/qplatformtheme.h