diff --git a/samples/widgets/native.cpp b/samples/widgets/native.cpp index e9234fe480..030b8f8c40 100644 --- a/samples/widgets/native.cpp +++ b/samples/widgets/native.cpp @@ -67,6 +67,20 @@ void BuildTestMenu(wxMenu *menu) #define BS_SPLITBUTTON 0x000c #endif // BS_SPLITBUTTON +#ifndef BCN_DROPDOWN + #define BCN_DROPDOWN (-1248) +#endif // defined(BCN_DROPDOWN) + +// This duplicates the standard NMBCDROPDOWN struct which is not defined in +// some old (up to at least 4.9.1) MinGW-w64 headers even though, annoyingly, +// BCN_DROPDOWN is, so we can't even use as an indicator of whether the struct +// is defined or not. +struct wxNMBCDROPDOWN +{ + NMHDR hdr; + RECT rcButton; +}; + class NativeWindow : public wxNativeWindow { public: @@ -106,9 +120,6 @@ public: } protected: - // This code requires NMBCDROPDOWN to work, we don't really want to - // reproduce its definition here for very old compilers not having it. -#ifdef BCN_DROPDOWN // Split buttons under MSW don't show the menu on their own, unlike their // equivalents under the other platforms, so do it manually here. This also // shows how to handle a native event in MSW (for the specific case of @@ -120,7 +131,7 @@ protected: if ( hdr->code != BCN_DROPDOWN ) return wxNativeWindow::MSWOnNotify(idCtrl, lParam, result); - const NMBCDROPDOWN* dd = reinterpret_cast(lParam); + const wxNMBCDROPDOWN* dd = reinterpret_cast(lParam); wxMenu menu; BuildTestMenu(&menu); @@ -128,7 +139,6 @@ protected: return true; } -#endif // defined(BCN_DROPDOWN) }; #elif defined(__WXGTK__)