1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#ifndef kstandardguiitem_h
9#define kstandardguiitem_h
10
11#include <kwidgetsaddons_export.h>
12
13#include <QPair>
14
15#include <kguiitem.h>
16
17class QString;
18
19/**
20 * @short Provides a set of standardized KGuiItems.
21 *
22 * The various methods return standardized KGuiItem's
23 * conforming to the KDE UI Standards. Use them instead of creating
24 * your own.
25 *
26 * @author Holger Freyther <freyther@kde.org>
27 */
28namespace KStandardGuiItem
29{
30/**
31 * The back and forward items by default use the RTL settings for Hebrew
32 * and Arab countries. If you want those actions to ignore the RTL value
33 * and force 'Western' behavior instead, use the IgnoreRTL value instead.
34 */
35enum BidiMode { UseRTL = 0, IgnoreRTL };
36
37enum StandardItem {
38 Ok = 1,
39 Cancel,
40 Discard,
41 Save,
42 DontSave,
43 SaveAs,
44 Apply,
45 Clear,
46 Help,
47 Defaults,
48 Close,
49 Back,
50 Forward,
51 Print,
52 Continue,
53 Open,
54 Quit,
55 AdminMode,
56 Reset,
57 Delete,
58 Insert,
59 Configure,
60 Find,
61 Stop,
62 Add,
63 Remove,
64 Test,
65 Properties,
66 Overwrite,
67 CloseWindow,
68 CloseDocument,
69};
70
71/**
72 * Returns the gui item for the given identifier @p id.
73 *
74 * @param id the identifier to search for
75 */
76KWIDGETSADDONS_EXPORT KGuiItem guiItem(StandardItem id);
77
78/**
79 * Returns the name of the gui item for the given identifier @p id.
80 *
81 * @param id the identifier to search for
82 */
83KWIDGETSADDONS_EXPORT QString standardItem(StandardItem id);
84
85/**
86 * Returns the 'Ok' gui item.
87 */
88KWIDGETSADDONS_EXPORT KGuiItem ok();
89
90/**
91 * Returns the 'Cancel' gui item.
92 */
93KWIDGETSADDONS_EXPORT KGuiItem cancel();
94
95/**
96 * Returns the 'Insert' gui item.
97 */
98KWIDGETSADDONS_EXPORT KGuiItem insert();
99
100/**
101 * Returns the 'Discard' gui item.
102 */
103KWIDGETSADDONS_EXPORT KGuiItem discard();
104
105/**
106 * Returns the 'Save' gui item.
107 */
108KWIDGETSADDONS_EXPORT KGuiItem save();
109
110/**
111 * Returns the 'Help' gui item.
112 */
113KWIDGETSADDONS_EXPORT KGuiItem help();
114
115/**
116 * Returns the 'DontSave' gui item.
117 */
118KWIDGETSADDONS_EXPORT KGuiItem dontSave();
119
120/**
121 * Returns the 'SaveAs' gui item.
122 */
123KWIDGETSADDONS_EXPORT KGuiItem saveAs();
124
125/**
126 * Returns the 'Apply' gui item.
127 */
128KWIDGETSADDONS_EXPORT KGuiItem apply();
129
130/**
131 * Returns the 'Clear' gui item.
132 */
133KWIDGETSADDONS_EXPORT KGuiItem clear();
134
135/**
136 * Returns the 'Defaults' gui item.
137 */
138KWIDGETSADDONS_EXPORT KGuiItem defaults();
139
140/**
141 * Returns the 'Close' gui item.
142 */
143KWIDGETSADDONS_EXPORT KGuiItem close();
144
145/**
146 * Returns the 'CloseWindow' gui item.
147 * @since 4.3
148 */
149KWIDGETSADDONS_EXPORT KGuiItem closeWindow();
150
151/**
152 * Returns the 'CloseDocument' gui item.
153 * @since 4.3
154 */
155KWIDGETSADDONS_EXPORT KGuiItem closeDocument();
156
157/**
158 * Returns the 'Print' gui item.
159 */
160KWIDGETSADDONS_EXPORT KGuiItem print();
161
162/**
163 * Returns the 'Properties' gui item.
164 */
165KWIDGETSADDONS_EXPORT KGuiItem properties();
166
167/**
168 * Returns the 'Reset' gui item.
169 */
170KWIDGETSADDONS_EXPORT KGuiItem reset();
171
172/**
173 * Returns the 'Overwrite' gui item.
174 */
175KWIDGETSADDONS_EXPORT KGuiItem overwrite();
176
177/**
178 * Returns a KGuiItem suiting for cases where code or functionality
179 * runs under root privileges. Used in conjunction with KConfig Modules.
180 */
181KWIDGETSADDONS_EXPORT KGuiItem adminMode();
182
183/**
184 * Returns the 'Continue' gui item. The short name is due to 'continue' being a
185 * reserved word in the C++ language.
186 */
187KWIDGETSADDONS_EXPORT KGuiItem cont();
188
189/**
190 * Returns the 'Delete' gui item. The short name is due to 'delete' being a
191 * reserved word in the C++ language.
192 */
193KWIDGETSADDONS_EXPORT KGuiItem del();
194
195/**
196 * Returns the 'Open' gui item.
197 */
198KWIDGETSADDONS_EXPORT KGuiItem open();
199
200/**
201 * Returns the 'Back' gui item, like Konqueror's back button.
202 * This GUI item can optionally honor the user's setting for BiDi, so the
203 * icon for right-to-left languages (Hebrew and Arab) has the arrow
204 * pointing in the opposite direction.
205 * By default the arrow points in the Western 'back' direction (i.e.
206 * to the left). This is because usually you only want the Bidi aware
207 * GUI item if you also want the 'forward' item. Those two are available
208 * in the separate backAndForward() method.
209 */
210KWIDGETSADDONS_EXPORT KGuiItem back(BidiMode useBidi = IgnoreRTL);
211
212/**
213 * Returns the 'Forward' gui item, like Konqueror's forward
214 * button. This GUI item can optionally honor the user's setting for BiDi,
215 * so the icon for right-to-left languages (Hebrew and Arab) has the arrow
216 * pointing in the opposite direction.
217 * By default the arrow points in the Western 'forward' direction (i.e.
218 * to the right). This is because usually you only want the Bidi aware
219 * GUI item if you also want the 'back' item. Those two are available
220 * in the separate backAndForward() method.
221 */
222KWIDGETSADDONS_EXPORT KGuiItem forward(BidiMode useBidi = IgnoreRTL);
223
224/**
225 * Returns the 'Configure' gui item.
226 */
227KWIDGETSADDONS_EXPORT KGuiItem configure();
228
229/**
230 * Return both a back and a forward gui item. This function always returns
231 * items that are aware of the Right-to-Left setting for Arab and Hebrew
232 * locales. If you have a reason for wanting the 'Western' back/forward
233 * buttons, please use the back() and forward() items instead.
234 */
235KWIDGETSADDONS_EXPORT QPair<KGuiItem, KGuiItem> backAndForward();
236
237/**
238 * Returns the 'Quit' gui item.
239 */
240KWIDGETSADDONS_EXPORT KGuiItem quit();
241
242/**
243 * Returns the 'Find' gui item.
244 */
245KWIDGETSADDONS_EXPORT KGuiItem find();
246
247/**
248 * Returns the 'Stop' gui item.
249 */
250KWIDGETSADDONS_EXPORT KGuiItem stop();
251
252/**
253 * Returns the 'Add' gui item.
254 */
255KWIDGETSADDONS_EXPORT KGuiItem add();
256
257/**
258 * Returns the 'Remove' gui item.
259 */
260KWIDGETSADDONS_EXPORT KGuiItem remove();
261
262/**
263 * Returns the 'Test' gui item.
264 */
265KWIDGETSADDONS_EXPORT KGuiItem test();
266
267KWIDGETSADDONS_EXPORT void assign(QPushButton *button, StandardItem item);
268}
269
270#endif
271

source code of kwidgetsaddons/src/kstandardguiitem.h