1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/dfb/dcclient.cpp
3 // Purpose: wxWindowDC, wxClientDC and wxPaintDC
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ===========================================================================
13 // ===========================================================================
15 // ---------------------------------------------------------------------------
17 // ---------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
26 #include "wx/dcclient.h"
29 #include "wx/window.h"
32 #include "wx/dfb/private.h"
34 // ===========================================================================
36 // ===========================================================================
38 //-----------------------------------------------------------------------------
40 //-----------------------------------------------------------------------------
42 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC
, wxDC
)
44 wxWindowDC::wxWindowDC(wxWindow
*win
)
45 : wxDC(win
? win
->GetDfbSurface() : NULL
)
50 void wxWindowDC::InitForWin(wxWindow
*win
)
52 wxCHECK_RET( win
, _T("invalid window") );
54 SetFont(win
->GetFont());
57 //-----------------------------------------------------------------------------
58 // base class for wxClientDC and wxPaintDC
59 //-----------------------------------------------------------------------------
61 wxClientDCBase::wxClientDCBase(wxWindow
*win
)
63 wxCHECK_RET( win
, _T("invalid window") );
65 wxRect rect
= win
->GetClientRect();
66 DFBRectangle dfbrect
= { rect
.x
, rect
.y
, rect
.width
, rect
.height
};
68 IDirectFBSurfacePtr
winsurf(win
->GetDfbSurface());
69 IDirectFBSurfacePtr subsurf
;
70 if ( !DFB_CALL( winsurf
->GetSubSurface(winsurf
, &dfbrect
, &subsurf
) ) )
76 // offset coordinates to account for subsurface's origin coordinates:
77 SetDeviceOrigin(rect
.x
, rect
.y
);
80 //-----------------------------------------------------------------------------
82 //-----------------------------------------------------------------------------
84 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
, wxWindowDC
)
86 wxClientDC::~wxClientDC()
88 // flip to surface so that the changes become visible
89 IDirectFBSurfacePtr
surface(GetDirectFBSurface());
91 surface
->Flip(surface
, NULL
, DSFLIP_NONE
);
94 //-----------------------------------------------------------------------------
96 //-----------------------------------------------------------------------------
98 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxWindowDC
)
100 #warning "wxPaintDC ctor must respect m_updateRegion"
102 wxPaintDC::~wxPaintDC()
104 // NB: do *not* flip the surface: wxPaintDC is used with EVT_PAINT and the
105 // surface will be flipped for the entire TLW once all children are