Merge branch 'gtk-tab'

Fixes for TAB navigation when using wxComboCtrl and wxDatePickerCtrl in
wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/703
This commit is contained in:
Vadim Zeitlin
2018-01-31 23:13:03 +01:00
4 changed files with 23 additions and 22 deletions

View File

@@ -16,6 +16,8 @@
// Only define generic if native doesn't have all the features // Only define generic if native doesn't have all the features
#if !defined(wxCOMBOCONTROL_FULLY_FEATURED) #if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
#include "wx/containr.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Generic wxComboCtrl // Generic wxComboCtrl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -30,15 +32,14 @@
#endif #endif
#include "wx/dcbuffer.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase class WXDLLIMPEXP_CORE wxGenericComboCtrl
: public wxNavigationEnabled<wxComboCtrlBase>
{ {
public: public:
// ctors and such // ctors and such
wxGenericComboCtrl() : wxComboCtrlBase() { Init(); } wxGenericComboCtrl() { Init(); }
wxGenericComboCtrl(wxWindow *parent, wxGenericComboCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
@@ -48,7 +49,6 @@ public:
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator, const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr) const wxString& name = wxComboBoxNameStr)
: wxComboCtrlBase()
{ {
Init(); Init();
@@ -96,19 +96,7 @@ protected:
#endif #endif
// For better transparent background rendering // For better transparent background rendering
virtual bool HasTransparentBackground() wxOVERRIDE 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
}
// Mandatory virtuals // Mandatory virtuals
virtual void OnResize() wxOVERRIDE; virtual void OnResize() wxOVERRIDE;

View File

@@ -12,6 +12,7 @@
#define _WX_GENERIC_DATECTRL_H_ #define _WX_GENERIC_DATECTRL_H_
#include "wx/compositewin.h" #include "wx/compositewin.h"
#include "wx/containr.h"
class WXDLLIMPEXP_FWD_CORE wxComboCtrl; class WXDLLIMPEXP_FWD_CORE wxComboCtrl;
@@ -19,7 +20,7 @@ class WXDLLIMPEXP_FWD_ADV wxCalendarCtrl;
class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup; class WXDLLIMPEXP_FWD_ADV wxCalendarComboPopup;
class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric class WXDLLIMPEXP_ADV wxDatePickerCtrlGeneric
: public wxCompositeWindow<wxDatePickerCtrlBase> : public wxCompositeWindowSettersOnly< wxNavigationEnabled<wxDatePickerCtrlBase> >
{ {
public: public:
// creating the control // creating the control

View File

@@ -751,9 +751,7 @@ void wxComboBoxExtraInputHandler::OnKey(wxKeyEvent& event)
if ( !combo->GetEventHandler()->ProcessEvent(redirectedEvent) ) if ( !combo->GetEventHandler()->ProcessEvent(redirectedEvent) )
{ {
// Don't let TAB through to the text ctrl - looks ugly event.Skip();
if ( event.GetKeyCode() != WXK_TAB )
event.Skip();
} }
} }

View File

@@ -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() void wxGenericComboCtrl::OnResize()
{ {