]> git.saurik.com Git - wxWidgets.git/blame - src/dfb/ifacehelpers.cpp
Revert the last commit since it doesn't work.
[wxWidgets.git] / src / dfb / ifacehelpers.cpp
CommitLineData
b3c86150
VS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/dfb/ifacehelpers.cpp
3// Purpose: helpers for dealing with DFB interfaces
4// Author: Vaclav Slavik
5// Created: 2006-08-09
6// RCS-ID: $Id$
7// Copyright: (c) 2006 REA Elektronik GmbH
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11// For compilers that support precompilation, includes "wx.h".
12#include "wx/wxprec.h"
13
14#ifdef __BORLANDC__
15 #pragma hdrstop
16#endif
17
18#include "wx/dfb/ifacehelpers.h"
19#include <directfb.h>
20
21//-----------------------------------------------------------------------------
22// wxDfbPtr
23//-----------------------------------------------------------------------------
24
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.
32
33DECLARE_INTERFACE(wxDummyDFBInterface)
34DEFINE_INTERFACE(wxDummyDFBInterface, )
35
36/* static */
37void wxDfbPtrBase::DoAddRef(void *ptr)
38{
39 wxDummyDFBInterface *p = (wxDummyDFBInterface*)ptr;
40 p->AddRef(p);
41}
42
43/* static */
44void wxDfbPtrBase::DoRelease(void *ptr)
45{
46 wxDummyDFBInterface *p = (wxDummyDFBInterface*)ptr;
47 p->Release(p);
48}