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

source code of kwidgetsaddons/src/kstandardguiitem.h