X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe8f794343fc22d3da1e6f003fdd754d2bdf9339..aaf5f98682223a5ceb3496e7a25865ad791e8ab7:/include/wx/cocoa/dc.h?ds=inline diff --git a/include/wx/cocoa/dc.h b/include/wx/cocoa/dc.h index dd4b3fdbe5..31c565f26c 100644 --- a/include/wx/cocoa/dc.h +++ b/include/wx/cocoa/dc.h @@ -6,29 +6,33 @@ // Created: 2003/04/01 // RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WX_COCOA_DC_H__ #define __WX_COCOA_DC_H__ -class WXDLLEXPORT wxDC; -WX_DECLARE_LIST(wxDC, wxCocoaDCStack); +DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform); + +#include "wx/dc.h" + +class WXDLLIMPEXP_FWD_CORE wxCocoaDCImpl; +WX_DECLARE_LIST(wxCocoaDCImpl, wxCocoaDCStack); //========================================================================= // wxDC //========================================================================= -class WXDLLEXPORT wxDC: public wxDCBase +class WXDLLIMPEXP_CORE wxCocoaDCImpl: public wxDCImpl { - DECLARE_DYNAMIC_CLASS(wxDC) - DECLARE_NO_COPY_CLASS(wxDC) + DECLARE_ABSTRACT_CLASS(wxCocoaDCImpl) + wxDECLARE_NO_COPY_CLASS(wxCocoaDCImpl); //------------------------------------------------------------------------- // Initialization //------------------------------------------------------------------------- public: - wxDC(); - ~wxDC(); - + wxCocoaDCImpl(wxDC *owner); + virtual ~wxCocoaDCImpl(); + //------------------------------------------------------------------------- // wxCocoa specifics //------------------------------------------------------------------------- @@ -38,6 +42,8 @@ public: static WX_NSTextStorage sm_cocoaNSTextStorage; static WX_NSLayoutManager sm_cocoaNSLayoutManager; static WX_NSTextContainer sm_cocoaNSTextContainer; + // Create a simple Wx to Bounds transform (just flip the coordinate system) + static WX_NSAffineTransform CocoaGetWxToBoundsTransform(bool isFlipped, float height); protected: // DC stack static wxCocoaDCStack sm_cocoaDCStack; @@ -46,7 +52,7 @@ protected: bool CocoaUnwindStackAndTakeFocus(); inline bool CocoaTakeFocus() { - wxCocoaDCStack::Node *node = sm_cocoaDCStack.GetFirst(); + wxCocoaDCStack::compatibility_iterator node = sm_cocoaDCStack.GetFirst(); if(node && (node->GetData() == this)) return true; return CocoaUnwindStackAndTakeFocus(); @@ -54,8 +60,16 @@ protected: void CocoaUnwindStackAndLoseFocus(); // DC flipping/transformation void CocoaApplyTransformations(); - float m_cocoaHeight; - bool m_cocoaFlipped; + void CocoaUnapplyTransformations(); + WX_NSAffineTransform m_cocoaWxToBoundsTransform; +// Get bounds rect (for Clear()) + // note: we use void * to mean NSRect * so that we can avoid + // putting NSRect in the headers. + virtual bool CocoaGetBounds(void *rectData); +// Blitting + virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest, + wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc, + wxRasterOperationMode logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask); //------------------------------------------------------------------------- // Implementation //------------------------------------------------------------------------- @@ -65,13 +79,13 @@ public: virtual void Clear(); - virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; } + virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; } virtual void EndDoc(void) {}; - + virtual void StartPage(void) {}; virtual void EndPage(void) {}; - virtual void SetFont(const wxFont& font) {} + virtual void SetFont(const wxFont& font); virtual void SetPen(const wxPen& pen); virtual void SetBrush(const wxBrush& brush); virtual void SetBackground(const wxBrush& brush); @@ -86,29 +100,29 @@ public: wxCoord *x, wxCoord *y, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, - wxFont *theFont = NULL) const; + const wxFont *theFont = NULL) const; virtual bool CanDrawBitmap() const; virtual bool CanGetTextExtent() const; virtual int GetDepth() const; virtual wxSize GetPPI() const; - virtual void SetMapMode(int mode); + virtual void SetMapMode(wxMappingMode mode); virtual void SetUserScale(double x, double y); virtual void SetLogicalScale(double x, double y); virtual void SetLogicalOrigin(wxCoord x, wxCoord y); virtual void SetDeviceOrigin(wxCoord x, wxCoord y); virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); - virtual void SetLogicalFunction(int function); + virtual void SetLogicalFunction(wxRasterOperationMode function); virtual void SetTextForeground(const wxColour& colour) ; virtual void SetTextBackground(const wxColour& colour) ; - void ComputeScaleAndOrigin(void); + virtual void ComputeScaleAndOrigin(); protected: virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, - int style = wxFLOOD_SURFACE); + wxFloodFillStyle style = wxFLOOD_SURFACE); virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; @@ -118,7 +132,7 @@ protected: virtual void DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc); - + virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, double sa, double ea); @@ -132,7 +146,7 @@ protected: virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, - bool useMask = FALSE); + bool useMask = false); virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, @@ -140,11 +154,11 @@ protected: virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); + int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); // this is gnarly - we can't even call this function DoSetClippingRegion() // because of virtual function hiding - virtual void DoSetClippingRegionAsRegion(const wxRegion& region); + virtual void DoSetDeviceClippingRegion(const wxRegion& region); virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height); @@ -155,7 +169,7 @@ protected: wxCoord xoffset, wxCoord yoffset); virtual void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, - int fillStyle = wxODDEVEN_RULE); + wxPolygonFillMode fillStyle = wxODDEVEN_RULE); }; #endif // __WX_COCOA_DC_H__