summaryrefslogtreecommitdiff
path: root/src/c_fl_value_input.cpp
blob: 37273a74ec6cc05c8c576d01c0f29f73762b0aa6 (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


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


#include <FL/Fl_Value_Input.H>
#include "c_fl_value_input.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_Input : public Fl_Value_Input {
public:
    using Fl_Value_Input::Fl_Value_Input;

    friend void fl_value_input_draw(VALUEINPUT a);
    friend int fl_value_input_handle(VALUEINPUT a, int e);

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

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

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




//  Flattened C API

VALUEINPUT new_fl_value_input(int x, int y, int w, int h, char* label) {
    My_Value_Input *a = new My_Value_Input(x, y, w, h, label);
    return a;
}

void free_fl_value_input(VALUEINPUT a) {
    delete reinterpret_cast<My_Value_Input*>(a);
}




void * fl_value_input_get_input(VALUEINPUT v) {
    return &(reinterpret_cast<Fl_Value_Input*>(v)->input);
}




unsigned int fl_value_input_get_cursor_color(VALUEINPUT v) {
    return reinterpret_cast<Fl_Value_Input*>(v)->cursor_color();
}

void fl_value_input_set_cursor_color(VALUEINPUT v, unsigned int c) {
    reinterpret_cast<Fl_Value_Input*>(v)->cursor_color(c);
}




int fl_value_input_get_shortcut(VALUEINPUT v) {
    return reinterpret_cast<Fl_Value_Input*>(v)->Fl_Value_Input::shortcut();
}

void fl_value_input_set_shortcut(VALUEINPUT v, int k) {
    reinterpret_cast<Fl_Value_Input*>(v)->Fl_Value_Input::shortcut(k);
}




int fl_value_input_is_soft(VALUEINPUT a) {
    return reinterpret_cast<Fl_Value_Input*>(a)->soft();
}

void fl_value_input_set_soft(VALUEINPUT a, int t) {
    reinterpret_cast<Fl_Value_Input*>(a)->soft(t);
}




unsigned int fl_value_input_get_text_color(VALUEINPUT v) {
    return reinterpret_cast<Fl_Value_Input*>(v)->textcolor();
}

void fl_value_input_set_text_color(VALUEINPUT v, unsigned int c) {
    reinterpret_cast<Fl_Value_Input*>(v)->textcolor(static_cast<Fl_Color>(c));
}

int fl_value_input_get_text_font(VALUEINPUT v) {
    return reinterpret_cast<Fl_Value_Input*>(v)->textfont();
}

void fl_value_input_set_text_font(VALUEINPUT v, int f) {
    reinterpret_cast<Fl_Value_Input*>(v)->textfont(static_cast<Fl_Font>(f));
}

int fl_value_input_get_text_size(VALUEINPUT v) {
    return reinterpret_cast<Fl_Value_Input*>(v)->textsize();
}

void fl_value_input_set_text_size(VALUEINPUT v, int s) {
    reinterpret_cast<Fl_Value_Input*>(v)->textsize(static_cast<Fl_Fontsize>(s));
}




void fl_value_input_resize(VALUEINPUT v, int x, int y, int w, int h) {
    reinterpret_cast<Fl_Value_Input*>(v)->resize(x, y, w, h);
}




void fl_value_input_draw(VALUEINPUT a) {
    reinterpret_cast<My_Value_Input*>(a)->Fl_Value_Input::draw();
}

int fl_value_input_handle(VALUEINPUT a, int e) {
    return reinterpret_cast<My_Value_Input*>(a)->Fl_Value_Input::handle(e);
}