summaryrefslogtreecommitdiffstats
path: root/kdeui/kstdguiitem.h
blob: 438f419fea29e8af859971ad5b7e21b5ed85179b (plain)
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
/* 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 __kstdguiitem_h
#define __kstdguiitem_h

// Needed for the template below
#include <kguiitem.h>

#include <tqstring.h>
#include <tqpair.h>

/**
 * @short Provides a set of standardized KGuiItems.
 *
 * The various static 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>
 */
class KDEUI_EXPORT KStdGuiItem
{
public:
    /**
     * 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 StdItem
    {
        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,    ///< @since 3.4
        Find,         ///< @since 3.4
	Stop,         ///< @since 3.4
	Add,          ///< @since 3.4
	Remove,       ///< @since 3.4
	Test,         ///< @since 3.4
	Properties,   ///< @since 3.4
	Overwrite     ///< @since 3.5
    };
    static KGuiItem guiItem ( StdItem ui_enum );
    static TQString  stdItem ( StdItem ui_enum );
    static KGuiItem ok();
    static KGuiItem cancel();
    static KGuiItem yes();
    static KGuiItem no();
    static KGuiItem insert();
    static KGuiItem discard();
    static KGuiItem save();
    static KGuiItem help();
    static KGuiItem dontSave();
    static KGuiItem saveAs();
    static KGuiItem apply();
    static KGuiItem clear();
    static KGuiItem defaults();
    static KGuiItem close();
    static KGuiItem print();
    /**
     * @since 3.4
     */
    static KGuiItem properties();
    static KGuiItem reset();
    /**
     * @since 3.5
     */
    static KGuiItem overwrite();
    /**
     * Returns a KGuiItem suiting for cases where code or functionality
     * runs under root privileges. Used in conjunction with KConfig Modules.
     */
    static KGuiItem adminMode();

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

    /**
     * Returns a "delete" item. The short name is due to "delete" being a
     * reserved word in the C++ language.
     * @since 3.3
     */
    static KGuiItem del();

    static KGuiItem open();

    /**
     * Return a GUI item for a 'back' action, 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.
     */
    static KGuiItem back( BidiMode useBidi = IgnoreRTL );

    /**
     * Return a GUI item for a 'forward' action, 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.
     */
    static KGuiItem forward( BidiMode useBidi = IgnoreRTL );

    /**
     * Returns a "configure" item.
     * @since 3.4
     */
    static KGuiItem configure();

    /**
     * Return both a back and a forward 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.
     */
    static TQPair<KGuiItem, KGuiItem> backAndForward();

    static KGuiItem quit();

    /**
    * Returns a "find" item.
    * @since 3.4
    */
    static KGuiItem find();

    /**
    * Returns a "stop" item.
    * @since 3.4
    */
    static KGuiItem stop();

    /**
    * Returns a "add" item.
    * @since 3.4
    */
    static KGuiItem add();

    /**
    * Returns a "remove" item.
    * @since 3.4
    */
    static KGuiItem remove();

    /**
    * Returns a "test" item.
    * @since 3.4
    */
    static KGuiItem test();

};

#endif

// vim: set et ts=4 sw=4 sts=4: