Merge branch 'mac-native-focus-ring' of https://github.com/vslavik/wxWidgets

Draw wxTextCtrl focus ring natively on Mac.

Add wxWindow::EnableVisibleFocus() to explicitly control the focus ring
visibility if necessary.

See https://github.com/wxWidgets/wxWidgets/pull/2037
This commit is contained in:
Vadim Zeitlin
2020-09-01 14:59:42 +02:00
10 changed files with 33 additions and 38 deletions

View File

@@ -111,6 +111,8 @@ public :
virtual void SetNeedsDisplay( const wxRect* where = NULL ) wxOVERRIDE;
virtual bool GetNeedsDisplay() const wxOVERRIDE;
virtual void EnableFocusRing(bool enabled) wxOVERRIDE;
virtual void SetDrawingEnabled(bool enabled) wxOVERRIDE;
virtual bool CanFocus() const wxOVERRIDE;

View File

@@ -301,8 +301,7 @@ public :
virtual void SetNeedsDisplay( const wxRect* where = NULL ) = 0;
virtual bool GetNeedsDisplay() const = 0;
virtual bool NeedsFocusRect() const;
virtual void SetNeedsFocusRect( bool needs );
virtual void EnableFocusRing(bool WXUNUSED(enabled)) {}
virtual bool NeedsFrame() const;
virtual void SetNeedsFrame( bool needs );
@@ -598,7 +597,6 @@ protected :
bool m_wantsUserKey;
bool m_wantsUserMouse;
wxWindowMac* m_wxPeer;
bool m_needsFocusRect;
bool m_needsFrame;
bool m_shouldSendEvents;

View File

@@ -157,6 +157,7 @@ public:
void MacOnScroll( wxScrollEvent&event );
virtual bool AcceptsFocus() const wxOVERRIDE;
virtual void EnableVisibleFocus(bool enabled) wxOVERRIDE;
virtual bool IsDoubleBuffered() const wxOVERRIDE { return true; }

View File

@@ -767,6 +767,9 @@ public:
// call this when the return value of AcceptsFocus() changes
virtual void SetCanFocus(bool WXUNUSED(canFocus)) { }
// call to customize visible focus indicator if possible in the port
virtual void EnableVisibleFocus(bool WXUNUSED(enabled)) { }
// navigates inside this window
bool NavigateIn(int flags = wxNavigationKeyEvent::IsForward)
{ return DoNavigateIn(flags); }