]>
Commit | Line | Data |
---|---|---|
b3c86150 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/dfb/private.h | |
3 | // Purpose: private helpers for wxDFB implementation | |
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 | #ifndef _WX_DFB_PRIVATE_H_ | |
12 | #define _WX_DFB_PRIVATE_H_ | |
13 | ||
14 | #include "wx/intl.h" | |
15 | #include "wx/log.h" | |
16 | ||
52c8d32a | 17 | #include "wx/dfb/wrapdfb.h" |
9800ae33 | 18 | #include <directfb_version.h> |
b3c86150 | 19 | |
b3c86150 VS |
20 | //----------------------------------------------------------------------------- |
21 | // strings conversion | |
22 | //----------------------------------------------------------------------------- | |
23 | ||
24 | // convert string from wxString to UTF-8 encoded const char* | |
25 | #if wxUSE_UNICODE | |
26 | #define wxSTR_TO_DFB(s) (s).mb_str(wxConvUTF8) | |
27 | #else | |
28 | #define wxSTR_TO_DFB(s) wxConvUTF8.cWC2MB((s).wc_str(*wxConvUI)) | |
29 | #endif | |
30 | ||
b3c86150 VS |
31 | //----------------------------------------------------------------------------- |
32 | // surface manipulation helpers | |
33 | //----------------------------------------------------------------------------- | |
34 | ||
35 | /// Mode of wxDfbCloneSurface() call | |
36 | enum wxDfbCloneSurfaceMode | |
37 | { | |
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 | |
42 | }; | |
43 | ||
2582bcdc VS |
44 | /** |
45 | Creates surface that is compatible with given @a surface (i.e. has same | |
46 | capabilities, pixel format etc.) and has given @a size. | |
47 | */ | |
48 | wxIDirectFBSurfacePtr wxDfbCreateCompatibleSurface( | |
49 | const wxIDirectFBSurfacePtr& surface, | |
50 | const wxSize& size); | |
51 | ||
b3c86150 VS |
52 | /** |
53 | Creates a new surface by cloning existing one. Depending on @a mode, | |
54 | either makes exact copy (wxDfbCloneSurface_CopyPixels) or only creates a | |
55 | new surface with the same size and attributes (wxDfbCloneSurface_NoPixels). | |
56 | */ | |
52c8d32a VS |
57 | wxIDirectFBSurfacePtr wxDfbCloneSurface(const wxIDirectFBSurfacePtr& s, |
58 | wxDfbCloneSurfaceMode mode); | |
b3c86150 VS |
59 | |
60 | /// Returns bit depth used by the surface | |
52c8d32a | 61 | int wxDfbGetSurfaceDepth(const wxIDirectFBSurfacePtr& s); |
b3c86150 VS |
62 | |
63 | /// Returns interface to the primary display layer: | |
52c8d32a | 64 | wxIDirectFBDisplayLayerPtr wxDfbGetDisplayLayer(); |
b3c86150 VS |
65 | |
66 | /// Returns interface to the primary surface: | |
52c8d32a | 67 | wxIDirectFBSurfacePtr wxDfbGetPrimarySurface(); |
b3c86150 VS |
68 | |
69 | //----------------------------------------------------------------------------- | |
52c8d32a | 70 | // misc helpers |
b3c86150 VS |
71 | //----------------------------------------------------------------------------- |
72 | ||
b3c86150 VS |
73 | /// Convert DirectFB timestamp to wxEvent one: |
74 | #define wxDFB_EVENT_TIMESTAMP(event) \ | |
75 | ((event).timestamp.tv_sec * 1000 + (event).timestamp.tv_usec / 1000) | |
76 | ||
9800ae33 VZ |
77 | /** |
78 | Check if DirectFB library version is at least @a major.@a minor.@a release. | |
79 | ||
52c8d32a | 80 | @see wxCHECK_VERSION |
9800ae33 VZ |
81 | */ |
82 | #define wxCHECK_DFB_VERSION(major,minor,release) \ | |
83 | (DIRECTFB_MAJOR_VERSION > (major) || \ | |
84 | (DIRECTFB_MAJOR_VERSION == (major) && \ | |
85 | DIRECTFB_MINOR_VERSION > (minor)) || \ | |
86 | (DIRECTFB_MAJOR_VERSION == (major) && \ | |
87 | DIRECTFB_MINOR_VERSION == (minor) && \ | |
88 | DIRECTFB_MICRO_VERSION >= (release))) | |
b3c86150 VS |
89 | |
90 | #endif // _WX_DFB_PRIVATE_H_ |