Simplify wxWindowID definition

Define it in wx/defs.h directly instead of conditionally including
wx/windowid.h from there just in order to get this type definition.

This has several advantages:

- wxWindowIDRef is not defined in (maybe) non-GUI code including
  wx/defs.h, as it should be the case for this class defined in
  core library only.
- wx/windowid.h becomes a normal header, including wx/defs.h as
  (almost) all the other ones instead of being exceptional.
- wx/windowid.h doesn't need to be included by wx/utils.h at all
  just to get wxWindowID definition.

Closes https://github.com/wxWidgets/wxWidgets/pull/1850
This commit is contained in:
Vadim Zeitlin
2020-04-21 16:29:03 +02:00
parent 9df975f2a9
commit a2a3897124
6 changed files with 8 additions and 18 deletions

View File

@@ -1937,17 +1937,9 @@ enum wxStandardID
/* wxWindowID type */
/* ---------------------------------------------------------------------------- */
/*
* wxWindowID used to be just a typedef defined here, now it's a class, but we
* still continue to define it here for compatibility, so that the code using
* it continues to compile even if it includes just wx/defs.h.
*
* Notice that wx/windowid.h can only be included after wxID_XYZ definitions
* (as it uses them).
*/
#if defined(__cplusplus) && wxUSE_GUI
#include "wx/windowid.h"
#endif
/* Note that this is defined even in non-GUI code as the same type is also used
for e.g. timer IDs. */
typedef int wxWindowID;
/* ---------------------------------------------------------------------------- */
/* other constants */