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