| 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 | |
| 17 | class 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 | */ |
| 28 | namespace 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 | */ |
| 38 | enum 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 | */ |
| 76 | enum 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 | */ |
| 115 | KWIDGETSADDONS_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 | */ |
| 122 | KWIDGETSADDONS_EXPORT QString standardItem(StandardItem id); |
| 123 | |
| 124 | /*! |
| 125 | * Returns the 'Ok' gui item. |
| 126 | */ |
| 127 | KWIDGETSADDONS_EXPORT KGuiItem ok(); |
| 128 | |
| 129 | /*! |
| 130 | * Returns the 'Cancel' gui item. |
| 131 | */ |
| 132 | KWIDGETSADDONS_EXPORT KGuiItem cancel(); |
| 133 | |
| 134 | /*! |
| 135 | * Returns the 'Insert' gui item. |
| 136 | */ |
| 137 | KWIDGETSADDONS_EXPORT KGuiItem insert(); |
| 138 | |
| 139 | /*! |
| 140 | * Returns the 'Discard' gui item. |
| 141 | */ |
| 142 | KWIDGETSADDONS_EXPORT KGuiItem discard(); |
| 143 | |
| 144 | /*! |
| 145 | * Returns the 'Save' gui item. |
| 146 | */ |
| 147 | KWIDGETSADDONS_EXPORT KGuiItem save(); |
| 148 | |
| 149 | /*! |
| 150 | * Returns the 'Help' gui item. |
| 151 | */ |
| 152 | KWIDGETSADDONS_EXPORT KGuiItem help(); |
| 153 | |
| 154 | /*! |
| 155 | * Returns the 'DontSave' gui item. |
| 156 | */ |
| 157 | KWIDGETSADDONS_EXPORT KGuiItem dontSave(); |
| 158 | |
| 159 | /*! |
| 160 | * Returns the 'SaveAs' gui item. |
| 161 | */ |
| 162 | KWIDGETSADDONS_EXPORT KGuiItem saveAs(); |
| 163 | |
| 164 | /*! |
| 165 | * Returns the 'Apply' gui item. |
| 166 | */ |
| 167 | KWIDGETSADDONS_EXPORT KGuiItem apply(); |
| 168 | |
| 169 | /*! |
| 170 | * Returns the 'Clear' gui item. |
| 171 | */ |
| 172 | KWIDGETSADDONS_EXPORT KGuiItem clear(); |
| 173 | |
| 174 | /*! |
| 175 | * Returns the 'Defaults' gui item. |
| 176 | */ |
| 177 | KWIDGETSADDONS_EXPORT KGuiItem defaults(); |
| 178 | |
| 179 | /*! |
| 180 | * Returns the 'Close' gui item. |
| 181 | */ |
| 182 | KWIDGETSADDONS_EXPORT KGuiItem close(); |
| 183 | |
| 184 | /*! |
| 185 | * Returns the 'CloseWindow' gui item. |
| 186 | * \since 4.3 |
| 187 | */ |
| 188 | KWIDGETSADDONS_EXPORT KGuiItem closeWindow(); |
| 189 | |
| 190 | /*! |
| 191 | * Returns the 'CloseDocument' gui item. |
| 192 | * \since 4.3 |
| 193 | */ |
| 194 | KWIDGETSADDONS_EXPORT KGuiItem closeDocument(); |
| 195 | |
| 196 | /*! |
| 197 | * Returns the 'Print' gui item. |
| 198 | */ |
| 199 | KWIDGETSADDONS_EXPORT KGuiItem print(); |
| 200 | |
| 201 | /*! |
| 202 | * Returns the 'Properties' gui item. |
| 203 | */ |
| 204 | KWIDGETSADDONS_EXPORT KGuiItem properties(); |
| 205 | |
| 206 | /*! |
| 207 | * Returns the 'Reset' gui item. |
| 208 | */ |
| 209 | KWIDGETSADDONS_EXPORT KGuiItem reset(); |
| 210 | |
| 211 | /*! |
| 212 | * Returns the 'Overwrite' gui item. |
| 213 | */ |
| 214 | KWIDGETSADDONS_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 | */ |
| 220 | KWIDGETSADDONS_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 | */ |
| 226 | KWIDGETSADDONS_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 | */ |
| 232 | KWIDGETSADDONS_EXPORT KGuiItem del(); |
| 233 | |
| 234 | /*! |
| 235 | * Returns the 'Open' gui item. |
| 236 | */ |
| 237 | KWIDGETSADDONS_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 | */ |
| 249 | KWIDGETSADDONS_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 | */ |
| 261 | KWIDGETSADDONS_EXPORT KGuiItem forward(BidiMode useBidi = IgnoreRTL); |
| 262 | |
| 263 | /*! |
| 264 | * Returns the 'Configure' gui item. |
| 265 | */ |
| 266 | KWIDGETSADDONS_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 | */ |
| 274 | KWIDGETSADDONS_EXPORT QPair<KGuiItem, KGuiItem> backAndForward(); |
| 275 | |
| 276 | /*! |
| 277 | * Returns the 'Quit' gui item. |
| 278 | */ |
| 279 | KWIDGETSADDONS_EXPORT KGuiItem quit(); |
| 280 | |
| 281 | /*! |
| 282 | * Returns the 'Find' gui item. |
| 283 | */ |
| 284 | KWIDGETSADDONS_EXPORT KGuiItem find(); |
| 285 | |
| 286 | /*! |
| 287 | * Returns the 'Stop' gui item. |
| 288 | */ |
| 289 | KWIDGETSADDONS_EXPORT KGuiItem stop(); |
| 290 | |
| 291 | /*! |
| 292 | * Returns the 'Add' gui item. |
| 293 | */ |
| 294 | KWIDGETSADDONS_EXPORT KGuiItem add(); |
| 295 | |
| 296 | /*! |
| 297 | * Returns the 'Remove' gui item. |
| 298 | */ |
| 299 | KWIDGETSADDONS_EXPORT KGuiItem remove(); |
| 300 | |
| 301 | /*! |
| 302 | * Returns the 'Test' gui item. |
| 303 | */ |
| 304 | KWIDGETSADDONS_EXPORT KGuiItem test(); |
| 305 | |
| 306 | /*! |
| 307 | * |
| 308 | */ |
| 309 | KWIDGETSADDONS_EXPORT void assign(QPushButton *button, StandardItem item); |
| 310 | } |
| 311 | |
| 312 | #endif |
| 313 | |