Add wxT_2() macro for compatibility with wxWidgets 2 API.
This macro can be used to make the same code compile with both v2 and v3 as it expands to wxT() in 2.8 and nothing in later versions. See #12925. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66968 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1244d2e07f
commit
9204fde6ee
@ -46,7 +46,9 @@ changes:
|
||||
- Some structure fields which used to be of type "const wxChar *" (such as
|
||||
wxCmdLineEntryDesc::shortName, longName and description fields) are now of
|
||||
type "const char *", you need to remove wxT() or _T() around the values used
|
||||
to initialize them (which should normally always be ASCII).
|
||||
to initialize them (which should normally always be ASCII). If you want your
|
||||
code to remain compatible with Unicode build of previous wx version, please
|
||||
use the special wxT_2, which is the same as wxT in 2.x only, instead.
|
||||
|
||||
- wxIPC classes didn't work correctly in Unicode build before, this was fixed
|
||||
but at a price of breaking backwards compatibility: many methods which used
|
||||
|
@ -250,6 +250,12 @@
|
||||
#endif /* ASCII/Unicode */
|
||||
#endif /* !defined(wxT) */
|
||||
|
||||
/*
|
||||
wxT_2 exists only for compatibility with wx 2.x and is the same as wxT() in
|
||||
that version but nothing in the newer ones.
|
||||
*/
|
||||
#define wxT_2(x) x
|
||||
|
||||
/*
|
||||
wxS ("wx string") macro can be used to create literals using the same
|
||||
representation as wxString does internally, i.e. wchar_t in Unicode build
|
||||
|
@ -32,6 +32,32 @@
|
||||
*/
|
||||
#define wxT(string)
|
||||
|
||||
/**
|
||||
Compatibility macro which expands to wxT() in wxWidgets 2 only.
|
||||
|
||||
This macro can be used in the code which needs to compile with both
|
||||
wxWidgets 2 and 3 versions in places where v2 API requires a Unicode string
|
||||
(in Unicode build) and v3 API only accepts a standard standard narrow
|
||||
string as in e.g. wxCmdLineEntryDesc structure objects initializers.
|
||||
|
||||
Example of use:
|
||||
@code
|
||||
const wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
{
|
||||
{ wxCMD_LINE_SWITCH, wxT_2("q"), wxT_2("quiet"),
|
||||
wxT_2("Don't output verbose messages") },
|
||||
wxCMD_LINE_DESC_END
|
||||
};
|
||||
@endcode
|
||||
|
||||
Without @c wxT_2 the code above wouldn't compile with wxWidgets 2, with @c
|
||||
wxT instead of it, it wouldn't compile with wxWidgets 3.
|
||||
|
||||
@see wxT()
|
||||
|
||||
@header{wx/chartype.h}
|
||||
*/
|
||||
|
||||
/**
|
||||
wxS is macro which can be used with character and string literals (in other words,
|
||||
@c 'x' or @c "foo") to either convert them to wide characters or wide strings
|
||||
|
Loading…
Reference in New Issue
Block a user