FIX: Intercept IDLE event in DropDown to fix various problems on MacOS

Change-Id: Ia9aa96c90f1b7c3f6c33b7325dc28a4f780969c3
This commit is contained in:
chunmao.guo 2022-08-05 15:35:43 +08:00 committed by Yifan Wu
parent ace72ecdbc
commit 646934953c
5 changed files with 59 additions and 40 deletions

View file

@ -9,6 +9,8 @@
#define DD_NO_TEXT 0x2000000
#define DD_STYLE_MASK 0x3000000
wxDECLARE_EVENT(EVT_DISMISS, wxCommandEvent);
class DropDown : public wxPopupTransientWindow
{
std::vector<wxString> & texts;
@ -39,11 +41,17 @@ class DropDown : public wxPopupTransientWindow
wxPoint dragStart;
public:
DropDown(std::vector<wxString> &texts,
std::vector<wxBitmap> &icons);
DropDown(wxWindow * parent,
std::vector<wxString> &texts,
std::vector<wxBitmap> &icons,
long style = 0);
void Create(wxWindow * parent,
long style = 0);
public:
void Invalidate(bool clear = false);
@ -73,6 +81,9 @@ public:
void Rescale();
bool HasDismissLongTime();
protected:
void OnDismiss() override;
private:
void paintEvent(wxPaintEvent& evt);
@ -92,7 +103,6 @@ private:
void sendDropDownEvent();
void OnDismiss() override;
DECLARE_EVENT_TABLE()
};