]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dfb/dc.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / dfb / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/dc.h
3 // Purpose: wxDC class
4 // Author: Vaclav Slavik
5 // Created: 2006-08-07
6 // Copyright: (c) 2006 REA Elektronik GmbH
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_DFB_DC_H_
11 #define _WX_DFB_DC_H_
12
13 #include "wx/defs.h"
14 #include "wx/region.h"
15 #include "wx/dc.h"
16 #include "wx/dfb/dfbptr.h"
17
18 wxDFB_DECLARE_INTERFACE(IDirectFBSurface);
19
20 //-----------------------------------------------------------------------------
21 // wxDFBDCImpl
22 //-----------------------------------------------------------------------------
23
24 class WXDLLIMPEXP_CORE wxDFBDCImpl : public wxDCImpl
25 {
26 public:
27 // ctors
28 wxDFBDCImpl(wxDC *owner) : wxDCImpl(owner) { m_surface = NULL; }
29 wxDFBDCImpl(wxDC *owner, const wxIDirectFBSurfacePtr& surface)
30 : wxDCImpl(owner)
31 {
32 DFBInit(surface);
33 }
34
35 bool IsOk() const { return m_surface != NULL; }
36
37 // implement base class pure virtuals
38 // ----------------------------------
39
40 virtual void Clear();
41
42 virtual bool StartDoc(const wxString& message);
43 virtual void EndDoc();
44
45 virtual void StartPage();
46 virtual void EndPage();
47
48 virtual void SetFont(const wxFont& font);
49 virtual void SetPen(const wxPen& pen);
50 virtual void SetBrush(const wxBrush& brush);
51 virtual void SetBackground(const wxBrush& brush);
52 virtual void SetBackgroundMode(int mode);
53 #if wxUSE_PALETTE
54 virtual void SetPalette(const wxPalette& palette);
55 #endif
56
57 virtual void SetLogicalFunction(wxRasterOperationMode function);
58
59 virtual void DestroyClippingRegion();
60
61 virtual wxCoord GetCharHeight() const;
62 virtual wxCoord GetCharWidth() const;
63 virtual void DoGetTextExtent(const wxString& string,
64 wxCoord *x, wxCoord *y,
65 wxCoord *descent = NULL,
66 wxCoord *externalLeading = NULL,
67 const wxFont *theFont = NULL) const;
68
69 virtual bool CanDrawBitmap() const { return true; }
70 virtual bool CanGetTextExtent() const { return true; }
71 virtual int GetDepth() const;
72 virtual wxSize GetPPI() const;
73
74 // Returns the surface (and increases its ref count)
75 wxIDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; }
76
77 protected:
78 // implementation
79 wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); }
80 wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); }
81 wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); }
82 wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); }
83 wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); }
84 wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); }
85 wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); }
86 wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
87
88 // initializes the DC from a surface, must be called if default ctor
89 // was used
90 void DFBInit(const wxIDirectFBSurfacePtr& surface);
91
92 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
93 wxFloodFillStyle style = wxFLOOD_SURFACE);
94
95 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
96
97 virtual void DoDrawPoint(wxCoord x, wxCoord y);
98 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
99
100 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
101 wxCoord x2, wxCoord y2,
102 wxCoord xc, wxCoord yc);
103 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
104 double sa, double ea);
105
106 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
107 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
108 wxCoord width, wxCoord height,
109 double radius);
110 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
111
112 virtual void DoCrossHair(wxCoord x, wxCoord y);
113
114 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
115 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
116 bool useMask = false);
117
118 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
119 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
120 double angle);
121
122 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
123 wxDC *source, wxCoord xsrc, wxCoord ysrc,
124 wxRasterOperationMode rop = wxCOPY, bool useMask = false,
125 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
126
127 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
128 wxCoord width, wxCoord height);
129 virtual void DoSetDeviceClippingRegion(const wxRegion& region);
130
131 virtual void DoGetSize(int *width, int *height) const;
132 virtual void DoGetSizeMM(int* width, int* height) const;
133
134 virtual void DoDrawLines(int n, const wxPoint points[],
135 wxCoord xoffset, wxCoord yoffset);
136 virtual void DoDrawPolygon(int n, const wxPoint points[],
137 wxCoord xoffset, wxCoord yoffset,
138 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
139
140 // implementation from now on:
141 protected:
142 wxIDirectFBFontPtr GetCurrentFont() const;
143
144 private:
145 // Unified implementation of DrawIcon, DrawBitmap and Blit:
146 void DoDrawSubBitmap(const wxBitmap &bmp,
147 wxCoord x, wxCoord y, wxCoord w, wxCoord h,
148 wxCoord destx, wxCoord desty, int rop, bool useMask);
149 bool DoBlitFromSurface(const wxIDirectFBSurfacePtr& src,
150 wxCoord srcx, wxCoord srcy,
151 wxCoord w, wxCoord h,
152 wxCoord dstx, wxCoord dsty);
153
154 // selects colour into surface's state
155 void SelectColour(const wxColour& clr);
156
157 protected:
158 wxIDirectFBSurfacePtr m_surface;
159
160 double m_mm_to_pix_x, m_mm_to_pix_y;
161
162 friend class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; // for Init
163
164 DECLARE_ABSTRACT_CLASS(wxDFBDCImpl)
165 };
166
167 #endif // _WX_DFB_DC_H_