X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4807c0a8fdce8c8a21f7296cc224c08297ca54b..10ff9c616e00e4074dfdc2ac9e354605cc129c22:/src/mac/carbon/utils.cpp diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index f97f8da6b6..042fc6832c 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -220,7 +220,7 @@ int wxDisplayDepth() return theDepth; #else - return 32; // TODO + return 32; // TODO #endif } @@ -266,7 +266,7 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height) *height = bounds.size.height; #else int w, h; - wxDisplaySize(&w,&h); + wxDisplaySize(&w,&h); if ( x ) *x = 0; if ( y ) @@ -469,7 +469,7 @@ OSStatus wxMacCarbonEvent::SetParameter(EventParamName inName, EventParamType in IMPLEMENT_DYNAMIC_CLASS( wxMacControl , wxObject ) -wxMacControl::wxMacControl() +wxMacControl::wxMacControl() { Init(); } @@ -643,7 +643,29 @@ void wxMacControl::SuperChangedPosition() void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) { m_font = font; -#ifndef __LP64__ +#if wxMAC_USE_CORE_TEXT + if ( UMAGetSystemVersion() >= 0x1050 ) + { + HIViewPartCode part = 0; + HIThemeTextHorizontalFlush flush = kHIThemeTextHorizontalFlushDefault; + if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_CENTER_HORIZONTAL ) + flush = kHIThemeTextHorizontalFlushCenter; + else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT ) + flush = kHIThemeTextHorizontalFlushRight; + HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.MacGetCTFont() ); + HIViewSetTextHorizontalFlush( m_controlRef, part, flush ); + + if ( foreground != *wxBLACK ) + { + ControlFontStyleRec fontStyle; + foreground.GetRGBColor( &fontStyle.foreColor ); + fontStyle.flags = kControlUseForeColorMask; + ::SetControlFontStyle( m_controlRef , &fontStyle ); + } + + } +#endif +#if wxMAC_USE_ATSU_TEXT ControlFontStyleRec fontStyle; if ( font.MacGetThemeFontID() != kThemeCurrentPortFont ) { @@ -699,8 +721,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l void wxMacControl::SetBackgroundColour( const wxColour &WXUNUSED(col) ) { - // TODO - // setting up a color proc is not recommended anymore +// HITextViewSetBackgroundColor( m_textView , color ); } void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum ) @@ -824,9 +845,9 @@ void wxMacControl::GetRect( Rect *r ) void wxMacControl::GetRectInWindowCoords( Rect *r ) { GetControlBounds( m_controlRef , r ) ; - + WindowRef tlwref = GetControlOwner( m_controlRef ) ; - + wxTopLevelWindowMac* tlwwx = wxFindWinFromMacWindow( tlwref ) ; if ( tlwwx != NULL ) { @@ -1887,7 +1908,7 @@ void wxMacDataItemBrowserControl::MacScrollTo( unsigned int n ) UInt32 linebottom = linetop + height; Rect rect ; GetRect( &rect ); - + if ( linetop < top || linebottom > (top + rect.bottom - rect.top ) ) SetScrollPosition( wxMax( n-2, 0 ) * ((UInt32)height) , left ) ; @@ -1933,28 +1954,20 @@ CGColorSpaceRef wxMacGetGenericRGBColorSpace() return genericRGBColorSpace; } -CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) +CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) { CGColorRef color ; HIThemeBrushCreateCGColor( brush, &color ); return color; } -#ifndef __LP64__ - -wxMacPortSaver::wxMacPortSaver( GrafPtr port ) -{ - ::GetPort( &m_port ); - ::SetPort( port ); -} +#if wxMAC_USE_QUICKDRAW -wxMacPortSaver::~wxMacPortSaver() +static inline void PointFromHIPoint(const HIPoint& p, Point *pt) { - ::SetPort( m_port ); + pt->h = wx_static_cast(short, p.x); + pt->v = wx_static_cast(short, p.y); } -#endif - -#if wxMAC_USE_QUICKDRAW void wxMacGlobalToLocal( WindowRef window , Point*pt ) { @@ -1963,8 +1976,7 @@ void wxMacGlobalToLocal( WindowRef window , Point*pt ) // TODO check toolbar offset HIViewFindByID( HIViewGetRoot( window ), kHIViewWindowContentID , &contentView) ; HIPointConvert( &p, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceView, contentView ); - pt->h = p.x; - pt->v = p.y; + PointFromHIPoint(p, pt); } void wxMacLocalToGlobal( WindowRef window , Point*pt ) @@ -1974,10 +1986,10 @@ void wxMacLocalToGlobal( WindowRef window , Point*pt ) // TODO check toolbar offset HIViewFindByID( HIViewGetRoot( window ), kHIViewWindowContentID , &contentView) ; HIPointConvert( &p, kHICoordSpaceView, contentView, kHICoordSpace72DPIGlobal, NULL ); - pt->h = p.x; - pt->v = p.y; + PointFromHIPoint(p, pt); } -#endif + +#endif // wxMAC_USE_QUICKDRAW #endif // wxUSE_GUI