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