summaryrefslogtreecommitdiff
path: root/src/c_fl_help_view.cpp
blob: 50d5d58cbee0d5fb85403c633e4c532cfc99b657 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193


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


#include <FL/Fl_Group.H>
#include <FL/Fl_Help_View.H>
#include <FL/Enumerations.H>
#include "c_fl_help_view.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_Help_View : public Fl_Help_View {
public:
    using Fl_Help_View::Fl_Help_View;

    friend void fl_help_view_draw(HELPVIEW v);
    friend int fl_help_view_handle(HELPVIEW v, int e);

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

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

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




//  Flattened C API

HELPVIEW new_fl_help_view(int x, int y, int w, int h, char * label) {
    My_Help_View *v = new My_Help_View(x, y, w, h, label);
    return v;
}

void free_fl_help_view(HELPVIEW v) {
    delete reinterpret_cast<My_Help_View*>(v);
}




void fl_help_view_clear_selection(HELPVIEW v) {
    reinterpret_cast<Fl_Help_View*>(v)->clear_selection();
}

void fl_help_view_select_all(HELPVIEW v) {
    reinterpret_cast<Fl_Help_View*>(v)->select_all();
}




int fl_help_view_find(HELPVIEW v, const char * s, int p) {
    return reinterpret_cast<Fl_Help_View*>(v)->find(s, p);
}

int fl_help_view_get_leftline(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->leftline();
}

void fl_help_view_set_leftline(HELPVIEW v, int t) {
    reinterpret_cast<Fl_Help_View*>(v)->leftline(t);
}

int fl_help_view_get_topline(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->topline();
}

void fl_help_view_set_topline(HELPVIEW v, int t) {
    reinterpret_cast<Fl_Help_View*>(v)->topline(t);
}

void fl_help_view_set_topline_target(HELPVIEW v, const char * t) {
    reinterpret_cast<Fl_Help_View*>(v)->topline(t);
}




const char * fl_help_view_directory(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->directory();
}

const char * fl_help_view_filename(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->filename();
}

int fl_help_view_load(HELPVIEW v, const char * f) {
    return reinterpret_cast<Fl_Help_View*>(v)->load(f);
}

const char * fl_help_view_title(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->title();
}

const char * fl_help_view_get_value(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->value();
}

void fl_help_view_set_value(HELPVIEW v, const char * t) {
    reinterpret_cast<Fl_Help_View*>(v)->value(t);
}

void fl_help_view_link(HELPVIEW v, void * f) {
    reinterpret_cast<Fl_Help_View*>(v)->link(reinterpret_cast<Fl_Help_Func*>(f));
}




int fl_help_view_get_scrollbar_size(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->scrollbar_size();
}

void fl_help_view_set_scrollbar_size(HELPVIEW v, int s) {
    reinterpret_cast<Fl_Help_View*>(v)->scrollbar_size(s);
}

int fl_help_view_get_size(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->size();
}

void fl_help_view_set_size(HELPVIEW v, int w, int h) {
    reinterpret_cast<Fl_Help_View*>(v)->size(w, h);
}

void fl_help_view_resize(HELPVIEW v, int x, int y, int w, int h) {
    reinterpret_cast<Fl_Help_View*>(v)->resize(x, y, w, h);
}

unsigned int fl_help_view_get_textcolor(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->textcolor();
}

void fl_help_view_set_textcolor(HELPVIEW v, unsigned int c) {
    reinterpret_cast<Fl_Help_View*>(v)->textcolor(c);
}

int fl_help_view_get_textfont(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->textfont();
}

void fl_help_view_set_textfont(HELPVIEW v, int f) {
    reinterpret_cast<Fl_Help_View*>(v)->textfont(f);
}

int fl_help_view_get_textsize(HELPVIEW v) {
    return reinterpret_cast<Fl_Help_View*>(v)->textsize();
}

void fl_help_view_set_textsize(HELPVIEW v, int s) {
    reinterpret_cast<Fl_Help_View*>(v)->textsize(s);
}




void fl_help_view_draw(HELPVIEW v) {
    #if FL_ABI_VERSION >= 10303
    reinterpret_cast<My_Help_View*>(v)->Fl_Help_View::draw();
    #else
    reinterpret_cast<My_Help_View*>(v)->Fl_Group::draw();
    #endif
}

int fl_help_view_handle(HELPVIEW v, int e) {
    #if FL_ABI_VERSION >= 10303
    return reinterpret_cast<My_Help_View*>(v)->Fl_Help_View::handle(e);
    #else
    return reinterpret_cast<My_Help_View*>(v)->Fl_Group::handle(e);
    #endif
}