Added native focus rectangle drawing for wxMac (CG only at present)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -72,6 +72,8 @@ public:
|
||||
const wxRect& rect,
|
||||
int flags = 0);
|
||||
|
||||
virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0);
|
||||
|
||||
private:
|
||||
void DrawMacThemeButton(wxWindow *win,
|
||||
wxDC& dc,
|
||||
@@ -206,8 +208,8 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win,
|
||||
|
||||
int wxRendererMac::GetHeaderButtonHeight(wxWindow* WXUNUSED(win))
|
||||
{
|
||||
SInt32 standardHeight;
|
||||
OSStatus errStatus;
|
||||
SInt32 standardHeight;
|
||||
OSStatus errStatus;
|
||||
|
||||
errStatus = GetThemeMetric( kThemeMetricListHeaderHeight, &standardHeight );
|
||||
if (errStatus == noErr)
|
||||
@@ -504,3 +506,47 @@ wxRendererMac::DrawPushButton(wxWindow *win,
|
||||
kind, kThemeAdornmentNone);
|
||||
}
|
||||
|
||||
void
|
||||
wxRendererMac::DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags)
|
||||
{
|
||||
if (!win)
|
||||
{
|
||||
wxDelegateRendererNative::DrawFocusRect(win, dc, rect, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
#if wxMAC_USE_CORE_GRAPHICS
|
||||
{
|
||||
CGRect cgrect = CGRectMake( rect.x , rect.y , rect.width, rect.height ) ;
|
||||
|
||||
HIThemeFrameDrawInfo info ;
|
||||
memset( &info, 0 , sizeof(info) ) ;
|
||||
|
||||
info.version = 0 ;
|
||||
info.kind = 0 ;
|
||||
info.state = kThemeStateActive;
|
||||
info.isFocused = true ;
|
||||
|
||||
CGContextRef cgContext = (CGContextRef) win->MacGetCGContextRef() ;
|
||||
wxASSERT( cgContext ) ;
|
||||
|
||||
HIThemeDrawFocusRect( &cgrect , true , cgContext , kHIThemeOrientationNormal ) ;
|
||||
}
|
||||
#else
|
||||
// FIXME: not yet working for !wxMAC_USE_CORE_GRAPHICS
|
||||
{
|
||||
Rect r;
|
||||
r.left = rect.x; r.top = rect.y; r.right = rect.GetRight(); r.bottom = rect.GetBottom();
|
||||
wxTopLevelWindowMac* top = win->MacGetTopLevelWindow();
|
||||
if ( top )
|
||||
{
|
||||
wxPoint pt(0, 0) ;
|
||||
wxMacControl::Convert( &pt , win->GetPeer() , top->GetPeer() ) ;
|
||||
OffsetRect( &r , pt.x , pt.y ) ;
|
||||
}
|
||||
|
||||
DrawThemeFocusRect( &r , true ) ;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user