File: kstandardguiitem.h

package info (click to toggle)
kde4libs 4%3A4.14.2-5%2Bdeb8u2
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 82,428 kB
  • ctags: 99,415
  • sloc: cpp: 761,864; xml: 12,344; ansic: 6,295; java: 4,060; perl: 2,938; yacc: 2,507; python: 1,207; sh: 1,179; ruby: 337; lex: 278; makefile: 29
file content (264 lines) | stat: -rw-r--r-- 7,012 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/* This file is part of the KDE libraries
   Copyright (C) 2001 Holger Freyther <freyther@kde.org>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef kstandardguiitem_h
#define kstandardguiitem_h

#include <kdeui_export.h>

#include <QtCore/QPair>

#include <kguiitem.h>

class QString;

/**
 * @short Provides a set of standardized KGuiItems.
 *
 * The various KDEUI_EXPORT methods returns standardized @ref KGuiItem's
 * conforming to the KDE UI Standards. Use them instead of creating
 * your own.
 *
 * @author Holger Freyther <freyther@kde.org>
 */
namespace KStandardGuiItem
{
    /**
     * The back and forward items by default use the RTL settings for Hebrew
     * and Arab countries. If you want those actions to ignore the RTL value
     * and force 'Western' behavior instead, use the IgnoreRTL value instead.
     */
    enum BidiMode { UseRTL = 0, IgnoreRTL };

    enum StandardItem
    {
        Ok=1, Cancel, Yes, No, Discard, Save, DontSave, SaveAs, Apply, Clear,
        Help, Defaults, Close, Back, Forward, Print, Continue, Open, Quit,
        AdminMode, Reset, Delete, Insert, Configure, Find, Stop, Add, Remove,
        Test, Properties, Overwrite, CloseWindow, CloseDocument
    };

    /**
     * Returns the gui item for the given identifier @param id.
     *
     * @param id the identifier to search for
     */
    KDEUI_EXPORT KGuiItem guiItem( StandardItem id );

    /**
     * Returns the name of the gui item for the given identifier @param id.
     *
     * @param id the identifier to search for
     */
    KDEUI_EXPORT QString standardItem( StandardItem id );

    /**
     * Returns the 'Ok' gui item.
     */
    KDEUI_EXPORT KGuiItem ok();

    /**
     * Returns the 'Cancel' gui item.
     */
    KDEUI_EXPORT KGuiItem cancel();

    /**
     * Returns the 'Yes' gui item.
     */
    KDEUI_EXPORT KGuiItem yes();

    /**
     * Returns the 'No' gui item.
     */
    KDEUI_EXPORT KGuiItem no();

    /**
     * Returns the 'Insert' gui item.
     */
    KDEUI_EXPORT KGuiItem insert();

    /**
     * Returns the 'Discard' gui item.
     */
    KDEUI_EXPORT KGuiItem discard();

    /**
     * Returns the 'Save' gui item.
     */
    KDEUI_EXPORT KGuiItem save();

    /**
     * Returns the 'Help' gui item.
     */
    KDEUI_EXPORT KGuiItem help();

    /**
     * Returns the 'DontSave' gui item.
     */
    KDEUI_EXPORT KGuiItem dontSave();

    /**
     * Returns the 'SaveAs' gui item.
     */
    KDEUI_EXPORT KGuiItem saveAs();

    /**
     * Returns the 'Apply' gui item.
     */
    KDEUI_EXPORT KGuiItem apply();

    /**
     * Returns the 'Clear' gui item.
     */
    KDEUI_EXPORT KGuiItem clear();

    /**
     * Returns the 'Defaults' gui item.
     */
    KDEUI_EXPORT KGuiItem defaults();

    /**
     * Returns the 'Close' gui item.
     */
    KDEUI_EXPORT KGuiItem close();

    /**
     * Returns the 'CloseWindow' gui item.
     * @since 4.3
     */
    KDEUI_EXPORT KGuiItem closeWindow();

    /**
     * Returns the 'CloseDocument' gui item.
     * @since 4.3
     */
    KDEUI_EXPORT KGuiItem closeDocument();

    /**
     * Returns the 'Print' gui item.
     */
    KDEUI_EXPORT KGuiItem print();

    /**
     * Returns the 'Properties' gui item.
     */
    KDEUI_EXPORT KGuiItem properties();

    /**
     * Returns the 'Reset' gui item.
     */
    KDEUI_EXPORT KGuiItem reset();

    /**
     * Returns the 'Overwrite' gui item.
     */
    KDEUI_EXPORT KGuiItem overwrite();

    /**
     * Returns a KGuiItem suiting for cases where code or functionality
     * runs under root privileges. Used in conjunction with KConfig Modules.
     */
    KDEUI_EXPORT KGuiItem adminMode();

    /**
     * Returns the 'Continue' gui item. The short name is due to 'continue' being a
     * reserved word in the C++ language.
     */
    KDEUI_EXPORT KGuiItem cont();

    /**
     * Returns the 'Delete' gui item. The short name is due to 'delete' being a
     * reserved word in the C++ language.
     */
    KDEUI_EXPORT KGuiItem del();

    /**
     * Returns the 'Open' gui item.
     */
    KDEUI_EXPORT KGuiItem open();

    /**
     * Returns the 'Back' gui item, like Konqueror's back button.
     * This GUI item can optionally honor the user's setting for BiDi, so the
     * icon for right-to-left languages (Hebrew and Arab) has the arrow
     * pointing in the opposite direction.
     * By default the arrow points in the Western 'back' direction (i.e.
     * to the left). This is because usually you only want the Bidi aware
     * GUI item if you also want the 'forward' item. Those two are available
     * in the separate backAndForward() method.
     */
    KDEUI_EXPORT KGuiItem back( BidiMode useBidi = IgnoreRTL );

    /**
     * Returns the 'Forward' gui item, like Konqueror's forward
     * button. This GUI item can optionally honor the user's setting for BiDi,
     * so the icon for right-to-left languages (Hebrew and Arab) has the arrow
     * pointing in the opposite direction.
     * By default the arrow points in the Western 'forward' direction (i.e.
     * to the right). This is because usually you only want the Bidi aware
     * GUI item if you also want the 'back' item. Those two are available
     * in the separate backAndForward() method.
     */
    KDEUI_EXPORT KGuiItem forward( BidiMode useBidi = IgnoreRTL );

    /**
     * Returns the 'Configure' gui item.
     */
    KDEUI_EXPORT KGuiItem configure();

    /**
     * Return both a back and a forward gui item. This function always returns
     * items that are aware of the Right-to-Left setting for Arab and Hebrew
     * locales. If you have a reason for wanting the 'Western' back/forward
     * buttons, please use the back() and forward() items instead.
     */
    KDEUI_EXPORT QPair<KGuiItem, KGuiItem> backAndForward();

    /**
     * Returns the 'Quit' gui item.
     */
    KDEUI_EXPORT KGuiItem quit();

    /**
     * Returns the 'Find' gui item.
     */
    KDEUI_EXPORT KGuiItem find();

    /**
     * Returns the 'Stop' gui item.
     */
    KDEUI_EXPORT KGuiItem stop();

    /**
     * Returns the 'Add' gui item.
     */
    KDEUI_EXPORT KGuiItem add();

    /**
     * Returns the 'Remove' gui item.
     */
    KDEUI_EXPORT KGuiItem remove();

    /**
     * Returns the 'Test' gui item.
     */
    KDEUI_EXPORT KGuiItem test();

}

#endif