From: Vadim Zeitlin Date: Fri, 30 Nov 2007 14:31:09 +0000 (+0000) Subject: unused parameters and float/double->int conversion warning fixes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/9a8864cad79d7021630c5e72f4a8f2d76b6b44d8?ds=sidebyside unused parameters and float/double->int conversion warning fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50352 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/dcmemory.cpp b/src/mac/carbon/dcmemory.cpp index 2302c3d776..f1086953b4 100644 --- a/src/mac/carbon/dcmemory.cpp +++ b/src/mac/carbon/dcmemory.cpp @@ -25,18 +25,18 @@ IMPLEMENT_ABSTRACT_CLASS(wxMemoryDCImpl,wxPaintDCImpl) wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner ) : wxPaintDCImpl( owner ) -{ - Init(); +{ + Init(); } wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxBitmap& bitmap ) : wxPaintDCImpl( owner ) -{ - Init(); +{ + Init(); DoSelect(bitmap); } -wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC *dc ) +wxMemoryDCImpl::wxMemoryDCImpl( wxMemoryDC *owner, wxDC * WXUNUSED(dc) ) : wxPaintDCImpl( owner ) { Init(); diff --git a/src/mac/carbon/region.cpp b/src/mac/carbon/region.cpp index 3ee709f722..20d5d46b7d 100644 --- a/src/mac/carbon/region.cpp +++ b/src/mac/carbon/region.cpp @@ -29,22 +29,22 @@ class WXDLLEXPORT wxRegionRefData : public wxGDIRefData { public: wxRegionRefData() - { - m_macRgn.reset( HIShapeCreateMutable() ); + { + m_macRgn.reset( HIShapeCreateMutable() ); } wxRegionRefData(HIShapeRef hRegion) - { - m_macRgn.reset( HIShapeCreateMutableCopy(hRegion) ); + { + m_macRgn.reset( HIShapeCreateMutableCopy(hRegion) ); } - + wxRegionRefData(long x, long y, long w, long h) { CGRect r = CGRectMake(x,y,w,h); wxCFRef rect(HIShapeCreateWithRect(&r)); - m_macRgn.reset( HIShapeCreateMutableCopy(rect) ); + m_macRgn.reset( HIShapeCreateMutableCopy(rect) ); } - + wxRegionRefData(const wxRegionRefData& data) : wxGDIRefData() { @@ -52,7 +52,7 @@ public: } virtual ~wxRegionRefData() - { + { } wxCFRef m_macRgn; @@ -85,8 +85,8 @@ wxRegion::wxRegion(long x, long y, long w, long h) wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight) { - m_refData = new wxRegionRefData(topLeft.x , topLeft.y , - topLeft.x - bottomRight.x , + m_refData = new wxRegionRefData(topLeft.x , topLeft.y , + topLeft.x - bottomRight.x , topLeft.y - bottomRight.y); } @@ -97,9 +97,12 @@ wxRegion::wxRegion(const wxRect& rect) wxRegion::wxRegion(size_t n, const wxPoint *points, int WXUNUSED(fillStyle)) { - m_refData = new wxRegionRefData; + wxUnusedVar(n); + wxUnusedVar(points); #if 0 // ndef __LP64__ + m_refData = new wxRegionRefData; + // TODO : any APIs ? // OS X somehow does not collect the region invisibly as before, so sometimes things // get drawn on screen instead of just being combined into a region, therefore we allocate a temp gworld now @@ -138,6 +141,9 @@ wxRegion::wxRegion(size_t n, const wxPoint *points, int WXUNUSED(fillStyle)) ::SetGWorld( oldWorld, oldGDHandle ); } +#else + wxFAIL_MSG( "not implemented" ); + m_refData = NULL; #endif } @@ -238,10 +244,10 @@ bool wxRegion::DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const { CGRect box ; HIShapeGetBounds( M_REGION , &box ) ; - x = box.origin.x ; - y = box.origin.y ; - w = box.size.width ; - h = box.size.height ; + x = wx_static_cast(int, box.origin.x); + y = wx_static_cast(int, box.origin.y); + w = wx_static_cast(int, box.size.width); + h = wx_static_cast(int, box.size.height); return true; } @@ -295,7 +301,7 @@ wxRegionContain wxRegion::DoContainsRect(const wxRect& r) const wxCFRef intersect(HIShapeCreateIntersection(rectshape,M_REGION)); CGRect bounds; HIShapeGetBounds(intersect, &bounds); - + if ( HIShapeIsRectangular(intersect) && CGRectEqualToRect(rect,bounds) ) return wxInRegion; else if ( HIShapeIsEmpty( intersect ) ) @@ -440,14 +446,14 @@ void wxRegionIterator::Reset(const wxRegion& region) m_numRects = 1; m_rects = new wxRect[m_numRects]; m_rects[0] = m_region.GetBox(); - + #else RegionToRectsUPP proc = (RegionToRectsUPP) wxMacRegionToRectsCounterCallback; OSStatus err = noErr; RgnHandle rgn = NewRgn(); HIShapeGetAsQDRgn(OTHER_M_REGION(region), rgn); - + err = QDRegionToRects (rgn, kQDParseRegionFromTopLeft, proc, (void*)&m_numRects); if (err == noErr) { diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index b91247bfd5..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(); } @@ -654,7 +654,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l flush = kHIThemeTextHorizontalFlushRight; HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.MacGetCTFont() ); HIViewSetTextHorizontalFlush( m_controlRef, part, flush ); - + if ( foreground != *wxBLACK ) { ControlFontStyleRec fontStyle; @@ -662,7 +662,7 @@ void wxMacControl::SetFont( const wxFont & font , const wxColour& foreground , l fontStyle.flags = kControlUseForeColorMask; ::SetControlFontStyle( m_controlRef , &fontStyle ); } - + } #endif #if wxMAC_USE_ATSU_TEXT @@ -845,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 ) { @@ -1908,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 ) ; @@ -1954,7 +1954,7 @@ CGColorSpaceRef wxMacGetGenericRGBColorSpace() return genericRGBColorSpace; } -CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) +CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) { CGColorRef color ; HIThemeBrushCreateCGColor( brush, &color ); @@ -1963,6 +1963,12 @@ CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush ) #if wxMAC_USE_QUICKDRAW +static inline void PointFromHIPoint(const HIPoint& p, Point *pt) +{ + pt->h = wx_static_cast(short, p.x); + pt->v = wx_static_cast(short, p.y); +} + void wxMacGlobalToLocal( WindowRef window , Point*pt ) { HIPoint p = CGPointMake( pt->h, pt->v ); @@ -1970,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 ) @@ -1981,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