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


#include <FL/Fl_Spinner.H>
#include "c_fl_spinner.h"
#include "c_fl_type.h"




class My_Spinner : public Fl_Spinner {
    public:
        using Fl_Spinner::Fl_Spinner;
        friend void spinner_set_draw_hook(SPINNER n, void * d);
        friend void fl_spinner_draw(SPINNER n);
        friend void spinner_set_handle_hook(SPINNER n, void * h);
        friend int fl_spinner_handle(SPINNER n, int e);
    protected:
        void draw();
        void real_draw();
        int handle(int e);
        int real_handle(int e);
        d_hook_p draw_hook;
        h_hook_p handle_hook;
};

void My_Spinner::draw() {
    (*draw_hook)(this->user_data());
}

void My_Spinner::real_draw() {
    Fl_Spinner::draw();
}

int My_Spinner::handle(int e) {
    return (*handle_hook)(this->user_data(), e);
}

int My_Spinner::real_handle(int e) {
    return Fl_Spinner::handle(e);
}

void spinner_set_draw_hook(SPINNER n, void * d) {
    reinterpret_cast<My_Spinner*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d);
}

void fl_spinner_draw(SPINNER n) {
    reinterpret_cast<My_Spinner*>(n)->real_draw();
}

void spinner_set_handle_hook(SPINNER n, void * h) {
    reinterpret_cast<My_Spinner*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h);
}

int fl_spinner_handle(SPINNER n, int e) {
    return reinterpret_cast<My_Spinner*>(n)->real_handle(e);
}




SPINNER new_fl_spinner(int x, int y, int w, int h, char* label) {
    My_Spinner *n = new My_Spinner(x, y, w, h, label);
    return n;
}

void free_fl_spinner(SPINNER n) {
    delete reinterpret_cast<My_Spinner*>(n);
}




unsigned int fl_spinner_get_color(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->color();
}

void fl_spinner_set_color(SPINNER n, unsigned int t) {
    reinterpret_cast<My_Spinner*>(n)->color(t);
}

unsigned int fl_spinner_get_selection_color(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->selection_color();
}

void fl_spinner_set_selection_color(SPINNER n, unsigned int t) {
    reinterpret_cast<My_Spinner*>(n)->selection_color(t);
}

unsigned int fl_spinner_get_textcolor(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->textcolor();
}

void fl_spinner_set_textcolor(SPINNER n, unsigned int t) {
    reinterpret_cast<My_Spinner*>(n)->textcolor(t);
}

int fl_spinner_get_textfont(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->textfont();
}

void fl_spinner_set_textfont(SPINNER n, int t) {
    reinterpret_cast<My_Spinner*>(n)->textfont(t);
}

int fl_spinner_get_textsize(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->textsize();
}

void fl_spinner_set_textsize(SPINNER n, int t) {
    reinterpret_cast<My_Spinner*>(n)->textsize(t);
}




double fl_spinner_get_minimum(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->minimum();
}

void fl_spinner_set_minimum(SPINNER n, double t) {
    reinterpret_cast<My_Spinner*>(n)->minimum(t);
}

double fl_spinner_get_maximum(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->maximum();
}

void fl_spinner_set_maximum(SPINNER n, double t) {
    reinterpret_cast<My_Spinner*>(n)->maximum(t);
}

void fl_spinner_range(SPINNER n, double a, double b) {
    reinterpret_cast<My_Spinner*>(n)->range(a,b);
}

double fl_spinner_get_step(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->step();
}

void fl_spinner_set_step(SPINNER n, double t) {
    reinterpret_cast<My_Spinner*>(n)->step(t);
}

int fl_spinner_get_type(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->type();
}

void fl_spinner_set_type(SPINNER n, int t) {
    reinterpret_cast<My_Spinner*>(n)->type(t);
}

double fl_spinner_get_value(SPINNER n) {
    return reinterpret_cast<My_Spinner*>(n)->value();
}

void fl_spinner_set_value(SPINNER n, double t) {
    reinterpret_cast<My_Spinner*>(n)->value(t);
}