summaryrefslogtreecommitdiff
path: root/Source/++DFB/++dfb/idirectfb.cpp
blob: 87c812cdadc23fb3624f4740cbaf1635a49297e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*
   (c) Copyright 2000-2002  convergence integrated media GmbH.
   All rights reserved.

   Written by Denis Oliver Kropp <dok@convergence.de>,
              Andreas Hundt <andi@convergence.de> and
              Sven Neumann <sven@convergence.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.
*/

#include "++dfb.h"
#include "++dfb_internal.h"

void IDirectFB::SetCooperativeLevel (DFBCooperativeLevel level)
{
     DFBCHECK( iface->SetCooperativeLevel (iface, level) );
}

void IDirectFB::SetVideoMode (unsigned int width,
                              unsigned int height,
                              unsigned int bpp)
{
     DFBCHECK( iface->SetVideoMode (iface, width, height, bpp) );
}

void IDirectFB::GetDeviceDescription (DFBGraphicsDeviceDescription *desc)
{
     DFBCHECK( iface->GetDeviceDescription (iface, desc) );
}

void IDirectFB::EnumVideoModes (DFBVideoModeCallback  callback,
                                void                 *callbackdata)
{
     DFBCHECK( iface->EnumVideoModes (iface, callback, callbackdata) );
}

IDirectFBSurface IDirectFB::CreateSurface (DFBSurfaceDescription &desc) const
{
     IDirectFBSurface_C *idirectfbsurface;

     DFBCHECK( iface->CreateSurface (iface, &desc, &idirectfbsurface) );

     return IDirectFBSurface (idirectfbsurface);
}

IDirectFBPalette IDirectFB::CreatePalette (DFBPaletteDescription &desc)
{
     IDirectFBPalette_C *idirectfbpalette;

     DFBCHECK( iface->CreatePalette (iface, &desc, &idirectfbpalette) );

     return IDirectFBPalette (idirectfbpalette);
}

void IDirectFB::EnumDisplayLayers (DFBDisplayLayerCallback  callback,
                                   void                    *callbackdata)
{
     DFBCHECK( iface->EnumDisplayLayers (iface, callback, callbackdata) );
}


IDirectFBScreen IDirectFB::GetScreen (DFBScreenID screen_id)
{
     IDirectFBScreen_C *idirectfbscreen;

     DFBCHECK( iface->GetScreen (iface, screen_id, &idirectfbscreen) );

     return IDirectFBScreen (idirectfbscreen);
}

void IDirectFB::EnumScreens (DFBScreenCallback  callback,
                             void              *callbackdata)
{
     DFBCHECK( iface->EnumScreens (iface, callback, callbackdata) );
}


IDirectFBDisplayLayer IDirectFB::GetDisplayLayer (DFBDisplayLayerID layer_id)
{
     IDirectFBDisplayLayer_C *idirectfbdisplaylayer;

     DFBCHECK( iface->GetDisplayLayer (iface, layer_id, &idirectfbdisplaylayer) );

     return IDirectFBDisplayLayer (idirectfbdisplaylayer);
}

void IDirectFB::EnumInputDevices (DFBInputDeviceCallback  callback,
                                  void                   *callbackdata) const
{
     DFBCHECK( iface->EnumInputDevices (iface, callback, callbackdata) );
}

IDirectFBInputDevice IDirectFB::GetInputDevice (DFBInputDeviceID device_id) const
{
     IDirectFBInputDevice_C *idirectfbinputdevice;

     DFBCHECK( iface->GetInputDevice (iface, device_id, &idirectfbinputdevice) );

     return IDirectFBInputDevice (idirectfbinputdevice);
}

IDirectFBEventBuffer IDirectFB::CreateEventBuffer () const
{
     IDirectFBEventBuffer_C *idirectfbeventbuffer;

     DFBCHECK( iface->CreateEventBuffer (iface, &idirectfbeventbuffer) );

     static IDirectFBEventBuffer *buffer = new IDirectFBEventBuffer (idirectfbeventbuffer);
     return *buffer;
//     return IDirectFBEventBuffer (idirectfbeventbuffer);
}

IDirectFBEventBuffer IDirectFB::CreateInputEventBuffer (DFBInputDeviceCapabilities caps,
                                                        DFBBoolean                 global)
{
     IDirectFBEventBuffer_C *idirectfbeventbuffer;

     DFBCHECK( iface->CreateInputEventBuffer (iface, caps, global,
                                              &idirectfbeventbuffer) );

     return IDirectFBEventBuffer (idirectfbeventbuffer);
}

IDirectFBImageProvider IDirectFB::CreateImageProvider (const char *filename) const
{
     IDirectFBImageProvider_C *idirectfbimageprovider;

     DFBCHECK( iface->CreateImageProvider (iface, filename, &idirectfbimageprovider) );

     return IDirectFBImageProvider (idirectfbimageprovider);
}

IDirectFBVideoProvider IDirectFB::CreateVideoProvider (const char *filename)
{
     IDirectFBVideoProvider_C *idirectfbvideoprovider;

     DFBCHECK( iface->CreateVideoProvider (iface, filename, &idirectfbvideoprovider) );

     return IDirectFBVideoProvider (idirectfbvideoprovider);
}

IDirectFBFont IDirectFB::CreateFont (const char         *filename,
                                      DFBFontDescription &desc) const
{
     IDirectFBFont_C *idirectfbfont;

     DFBCHECK( iface->CreateFont (iface, filename, &desc, &idirectfbfont) );

     return IDirectFBFont (idirectfbfont);
}

IDirectFBDataBuffer IDirectFB::CreateDataBuffer (DFBDataBufferDescription &desc)
{
     IDirectFBDataBuffer_C *idirectfbdatabuffer;

     DFBCHECK( iface->CreateDataBuffer (iface, &desc, &idirectfbdatabuffer) );

     return IDirectFBDataBuffer (idirectfbdatabuffer);
}

struct timeval IDirectFB::SetClipboardData (const char   *mime_type,
                                            const void   *data,
                                            unsigned int  size)
{
     struct timeval timestamp;

     DFBCHECK( iface->SetClipboardData (iface, mime_type, data, size, &timestamp) );

     return timestamp;
}

void IDirectFB::GetClipboardData (char         **mime_type,
                                  void         **data,
                                  unsigned int  *size)
{
     DFBCHECK( iface->GetClipboardData (iface, mime_type, data, size) );
}

struct timeval IDirectFB::GetClipboardTimeStamp()
{
     struct timeval timestamp;

     DFBCHECK( iface->GetClipboardTimeStamp (iface, &timestamp) );

     return timestamp;
}

void IDirectFB::Suspend()
{
     DFBCHECK( iface->Suspend (iface) );
}

void IDirectFB::Resume()
{
     DFBCHECK( iface->Resume (iface) );
}

void IDirectFB::WaitIdle()
{
     DFBCHECK( iface->WaitIdle (iface) );
}

void IDirectFB::WaitForSync()
{
     DFBCHECK( iface->WaitForSync (iface) );
}

void *IDirectFB::GetInterface (const char *type,
                               const char *implementation,
                               void       *arg)
{
     void *interface;

     DFBCHECK( iface->GetInterface (iface, type, implementation, arg, &interface) );

     return interface;
}