From ac88eadd78db0448d053048bd7b850aeaca19918 Mon Sep 17 00:00:00 2001 From: wangqr Date: Wed, 6 May 2020 15:32:54 -0400 Subject: [PATCH] Use wxGenericStaticBitmap on wxOSX>=3.1.0 to get mouse event See https://trac.wxwidgets.org/ticket/18545 Fix wangqr/Aegisub#45 --- src/dialog_colorpicker.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/dialog_colorpicker.cpp b/src/dialog_colorpicker.cpp index a62efa51c..dd8f24c1e 100644 --- a/src/dialog_colorpicker.cpp +++ b/src/dialog_colorpicker.cpp @@ -62,6 +62,9 @@ #ifdef __WXMAC__ #include +#if wxCHECK_VERSION(3, 1, 0) +#include +#endif #endif namespace { @@ -241,7 +244,11 @@ wxDEFINE_EVENT(EVT_RECENT_SELECT, ValueEvent); /// @class ColorPickerRecent /// @brief A grid of recently used colors which can be selected by clicking on them +#if wxCHECK_VERSION(3, 1, 0) && defined(__WXMAC__) +class ColorPickerRecent final : public wxGenericStaticBitmap { +#else class ColorPickerRecent final : public wxStaticBitmap { +#endif int rows; ///< Number of rows of colors int cols; ///< Number of cols of colors int cellsize; ///< Width/Height of each cell @@ -290,7 +297,11 @@ class ColorPickerRecent final : public wxStaticBitmap { public: ColorPickerRecent(wxWindow *parent, int cols, int rows, int cellsize) +#if wxCHECK_VERSION(3, 1, 0) && defined(__WXMAC__) + : wxGenericStaticBitmap(parent, -1, wxBitmap(), wxDefaultPosition, wxDefaultSize, STATIC_BORDER_FLAG) +#else : wxStaticBitmap(parent, -1, wxBitmap(), wxDefaultPosition, wxDefaultSize, STATIC_BORDER_FLAG) +#endif , rows(rows) , cols(cols) , cellsize(cellsize) @@ -462,7 +473,11 @@ class DialogColorPicker final : public wxDialog { ColorPickerScreenDropper *screen_dropper; +#if wxCHECK_VERSION(3, 1, 0) && defined(__WXMAC__) + wxGenericStaticBitmap* screen_dropper_icon; +#else wxStaticBitmap *screen_dropper_icon; +#endif /// Update all other controls as a result of modifying an RGB control void UpdateFromRGB(bool dirty = true); @@ -591,7 +606,11 @@ DialogColorPicker::DialogColorPicker(wxWindow *parent, agi::Color initial_color, eyedropper_bitmap = GETIMAGE(eyedropper_tool_24); #endif eyedropper_bitmap.SetMask(new wxMask(eyedropper_bitmap, wxColour(255, 0, 255))); +#if wxCHECK_VERSION(3, 1, 0) && defined(__WXMAC__) + screen_dropper_icon = new wxGenericStaticBitmap(this, -1, eyedropper_bitmap, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER); +#else screen_dropper_icon = new wxStaticBitmap(this, -1, eyedropper_bitmap, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER); +#endif screen_dropper = new ColorPickerScreenDropper(this, 7, 7, 8); // Arrange the controls in a nice way