KWidgetsAddons

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

KDE's Doxygen guidelines are available online.