summaryrefslogtreecommitdiff
path: root/src/c_fl_value_output.cpp
blob: b7cc1d67f79cfb0f1feca3b9c4db811bc19606d5 (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


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


#include <FL/Fl_Value_Output.H>
#include "c_fl_value_output.h"




//  Exports from Ada

extern "C" void widget_draw_hook(void * ud);
extern "C" int widget_handle_hook(void * ud, int e);




//  Attaching all relevant hooks and friends

class My_Value_Output : public Fl_Value_Output {
public:
    using Fl_Value_Output::Fl_Value_Output;

    friend void fl_value_output_draw(VALUEOUTPUT a);
    friend int fl_value_output_handle(VALUEOUTPUT a, int e);

    void draw();
    int handle(int e);
};

void My_Value_Output::draw() {
    widget_draw_hook(this->user_data());
}

int My_Value_Output::handle(int e) {
    return widget_handle_hook(this->user_data(), e);
}




//  Flattened C API

VALUEOUTPUT new_fl_value_output(int x, int y, int w, int h, char* label) {
    My_Value_Output *a = new My_Value_Output(x, y, w, h, label);
    return a;
}

void free_fl_value_output(VALUEOUTPUT a) {
    delete reinterpret_cast<My_Value_Output*>(a);
}




int fl_value_output_is_soft(VALUEOUTPUT a) {
    return reinterpret_cast<Fl_Value_Output*>(a)->soft();
}

void fl_value_output_set_soft(VALUEOUTPUT a, int t) {
    reinterpret_cast<Fl_Value_Output*>(a)->soft(t);
}




unsigned int fl_value_output_get_text_color(VALUEOUTPUT v) {
    return reinterpret_cast<Fl_Value_Output*>(v)->textcolor();
}

void fl_value_output_set_text_color(VALUEOUTPUT v, unsigned int c) {
    reinterpret_cast<Fl_Value_Output*>(v)->textcolor(static_cast<Fl_Color>(c));
}

int fl_value_output_get_text_font(VALUEOUTPUT v) {
    return reinterpret_cast<Fl_Value_Output*>(v)->textfont();
}

void fl_value_output_set_text_font(VALUEOUTPUT v, int f) {
    reinterpret_cast<Fl_Value_Output*>(v)->textfont(static_cast<Fl_Font>(f));
}

int fl_value_output_get_text_size(VALUEOUTPUT v) {
    return reinterpret_cast<Fl_Value_Output*>(v)->textsize();
}

void fl_value_output_set_text_size(VALUEOUTPUT v, int s) {
    reinterpret_cast<Fl_Value_Output*>(v)->textsize(static_cast<Fl_Fontsize>(s));
}




void fl_value_output_draw(VALUEOUTPUT a) {
    reinterpret_cast<My_Value_Output*>(a)->Fl_Value_Output::draw();
}

int fl_value_output_handle(VALUEOUTPUT a, int e) {
    return reinterpret_cast<My_Value_Output*>(a)->Fl_Value_Output::handle(e);
}