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
|
#include <FL/Fl_Chart.H>
#include "c_fl_chart.h"
#include "c_fl_type.h"
class My_Chart : public Fl_Chart {
public:
using Fl_Chart::Fl_Chart;
friend void chart_set_draw_hook(CHART n, void * d);
friend void fl_chart_draw(CHART n);
friend void chart_set_handle_hook(CHART n, void * h);
friend int fl_chart_handle(CHART 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_Chart::draw() {
(*draw_hook)(this->user_data());
}
void My_Chart::real_draw() {
Fl_Chart::draw();
}
int My_Chart::handle(int e) {
return (*handle_hook)(this->user_data(), e);
}
int My_Chart::real_handle(int e) {
return Fl_Chart::handle(e);
}
void chart_set_draw_hook(CHART n, void * d) {
reinterpret_cast<My_Chart*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d);
}
void fl_chart_draw(CHART n) {
reinterpret_cast<My_Chart*>(n)->real_draw();
}
void chart_set_handle_hook(CHART n, void * h) {
reinterpret_cast<My_Chart*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h);
}
int fl_chart_handle(CHART n, int e) {
return reinterpret_cast<My_Chart*>(n)->real_handle(e);
}
CHART new_fl_chart(int x, int y, int w, int h, char* label) {
My_Chart *b = new My_Chart(x, y, w, h, label);
return b;
}
void free_fl_chart(CHART b) {
delete reinterpret_cast<My_Chart*>(b);
}
void fl_chart_add(CHART b, double v, char * s, unsigned int c) {
reinterpret_cast<Fl_Chart*>(b)->add(v,s,c);
}
void fl_chart_insert(CHART b, int i, double v, char * s, unsigned int c) {
reinterpret_cast<Fl_Chart*>(b)->insert(i,v,s,c);
}
void fl_chart_replace(CHART b, int i, double v, char * s, unsigned int c) {
reinterpret_cast<Fl_Chart*>(b)->replace(i,v,s,c);
}
void fl_chart_clear(CHART b) {
reinterpret_cast<Fl_Chart*>(b)->clear();
}
int fl_chart_get_autosize(CHART b) {
return reinterpret_cast<Fl_Chart*>(b)->autosize();
}
void fl_chart_set_autosize(CHART b, int a) {
reinterpret_cast<Fl_Chart*>(b)->autosize(a);
}
void fl_chart_get_bounds(CHART b, double * l, double * u) {
reinterpret_cast<Fl_Chart*>(b)->bounds(l,u);
}
void fl_chart_set_bounds(CHART b, double l, double u) {
reinterpret_cast<Fl_Chart*>(b)->bounds(l,u);
}
int fl_chart_get_maxsize(CHART b) {
return reinterpret_cast<Fl_Chart*>(b)->maxsize();
}
void fl_chart_set_maxsize(CHART b, int m) {
reinterpret_cast<Fl_Chart*>(b)->maxsize(m);
}
int fl_chart_size(CHART b) {
return reinterpret_cast<Fl_Chart*>(b)->size();
}
void fl_chart_size2(CHART b, int w, int h) {
reinterpret_cast<Fl_Chart*>(b)->size(w, h);
}
unsigned int fl_chart_get_textcolor(CHART b) {
return reinterpret_cast<Fl_Chart*>(b)->textcolor();
}
void fl_chart_set_textcolor(CHART b, unsigned int c) {
reinterpret_cast<Fl_Chart*>(b)->textcolor(c);
}
int fl_chart_get_textfont(CHART b) {
return reinterpret_cast<Fl_Chart*>(b)->textfont();
}
void fl_chart_set_textfont(CHART b, int f) {
reinterpret_cast<Fl_Chart*>(b)->textfont(f);
}
int fl_chart_get_textsize(CHART b) {
return reinterpret_cast<Fl_Chart*>(b)->textsize();
}
void fl_chart_set_textsize(CHART b, int s) {
reinterpret_cast<Fl_Chart*>(b)->textsize(s);
}
|