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:
@@ -1937,17 +1937,9 @@ enum wxStandardID
|
|||||||
/* wxWindowID type */
|
/* wxWindowID type */
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/*
|
/* Note that this is defined even in non-GUI code as the same type is also used
|
||||||
* wxWindowID used to be just a typedef defined here, now it's a class, but we
|
for e.g. timer IDs. */
|
||||||
* still continue to define it here for compatibility, so that the code using
|
typedef int wxWindowID;
|
||||||
* 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
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------- */
|
||||||
/* other constants */
|
/* other constants */
|
||||||
|
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
#include "wx/object.h" // base class
|
#include "wx/object.h" // base class
|
||||||
|
|
||||||
|
#include "wx/windowid.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// forward declarations
|
// forward declarations
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
#include "wx/filefn.h"
|
#include "wx/filefn.h"
|
||||||
#include "wx/hashmap.h"
|
#include "wx/hashmap.h"
|
||||||
#include "wx/versioninfo.h"
|
#include "wx/versioninfo.h"
|
||||||
#include "wx/windowid.h"
|
|
||||||
#include "wx/meta/implicitconversion.h"
|
#include "wx/meta/implicitconversion.h"
|
||||||
|
|
||||||
#if wxUSE_GUI
|
#if wxUSE_GUI
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include "wx/intl.h"
|
#include "wx/intl.h"
|
||||||
|
|
||||||
#include "wx/validate.h" // for wxDefaultValidator (always include it)
|
#include "wx/validate.h" // for wxDefaultValidator (always include it)
|
||||||
|
#include "wx/windowid.h"
|
||||||
|
|
||||||
#if wxUSE_PALETTE
|
#if wxUSE_PALETTE
|
||||||
#include "wx/palette.h"
|
#include "wx/palette.h"
|
||||||
|
@@ -10,9 +10,7 @@
|
|||||||
#ifndef _WX_WINDOWID_H_
|
#ifndef _WX_WINDOWID_H_
|
||||||
#define _WX_WINDOWID_H_
|
#define _WX_WINDOWID_H_
|
||||||
|
|
||||||
// NB: do not include defs.h as we are included from it
|
#include "wx/defs.h"
|
||||||
|
|
||||||
typedef int wxWindowID;
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxWindowIDRef: reference counted id value
|
// wxWindowIDRef: reference counted id value
|
||||||
|
@@ -22,9 +22,7 @@
|
|||||||
#endif //WX_PRECOMP
|
#endif //WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/hashmap.h"
|
#include "wx/hashmap.h"
|
||||||
|
#include "wx/windowid.h"
|
||||||
// Not needed, included in defs.h
|
|
||||||
// #include "wx/windowid.h"
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user