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
commit 0091e2aaab
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
#if !defined(wxCOMBOCONTROL_FULLY_FEATURED)
#include "wx/containr.h"
// ----------------------------------------------------------------------------
// Generic wxComboCtrl
// ----------------------------------------------------------------------------
@ -30,15 +32,14 @@
#endif
#include "wx/dcbuffer.h"
extern WXDLLIMPEXP_DATA_CORE(const char) wxComboBoxNameStr[];
class WXDLLIMPEXP_CORE wxGenericComboCtrl : public wxComboCtrlBase
class WXDLLIMPEXP_CORE wxGenericComboCtrl
: public wxNavigationEnabled<wxComboCtrlBase>
{
public:
// ctors and such
wxGenericComboCtrl() : wxComboCtrlBase() { Init(); }
wxGenericComboCtrl() { Init(); }
wxGenericComboCtrl(wxWindow *parent,
wxWindowID id = wxID_ANY,
@ -48,7 +49,6 @@ public:
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr)
: wxComboCtrlBase()
{
Init();
@ -96,19 +96,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;

View File

@ -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 wxCompositeWindow<wxDatePickerCtrlBase>
: public wxCompositeWindowSettersOnly< wxNavigationEnabled<wxDatePickerCtrlBase> >
{
public:
// creating the control

View File

@ -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();
}
}

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()
{