summaryrefslogtreecommitdiff
path: root/src/c_fl_menuitem.cpp
blob: cb4ebeef4671800be7ee6dcb43b66243eafd96a8 (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
194


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


#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Image.H>
#include "c_fl_menuitem.h"




//  Exports from Ada

extern "C" void menu_item_callback_hook(void * cobj, void * ud);




//  Flattened C API

void * null_fl_menu_item() {
    Fl_Menu_Item *mi = new Fl_Menu_Item;
    mi->label(0);
    return mi;
}

void * new_fl_menu_item(char * t, void * c, unsigned long s, unsigned long f) {
    Fl_Menu_Item *mi = new Fl_Menu_Item;
    mi->callback(c==0?0:reinterpret_cast<Fl_Callback_p>(&menu_item_callback_hook), c);
    mi->flags = static_cast<int>(f);
    mi->shortcut(static_cast<int>(s));
    mi->label(t);
    return mi;
}

void free_fl_menu_item(MENUITEM mi) {
    delete static_cast<Fl_Menu_Item*>(mi);
}




void * fl_menu_item_get_user_data(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->user_data();
}

void fl_menu_item_set_callback(MENUITEM mi, void * c) {
    static_cast<Fl_Menu_Item*>(mi)->callback
        (c==0?0:reinterpret_cast<Fl_Callback_p>(&menu_item_callback_hook), c);
}

void fl_menu_item_do_callback(MENUITEM mi, void * w) {
    static_cast<Fl_Menu_Item*>(mi)->do_callback(static_cast<Fl_Widget*>(w));
}




int fl_menu_item_checkbox(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->checkbox();
}

int fl_menu_item_radio(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->radio();
}

int fl_menu_item_submenu(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->submenu();
}

int fl_menu_item_value(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->value();
}

void fl_menu_item_set(MENUITEM mi) {
    static_cast<Fl_Menu_Item*>(mi)->set();
}

void fl_menu_item_clear(MENUITEM mi) {
    static_cast<Fl_Menu_Item*>(mi)->clear();
}

void fl_menu_item_setonly(MENUITEM mi) {
    static_cast<Fl_Menu_Item*>(mi)->setonly();
}




const char * fl_menu_item_get_label(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->label();
}

void fl_menu_item_set_label(MENUITEM mi, const char *t) {
    static_cast<Fl_Menu_Item*>(mi)->label(t);
}

void fl_menu_item_set_label2(MENUITEM mi, int k, const char * t) {
    static_cast<Fl_Menu_Item*>(mi)->label(static_cast<Fl_Labeltype>(k), t);
}

unsigned int fl_menu_item_get_labelcolor(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->labelcolor();
}

void fl_menu_item_set_labelcolor(MENUITEM mi, unsigned int c) {
    static_cast<Fl_Menu_Item*>(mi)->labelcolor(c);
}

int fl_menu_item_get_labelfont(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->labelfont();
}

void fl_menu_item_set_labelfont(MENUITEM mi, int f) {
    static_cast<Fl_Menu_Item*>(mi)->labelfont(f);
}

int fl_menu_item_get_labelsize(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->labelsize();
}

void fl_menu_item_set_labelsize(MENUITEM mi, int s) {
    static_cast<Fl_Menu_Item*>(mi)->labelsize(s);
}

int fl_menu_item_get_labeltype(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->labeltype();
}

void fl_menu_item_set_labeltype(MENUITEM mi, int t) {
    static_cast<Fl_Menu_Item*>(mi)->labeltype(static_cast<Fl_Labeltype>(t));
}




int fl_menu_item_get_shortcut(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->shortcut();
}

void fl_menu_item_set_shortcut(MENUITEM mi, int s) {
    static_cast<Fl_Menu_Item*>(mi)->shortcut(s);
}

unsigned long fl_menu_item_get_flags(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->flags;
}

void fl_menu_item_set_flags(MENUITEM mi, unsigned long f) {
    static_cast<Fl_Menu_Item*>(mi)->flags = f;
}




void fl_menu_item_image(MENUITEM mi, void * i) {
    static_cast<Fl_Menu_Item*>(mi)->image(static_cast<Fl_Image*>(i));
}




void fl_menu_item_activate(MENUITEM mi) {
    static_cast<Fl_Menu_Item*>(mi)->activate();
}

void fl_menu_item_deactivate(MENUITEM mi) {
    static_cast<Fl_Menu_Item*>(mi)->deactivate();
}

void fl_menu_item_show(MENUITEM mi) {
    static_cast<Fl_Menu_Item*>(mi)->show();
}

void fl_menu_item_hide(MENUITEM mi) {
    static_cast<Fl_Menu_Item*>(mi)->hide();
}

int fl_menu_item_active(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->active();
}

int fl_menu_item_visible(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->visible();
}

int fl_menu_item_activevisible(MENUITEM mi) {
    return static_cast<Fl_Menu_Item*>(mi)->activevisible();
}