summaryrefslogtreecommitdiff
path: root/src/c_fl_surface_device.cpp
blob: 50088cfa5fa22de8b71fed308464475c070d3ae8 (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


//  Programmed by Jedidiah Barber
//  Released into the public domain


#include <FL/Fl_Device.H>
#include "c_fl_surface_device.h"




//  Adding relevant friends

class My_Surface_Device : public Fl_Surface_Device {
public:
    using Fl_Surface_Device::Fl_Surface_Device;
    friend SURFACEDEVICE new_fl_surface_device(void * g);
};




//  Flattened C API

SURFACEDEVICE new_fl_surface_device(void * g) {
    My_Surface_Device *s = new My_Surface_Device(reinterpret_cast<Fl_Graphics_Driver*>(g));
    return s;
}

void free_fl_surface_device(SURFACEDEVICE s) {
    delete reinterpret_cast<My_Surface_Device*>(s);
}




void fl_surface_device_set_current(SURFACEDEVICE s) {
    //  virtual so disable dispatch
    reinterpret_cast<Fl_Surface_Device*>(s)->Fl_Surface_Device::set_current();
}

SURFACEDEVICE fl_surface_device_get_surface(void) {
    return Fl_Surface_Device::surface();
}




void * fl_surface_device_get_driver(SURFACEDEVICE s) {
    return reinterpret_cast<Fl_Surface_Device*>(s)->driver();
}

void fl_surface_device_set_driver(SURFACEDEVICE s, void * g) {
    reinterpret_cast<Fl_Surface_Device*>(s)->driver(reinterpret_cast<Fl_Graphics_Driver*>(g));
}