Account for wxTE_PROCESS_TAB when doing tab navigation on wxOSX.
This commit is contained in:
@@ -16,9 +16,27 @@
|
||||
|
||||
@class wxTextEntryFormatter;
|
||||
|
||||
class wxNSTextBase : public wxWidgetCocoaImpl, public wxTextWidgetImpl
|
||||
{
|
||||
public :
|
||||
wxNSTextBase( wxTextCtrl *text, WXWidget w )
|
||||
: wxWidgetCocoaImpl(text, w),
|
||||
wxTextWidgetImpl(text)
|
||||
{
|
||||
}
|
||||
wxNSTextBase( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w )
|
||||
: wxWidgetCocoaImpl(wxPeer, w),
|
||||
wxTextWidgetImpl(entry)
|
||||
{
|
||||
}
|
||||
virtual ~wxNSTextBase() { }
|
||||
|
||||
virtual bool ShouldHandleKeyNavigation(const wxKeyEvent &event) const wxOVERRIDE;
|
||||
};
|
||||
|
||||
// implementation exposed, so that search control can pull it
|
||||
|
||||
class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
|
||||
class wxNSTextFieldControl : public wxNSTextBase
|
||||
{
|
||||
public :
|
||||
// wxNSTextFieldControl must always be associated with a wxTextEntry. If
|
||||
@@ -67,7 +85,7 @@ private:
|
||||
wxTextEntryFormatter* GetFormatter();
|
||||
};
|
||||
|
||||
class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
|
||||
class wxNSTextViewControl : public wxNSTextBase
|
||||
{
|
||||
public:
|
||||
wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style );
|
||||
|
@@ -646,6 +646,15 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
bool wxNSTextBase::ShouldHandleKeyNavigation(const wxKeyEvent &event) const
|
||||
{
|
||||
// Text controls must be allowed to handle the key even if wxWANTS_CHARS is not set, provided wxTE_PROCESS_TAB
|
||||
// is set. To make Shift+TAB work with text controls we must process it here regardless of wxTE_PROCESS_TAB.
|
||||
// For Ctrl(+Shift)+TAB to work as navigation key consistently in all types of text fields we must process it here as well.
|
||||
return (!m_wxPeer->HasFlag(wxTE_PROCESS_TAB) || event.HasAnyModifiers());
|
||||
}
|
||||
|
||||
// wxNSTextViewControl
|
||||
|
||||
// Official Apple docs suggest to use FLT_MAX when embedding an NSTextView
|
||||
@@ -656,8 +665,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
|
||||
#define MAX_WIDTH 1000000
|
||||
|
||||
wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style )
|
||||
: wxWidgetCocoaImpl(wxPeer, w),
|
||||
wxTextWidgetImpl(wxPeer)
|
||||
: wxNSTextBase(wxPeer, w)
|
||||
{
|
||||
wxNSTextScrollView* sv = (wxNSTextScrollView*) w;
|
||||
m_scrollView = sv;
|
||||
@@ -963,8 +971,7 @@ wxSize wxNSTextViewControl::GetBestSize() const
|
||||
// wxNSTextFieldControl
|
||||
|
||||
wxNSTextFieldControl::wxNSTextFieldControl( wxTextCtrl *text, WXWidget w )
|
||||
: wxWidgetCocoaImpl(text, w),
|
||||
wxTextWidgetImpl(text)
|
||||
: wxNSTextBase(text, w)
|
||||
{
|
||||
Init(w);
|
||||
}
|
||||
@@ -972,8 +979,7 @@ wxNSTextFieldControl::wxNSTextFieldControl( wxTextCtrl *text, WXWidget w )
|
||||
wxNSTextFieldControl::wxNSTextFieldControl(wxWindow *wxPeer,
|
||||
wxTextEntry *entry,
|
||||
WXWidget w)
|
||||
: wxWidgetCocoaImpl(wxPeer, w),
|
||||
wxTextWidgetImpl(entry)
|
||||
: wxNSTextBase(wxPeer, entry, w)
|
||||
{
|
||||
Init(w);
|
||||
}
|
||||
|
Reference in New Issue
Block a user