Fix widgets sample build with MinGW-w64 4.9.1
The headers for this compiler, at least in the version packaged under Debian, define BCN_DROPDOWN but not the NMBCDROPDOWN struct we also need, so we have no choice but to redeclare the struct ourselves to allow this code to compile.
This commit is contained in:
parent
fb4ff2449c
commit
5b597cd0e8
@ -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<NMBCDROPDOWN*>(lParam);
|
||||
const wxNMBCDROPDOWN* dd = reinterpret_cast<wxNMBCDROPDOWN*>(lParam);
|
||||
|
||||
wxMenu menu;
|
||||
BuildTestMenu(&menu);
|
||||
@ -128,7 +139,6 @@ protected:
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // defined(BCN_DROPDOWN)
|
||||
};
|
||||
|
||||
#elif defined(__WXGTK__)
|
||||
|
Loading…
Reference in New Issue
Block a user