1 /////////////////////////////////////////////////////////////////////////////
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_DC_H__
13 #define __WX_COCOA_DC_H__
15 //=========================================================================
17 //=========================================================================
18 class WXDLLEXPORT wxDC
: public wxDCBase
20 DECLARE_DYNAMIC_CLASS(wxDC
)
21 DECLARE_NO_COPY_CLASS(wxDC
)
26 static void CocoaInitializeTextSystem();
27 static void CocoaShutdownTextSystem();
28 static wxDC
*sm_focusedDC
;
29 static WX_NSTextStorage sm_cocoaNSTextStorage
;
30 static WX_NSLayoutManager sm_cocoaNSLayoutManager
;
31 static WX_NSTextContainer sm_cocoaNSTextContainer
;
33 // implement base class pure virtuals
34 // ----------------------------------
38 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return TRUE
; }
39 virtual void EndDoc(void) {};
41 virtual void StartPage(void) {};
42 virtual void EndPage(void) {};
44 virtual void SetFont(const wxFont
& font
) {}
45 virtual void SetPen(const wxPen
& pen
);
46 virtual void SetBrush(const wxBrush
& brush
);
47 virtual void SetBackground(const wxBrush
& brush
);
48 virtual void SetBackgroundMode(int mode
) { m_backgroundMode
= mode
; }
49 virtual void SetPalette(const wxPalette
& palette
);
51 virtual void DestroyClippingRegion();
53 virtual wxCoord
GetCharHeight() const;
54 virtual wxCoord
GetCharWidth() const;
55 virtual void DoGetTextExtent(const wxString
& string
,
56 wxCoord
*x
, wxCoord
*y
,
57 wxCoord
*descent
= NULL
,
58 wxCoord
*externalLeading
= NULL
,
59 wxFont
*theFont
= NULL
) const;
61 virtual bool CanDrawBitmap() const;
62 virtual bool CanGetTextExtent() const;
63 virtual int GetDepth() const;
64 virtual wxSize
GetPPI() const;
66 virtual void SetMapMode(int mode
);
67 virtual void SetUserScale(double x
, double y
);
69 virtual void SetLogicalScale(double x
, double y
);
70 virtual void SetLogicalOrigin(wxCoord x
, wxCoord y
);
71 virtual void SetDeviceOrigin(wxCoord x
, wxCoord y
);
72 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
73 virtual void SetLogicalFunction(int function
);
75 virtual void SetTextForeground(const wxColour
& colour
) ;
76 virtual void SetTextBackground(const wxColour
& colour
) ;
78 void ComputeScaleAndOrigin(void);
80 virtual bool DoFloodFill(wxCoord x
, wxCoord y
, const wxColour
& col
,
81 int style
= wxFLOOD_SURFACE
);
83 virtual bool DoGetPixel(wxCoord x
, wxCoord y
, wxColour
*col
) const;
85 virtual void DoDrawPoint(wxCoord x
, wxCoord y
);
86 virtual void DoDrawLine(wxCoord x1
, wxCoord y1
, wxCoord x2
, wxCoord y2
);
88 virtual void DoDrawArc(wxCoord x1
, wxCoord y1
,
89 wxCoord x2
, wxCoord y2
,
90 wxCoord xc
, wxCoord yc
);
92 virtual void DoDrawEllipticArc(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
,
93 double sa
, double ea
);
95 virtual void DoDrawRectangle(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
96 virtual void DoDrawRoundedRectangle(wxCoord x
, wxCoord y
,
97 wxCoord width
, wxCoord height
,
99 virtual void DoDrawEllipse(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
101 virtual void DoCrossHair(wxCoord x
, wxCoord y
);
103 virtual void DoDrawIcon(const wxIcon
& icon
, wxCoord x
, wxCoord y
);
104 virtual void DoDrawBitmap(const wxBitmap
&bmp
, wxCoord x
, wxCoord y
,
105 bool useMask
= FALSE
);
107 virtual void DoDrawText(const wxString
& text
, wxCoord x
, wxCoord y
);
108 virtual void DoDrawRotatedText(const wxString
& text
, wxCoord x
, wxCoord y
,
111 virtual bool DoBlit(wxCoord xdest
, wxCoord ydest
, wxCoord width
, wxCoord height
,
112 wxDC
*source
, wxCoord xsrc
, wxCoord ysrc
,
113 int rop
= wxCOPY
, bool useMask
= FALSE
, wxCoord xsrcMask
= -1, wxCoord ysrcMask
= -1);
115 // this is gnarly - we can't even call this function DoSetClippingRegion()
116 // because of virtual function hiding
117 virtual void DoSetClippingRegionAsRegion(const wxRegion
& region
);
118 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
,
119 wxCoord width
, wxCoord height
);
121 virtual void DoGetSize(int *width
, int *height
) const;
122 virtual void DoGetSizeMM(int* width
, int* height
) const;
124 virtual void DoDrawLines(int n
, wxPoint points
[],
125 wxCoord xoffset
, wxCoord yoffset
);
126 virtual void DoDrawPolygon(int n
, wxPoint points
[],
127 wxCoord xoffset
, wxCoord yoffset
,
128 int fillStyle
= wxODDEVEN_RULE
);
132 #endif // __WX_COCOA_DC_H__