]>
Commit | Line | Data |
---|---|---|
a24aff65 | 1 | ///////////////////////////////////////////////////////////////////////////// |
6c342f3f DE |
2 | // Name: wx/cocoa/dc.h |
3 | // Purpose: wxDC | |
4 | // Author: David Elliott | |
a24aff65 | 5 | // Modified by: |
6c342f3f | 6 | // Created: 2003/04/01 |
a24aff65 | 7 | // RCS-ID: $Id$ |
6c342f3f DE |
8 | // Copyright: (c) 2003 David Elliott |
9 | // Licence: wxWindows license | |
a24aff65 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
6c342f3f DE |
12 | #ifndef __WX_COCOA_DC_H__ |
13 | #define __WX_COCOA_DC_H__ | |
a24aff65 | 14 | |
fe8f7943 DE |
15 | class WXDLLEXPORT wxDC; |
16 | WX_DECLARE_LIST(wxDC, wxCocoaDCStack); | |
17 | ||
6c342f3f DE |
18 | //========================================================================= |
19 | // wxDC | |
20 | //========================================================================= | |
a24aff65 DE |
21 | class WXDLLEXPORT wxDC: public wxDCBase |
22 | { | |
23 | DECLARE_DYNAMIC_CLASS(wxDC) | |
24 | DECLARE_NO_COPY_CLASS(wxDC) | |
fe8f7943 DE |
25 | //------------------------------------------------------------------------- |
26 | // Initialization | |
27 | //------------------------------------------------------------------------- | |
6c342f3f | 28 | public: |
a24aff65 DE |
29 | wxDC(); |
30 | ~wxDC(); | |
31 | ||
fe8f7943 DE |
32 | //------------------------------------------------------------------------- |
33 | // wxCocoa specifics | |
34 | //------------------------------------------------------------------------- | |
35 | public: | |
6c342f3f DE |
36 | static void CocoaInitializeTextSystem(); |
37 | static void CocoaShutdownTextSystem(); | |
6c342f3f DE |
38 | static WX_NSTextStorage sm_cocoaNSTextStorage; |
39 | static WX_NSLayoutManager sm_cocoaNSLayoutManager; | |
40 | static WX_NSTextContainer sm_cocoaNSTextContainer; | |
fe8f7943 DE |
41 | protected: |
42 | // DC stack | |
43 | static wxCocoaDCStack sm_cocoaDCStack; | |
44 | virtual bool CocoaLockFocus(); | |
45 | virtual bool CocoaUnlockFocus(); | |
46 | bool CocoaUnwindStackAndTakeFocus(); | |
47 | inline bool CocoaTakeFocus() | |
48 | { | |
49 | wxCocoaDCStack::Node *node = sm_cocoaDCStack.GetFirst(); | |
50 | if(node && (node->GetData() == this)) | |
51 | return true; | |
52 | return CocoaUnwindStackAndTakeFocus(); | |
53 | } | |
54 | void CocoaUnwindStackAndLoseFocus(); | |
55 | // DC flipping/transformation | |
56 | void CocoaApplyTransformations(); | |
57 | float m_cocoaHeight; | |
58 | bool m_cocoaFlipped; | |
59 | //------------------------------------------------------------------------- | |
60 | // Implementation | |
61 | //------------------------------------------------------------------------- | |
62 | public: | |
a24aff65 DE |
63 | // implement base class pure virtuals |
64 | // ---------------------------------- | |
65 | ||
66 | virtual void Clear(); | |
67 | ||
68 | virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; } | |
69 | virtual void EndDoc(void) {}; | |
70 | ||
71 | virtual void StartPage(void) {}; | |
72 | virtual void EndPage(void) {}; | |
73 | ||
74 | virtual void SetFont(const wxFont& font) {} | |
75 | virtual void SetPen(const wxPen& pen); | |
76 | virtual void SetBrush(const wxBrush& brush); | |
77 | virtual void SetBackground(const wxBrush& brush); | |
ed881889 | 78 | virtual void SetBackgroundMode(int mode) { m_backgroundMode = mode; } |
a24aff65 DE |
79 | virtual void SetPalette(const wxPalette& palette); |
80 | ||
81 | virtual void DestroyClippingRegion(); | |
82 | ||
83 | virtual wxCoord GetCharHeight() const; | |
84 | virtual wxCoord GetCharWidth() const; | |
85 | virtual void DoGetTextExtent(const wxString& string, | |
86 | wxCoord *x, wxCoord *y, | |
87 | wxCoord *descent = NULL, | |
88 | wxCoord *externalLeading = NULL, | |
89 | wxFont *theFont = NULL) const; | |
90 | ||
91 | virtual bool CanDrawBitmap() const; | |
92 | virtual bool CanGetTextExtent() const; | |
93 | virtual int GetDepth() const; | |
94 | virtual wxSize GetPPI() const; | |
95 | ||
96 | virtual void SetMapMode(int mode); | |
97 | virtual void SetUserScale(double x, double y); | |
98 | ||
99 | virtual void SetLogicalScale(double x, double y); | |
100 | virtual void SetLogicalOrigin(wxCoord x, wxCoord y); | |
101 | virtual void SetDeviceOrigin(wxCoord x, wxCoord y); | |
102 | virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp); | |
103 | virtual void SetLogicalFunction(int function); | |
104 | ||
105 | virtual void SetTextForeground(const wxColour& colour) ; | |
106 | virtual void SetTextBackground(const wxColour& colour) ; | |
107 | ||
108 | void ComputeScaleAndOrigin(void); | |
a24aff65 DE |
109 | protected: |
110 | virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, | |
111 | int style = wxFLOOD_SURFACE); | |
112 | ||
113 | virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; | |
114 | ||
115 | virtual void DoDrawPoint(wxCoord x, wxCoord y); | |
116 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
117 | ||
118 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, | |
119 | wxCoord x2, wxCoord y2, | |
120 | wxCoord xc, wxCoord yc); | |
121 | ||
122 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
123 | double sa, double ea); | |
124 | ||
125 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
126 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
127 | wxCoord width, wxCoord height, | |
128 | double radius); | |
129 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
130 | ||
131 | virtual void DoCrossHair(wxCoord x, wxCoord y); | |
132 | ||
133 | virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
134 | virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, | |
135 | bool useMask = FALSE); | |
136 | ||
137 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
138 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, | |
139 | double angle); | |
140 | ||
141 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
142 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
143 | int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); | |
144 | ||
145 | // this is gnarly - we can't even call this function DoSetClippingRegion() | |
146 | // because of virtual function hiding | |
147 | virtual void DoSetClippingRegionAsRegion(const wxRegion& region); | |
148 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, | |
149 | wxCoord width, wxCoord height); | |
a24aff65 DE |
150 | |
151 | virtual void DoGetSize(int *width, int *height) const; | |
152 | virtual void DoGetSizeMM(int* width, int* height) const; | |
153 | ||
154 | virtual void DoDrawLines(int n, wxPoint points[], | |
155 | wxCoord xoffset, wxCoord yoffset); | |
156 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
157 | wxCoord xoffset, wxCoord yoffset, | |
158 | int fillStyle = wxODDEVEN_RULE); | |
a24aff65 DE |
159 | }; |
160 | ||
6c342f3f | 161 | #endif // __WX_COCOA_DC_H__ |