From 563329f89f57018031b98ff76c32e3d51db03502 Mon Sep 17 00:00:00 2001 From: John Roberts Date: Sat, 18 Jul 2015 01:06:44 +0200 Subject: [PATCH] Fix wxSearchCtrl appearance under OS X 10.10 Yosemite. Avoid centered look which renders the control unusable under this version. See #16871. --- src/osx/cocoa/srchctrl.mm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/srchctrl.mm b/src/osx/cocoa/srchctrl.mm index 27797dcd4d..982151adfb 100644 --- a/src/osx/cocoa/srchctrl.mm +++ b/src/osx/cocoa/srchctrl.mm @@ -165,7 +165,25 @@ public : } } } - + + virtual void SetCentredLook( bool centre ) + { + SEL sel = @selector(setCenteredLook:); + if ( [m_searchFieldCell respondsToSelector: sel] ) + { + // all this avoids xcode parsing warnings when using + // [m_searchFieldCell setCenteredLook:NO]; + NSMethodSignature* signature = + [NSSearchFieldCell instanceMethodSignatureForSelector:sel]; + NSInvocation* invocation = + [NSInvocation invocationWithMethodSignature: signature]; + [invocation setTarget: m_searchFieldCell]; + [invocation setSelector:sel]; + [invocation setArgument:¢re atIndex:2]; + [invocation invoke]; + } + } + private: wxNSSearchField* m_searchField; NSSearchFieldCell* m_searchFieldCell; @@ -192,6 +210,7 @@ wxWidgetImplType* wxWidgetImpl::CreateSearchControl( wxSearchCtrl* wxpeer, wxNSSearchFieldControl* c = new wxNSSearchFieldControl( wxpeer, v ); c->SetNeedsFrame( false ); + c->SetCentredLook( false ); c->SetStringValue( str ); return c; }