X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8cfc5426cf50da368022813a04e29cf8ec5478a4..92f5ff59ccde20a9395084bb29c281ed6831b1b1:/include/wx/object.h diff --git a/include/wx/object.h b/include/wx/object.h index f6b11f8594..4603f3b123 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -175,6 +175,13 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \ ? (className *)(obj) \ : (className *)0) +// The 'this' pointer is always true, so use this version to cast the this +// pointer and avoid compiler warnings. +#define wxDynamicThisCast(obj, className) \ + (((obj)->IsKindOf(&className::sm_class##className)) \ + ? (className *)(obj) \ + : (className *)0) + #define wxConstCast(obj, className) ((className *)(obj)) #ifdef __WXDEBUG__