]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/dc.h
In the object destructor, Disassociate the object from its Cocoa counterpart
[wxWidgets.git] / include / wx / cocoa / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/dc.h
3 // Purpose: wxDC
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/04/01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_DC_H__
13 #define __WX_COCOA_DC_H__
14
15 //=========================================================================
16 // wxDC
17 //=========================================================================
18 class WXDLLEXPORT wxDC: public wxDCBase
19 {
20 DECLARE_DYNAMIC_CLASS(wxDC)
21 DECLARE_NO_COPY_CLASS(wxDC)
22 public:
23 wxDC();
24 ~wxDC();
25
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;
32
33 // implement base class pure virtuals
34 // ----------------------------------
35
36 virtual void Clear();
37
38 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
39 virtual void EndDoc(void) {};
40
41 virtual void StartPage(void) {};
42 virtual void EndPage(void) {};
43
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);
50
51 virtual void DestroyClippingRegion();
52
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;
60
61 virtual bool CanDrawBitmap() const;
62 virtual bool CanGetTextExtent() const;
63 virtual int GetDepth() const;
64 virtual wxSize GetPPI() const;
65
66 virtual void SetMapMode(int mode);
67 virtual void SetUserScale(double x, double y);
68
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);
74
75 virtual void SetTextForeground(const wxColour& colour) ;
76 virtual void SetTextBackground(const wxColour& colour) ;
77
78 void ComputeScaleAndOrigin(void);
79 protected:
80 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
81 int style = wxFLOOD_SURFACE);
82
83 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
84
85 virtual void DoDrawPoint(wxCoord x, wxCoord y);
86 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
87
88 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
89 wxCoord x2, wxCoord y2,
90 wxCoord xc, wxCoord yc);
91
92 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
93 double sa, double ea);
94
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,
98 double radius);
99 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
100
101 virtual void DoCrossHair(wxCoord x, wxCoord y);
102
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);
106
107 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
108 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
109 double angle);
110
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);
114
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);
120
121 virtual void DoGetSize(int *width, int *height) const;
122 virtual void DoGetSizeMM(int* width, int* height) const;
123
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);
129
130 };
131
132 #endif // __WX_COCOA_DC_H__