]>
git.saurik.com Git - wxWidgets.git/blob - src/dfb/dcclient.cpp
36a57c83306344076d57d615b1e5d91edd94e17a
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 // FIXME: this should be made to work: we need to detect that the window
55 // is not visible and in that case, a) ignore any drawing actions
56 // and b) provide dummy surface that can still be used to get
57 // information (e.g. text extents):
59 for ( wxWindow
*w
= win
; w
; w
= w
->GetParent() )
61 // painting on hidden TLW when non-TLW windows are shown is OK,
62 // DirectFB manages that:
63 if ( w
->IsTopLevel() )
66 wxASSERT_MSG( w
->IsShown(),
67 _T("painting on hidden window not implemented yet") );
71 SetFont(win
->GetFont());
74 //-----------------------------------------------------------------------------
75 // base class for wxClientDC and wxPaintDC
76 //-----------------------------------------------------------------------------
78 wxClientDCBase::wxClientDCBase(wxWindow
*win
)
80 wxCHECK_RET( win
, _T("invalid window") );
82 wxRect rect
= win
->GetClientRect();
83 DFBRectangle dfbrect
= { rect
.x
, rect
.y
, rect
.width
, rect
.height
};
85 wxIDirectFBSurfacePtr
subsurf(
86 win
->GetDfbSurface()->GetSubSurface(&dfbrect
));
93 // offset coordinates to account for subsurface's origin coordinates:
94 SetDeviceOrigin(rect
.x
, rect
.y
);
97 //-----------------------------------------------------------------------------
99 //-----------------------------------------------------------------------------
101 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
, wxWindowDC
)
103 wxClientDC::~wxClientDC()
105 // flip to surface so that the changes become visible
106 wxIDirectFBSurfacePtr
surface(GetDirectFBSurface());
108 // FIXME: do this only if the surface was modified (as opposed to e.g.
109 // used only to obtain text metrics)
111 surface
->Flip(NULL
, DSFLIP_NONE
);
114 //-----------------------------------------------------------------------------
116 //-----------------------------------------------------------------------------
118 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxWindowDC
)
120 #warning "wxPaintDC ctor must respect m_updateRegion"
122 wxPaintDC::~wxPaintDC()
124 // NB: do *not* flip the surface: wxPaintDC is used with EVT_PAINT and the
125 // surface will be flipped for the entire TLW once all children are