]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cpp.h
don't draw borders for bitmap buttons with wxBORDER_NONE style
[wxWidgets.git] / include / wx / cpp.h
1 /*
2 * Name: wx/cpp.h
3 * Purpose: Various preprocessor helpers
4 * Author: Vadim Zeitlin
5 * Created: 2006-09-30
6 * RCS-ID: $Id$
7 * Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8 * Licence: wxWindows licence
9 */
10
11 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
12
13 #ifndef _WX_CPP_H_
14 #define _WX_CPP_H_
15
16 /* wxCONCAT works like preprocessor ## operator but also works with macros */
17 #define wxCONCAT_HELPER(text, line) text ## line
18 #define wxCONCAT(text, line) wxCONCAT_HELPER(text, line)
19
20 #define wxCONCAT3(x1, x2, x3) wxCONCAT(wxCONCAT(x1, x2), x3)
21 #define wxCONCAT4(x1, x2, x3, x4) wxCONCAT(wxCONCAT3(x1, x2, x3), x4)
22 #define wxCONCAT5(x1, x2, x3, x4, x5) wxCONCAT(wxCONCAT4(x1, x2, x3, x4), x5)
23
24 /* wxSTRINGIZE works as the preprocessor # operator but also works with macros */
25 #define wxSTRINGIZE_HELPER(x) #x
26 #define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x)
27
28 /* a Unicode-friendly version of wxSTRINGIZE_T */
29 #define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x))
30
31 /*
32 Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the
33 current line number to the given identifier to reduce the probability of the
34 conflict (it may still happen if this is used in the headers, hence you
35 should avoid doing it or provide unique prefixes then) but we have to do it
36 differently for VC++
37 */
38 #if defined(__VISUALC__) && (__VISUALC__ >= 1300)
39 /*
40 __LINE__ handling is completely broken in VC++ when using "Edit and
41 Continue" (/ZI option) and results in preprocessor errors if we use it
42 inside the macros. Luckily VC7 has another standard macro which can be
43 used like this and is even better than __LINE__ because it is globally
44 unique.
45 */
46 # define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__)
47 #else /* normal compilers */
48 # define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__)
49 #endif
50
51 /* Create a "unique" name with the given prefix */
52 #define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text)
53
54 /*
55 This macro can be passed as argument to another macro when you don't have
56 anything to pass in fact.
57 */
58 #define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */
59
60 /*
61 Define __WXFUNCTION__ which is like standard __FUNCTION__ but defined as
62 NULL for the compilers which don't support the latter.
63 */
64 #ifndef __WXFUNCTION__
65 /* TODO: add more compilers supporting __FUNCTION__ */
66 #if defined(__DMC__)
67 /*
68 __FUNCTION__ happens to be not defined within class members
69 http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.beta/485
70 */
71 #define __WXFUNCTION__ (NULL)
72 #elif defined(__GNUC__) || \
73 (defined(_MSC_VER) && _MSC_VER >= 1300) || \
74 defined(__FUNCTION__)
75 #define __WXFUNCTION__ __FUNCTION__
76 #else
77 /* still define __WXFUNCTION__ to avoid #ifdefs elsewhere */
78 #define __WXFUNCTION__ (NULL)
79 #endif
80 #endif /* __WXFUNCTION__ already defined */
81
82 #endif /* _WX_CPP_H_ */
83