From 792e4dcced087769c7899220fc8f9bf9fe7c167c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Mon, 6 Jul 2020 17:06:09 +0200 Subject: [PATCH] macOS wxTextEntry::GetTextPeer fix for wxGenericComboCtrl (#1931) * overriding GetTextPeer in generic combo control * undo https://github.com/wxWidgets/wxWidgets/commit/81e3760e4a9587de9e74def6fb1d1bb157dcfa9c * inlining GetTextPeer() * moving out of line to reduce header include --- include/wx/generic/combo.h | 4 ++-- src/generic/combog.cpp | 7 +++++++ src/generic/odcombo.cpp | 7 ------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/wx/generic/combo.h b/include/wx/generic/combo.h index 9c5da101d0..9b0cf9e7b5 100644 --- a/include/wx/generic/combo.h +++ b/include/wx/generic/combo.h @@ -91,8 +91,8 @@ protected: virtual GtkEditable *GetEditable() const wxOVERRIDE { return NULL; } virtual GtkEntry *GetEntry() const wxOVERRIDE { return NULL; } #endif -#elif defined(__WXMAC__) - // Looks like there's nothing we need to override here +#elif defined(__WXOSX__) + virtual wxTextWidgetImpl * GetTextPeer() const wxOVERRIDE; #endif // For better transparent background rendering diff --git a/src/generic/combog.cpp b/src/generic/combog.cpp index 411dc2e782..1f5f3d2bea 100644 --- a/src/generic/combog.cpp +++ b/src/generic/combog.cpp @@ -458,6 +458,13 @@ bool wxGenericComboCtrl::IsKeyPopupToggle(const wxKeyEvent& event) const return false; } +#if defined(__WXOSX__) +wxTextWidgetImpl * wxGenericComboCtrl::GetTextPeer() const +{ + return m_text ? m_text->GetTextPeer() : NULL; +} +#endif + #ifdef __WXUNIVERSAL__ bool wxGenericComboCtrl::PerformAction(const wxControlAction& action, diff --git a/src/generic/odcombo.cpp b/src/generic/odcombo.cpp index 9c0a21a489..fd3061e414 100644 --- a/src/generic/odcombo.cpp +++ b/src/generic/odcombo.cpp @@ -988,14 +988,7 @@ void wxOwnerDrawnComboBox::DoClear() // There is no text entry when using wxCB_READONLY style, so test for it. if ( GetTextCtrl() ) - { -#ifdef __WXOSX__ - // this has to be rerouted to the text control explicitly on macOS - GetTextCtrl()->Clear(); -#else wxTextEntry::Clear(); -#endif - } } void wxOwnerDrawnComboBox::Clear()