KDEUI
fixx11h.h
Go to the documentation of this file.
00001 /**************************************************************************** 00002 00003 Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a 00006 copy of this software and associated documentation files (the "Software"), 00007 to deal in the Software without restriction, including without limitation 00008 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00009 and/or sell copies of the Software, and to permit persons to whom the 00010 Software is furnished to do so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in 00013 all copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00018 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00020 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00021 DEALINGS IN THE SOFTWARE. 00022 00023 ****************************************************************************/ 00024 00025 00026 //#ifdef don't do this, this file is supposed to be included 00027 //#define multiple times 00028 00029 #include <QtCore/QtGlobal> 00030 00031 #ifdef Q_WS_X11 00032 00033 /* Usage: 00034 00035 If you get compile errors caused by X11 includes (the line 00036 where first error appears contains word like None, Unsorted, 00037 Below, etc.), put #include <fixx11h.h> in the .cpp file 00038 (not .h file!) between the place where X11 headers are 00039 included and the place where the file with compile 00040 error is included (or the place where the compile error 00041 in the .cpp file occurs). 00042 00043 This file remaps X11 #defines to const variables or 00044 inline functions. The side effect may be that these 00045 symbols may now refer to different variables 00046 (e.g. if X11 #defined NoButton, after this file 00047 is included NoButton would no longer be X11's 00048 NoButton, but Qt::NoButton instead). At this time, 00049 there's no conflict known that could cause problems. 00050 00051 The original X11 symbols are still accessible 00052 (e.g. for None) as X::None, XNone, and also still 00053 None, unless name lookup finds different None 00054 first (in the current class, etc.) 00055 00056 Use 'Unsorted', 'Bool' and 'index' as templates. 00057 00058 */ 00059 00060 namespace X 00061 { 00062 00063 // template ---> 00064 // Affects: Should be without side effects. 00065 #ifdef Unsorted 00066 #ifndef FIXX11H_Unsorted 00067 #define FIXX11H_Unsorted 00068 const int XUnsorted = Unsorted; 00069 #undef Unsorted 00070 const int Unsorted = XUnsorted; 00071 #endif 00072 #undef Unsorted 00073 #endif 00074 // template <--- 00075 00076 // Affects: Should be without side effects. 00077 #ifdef None 00078 #ifndef FIXX11H_None 00079 #define FIXX11H_None 00080 const XID XNone = None; 00081 #undef None 00082 const XID None = XNone; 00083 #endif 00084 #undef None 00085 #endif 00086 00087 // template ---> 00088 // Affects: Should be without side effects. 00089 #ifdef Bool 00090 #ifndef FIXX11H_Bool 00091 #define FIXX11H_Bool 00092 #ifdef _XTYPEDEF_BOOL /* Xdefs.h has typedef'ed Bool already */ 00093 #undef Bool 00094 #else 00095 typedef Bool XBool; 00096 #undef Bool 00097 typedef XBool Bool; 00098 #endif 00099 #endif 00100 #undef Bool 00101 #define _XTYPEDEF_BOOL 00102 #endif 00103 // template <--- 00104 00105 // Affects: Should be without side effects. 00106 #ifdef KeyPress 00107 #ifndef FIXX11H_KeyPress 00108 #define FIXX11H_KeyPress 00109 const int XKeyPress = KeyPress; 00110 #undef KeyPress 00111 const int KeyPress = XKeyPress; 00112 #endif 00113 #undef KeyPress 00114 #endif 00115 00116 // Affects: Should be without side effects. 00117 #ifdef KeyRelease 00118 #ifndef FIXX11H_KeyRelease 00119 #define FIXX11H_KeyRelease 00120 const int XKeyRelease = KeyRelease; 00121 #undef KeyRelease 00122 const int KeyRelease = XKeyRelease; 00123 #endif 00124 #undef KeyRelease 00125 #endif 00126 00127 // Affects: Should be without side effects. 00128 #ifdef Above 00129 #ifndef FIXX11H_Above 00130 #define FIXX11H_Above 00131 const int XAbove = Above; 00132 #undef Above 00133 const int Above = XAbove; 00134 #endif 00135 #undef Above 00136 #endif 00137 00138 // Affects: Should be without side effects. 00139 #ifdef Below 00140 #ifndef FIXX11H_Below 00141 #define FIXX11H_Below 00142 const int XBelow = Below; 00143 #undef Below 00144 const int Below = XBelow; 00145 #endif 00146 #undef Below 00147 #endif 00148 00149 // Affects: Should be without side effects. 00150 #ifdef FocusIn 00151 #ifndef FIXX11H_FocusIn 00152 #define FIXX11H_FocusIn 00153 const int XFocusIn = FocusIn; 00154 #undef FocusIn 00155 const int FocusIn = XFocusIn; 00156 #endif 00157 #undef FocusIn 00158 #endif 00159 00160 // Affects: Should be without side effects. 00161 #ifdef FocusOut 00162 #ifndef FIXX11H_FocusOut 00163 #define FIXX11H_FocusOut 00164 const int XFocusOut = FocusOut; 00165 #undef FocusOut 00166 const int FocusOut = XFocusOut; 00167 #endif 00168 #undef FocusOut 00169 #endif 00170 00171 // Affects: Should be without side effects. 00172 #ifdef Always 00173 #ifndef FIXX11H_Always 00174 #define FIXX11H_Always 00175 const int XAlways = Always; 00176 #undef Always 00177 const int Always = XAlways; 00178 #endif 00179 #undef Always 00180 #endif 00181 00182 // Affects: Should be without side effects. 00183 #ifdef Success 00184 #ifndef FIXX11H_Success 00185 #define FIXX11H_Success 00186 const int XSuccess = Success; 00187 #undef Success 00188 const int Success = XSuccess; 00189 #endif 00190 #undef Success 00191 #endif 00192 00193 // Affects: Should be without side effects. 00194 #ifdef GrayScale 00195 #ifndef FIXX11H_GrayScale 00196 #define FIXX11H_GrayScale 00197 const int XGrayScale = GrayScale; 00198 #undef GrayScale 00199 const int GrayScale = XGrayScale; 00200 #endif 00201 #undef GrayScale 00202 #endif 00203 00204 // Affects: Should be without side effects. 00205 #ifdef Status 00206 #ifndef FIXX11H_Status 00207 #define FIXX11H_Status 00208 typedef Status XStatus; 00209 #undef Status 00210 typedef XStatus Status; 00211 #endif 00212 #undef Status 00213 #endif 00214 00215 // template ---> 00216 // Affects: Should be without side effects. 00217 #ifdef CursorShape 00218 #ifndef FIXX11H_CursorShape 00219 #define FIXX11H_CursorShape 00220 const int XCursorShape = CursorShape; 00221 #undef CursorShape 00222 const int CursorShape = XCursorShape; 00223 #endif 00224 #undef CursorShape 00225 #endif 00226 // template <--- 00227 00228 // template ---> 00229 // Affects: Should be without side effects. 00230 #ifdef FontChange 00231 #ifndef FIXX11H_FontChange 00232 #define FIXX11H_FontChange 00233 const int XFontChange = FontChange; 00234 #undef FontChange 00235 const int FontChange = XFontChange; 00236 #endif 00237 #undef FontChange 00238 #endif 00239 // template <--- 00240 00241 // Affects: Should be without side effects. 00242 #ifdef NormalState 00243 #ifndef FIXX11H_NormalState 00244 #define FIXX11H_NormalState 00245 const int XNormalState = NormalState; 00246 #undef NormalState 00247 const int NormalState = XNormalState; 00248 #endif 00249 #undef NormalState 00250 #endif 00251 00252 // template ---> 00253 // Affects: Should be without side effects. 00254 #ifdef index 00255 #ifndef FIXX11H_index 00256 #define FIXX11H_index 00257 inline 00258 const char* Xindex( const char* s, int c ) 00259 { 00260 return index( s, c ); 00261 } 00262 #undef index 00263 inline 00264 const char* index( const char* s, int c ) 00265 { 00266 return Xindex( s, c ); 00267 } 00268 #endif 00269 #undef index 00270 #endif 00271 // template <--- 00272 00273 #ifdef rindex 00274 // Affects: Should be without side effects. 00275 #ifndef FIXX11H_rindex 00276 #define FIXX11H_rindex 00277 inline 00278 const char* Xrindex( const char* s, int c ) 00279 { 00280 return rindex( s, c ); 00281 } 00282 #undef rindex 00283 inline 00284 const char* rindex( const char* s, int c ) 00285 { 00286 return Xrindex( s, c ); 00287 } 00288 #endif 00289 #undef rindex 00290 #endif 00291 } 00292 00293 using namespace X; 00294 00295 #endif
KDE 4.6 API Reference