1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dfb/private.h
3 // Purpose: private helpers for wxDFB implementation
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2006 REA Elektronik GmbH
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_DFB_PRIVATE_H_
12 #define _WX_DFB_PRIVATE_H_
17 #include "wx/dfb/wrapdfb.h"
18 #include <directfb_version.h>
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 // convert string from wxString to UTF-8 encoded const char*
26 #define wxSTR_TO_DFB(s) (s).mb_str(wxConvUTF8)
28 #define wxSTR_TO_DFB(s) wxConvUTF8.cWC2MB((s).wc_str(*wxConvUI))
31 //-----------------------------------------------------------------------------
32 // surface manipulation helpers
33 //-----------------------------------------------------------------------------
35 /// Mode of wxDfbCloneSurface() call
36 enum wxDfbCloneSurfaceMode
38 /// Don't copy surface pixels, just clone surface size and attributes
39 wxDfbCloneSurface_NoPixels
= 0,
40 /// Make exact copy, including the pixels
41 wxDfbCloneSurface_CopyPixels
45 Creates a new surface by cloning existing one. Depending on @a mode,
46 either makes exact copy (wxDfbCloneSurface_CopyPixels) or only creates a
47 new surface with the same size and attributes (wxDfbCloneSurface_NoPixels).
49 wxIDirectFBSurfacePtr
wxDfbCloneSurface(const wxIDirectFBSurfacePtr
& s
,
50 wxDfbCloneSurfaceMode mode
);
52 /// Returns bit depth used by the surface
53 int wxDfbGetSurfaceDepth(const wxIDirectFBSurfacePtr
& s
);
55 /// Returns interface to the primary display layer:
56 wxIDirectFBDisplayLayerPtr
wxDfbGetDisplayLayer();
58 /// Returns interface to the primary surface:
59 wxIDirectFBSurfacePtr
wxDfbGetPrimarySurface();
61 //-----------------------------------------------------------------------------
63 //-----------------------------------------------------------------------------
65 /// Convert DirectFB timestamp to wxEvent one:
66 #define wxDFB_EVENT_TIMESTAMP(event) \
67 ((event).timestamp.tv_sec * 1000 + (event).timestamp.tv_usec / 1000)
70 Check if DirectFB library version is at least @a major.@a minor.@a release.
74 #define wxCHECK_DFB_VERSION(major,minor,release) \
75 (DIRECTFB_MAJOR_VERSION > (major) || \
76 (DIRECTFB_MAJOR_VERSION == (major) && \
77 DIRECTFB_MINOR_VERSION > (minor)) || \
78 (DIRECTFB_MAJOR_VERSION == (major) && \
79 DIRECTFB_MINOR_VERSION == (minor) && \
80 DIRECTFB_MICRO_VERSION >= (release)))
82 #endif // _WX_DFB_PRIVATE_H_