]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/chartype.h
Use wxSTC_INVALID_POSITION in wxStyledTextCtrl documentation.
[wxWidgets.git] / interface / wx / chartype.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: chartype.h
3 // Purpose: interface of global functions
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 /** @addtogroup group_funcmacro_string */
10 //@{
11
12 /**
13 This macro can be used with character and string literals (in other words,
14 @c 'x' or @c "foo") to automatically convert them to wide strings in Unicode
15 builds of wxWidgets. This macro simply returns the value passed to it
16 without changes in ASCII build. In fact, its definition is:
17
18 @code
19 #ifdef UNICODE
20 # define wxT(x) L##x
21 #else // !Unicode
22 # define wxT(x) x
23 #endif
24 @endcode
25
26 Note that since wxWidgets 2.9.0 you shouldn't use wxT() anymore in your
27 program sources (it was previously required if you wanted to support Unicode).
28
29 @see @ref overview_unicode, wxS()
30
31 @header{wx/chartype.h}
32 */
33 #define wxT(string)
34
35 /**
36 Compatibility macro which expands to wxT() in wxWidgets 2 only.
37
38 This macro can be used in code which needs to compile with both
39 wxWidgets 2 and 3 versions, in places where the wx2 API requires a Unicode string
40 (in Unicode build) but the wx3 API only accepts a standard narrow
41 string, as in e.g. wxCmdLineEntryDesc structure objects initializers.
42
43 Example of use:
44 @code
45 const wxCmdLineEntryDesc cmdLineDesc[] =
46 {
47 { wxCMD_LINE_SWITCH, wxT_2("q"), wxT_2("quiet"),
48 wxT_2("Don't output verbose messages") },
49 wxCMD_LINE_DESC_END
50 };
51 @endcode
52
53 Without @c wxT_2 the code above wouldn't compile with wxWidgets 2, but using @c
54 wxT instead, it wouldn't compile with wxWidgets 3.
55
56 @see wxT()
57
58 @since 2.8.12, 2.9.2
59
60 @header{wx/chartype.h}
61 */
62 #define wxT_2(string)
63
64 /**
65 wxS is a macro which can be used with character and string literals (in other words,
66 @c 'x' or @c "foo") to convert them either to wide characters or wide strings
67 in @c wchar_t-based (UTF-16) builds, or to keep them unchanged in @c char-based
68 (UTF-8) builds.
69
70 Basically this macro produces characters or strings of type wxStringCharType.
71
72 The use of this macro is optional as the translation will always be done at
73 run-time even if there is a mismatch between the kind of the literal used
74 and the string or character type used in the current build.
75 However using it can be beneficial in <b>performance-sensitive code</b> to
76 do the conversion at compile-time instead.
77
78 @see @ref overview_unicode, wxT()
79
80 @header{wx/chartype.h}
81 */
82 #define wxS(string)
83
84 /**
85 This macro is exactly the same as wxT() and is defined in wxWidgets simply
86 because it may be more intuitive for Windows programmers as the standard
87 Win32 headers also define it (as well as yet another name for the same
88 macro which is _TEXT()).
89
90 Don't confuse this macro with _()!
91
92 Note that since wxWidgets 2.9.0 the use of _T() is discouraged just like
93 for wxT() and also that this macro may conflict with identifiers defined in
94 standard headers of some compilers (such as Sun CC) so its use should
95 really be avoided.
96
97 @header{wx/chartype.h}
98 */
99 #define _T(string)
100
101 /**
102 wxChar is defined to be
103 - @c char when <tt>wxUSE_UNICODE==0</tt>
104 - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default).
105 */
106 typedef wxUSE_UNICODE_dependent wxChar;
107
108 /**
109 wxSChar is defined to be
110 - <tt>signed char</tt> when <tt>wxUSE_UNICODE==0</tt>
111 - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default).
112 */
113 typedef wxUSE_UNICODE_dependent wxSChar;
114
115 /**
116 wxUChar is defined to be
117 - <tt>unsigned char</tt> when <tt>wxUSE_UNICODE==0</tt>
118 - @c wchar_t when <tt>wxUSE_UNICODE==1</tt> (the default).
119 */
120 typedef wxUSE_UNICODE_dependent wxUChar;
121
122 /**
123 wxStringCharType is defined to be:
124 - @c char when <tt>wxUSE_UNICODE==0</tt>
125 - @c char when <tt>wxUSE_UNICODE_WCHAR==0</tt> and <tt>wxUSE_UNICODE==1</tt>
126 - @c wchar_t when <tt>wxUSE_UNICODE_WCHAR==1</tt> and <tt>wxUSE_UNICODE==1</tt>
127
128 The @c wxUSE_UNICODE_WCHAR symbol is defined to @c 1 when building on
129 Windows while it's defined to @c 0 when building on Unix, Linux or OS X.
130 (Note that @c wxUSE_UNICODE_UTF8 symbol is defined as the opposite of
131 @c wxUSE_UNICODE_WCHAR.)
132
133 Note that wxStringCharType (as the name says) is the type used by wxString
134 for internal storage of the characters.
135 */
136 typedef wxUSE_UNICODE_WCHAR_dependent wxStringCharType;
137
138 //@}