File indexing completed on 2024-04-28 03:59:15
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2001 Holger Freyther <freyther@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef kstandardguiitem_h 0009 #define kstandardguiitem_h 0010 0011 #include <kwidgetsaddons_export.h> 0012 0013 #include <QPair> 0014 0015 #include <kguiitem.h> 0016 0017 class QString; 0018 0019 /** 0020 * @short Provides a set of standardized KGuiItems. 0021 * 0022 * The various methods return standardized KGuiItem's 0023 * conforming to the KDE UI Standards. Use them instead of creating 0024 * your own. 0025 * 0026 * @author Holger Freyther <freyther@kde.org> 0027 */ 0028 namespace KStandardGuiItem 0029 { 0030 /** 0031 * The back and forward items by default use the RTL settings for Hebrew 0032 * and Arab countries. If you want those actions to ignore the RTL value 0033 * and force 'Western' behavior instead, use the IgnoreRTL value instead. 0034 */ 0035 enum BidiMode { UseRTL = 0, IgnoreRTL }; 0036 0037 enum StandardItem { 0038 Ok = 1, 0039 Cancel, 0040 Discard, 0041 Save, 0042 DontSave, 0043 SaveAs, 0044 Apply, 0045 Clear, 0046 Help, 0047 Defaults, 0048 Close, 0049 Back, 0050 Forward, 0051 Print, 0052 Continue, 0053 Open, 0054 Quit, 0055 AdminMode, 0056 Reset, 0057 Delete, 0058 Insert, 0059 Configure, 0060 Find, 0061 Stop, 0062 Add, 0063 Remove, 0064 Test, 0065 Properties, 0066 Overwrite, 0067 CloseWindow, 0068 CloseDocument, 0069 }; 0070 0071 /** 0072 * Returns the gui item for the given identifier @p id. 0073 * 0074 * @param id the identifier to search for 0075 */ 0076 KWIDGETSADDONS_EXPORT KGuiItem guiItem(StandardItem id); 0077 0078 /** 0079 * Returns the name of the gui item for the given identifier @p id. 0080 * 0081 * @param id the identifier to search for 0082 */ 0083 KWIDGETSADDONS_EXPORT QString standardItem(StandardItem id); 0084 0085 /** 0086 * Returns the 'Ok' gui item. 0087 */ 0088 KWIDGETSADDONS_EXPORT KGuiItem ok(); 0089 0090 /** 0091 * Returns the 'Cancel' gui item. 0092 */ 0093 KWIDGETSADDONS_EXPORT KGuiItem cancel(); 0094 0095 /** 0096 * Returns the 'Insert' gui item. 0097 */ 0098 KWIDGETSADDONS_EXPORT KGuiItem insert(); 0099 0100 /** 0101 * Returns the 'Discard' gui item. 0102 */ 0103 KWIDGETSADDONS_EXPORT KGuiItem discard(); 0104 0105 /** 0106 * Returns the 'Save' gui item. 0107 */ 0108 KWIDGETSADDONS_EXPORT KGuiItem save(); 0109 0110 /** 0111 * Returns the 'Help' gui item. 0112 */ 0113 KWIDGETSADDONS_EXPORT KGuiItem help(); 0114 0115 /** 0116 * Returns the 'DontSave' gui item. 0117 */ 0118 KWIDGETSADDONS_EXPORT KGuiItem dontSave(); 0119 0120 /** 0121 * Returns the 'SaveAs' gui item. 0122 */ 0123 KWIDGETSADDONS_EXPORT KGuiItem saveAs(); 0124 0125 /** 0126 * Returns the 'Apply' gui item. 0127 */ 0128 KWIDGETSADDONS_EXPORT KGuiItem apply(); 0129 0130 /** 0131 * Returns the 'Clear' gui item. 0132 */ 0133 KWIDGETSADDONS_EXPORT KGuiItem clear(); 0134 0135 /** 0136 * Returns the 'Defaults' gui item. 0137 */ 0138 KWIDGETSADDONS_EXPORT KGuiItem defaults(); 0139 0140 /** 0141 * Returns the 'Close' gui item. 0142 */ 0143 KWIDGETSADDONS_EXPORT KGuiItem close(); 0144 0145 /** 0146 * Returns the 'CloseWindow' gui item. 0147 * @since 4.3 0148 */ 0149 KWIDGETSADDONS_EXPORT KGuiItem closeWindow(); 0150 0151 /** 0152 * Returns the 'CloseDocument' gui item. 0153 * @since 4.3 0154 */ 0155 KWIDGETSADDONS_EXPORT KGuiItem closeDocument(); 0156 0157 /** 0158 * Returns the 'Print' gui item. 0159 */ 0160 KWIDGETSADDONS_EXPORT KGuiItem print(); 0161 0162 /** 0163 * Returns the 'Properties' gui item. 0164 */ 0165 KWIDGETSADDONS_EXPORT KGuiItem properties(); 0166 0167 /** 0168 * Returns the 'Reset' gui item. 0169 */ 0170 KWIDGETSADDONS_EXPORT KGuiItem reset(); 0171 0172 /** 0173 * Returns the 'Overwrite' gui item. 0174 */ 0175 KWIDGETSADDONS_EXPORT KGuiItem overwrite(); 0176 0177 /** 0178 * Returns a KGuiItem suiting for cases where code or functionality 0179 * runs under root privileges. Used in conjunction with KConfig Modules. 0180 */ 0181 KWIDGETSADDONS_EXPORT KGuiItem adminMode(); 0182 0183 /** 0184 * Returns the 'Continue' gui item. The short name is due to 'continue' being a 0185 * reserved word in the C++ language. 0186 */ 0187 KWIDGETSADDONS_EXPORT KGuiItem cont(); 0188 0189 /** 0190 * Returns the 'Delete' gui item. The short name is due to 'delete' being a 0191 * reserved word in the C++ language. 0192 */ 0193 KWIDGETSADDONS_EXPORT KGuiItem del(); 0194 0195 /** 0196 * Returns the 'Open' gui item. 0197 */ 0198 KWIDGETSADDONS_EXPORT KGuiItem open(); 0199 0200 /** 0201 * Returns the 'Back' gui item, like Konqueror's back button. 0202 * This GUI item can optionally honor the user's setting for BiDi, so the 0203 * icon for right-to-left languages (Hebrew and Arab) has the arrow 0204 * pointing in the opposite direction. 0205 * By default the arrow points in the Western 'back' direction (i.e. 0206 * to the left). This is because usually you only want the Bidi aware 0207 * GUI item if you also want the 'forward' item. Those two are available 0208 * in the separate backAndForward() method. 0209 */ 0210 KWIDGETSADDONS_EXPORT KGuiItem back(BidiMode useBidi = IgnoreRTL); 0211 0212 /** 0213 * Returns the 'Forward' gui item, like Konqueror's forward 0214 * button. This GUI item can optionally honor the user's setting for BiDi, 0215 * so the icon for right-to-left languages (Hebrew and Arab) has the arrow 0216 * pointing in the opposite direction. 0217 * By default the arrow points in the Western 'forward' direction (i.e. 0218 * to the right). This is because usually you only want the Bidi aware 0219 * GUI item if you also want the 'back' item. Those two are available 0220 * in the separate backAndForward() method. 0221 */ 0222 KWIDGETSADDONS_EXPORT KGuiItem forward(BidiMode useBidi = IgnoreRTL); 0223 0224 /** 0225 * Returns the 'Configure' gui item. 0226 */ 0227 KWIDGETSADDONS_EXPORT KGuiItem configure(); 0228 0229 /** 0230 * Return both a back and a forward gui item. This function always returns 0231 * items that are aware of the Right-to-Left setting for Arab and Hebrew 0232 * locales. If you have a reason for wanting the 'Western' back/forward 0233 * buttons, please use the back() and forward() items instead. 0234 */ 0235 KWIDGETSADDONS_EXPORT QPair<KGuiItem, KGuiItem> backAndForward(); 0236 0237 /** 0238 * Returns the 'Quit' gui item. 0239 */ 0240 KWIDGETSADDONS_EXPORT KGuiItem quit(); 0241 0242 /** 0243 * Returns the 'Find' gui item. 0244 */ 0245 KWIDGETSADDONS_EXPORT KGuiItem find(); 0246 0247 /** 0248 * Returns the 'Stop' gui item. 0249 */ 0250 KWIDGETSADDONS_EXPORT KGuiItem stop(); 0251 0252 /** 0253 * Returns the 'Add' gui item. 0254 */ 0255 KWIDGETSADDONS_EXPORT KGuiItem add(); 0256 0257 /** 0258 * Returns the 'Remove' gui item. 0259 */ 0260 KWIDGETSADDONS_EXPORT KGuiItem remove(); 0261 0262 /** 0263 * Returns the 'Test' gui item. 0264 */ 0265 KWIDGETSADDONS_EXPORT KGuiItem test(); 0266 0267 KWIDGETSADDONS_EXPORT void assign(QPushButton *button, StandardItem item); 0268 } 0269 0270 #endif