From f775501ba0a3b514cd0417e947c307c850d1dfec Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jan 2018 19:40:59 +0100 Subject: [PATCH 1/5] Don't eat TAB unconditionally in wxComboCtrl This prevented TAB navigation from doing anything at all when the focus was on wxComboCtrl in wxGTK and, probably, all the other non-MSW ports (in wxMSW TAB navigation happens before normal key processing, so this check was irrelevant there). --- src/common/combocmn.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 33342b6952..3dc6901f82 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -751,9 +751,7 @@ void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event) if ( !combo->GetEventHandler()->ProcessEvent(redirectedEvent) ) { - // Don't let TAB through to the text ctrl - looks ugly - if ( event.GetKeyCode() != WXK_TAB ) - event.Skip(); + event.Skip(); } } From 3825baf708dc1a7f41290fabad55d83b25a22637 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jan 2018 19:45:32 +0100 Subject: [PATCH 2/5] Remove wx/dcbuffer.h dependency from wx/generic/combo.h This header doesn't really need to be included from here and it was done solely in order to get the value of wxALWAYS_NATIVE_DOUBLE_BUFFER from it. Move the code using this macro in the .cpp file instead. --- include/wx/generic/combo.h | 16 +--------------- src/generic/combog.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/wx/generic/combo.h b/include/wx/generic/combo.h index 92b3ff624e..dc9155394f 100644 --- a/include/wx/generic/combo.h +++ b/include/wx/generic/combo.h @@ -30,8 +30,6 @@ #endif -#include "wx/dcbuffer.h" - extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase @@ -96,19 +94,7 @@ protected: #endif // For better transparent background rendering - virtual bool HasTransparentBackground() wxOVERRIDE - { - #if wxALWAYS_NATIVE_DOUBLE_BUFFER - #ifdef __WXGTK__ - // Sanity check for GTK+ - return IsDoubleBuffered(); - #else - return true; - #endif - #else - return false; - #endif - } + virtual bool HasTransparentBackground() wxOVERRIDE; // Mandatory virtuals virtual void OnResize() wxOVERRIDE; diff --git a/src/generic/combog.cpp b/src/generic/combog.cpp index 1bac5e630e..411dc2e782 100644 --- a/src/generic/combog.cpp +++ b/src/generic/combog.cpp @@ -198,6 +198,20 @@ wxGenericComboCtrl::~wxGenericComboCtrl() { } +bool wxGenericComboCtrl::HasTransparentBackground() +{ +#if wxALWAYS_NATIVE_DOUBLE_BUFFER + #ifdef __WXGTK__ + // Sanity check for GTK+ + return IsDoubleBuffered(); + #else + return true; + #endif +#else + return false; +#endif +} + void wxGenericComboCtrl::OnResize() { From 27cad5e04d4de436c1ebf0aa167e1502040fb502 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jan 2018 19:50:09 +0100 Subject: [PATCH 3/5] Fix TAB navigation with wxComboCtrl in non-MSW ports Derive wxGenericComboCtrl from wxNavigationEnabled<> to make TAB work correctly when the focus was on it, otherwise it didn't move it correctly to the next control. This notably allows TAB to cycle through all the controls in the "combo" sample whereas previously it stopped on reaching the combo control with the list popup with wxGTK. --- include/wx/generic/combo.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/wx/generic/combo.h b/include/wx/generic/combo.h index dc9155394f..9c5da101d0 100644 --- a/include/wx/generic/combo.h +++ b/include/wx/generic/combo.h @@ -16,6 +16,8 @@ // Only define generic if native doesn't have all the features #if !defined(wxCOMBOCONTROL_FULLY_FEATURED) +#include "wx/containr.h" + // ---------------------------------------------------------------------------- // Generic wxComboCtrl // ---------------------------------------------------------------------------- @@ -32,11 +34,12 @@ extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; -class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase +class WXDLLIMPEXP_CORE wxGenericComboCtrl + : public wxNavigationEnabled { public: // ctors and such - wxGenericComboCtrl() : wxComboCtrlBase() { Init(); } + wxGenericComboCtrl() { Init(); } wxGenericComboCtrl(wxWindow *parent, wxWindowID id = wxID_ANY, @@ -46,7 +49,6 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr) - : wxComboCtrlBase() { Init(); From 1de107c03706de5e1864f7e167d29eea93df066f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jan 2018 19:49:03 +0100 Subject: [PATCH 4/5] Derive wxDatePickerCtrlGeneric from wxCompositeWindowSettersOnly This class doesn't need the extra focus-related features of wxCompositeWindow. --- include/wx/generic/datectrl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wx/generic/datectrl.h b/include/wx/generic/datectrl.h index 61a4ad18c9..9c273a6e40 100644 --- a/include/wx/generic/datectrl.h +++ b/include/wx/generic/datectrl.h @@ -19,7 +19,7 @@ class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl; class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup; class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric - : public wxCompositeWindow + : public wxCompositeWindowSettersOnly { public: // creating the control From 648cfe074305512952132c40b03758be577bda93 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Jan 2018 21:35:20 +0100 Subject: [PATCH 5/5] Fix TAB navigation for wxDatePickerCtrl in wxGTK Inherit from wxNavigationEnabled<> to make navigation work correctly in wxGTK. --- include/wx/generic/datectrl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wx/generic/datectrl.h b/include/wx/generic/datectrl.h index 9c273a6e40..09d340739d 100644 --- a/include/wx/generic/datectrl.h +++ b/include/wx/generic/datectrl.h @@ -12,6 +12,7 @@ #define _WX_GENERIC_DATECTRL_H_ #include "wx/compositewin.h" +#include "wx/containr.h" class WXDLLIMPEXP_FWD_CORE wxComboCtrl; @@ -19,7 +20,7 @@ class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl; class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup; class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric - : public wxCompositeWindowSettersOnly + : public wxCompositeWindowSettersOnly< wxNavigationEnabled > { public: // creating the control