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 };
122
123 enum DialogType {
124 FileDialog,
125 ColorDialog,
126 FontDialog,
127 MessageDialog
128 };
129
130 enum Palette {
131 SystemPalette,
132 ToolTipPalette,
133 ToolButtonPalette,
134 ButtonPalette,
135 CheckBoxPalette,
136 RadioButtonPalette,
137 HeaderPalette,
138 ComboBoxPalette,
139 ItemViewPalette,
140 MessageBoxLabelPelette,
141 MessageBoxLabelPalette = MessageBoxLabelPelette,
142 TabBarPalette,
143 LabelPalette,
144 GroupBoxPalette,
145 MenuPalette,
146 MenuBarPalette,
147 TextEditPalette,
148 TextLineEditPalette,
149 NPalettes
150 };
151
152 enum Font {
153 SystemFont,
154 MenuFont,
155 MenuBarFont,
156 MenuItemFont,
157 MessageBoxFont,
158 LabelFont,
159 TipLabelFont,
160 StatusBarFont,
161 TitleBarFont,
162 MdiSubWindowTitleFont,
163 DockWidgetTitleFont,
164 PushButtonFont,
165 CheckBoxFont,
166 RadioButtonFont,
167 ToolButtonFont,
168 ItemViewFont,
169 ListViewFont,
170 HeaderViewFont,
171 ListBoxFont,
172 ComboMenuItemFont,
173 ComboLineEditFont,
174 SmallFont,
175 MiniFont,
176 FixedFont,
177 GroupBoxTitleFont,
178 TabButtonFont,
179 EditorFont,
180 NFonts
181 };
182
183 enum StandardPixmap { // Keep in sync with QStyle::StandardPixmap
184 TitleBarMenuButton,
185 TitleBarMinButton,
186 TitleBarMaxButton,
187 TitleBarCloseButton,
188 TitleBarNormalButton,
189 TitleBarShadeButton,
190 TitleBarUnshadeButton,
191 TitleBarContextHelpButton,
192 DockWidgetCloseButton,
193 MessageBoxInformation,
194 MessageBoxWarning,
195 MessageBoxCritical,
196 MessageBoxQuestion,
197 DesktopIcon,
198 TrashIcon,
199 ComputerIcon,
200 DriveFDIcon,
201 DriveHDIcon,
202 DriveCDIcon,
203 DriveDVDIcon,
204 DriveNetIcon,
205 DirOpenIcon,
206 DirClosedIcon,
207 DirLinkIcon,
208 DirLinkOpenIcon,
209 FileIcon,
210 FileLinkIcon,
211 ToolBarHorizontalExtensionButton,
212 ToolBarVerticalExtensionButton,
213 FileDialogStart,
214 FileDialogEnd,
215 FileDialogToParent,
216 FileDialogNewFolder,
217 FileDialogDetailedView,
218 FileDialogInfoView,
219 FileDialogContentsView,
220 FileDialogListView,
221 FileDialogBack,
222 DirIcon,
223 DialogOkButton,
224 DialogCancelButton,
225 DialogHelpButton,
226 DialogOpenButton,
227 DialogSaveButton,
228 DialogCloseButton,
229 DialogApplyButton,
230 DialogResetButton,
231 DialogDiscardButton,
232 DialogYesButton,
233 DialogNoButton,
234 ArrowUp,
235 ArrowDown,
236 ArrowLeft,
237 ArrowRight,
238 ArrowBack,
239 ArrowForward,
240 DirHomeIcon,
241 CommandLink,
242 VistaShield,
243 BrowserReload,
244 BrowserStop,
245 MediaPlay,
246 MediaStop,
247 MediaPause,
248 MediaSkipForward,
249 MediaSkipBackward,
250 MediaSeekForward,
251 MediaSeekBackward,
252 MediaVolume,
253 MediaVolumeMuted,
254 LineEditClearButton,
255 // do not add any values below/greater than this
256 CustomBase = 0xf0000000
257 };
258
259 enum KeyboardSchemes
260 {
261 WindowsKeyboardScheme,
262 MacKeyboardScheme,
263 X11KeyboardScheme,
264 KdeKeyboardScheme,
265 GnomeKeyboardScheme,
266 CdeKeyboardScheme
267 };
268
269 enum UiEffect
270 {
271 GeneralUiEffect = 0x1,
272 AnimateMenuUiEffect = 0x2,
273 FadeMenuUiEffect = 0x4,
274 AnimateComboUiEffect = 0x8,
275 AnimateTooltipUiEffect = 0x10,
276 FadeTooltipUiEffect = 0x20,
277 AnimateToolBoxUiEffect = 0x40,
278 HoverEffect = 0x80
279 };
280
281 enum IconOption {
282 DontUseCustomDirectoryIcons = 0x01
283 };
284 Q_DECLARE_FLAGS(IconOptions, IconOption)
285
286 explicit QPlatformTheme();
287 virtual ~QPlatformTheme();
288
289 virtual QPlatformMenuItem* createPlatformMenuItem() const;
290 virtual QPlatformMenu* createPlatformMenu() const;
291 virtual QPlatformMenuBar* createPlatformMenuBar() const;
292 virtual void showPlatformMenuBar() {}
293
294 virtual bool usePlatformNativeDialog(DialogType type) const;
295 virtual QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;
296
297#ifndef QT_NO_SYSTEMTRAYICON
298 virtual QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const;
299#endif
300
301 virtual const QPalette *palette(Palette type = SystemPalette) const;
302
303 virtual const QFont *font(Font type = SystemFont) const;
304
305 virtual QVariant themeHint(ThemeHint hint) const;
306
307 virtual QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const;
308 virtual QIcon fileIcon(const QFileInfo &fileInfo,
309 QPlatformTheme::IconOptions iconOptions = { }) const;
310 virtual QIconEngine *createIconEngine(const QString &iconName) const;
311
312#if QT_CONFIG(shortcut)
313 virtual QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const;
314#endif
315
316 virtual QString standardButtonText(int button) const;
317#if QT_CONFIG(shortcut)
318 virtual QKeySequence standardButtonShortcut(int button) const;
319#endif
320
321 static QVariant defaultThemeHint(ThemeHint hint);
322 static QString defaultStandardButtonText(int button);
323 static QString removeMnemonics(const QString &original);
324
325protected:
326 explicit QPlatformTheme(QPlatformThemePrivate *priv);
327 QScopedPointer<QPlatformThemePrivate> d_ptr;
328};
329
330QT_END_NAMESPACE
331
332#endif // QPLATFORMTHEME_H
333