]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/dc.h
Remove apparently unnecessary wxAuiMDIClientWindow dtor.
[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 licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_DC_H__
13 #define __WX_COCOA_DC_H__
14
15 DECLARE_WXCOCOA_OBJC_CLASS(NSAffineTransform);
16
17 #include "wx/dc.h"
18
19 class WXDLLIMPEXP_FWD_CORE wxCocoaDCImpl;
20 WX_DECLARE_LIST(wxCocoaDCImpl, wxCocoaDCStack);
21
22 //=========================================================================
23 // wxDC
24 //=========================================================================
25 class WXDLLIMPEXP_CORE wxCocoaDCImpl: public wxDCImpl
26 {
27 DECLARE_ABSTRACT_CLASS(wxCocoaDCImpl)
28 wxDECLARE_NO_COPY_CLASS(wxCocoaDCImpl);
29 //-------------------------------------------------------------------------
30 // Initialization
31 //-------------------------------------------------------------------------
32 public:
33 wxCocoaDCImpl(wxDC *owner);
34 virtual ~wxCocoaDCImpl();
35
36 //-------------------------------------------------------------------------
37 // wxCocoa specifics
38 //-------------------------------------------------------------------------
39 public:
40 static void CocoaInitializeTextSystem();
41 static void CocoaShutdownTextSystem();
42 static WX_NSTextStorage sm_cocoaNSTextStorage;
43 static WX_NSLayoutManager sm_cocoaNSLayoutManager;
44 static WX_NSTextContainer sm_cocoaNSTextContainer;
45 // Create a simple Wx to Bounds transform (just flip the coordinate system)
46 static WX_NSAffineTransform CocoaGetWxToBoundsTransform(bool isFlipped, float height);
47 protected:
48 // DC stack
49 static wxCocoaDCStack sm_cocoaDCStack;
50 virtual bool CocoaLockFocus();
51 virtual bool CocoaUnlockFocus();
52 bool CocoaUnwindStackAndTakeFocus();
53 inline bool CocoaTakeFocus()
54 {
55 wxCocoaDCStack::compatibility_iterator node = sm_cocoaDCStack.GetFirst();
56 if(node && (node->GetData() == this))
57 return true;
58 return CocoaUnwindStackAndTakeFocus();
59 }
60 void CocoaUnwindStackAndLoseFocus();
61 // DC flipping/transformation
62 void CocoaApplyTransformations();
63 void CocoaUnapplyTransformations();
64 WX_NSAffineTransform m_cocoaWxToBoundsTransform;
65 // Get bounds rect (for Clear())
66 // note: we use void * to mean NSRect * so that we can avoid
67 // putting NSRect in the headers.
68 virtual bool CocoaGetBounds(void *rectData);
69 // Blitting
70 virtual bool CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest,
71 wxCoord width, wxCoord height, wxCoord xsrc, wxCoord ysrc,
72 wxRasterOperationMode logicalFunc, bool useMask, wxCoord xsrcMask, wxCoord ysrcMask);
73 //-------------------------------------------------------------------------
74 // Implementation
75 //-------------------------------------------------------------------------
76 public:
77 // implement base class pure virtuals
78 // ----------------------------------
79
80 virtual void Clear();
81
82 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
83 virtual void EndDoc(void) {};
84
85 virtual void StartPage(void) {};
86 virtual void EndPage(void) {};
87
88 virtual void SetFont(const wxFont& font);
89 virtual void SetPen(const wxPen& pen);
90 virtual void SetBrush(const wxBrush& brush);
91 virtual void SetBackground(const wxBrush& brush);
92 virtual void SetBackgroundMode(int mode) { m_backgroundMode = mode; }
93 virtual void SetPalette(const wxPalette& palette);
94
95 virtual void DestroyClippingRegion();
96
97 virtual wxCoord GetCharHeight() const;
98 virtual wxCoord GetCharWidth() const;
99 virtual void DoGetTextExtent(const wxString& string,
100 wxCoord *x, wxCoord *y,
101 wxCoord *descent = NULL,
102 wxCoord *externalLeading = NULL,
103 const wxFont *theFont = NULL) const;
104
105 virtual bool CanDrawBitmap() const;
106 virtual bool CanGetTextExtent() const;
107 virtual int GetDepth() const;
108 virtual wxSize GetPPI() const;
109
110 virtual void SetMapMode(wxMappingMode mode);
111 virtual void SetUserScale(double x, double y);
112
113 virtual void SetLogicalScale(double x, double y);
114 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
115 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
116 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
117 virtual void SetLogicalFunction(wxRasterOperationMode function);
118
119 virtual void SetTextForeground(const wxColour& colour) ;
120 virtual void SetTextBackground(const wxColour& colour) ;
121
122 virtual void ComputeScaleAndOrigin();
123 protected:
124 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
125 wxFloodFillStyle style = wxFLOOD_SURFACE);
126
127 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
128
129 virtual void DoDrawPoint(wxCoord x, wxCoord y);
130 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
131
132 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
133 wxCoord x2, wxCoord y2,
134 wxCoord xc, wxCoord yc);
135
136 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
137 double sa, double ea);
138
139 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
140 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
141 wxCoord width, wxCoord height,
142 double radius);
143 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
144
145 virtual void DoCrossHair(wxCoord x, wxCoord y);
146
147 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
148 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
149 bool useMask = false);
150
151 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
152 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
153 double angle);
154
155 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
156 wxDC *source, wxCoord xsrc, wxCoord ysrc,
157 int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
158
159 // this is gnarly - we can't even call this function DoSetClippingRegion()
160 // because of virtual function hiding
161 virtual void DoSetDeviceClippingRegion(const wxRegion& region);
162 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
163 wxCoord width, wxCoord height);
164
165 virtual void DoGetSize(int *width, int *height) const;
166 virtual void DoGetSizeMM(int* width, int* height) const;
167
168 virtual void DoDrawLines(int n, wxPoint points[],
169 wxCoord xoffset, wxCoord yoffset);
170 virtual void DoDrawPolygon(int n, wxPoint points[],
171 wxCoord xoffset, wxCoord yoffset,
172 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
173 };
174
175 #endif // __WX_COCOA_DC_H__