X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5398a2e05001914ec3d83fd30f9f7e3f6a9e29be..b18e2046af6c8eaf6e867ba18dd9410dbd7dfcf7:/src/osx/carbon/window.cpp diff --git a/src/osx/carbon/window.cpp b/src/osx/carbon/window.cpp index 2e9a26ff25..875b62a41e 100644 --- a/src/osx/carbon/window.cpp +++ b/src/osx/carbon/window.cpp @@ -79,6 +79,14 @@ #define wxMAC_DEBUG_REDRAW 0 #endif +// Get the window with the focus +WXWidget wxWidgetImpl::FindFocus() +{ + ControlRef control = NULL ; + GetKeyboardFocus( GetUserFocusWindow() , &control ) ; + return control; +} + // --------------------------------------------------------------------------- // Carbon Events // --------------------------------------------------------------------------- @@ -814,8 +822,13 @@ pascal void wxMacLiveScrollbarActionProc( ControlRef control , ControlPartCode p } wxMAC_DEFINE_PROC_GETTER( ControlActionUPP , wxMacLiveScrollbarActionProc ) ; -wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, long extraStyle) +wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, + wxWindowMac* WXUNUSED(parent), + wxWindowID WXUNUSED(id), + const wxPoint& pos, + const wxSize& size, + long WXUNUSED(style), + long WXUNUSED(extraStyle)) { OSStatus err = noErr; Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ; @@ -917,19 +930,24 @@ void wxMacControl::Lower() void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const { - RgnHandle rgn = NewRgn() ; - Rect content ; - if ( GetControlRegion( m_controlRef, kControlContentMetaPart , rgn ) == noErr ) - GetRegionBounds( rgn , &content ) ; + HIShapeRef rgn = NULL; + Rect content ; + + if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr) + { + CGRect cgrect; + HIShapeGetBounds(rgn, &cgrect); + content = (Rect){ cgrect.origin.y, cgrect.origin.x, cgrect.origin.y+cgrect.size.height, cgrect.origin.x+cgrect.size.width }; + CFRelease(rgn); + } else { - GetControlBounds( m_controlRef , &content ); + GetControlBounds(m_controlRef, &content); content.right -= content.left; content.left = 0; content.bottom -= content.top; content.top = 0; } - DisposeRgn( rgn ) ; left = content.left; top = content.top; @@ -1223,7 +1241,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l flush = kHIThemeTextHorizontalFlushCenter; else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT ) flush = kHIThemeTextHorizontalFlushRight; - HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.MacGetCTFont() ); + HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.OSXGetCTFont() ); HIViewSetTextHorizontalFlush( m_controlRef, part, flush ); if ( foreground != *wxBLACK || ignoreBlack == false ) @@ -1264,7 +1282,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l { fontStyle.font = font.MacGetFontNum(); fontStyle.style = font.MacGetFontStyle(); - fontStyle.size = font.MacGetFontSize(); + fontStyle.size = font.GetPointSize(); fontStyle.flags = kControlUseFontMask | kControlUseFaceMask | kControlUseSizeMask; } @@ -1389,12 +1407,6 @@ void wxMacControl::GetFeatures( UInt32 * features ) GetControlFeatures( m_controlRef , features ); } -OSStatus wxMacControl::GetRegion( ControlPartCode partCode , RgnHandle region ) -{ - OSStatus err = GetControlRegion( m_controlRef , partCode , region ); - return err; -} - void wxMacControl::PulseGauge() { }