]>
git.saurik.com Git - wxWidgets.git/blob - src/dfb/ifacehelpers.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/dfb/ifacehelpers.cpp
3 // Purpose: helpers for dealing with DFB interfaces
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #include "wx/dfb/ifacehelpers.h"
21 //-----------------------------------------------------------------------------
23 //-----------------------------------------------------------------------------
25 // NB: We can't call AddRef() and Release() directly from wxDfbPtr<T> because
26 // we don't have full type declarations for them if we don't include
27 // <directfb.h> (which user wx headers can't). Fortunately, all DirectFB
28 // interfaces are structs with common beginning that contains pointers to
29 // AddRef and Release, so we can safely cast interface pointer to void* and
30 // then back to arbitrary interface pointer and these calls will still work
31 // correctly. For this purpose, we declare a dummy DFB interface here.
33 DECLARE_INTERFACE(wxDummyDFBInterface
)
34 DEFINE_INTERFACE(wxDummyDFBInterface
, )
37 void wxDfbPtrBase::DoAddRef(void *ptr
)
39 wxDummyDFBInterface
*p
= (wxDummyDFBInterface
*)ptr
;
44 void wxDfbPtrBase::DoRelease(void *ptr
)
46 wxDummyDFBInterface
*p
= (wxDummyDFBInterface
*)ptr
;