Factor out wxWidgetCocoaImpl::GetViewWithText()
Extract this function from wxWidgetCocoaImpl::SetFont() to allow its reuse. No changes, this is a pure refactoring.
This commit is contained in:
@@ -241,6 +241,10 @@ protected:
|
|||||||
// was the wx event for the current native key down event sent
|
// was the wx event for the current native key down event sent
|
||||||
bool WasKeyDownSent() const;
|
bool WasKeyDownSent() const;
|
||||||
|
|
||||||
|
|
||||||
|
// Return the view to apply the font/colour to.
|
||||||
|
NSView* GetViewWithText() const;
|
||||||
|
|
||||||
NSEvent* m_lastKeyDownEvent;
|
NSEvent* m_lastKeyDownEvent;
|
||||||
bool m_lastKeyDownWXSent;
|
bool m_lastKeyDownWXSent;
|
||||||
#if !wxOSX_USE_NATIVE_FLIPPED
|
#if !wxOSX_USE_NATIVE_FLIPPED
|
||||||
|
@@ -3543,13 +3543,19 @@ void wxWidgetCocoaImpl::SetControlSize( wxWindowVariant variant )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSView* wxWidgetCocoaImpl::GetViewWithText() const
|
||||||
|
{
|
||||||
|
if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
|
||||||
|
return [(NSScrollView*) m_osxView documentView];
|
||||||
|
else if ( [m_osxView isKindOfClass:[NSBox class] ] )
|
||||||
|
return [(NSBox*) m_osxView titleCell];
|
||||||
|
|
||||||
|
return m_osxView;
|
||||||
|
}
|
||||||
|
|
||||||
void wxWidgetCocoaImpl::SetFont(wxFont const& font)
|
void wxWidgetCocoaImpl::SetFont(wxFont const& font)
|
||||||
{
|
{
|
||||||
NSView* targetView = m_osxView;
|
NSView* const targetView = GetViewWithText();
|
||||||
if ( [m_osxView isKindOfClass:[NSScrollView class] ] )
|
|
||||||
targetView = [(NSScrollView*) m_osxView documentView];
|
|
||||||
else if ( [m_osxView isKindOfClass:[NSBox class] ] )
|
|
||||||
targetView = [(NSBox*) m_osxView titleCell];
|
|
||||||
|
|
||||||
if ([targetView respondsToSelector:@selector(setFont:)])
|
if ([targetView respondsToSelector:@selector(setFont:)])
|
||||||
[targetView setFont: font.OSXGetNSFont()];
|
[targetView setFont: font.OSXGetNSFont()];
|
||||||
|
Reference in New Issue
Block a user