DRC | 2ff39b8 | 2011-07-28 08:38:59 +0000 | [diff] [blame] | 1 | // |
| 2 | // "$Id: forms.H 8623 2011-04-24 17:09:41Z AlbrechtS $" |
| 3 | // |
| 4 | // Forms emulation header file for the Fast Light Tool Kit (FLTK). |
| 5 | // |
| 6 | // Copyright 1998-2011 by Bill Spitzak and others. |
| 7 | // |
| 8 | // This library is free software; you can redistribute it and/or |
| 9 | // modify it under the terms of the GNU Library General Public |
| 10 | // License as published by the Free Software Foundation; either |
| 11 | // version 2 of the License, or (at your option) any later version. |
| 12 | // |
| 13 | // This library is distributed in the hope that it will be useful, |
| 14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | // Library General Public License for more details. |
| 17 | // |
| 18 | // You should have received a copy of the GNU Library General Public |
| 19 | // License along with this library; if not, write to the Free Software |
| 20 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
| 21 | // USA. |
| 22 | // |
| 23 | // Please report all bugs and problems on the following page: |
| 24 | // |
| 25 | // http://www.fltk.org/str.php |
| 26 | // |
| 27 | |
| 28 | #ifndef __FORMS_H__ |
| 29 | #define __FORMS_H__ |
| 30 | |
| 31 | #include "Fl.H" |
| 32 | #include "Fl_Group.H" |
| 33 | #include "Fl_Window.H" |
| 34 | #include "fl_draw.H" |
| 35 | |
| 36 | typedef Fl_Widget FL_OBJECT; |
| 37 | typedef Fl_Window FL_FORM; |
| 38 | |
| 39 | //////////////////////////////////////////////////////////////// |
| 40 | // Random constants & symbols defined by forms.h file: |
| 41 | |
| 42 | #ifndef NULL |
| 43 | #define NULL 0 |
| 44 | #endif |
| 45 | #ifndef FALSE |
| 46 | #define FALSE 0 |
| 47 | #define TRUE 1 |
| 48 | #endif |
| 49 | |
| 50 | #define FL_ON 1 |
| 51 | #define FL_OK 1 |
| 52 | #define FL_VALID 1 |
| 53 | #define FL_PREEMPT 1 |
| 54 | #define FL_AUTO 2 |
| 55 | #define FL_WHEN_NEEDED FL_AUTO |
| 56 | #define FL_OFF 0 |
| 57 | #define FL_NONE 0 |
| 58 | #define FL_CANCEL 0 |
| 59 | #define FL_INVALID 0 |
| 60 | #define FL_IGNORE -1 |
| 61 | //#define FL_CLOSE -2 // this variable is never used in FLTK Forms. It is removed becaus it conflicts with the window FL_CLOSE event |
| 62 | |
| 63 | #define FL_LCOL FL_BLACK |
| 64 | #define FL_COL1 FL_GRAY |
| 65 | #define FL_MCOL FL_LIGHT1 |
| 66 | #define FL_LEFT_BCOL FL_LIGHT3 // 53 is better match |
| 67 | #define FL_TOP_BCOL FL_LIGHT2 // 51 |
| 68 | #define FL_BOTTOM_BCOL FL_DARK2 // 40 |
| 69 | #define FL_RIGHT_BCOL FL_DARK3 // 36 |
| 70 | #define FL_INACTIVE FL_INACTIVE_COLOR |
| 71 | #define FL_INACTIVE_COL FL_INACTIVE_COLOR |
| 72 | #define FL_FREE_COL1 FL_FREE_COLOR |
| 73 | #define FL_FREE_COL2 ((Fl_Color)(FL_FREE_COLOR+1)) |
| 74 | #define FL_FREE_COL3 ((Fl_Color)(FL_FREE_COLOR+2)) |
| 75 | #define FL_FREE_COL4 ((Fl_Color)(FL_FREE_COLOR+3)) |
| 76 | #define FL_FREE_COL5 ((Fl_Color)(FL_FREE_COLOR+4)) |
| 77 | #define FL_FREE_COL6 ((Fl_Color)(FL_FREE_COLOR+5)) |
| 78 | #define FL_FREE_COL7 ((Fl_Color)(FL_FREE_COLOR+6)) |
| 79 | #define FL_FREE_COL8 ((Fl_Color)(FL_FREE_COLOR+7)) |
| 80 | #define FL_FREE_COL9 ((Fl_Color)(FL_FREE_COLOR+8)) |
| 81 | #define FL_FREE_COL10 ((Fl_Color)(FL_FREE_COLOR+9)) |
| 82 | #define FL_FREE_COL11 ((Fl_Color)(FL_FREE_COLOR+10)) |
| 83 | #define FL_FREE_COL12 ((Fl_Color)(FL_FREE_COLOR+11)) |
| 84 | #define FL_FREE_COL13 ((Fl_Color)(FL_FREE_COLOR+12)) |
| 85 | #define FL_FREE_COL14 ((Fl_Color)(FL_FREE_COLOR+13)) |
| 86 | #define FL_FREE_COL15 ((Fl_Color)(FL_FREE_COLOR+14)) |
| 87 | #define FL_FREE_COL16 ((Fl_Color)(FL_FREE_COLOR+15)) |
| 88 | #define FL_TOMATO ((Fl_Color)(131)) |
| 89 | #define FL_INDIANRED ((Fl_Color)(164)) |
| 90 | #define FL_SLATEBLUE ((Fl_Color)(195)) |
| 91 | #define FL_DARKGOLD ((Fl_Color)(84)) |
| 92 | #define FL_PALEGREEN ((Fl_Color)(157)) |
| 93 | #define FL_ORCHID ((Fl_Color)(203)) |
| 94 | #define FL_DARKCYAN ((Fl_Color)(189)) |
| 95 | #define FL_DARKTOMATO ((Fl_Color)(113)) |
| 96 | #define FL_WHEAT ((Fl_Color)(174)) |
| 97 | |
| 98 | #define FL_ALIGN_BESIDE FL_ALIGN_INSIDE |
| 99 | |
| 100 | #define FL_PUP_TOGGLE 2 // FL_MENU_TOGGLE |
| 101 | #define FL_PUP_INACTIVE 1 // FL_MENU_INACTIVE |
| 102 | #define FL_NO_FRAME FL_NO_BOX |
| 103 | #define FL_ROUNDED3D_UPBOX FL_ROUND_UP_BOX |
| 104 | #define FL_ROUNDED3D_DOWNBOX FL_ROUND_DOWN_BOX |
| 105 | #define FL_OVAL3D_UPBOX FL_ROUND_UP_BOX |
| 106 | #define FL_OVAL3D_DOWNBOX FL_ROUND_DOWN_BOX |
| 107 | |
| 108 | #define FL_MBUTTON1 1 |
| 109 | #define FL_LEFTMOUSE 1 |
| 110 | #define FL_MBUTTON2 2 |
| 111 | #define FL_MIDDLEMOUSE 2 |
| 112 | #define FL_MBUTTON3 3 |
| 113 | #define FL_RIGHTMOUSE 3 |
| 114 | #define FL_MBUTTON4 4 |
| 115 | #define FL_MBUTTON5 5 |
| 116 | |
| 117 | #define FL_INVALID_STYLE 255 |
| 118 | #define FL_NORMAL_STYLE FL_HELVETICA |
| 119 | #define FL_BOLD_STYLE FL_HELVETICA_BOLD |
| 120 | #define FL_ITALIC_STYLE FL_HELVETICA_ITALIC |
| 121 | #define FL_BOLDITALIC_STYLE FL_HELVETICA_BOLD_ITALIC |
| 122 | #define FL_FIXED_STYLE FL_COURIER |
| 123 | #define FL_FIXEDBOLD_STYLE FL_COURIER_BOLD |
| 124 | #define FL_FIXEDITALIC_STYLE FL_COURIER_ITALIC |
| 125 | #define FL_FIXEDBOLDITALIC_STYLE FL_COURIER_BOLD_ITALIC |
| 126 | #define FL_TIMES_STYLE FL_TIMES |
| 127 | #define FL_TIMESBOLD_STYLE FL_TIMES_BOLD |
| 128 | #define FL_TIMESITALIC_STYLE FL_TIMES_ITALIC |
| 129 | #define FL_TIMESBOLDITALIC_STYLE FL_TIMES_BOLD_ITALIC |
| 130 | |
| 131 | // hacks to change the labeltype() when passed to fl_set_object_lstyle(): |
| 132 | #define FL_SHADOW_STYLE (FL_SHADOW_LABEL<<8) |
| 133 | #define FL_ENGRAVED_STYLE (FL_ENGRAVED_LABEL<<8) |
| 134 | #define FL_EMBOSSED_STYLE (FL_EMBOSSED_LABEL<<0) |
| 135 | |
| 136 | // size values are different from XForms, match older Forms: |
| 137 | #define FL_TINY_SIZE 8 |
| 138 | #define FL_SMALL_SIZE 11 // 10 |
| 139 | //#define FL_NORMAL_SIZE 14 // 12 |
| 140 | #define FL_MEDIUM_SIZE 18 // 14 |
| 141 | #define FL_LARGE_SIZE 24 // 18 |
| 142 | #define FL_HUGE_SIZE 32 // 24 |
| 143 | #define FL_DEFAULT_SIZE FL_SMALL_SIZE |
| 144 | #define FL_TINY_FONT FL_TINY_SIZE |
| 145 | #define FL_SMALL_FONT FL_SMALL_SIZE |
| 146 | #define FL_NORMAL_FONT FL_NORMAL_SIZE |
| 147 | #define FL_MEDIUM_FONT FL_MEDIUM_SIZE |
| 148 | #define FL_LARGE_FONT FL_LARGE_SIZE |
| 149 | #define FL_HUGE_FONT FL_HUGE_SIZE |
| 150 | #define FL_NORMAL_FONT1 FL_SMALL_FONT |
| 151 | #define FL_NORMAL_FONT2 FL_NORMAL_FONT |
| 152 | #define FL_DEFAULT_FONT FL_SMALL_FONT |
| 153 | |
| 154 | #define FL_RETURN_END_CHANGED FL_WHEN_RELEASE |
| 155 | #define FL_RETURN_CHANGED FL_WHEN_CHANGED |
| 156 | #define FL_RETURN_END FL_WHEN_RELEASE_ALWAYS |
| 157 | #define FL_RETURN_ALWAYS (FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED) |
| 158 | |
| 159 | #define FL_BOUND_WIDTH 3 |
| 160 | |
| 161 | typedef int FL_Coord; |
| 162 | typedef int FL_COLOR; |
| 163 | |
| 164 | //////////////////////////////////////////////////////////////// |
| 165 | // fltk interaction: |
| 166 | |
| 167 | #define FL_CMD_OPT void |
| 168 | extern FL_EXPORT void fl_initialize(int*, char*[], const char*, FL_CMD_OPT*, int); |
| 169 | inline void fl_finish() {} |
| 170 | |
| 171 | typedef void (*FL_IO_CALLBACK) (int, void*); |
| 172 | inline void fl_add_io_callback(int fd, short w, FL_IO_CALLBACK cb, void* v) { |
| 173 | Fl::add_fd(fd,w,cb,v);} |
| 174 | inline void fl_remove_io_callback(int fd, short, FL_IO_CALLBACK) { |
| 175 | Fl::remove_fd(fd);} // removes all the callbacks! |
| 176 | |
| 177 | // type of callback is different and no "id" number is returned: |
| 178 | inline void fl_add_timeout(long msec, void (*cb)(void*), void* v) { |
| 179 | Fl::add_timeout(msec*.001, cb, v);} |
| 180 | inline void fl_remove_timeout(int) {} |
| 181 | |
| 182 | // type of callback is different! |
| 183 | inline void fl_set_idle_callback(void (*cb)()) {Fl::set_idle(cb);} |
| 184 | |
| 185 | FL_EXPORT Fl_Widget* fl_do_forms(void); |
| 186 | FL_EXPORT Fl_Widget* fl_check_forms(); |
| 187 | inline Fl_Widget* fl_do_only_forms(void) {return fl_do_forms();} |
| 188 | inline Fl_Widget* fl_check_only_forms(void) {return fl_check_forms();} |
| 189 | |
| 190 | // because of new redraw behavior, these are no-ops: |
| 191 | inline void fl_freeze_object(Fl_Widget*) {} |
| 192 | inline void fl_unfreeze_object(Fl_Widget*) {} |
| 193 | inline void fl_freeze_form(Fl_Window*) {} |
| 194 | inline void fl_unfreeze_form(Fl_Window*) {} |
| 195 | inline void fl_freeze_all_forms() {} |
| 196 | inline void fl_unfreeze_all_forms() {} |
| 197 | |
| 198 | inline void fl_set_focus_object(Fl_Window*, Fl_Widget* o) {Fl::focus(o);} |
| 199 | inline void fl_reset_focus_object(Fl_Widget* o) {Fl::focus(o);} |
| 200 | #define fl_set_object_focus fl_set_focus_object |
| 201 | |
| 202 | // void fl_set_form_atclose(Fl_Window*w,int (*cb)(Fl_Window*,void*),void* v) |
| 203 | // void fl_set_atclose(int (*cb)(Fl_Window*,void*),void*) |
| 204 | // fl_set_form_atactivate/atdeactivate not implemented! |
| 205 | |
| 206 | //////////////////////////////////////////////////////////////// |
| 207 | // Fl_Widget: |
| 208 | |
| 209 | inline void fl_set_object_boxtype(Fl_Widget* o, Fl_Boxtype a) {o->box(a);} |
| 210 | inline void fl_set_object_lsize(Fl_Widget* o,int s) {o->labelsize(s);} |
| 211 | |
| 212 | /* forms lib font indexes must be byte sized - extract correct byte from style word */ |
| 213 | inline void fl_set_object_lstyle(Fl_Widget* o,int a) { |
| 214 | o->labelfont((Fl_Font)(a&0xff)); o->labeltype((Fl_Labeltype)(a>>8));} |
| 215 | inline void fl_set_object_lcol(Fl_Widget* o, Fl_Color a) {o->labelcolor(a);} |
| 216 | #define fl_set_object_lcolor fl_set_object_lcol |
| 217 | inline void fl_set_object_lalign(Fl_Widget* o, Fl_Align a) {o->align(a);} |
| 218 | #define fl_set_object_align fl_set_object_lalign |
| 219 | inline void fl_set_object_color(Fl_Widget* o,Fl_Color a,Fl_Color b) {o->color(a,b);} |
| 220 | inline void fl_set_object_label(Fl_Widget* o, const char* a) {o->label(a); o->redraw();} |
| 221 | inline void fl_set_object_position(Fl_Widget*o,int x,int y) {o->position(x,y);} |
| 222 | inline void fl_set_object_size(Fl_Widget* o, int w, int h) {o->size(w,h);} |
| 223 | inline void fl_set_object_geometry(Fl_Widget* o,int x,int y,int w,int h) {o->resize(x,y,w,h);} |
| 224 | |
| 225 | inline void fl_get_object_geometry(Fl_Widget* o,int*x,int*y,int*w,int*h) { |
| 226 | *x = o->x(); *y = o->y(); *w = o->w(); *h = o->h();} |
| 227 | inline void fl_get_object_position(Fl_Widget* o,int*x,int*y) { |
| 228 | *x = o->x(); *y = o->y();} |
| 229 | |
| 230 | typedef void (*Forms_CB)(Fl_Widget*, long); |
| 231 | inline void fl_set_object_callback(Fl_Widget*o,Forms_CB c,long a) {o->callback(c,a);} |
| 232 | #define fl_set_call_back fl_set_object_callback |
| 233 | inline void fl_call_object_callback(Fl_Widget* o) {o->do_callback();} |
| 234 | inline void fl_trigger_object(Fl_Widget* o) {o->do_callback();} |
| 235 | inline void fl_set_object_return(Fl_Widget* o, int v) { |
| 236 | o->when((Fl_When)(v|FL_WHEN_RELEASE));} |
| 237 | |
| 238 | inline void fl_redraw_object(Fl_Widget* o) {o->redraw();} |
| 239 | inline void fl_show_object(Fl_Widget* o) {o->show();} |
| 240 | inline void fl_hide_object(Fl_Widget* o) {o->hide();} |
| 241 | inline void fl_free_object(Fl_Widget* x) {delete x;} |
| 242 | inline void fl_delete_object(Fl_Widget* o) {o->parent()->remove(*o);} |
| 243 | inline void fl_activate_object(Fl_Widget* o) {o->activate();} |
| 244 | inline void fl_deactivate_object(Fl_Widget* o) {o->deactivate();} |
| 245 | |
| 246 | inline void fl_add_object(Fl_Window* f, Fl_Widget* x) {f->add(x);} |
| 247 | inline void fl_insert_object(Fl_Widget* o, Fl_Widget* b) {b->parent()->insert(*o,b);} |
| 248 | |
| 249 | inline Fl_Window* FL_ObjWin(Fl_Widget* o) {return o->window();} |
| 250 | |
| 251 | //////////////////////////////////////////////////////////////// |
| 252 | // things that appered in the demos a lot that I don't emulate, but |
| 253 | // I did not want to edit out of all the demos... |
| 254 | |
| 255 | inline int fl_get_border_width() {return 3;} |
| 256 | inline void fl_set_border_width(int) {} |
| 257 | inline void fl_set_object_dblbuffer(Fl_Widget*, int) {} |
| 258 | inline void fl_set_form_dblbuffer(Fl_Window*, int) {} |
| 259 | |
| 260 | //////////////////////////////////////////////////////////////// |
| 261 | // Fl_Window: |
| 262 | |
| 263 | inline void fl_free_form(Fl_Window* x) {delete x;} |
| 264 | inline void fl_redraw_form(Fl_Window* f) {f->redraw();} |
| 265 | |
| 266 | inline Fl_Window* fl_bgn_form(Fl_Boxtype b,int w,int h) { |
| 267 | Fl_Window* g = new Fl_Window(w,h,0); |
| 268 | g->box(b); |
| 269 | return g; |
| 270 | } |
| 271 | FL_EXPORT void fl_end_form(); |
| 272 | inline void fl_addto_form(Fl_Window* f) {f->begin();} |
| 273 | inline Fl_Group* fl_bgn_group() {return new Fl_Group(0,0,0,0,0);} |
| 274 | inline void fl_end_group() {Fl_Group::current()->forms_end();} |
| 275 | inline void fl_addto_group(Fl_Widget* o) {((Fl_Group* )o)->begin();} |
| 276 | #define resizebox _ddfdesign_kludge() |
| 277 | |
| 278 | inline void fl_scale_form(Fl_Window* f, double x, double y) { |
| 279 | f->resizable(f); f->size(int(f->w()*x),int(f->h()*y));} |
| 280 | inline void fl_set_form_position(Fl_Window* f,int x,int y) {f->position(x,y);} |
| 281 | inline void fl_set_form_size(Fl_Window* f, int w, int h) {f->size(w,h);} |
| 282 | inline void fl_set_form_geometry(Fl_Window* f,int x,int y,int w,int h) { |
| 283 | f->resize(x,y,w,h);} |
| 284 | #define fl_set_initial_placement fl_set_form_geometry |
| 285 | inline void fl_adjust_form_size(Fl_Window*) {} |
| 286 | |
| 287 | FL_EXPORT void fl_show_form(Fl_Window* f,int p,int b,const char* n); |
| 288 | enum { // "p" argument values: |
| 289 | FL_PLACE_FREE = 0, // make resizable |
| 290 | FL_PLACE_MOUSE = 1, // mouse centered on form |
| 291 | FL_PLACE_CENTER = 2, // center of the screen |
| 292 | FL_PLACE_POSITION = 4,// fixed position, resizable |
| 293 | FL_PLACE_SIZE = 8, // fixed size, normal fltk behavior |
| 294 | FL_PLACE_GEOMETRY =16,// fixed size and position |
| 295 | FL_PLACE_ASPECT = 32, // keep aspect ratio (ignored) |
| 296 | FL_PLACE_FULLSCREEN=64,// fill screen |
| 297 | FL_PLACE_HOTSPOT = 128,// enables hotspot |
| 298 | FL_PLACE_ICONIC = 256,// iconic (ignored) |
| 299 | FL_FREE_SIZE=(1<<14), // force resizable |
| 300 | FL_FIX_SIZE =(1<<15) // force off resizable |
| 301 | }; |
| 302 | #define FL_PLACE_FREE_CENTER (FL_PLACE_CENTER|FL_FREE_SIZE) |
| 303 | #define FL_PLACE_CENTERFREE (FL_PLACE_CENTER|FL_FREE_SIZE) |
| 304 | enum { // "b" arguement values: |
| 305 | FL_NOBORDER = 0, |
| 306 | FL_FULLBORDER, |
| 307 | FL_TRANSIENT |
| 308 | //FL_MODAL = (1<<8) // not implemented yet in Forms |
| 309 | }; |
| 310 | inline void fl_set_form_hotspot(Fl_Window* w,int x,int y) {w->hotspot(x,y);} |
| 311 | inline void fl_set_form_hotobject(Fl_Window* w, Fl_Widget* o) {w->hotspot(o);} |
| 312 | extern FL_EXPORT char fl_flip; // in forms.C |
| 313 | inline void fl_flip_yorigin() {fl_flip = 1;} |
| 314 | |
| 315 | #define fl_prepare_form_window fl_show_form |
| 316 | inline void fl_show_form_window(Fl_Window*) {} |
| 317 | |
| 318 | inline void fl_raise_form(Fl_Window* f) {f->show();} |
| 319 | |
| 320 | inline void fl_hide_form(Fl_Window* f) {f->hide();} |
| 321 | inline void fl_pop_form(Fl_Window* f) {f->show();} |
| 322 | |
| 323 | extern FL_EXPORT char fl_modal_next; // in forms.C |
| 324 | inline void fl_activate_all_forms() {} |
| 325 | inline void fl_deactivate_all_forms() {fl_modal_next = 1;} |
| 326 | inline void fl_deactivate_form(Fl_Window*w) {w->deactivate();} |
| 327 | inline void fl_activate_form(Fl_Window*w) {w->activate();} |
| 328 | |
| 329 | inline void fl_set_form_title(Fl_Window* f, const char* s) {f->label(s);} |
| 330 | inline void fl_title_form(Fl_Window* f, const char* s) {f->label(s);} |
| 331 | |
| 332 | typedef void (*Forms_FormCB)(Fl_Widget*); |
| 333 | inline void fl_set_form_callback(Fl_Window* f,Forms_FormCB c) {f->callback(c);} |
| 334 | #define fl_set_form_call_back fl_set_form_callback |
| 335 | |
| 336 | inline void fl_init() {} |
| 337 | FL_EXPORT void fl_set_graphics_mode(int,int); |
| 338 | |
| 339 | inline int fl_form_is_visible(Fl_Window* f) {return f->visible();} |
| 340 | |
| 341 | inline int fl_mouse_button() {return Fl::event_button();} |
| 342 | #define fl_mousebutton fl_mouse_button |
| 343 | |
| 344 | #define fl_free free |
| 345 | #define fl_malloc malloc |
| 346 | #define fl_calloc calloc |
| 347 | #define fl_realloc realloc |
| 348 | |
| 349 | //////////////////////////////////////////////////////////////// |
| 350 | // Drawing functions. Only usable inside an Fl_Free object? |
| 351 | |
| 352 | inline void fl_drw_box(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) { |
| 353 | fl_draw_box(b,x,y,w,h,bgc);} |
| 354 | inline void fl_drw_frame(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) { |
| 355 | fl_draw_box(b,x,y,w,h,bgc);} |
| 356 | |
| 357 | inline void fl_drw_text(Fl_Align align, int x, int y, int w, int h, |
| 358 | Fl_Color fgcolor, int size, Fl_Font style, |
| 359 | const char* s) { |
| 360 | fl_font(style,size); |
| 361 | fl_color(fgcolor); |
| 362 | fl_draw(s,x,y,w,h,align); |
| 363 | } |
| 364 | |
| 365 | // this does not work except for CENTER... |
| 366 | inline void fl_drw_text_beside(Fl_Align align, int x, int y, int w, int h, |
| 367 | Fl_Color fgcolor, int size, Fl_Font style, |
| 368 | const char* s) { |
| 369 | fl_font(style,size); |
| 370 | fl_color(fgcolor); |
| 371 | fl_draw(s,x,y,w,h,align); |
| 372 | } |
| 373 | |
| 374 | inline void fl_set_font_name(Fl_Font n,const char* s) {Fl::set_font(n,s);} |
| 375 | |
| 376 | inline void fl_mapcolor(Fl_Color c, uchar r, uchar g, uchar b) {Fl::set_color(c,r,g,b);} |
| 377 | |
| 378 | #define fl_set_clipping(x,y,w,h) fl_push_clip(x,y,w,h) |
| 379 | #define fl_unset_clipping() fl_pop_clip() |
| 380 | |
| 381 | //////////////////////////////////////////////////////////////// |
| 382 | // Forms classes: |
| 383 | |
| 384 | inline Fl_Widget* fl_add_new(Fl_Widget* p) {return p;} |
| 385 | inline Fl_Widget* fl_add_new(uchar t,Fl_Widget* p) {p->type(t); return p;} |
| 386 | |
| 387 | #define forms_constructor(type,name) \ |
| 388 | inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \ |
| 389 | return (type*)(fl_add_new(t, new type(x,y,w,h,l)));} |
| 390 | #define forms_constructort(type,name) \ |
| 391 | inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \ |
| 392 | return (type*)(fl_add_new(new type(t,x,y,w,h,l)));} |
| 393 | #define forms_constructorb(type,name) \ |
| 394 | inline type* name(Fl_Boxtype t,int x,int y,int w,int h,const char* l) { \ |
| 395 | return (type*)(fl_add_new(new type(t,x,y,w,h,l)));} |
| 396 | |
| 397 | #include "Fl_FormsBitmap.H" |
| 398 | #define FL_NORMAL_BITMAP FL_NO_BOX |
| 399 | forms_constructorb(Fl_FormsBitmap, fl_add_bitmap) |
| 400 | inline void fl_set_bitmap_data(Fl_Widget* o, int w, int h, const uchar* b) { |
| 401 | ((Fl_FormsBitmap*)o)->set(w,h,b); |
| 402 | } |
| 403 | |
| 404 | #include "Fl_FormsPixmap.H" |
| 405 | #define FL_NORMAL_PIXMAP FL_NO_BOX |
| 406 | forms_constructorb(Fl_FormsPixmap, fl_add_pixmap) |
| 407 | inline void fl_set_pixmap_data(Fl_Widget* o, char*const* b) { |
| 408 | ((Fl_FormsPixmap*)o)->set(b); |
| 409 | } |
| 410 | //inline void fl_set_pixmap_file(Fl_Widget*, const char*); |
| 411 | inline void fl_set_pixmap_align(Fl_Widget* o,Fl_Align a,int,int) {o->align(a);} |
| 412 | //inline void fl_set_pixmap_colorcloseness(int, int, int); |
| 413 | |
| 414 | #include "Fl_Box.H" |
| 415 | forms_constructorb(Fl_Box, fl_add_box) |
| 416 | |
| 417 | #include "Fl_Browser.H" |
| 418 | forms_constructor(Fl_Browser, fl_add_browser) |
| 419 | |
| 420 | inline void fl_clear_browser(Fl_Widget* o) { |
| 421 | ((Fl_Browser*)o)->clear();} |
| 422 | inline void fl_add_browser_line(Fl_Widget* o, const char* s) { |
| 423 | ((Fl_Browser*)o)->add(s);} |
| 424 | inline void fl_addto_browser(Fl_Widget* o, const char* s) { |
| 425 | ((Fl_Browser*)o)->add(s);} /* should also scroll to bottom */ |
| 426 | //inline void fl_addto_browser_chars(Fl_Widget*, const char*) |
| 427 | //#define fl_append_browser fl_addto_browser_chars |
| 428 | inline void fl_insert_browser_line(Fl_Widget* o, int n, const char* s) { |
| 429 | ((Fl_Browser*)o)->insert(n,s);} |
| 430 | inline void fl_delete_browser_line(Fl_Widget* o, int n) { |
| 431 | ((Fl_Browser*)o)->remove(n);} |
| 432 | inline void fl_replace_browser_line(Fl_Widget* o, int n, const char* s) { |
| 433 | ((Fl_Browser*)o)->replace(n,s);} |
| 434 | inline char* fl_get_browser_line(Fl_Widget* o, int n) { |
| 435 | return (char*)(((Fl_Browser*)o)->text(n));} |
| 436 | inline int fl_load_browser(Fl_Widget* o, const char* f) { |
| 437 | return ((Fl_Browser*)o)->load(f);} |
| 438 | inline void fl_select_browser_line(Fl_Widget* o, int n) { |
| 439 | ((Fl_Browser*)o)->select(n,1);} |
| 440 | inline void fl_deselect_browser_line(Fl_Widget* o, int n) { |
| 441 | ((Fl_Browser*)o)->select(n,0);} |
| 442 | inline void fl_deselect_browser(Fl_Widget* o) { |
| 443 | ((Fl_Browser*)o)->deselect();} |
| 444 | inline int fl_isselected_browser_line(Fl_Widget* o, int n) { |
| 445 | return ((Fl_Browser*)o)->selected(n);} |
| 446 | inline int fl_get_browser_topline(Fl_Widget* o) { |
| 447 | return ((Fl_Browser*)o)->topline();} |
| 448 | inline int fl_get_browser(Fl_Widget* o) { |
| 449 | return ((Fl_Browser*)o)->value();} |
| 450 | inline int fl_get_browser_maxline(Fl_Widget* o) { |
| 451 | return ((Fl_Browser*)o)->size();} |
| 452 | //linline int fl_get_browser_screenlines(Fl_Widget*); |
| 453 | inline void fl_set_browser_topline(Fl_Widget* o, int n) { |
| 454 | ((Fl_Browser*)o)->topline(n);} |
| 455 | inline void fl_set_browser_fontsize(Fl_Widget* o, int s) { |
| 456 | ((Fl_Browser*)o)->textsize(s);} |
| 457 | inline void fl_set_browser_fontstyle(Fl_Widget* o, Fl_Font s) { |
| 458 | ((Fl_Browser*)o)->textfont(s);} |
| 459 | inline void fl_set_browser_specialkey(Fl_Widget* o, char c) { |
| 460 | ((Fl_Browser*)o)->format_char(c);} |
| 461 | //inline void fl_set_browser_vscrollbar(Fl_Widget*, int); |
| 462 | //inline void fl_set_browser_hscrollbar(Fl_Widget*, int); |
| 463 | //inline void fl_set_browser_leftslider(Fl_Widget*, int); |
| 464 | //#define fl_set_browser_leftscrollbar fl_set_browser_leftslider |
| 465 | //inline void fl_set_browser_line_selectable(Fl_Widget*, int, int); |
| 466 | //inline void fl_get_browser_dimension(Fl_Widget*,int*,int*,int*,int*); |
| 467 | //inline void fl_set_browser_dblclick_callback(Fl_Widget*,FL_CALLBACKPTR,long); |
| 468 | //inline void fl_set_browser_xoffset(Fl_Widget*, FL_Coord); |
| 469 | //inline void fl_set_browser_scrollbarsize(Fl_Widget*, int, int); |
| 470 | inline void fl_setdisplayed_browser_line(Fl_Widget* o, int n, int i) { |
| 471 | ((Fl_Browser*)o)->display(n,i);} |
| 472 | inline int fl_isdisplayed_browser_line(Fl_Widget* o, int n) { |
| 473 | return ((Fl_Browser*)o)->displayed(n);} |
| 474 | |
| 475 | #include "Fl_Button.H" |
| 476 | |
| 477 | #define FL_NORMAL_BUTTON 0 |
| 478 | #define FL_TOUCH_BUTTON 4 |
| 479 | #define FL_INOUT_BUTTON 5 |
| 480 | #define FL_RETURN_BUTTON 6 |
| 481 | #define FL_HIDDEN_RET_BUTTON 7 |
| 482 | #define FL_PUSH_BUTTON FL_TOGGLE_BUTTON |
| 483 | #define FL_MENU_BUTTON 9 |
| 484 | |
| 485 | FL_EXPORT Fl_Button* fl_add_button(uchar t,int x,int y,int w,int h,const char* l); |
| 486 | inline int fl_get_button(Fl_Widget* b) {return ((Fl_Button*)b)->value();} |
| 487 | inline void fl_set_button(Fl_Widget* b, int v) {((Fl_Button*)b)->value(v);} |
| 488 | inline int fl_get_button_numb(Fl_Widget*) {return Fl::event_button();} |
| 489 | inline void fl_set_button_shortcut(Fl_Widget* b, const char* s,int=0) { |
| 490 | ((Fl_Button*)b)->shortcut(s);} |
| 491 | //#define fl_set_object_shortcut(b,s) fl_set_button_shortcut(b,s) |
| 492 | |
| 493 | #include "Fl_Light_Button.H" |
| 494 | forms_constructor(Fl_Light_Button, fl_add_lightbutton) |
| 495 | |
| 496 | #include "Fl_Round_Button.H" |
| 497 | forms_constructor(Fl_Round_Button, fl_add_roundbutton) |
| 498 | forms_constructor(Fl_Round_Button, fl_add_round3dbutton) |
| 499 | |
| 500 | #include "Fl_Check_Button.H" |
| 501 | forms_constructor(Fl_Check_Button, fl_add_checkbutton) |
| 502 | |
| 503 | inline Fl_Widget* fl_add_bitmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;} |
| 504 | inline void fl_set_bitmapbutton_data(Fl_Widget* o,int a,int b,uchar* c) { |
| 505 | (new Fl_Bitmap(c,a,b))->label(o);} // does not delete old Fl_Bitmap! |
| 506 | |
| 507 | inline Fl_Widget* fl_add_pixmapbutton(int t,int x,int y,int w,int h,const char* l) {Fl_Widget* o = fl_add_button(t,x,y,w,h,l); return o;} |
| 508 | inline void fl_set_pixmapbutton_data(Fl_Widget* o, const char*const* c) { |
| 509 | (new Fl_Pixmap(c))->label(o);} // does not delete old Fl_Pixmap! |
| 510 | |
| 511 | // Fl_Canvas object not yet implemented! |
| 512 | |
| 513 | #include "Fl_Chart.H" |
| 514 | |
| 515 | forms_constructor(Fl_Chart, fl_add_chart) |
| 516 | inline void fl_clear_chart(Fl_Widget* o) { |
| 517 | ((Fl_Chart*)o)->clear();} |
| 518 | inline void fl_add_chart_value(Fl_Widget* o,double v,const char* s,uchar c){ |
| 519 | ((Fl_Chart*)o)->add(v,s,c);} |
| 520 | inline void fl_insert_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) { |
| 521 | ((Fl_Chart*)o)->insert(i,v,s,c);} |
| 522 | inline void fl_replace_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) { |
| 523 | ((Fl_Chart*)o)->replace(i,v,s,c);} |
| 524 | inline void fl_set_chart_bounds(Fl_Widget* o, double a, double b) { |
| 525 | ((Fl_Chart*)o)->bounds(a,b);} |
| 526 | inline void fl_set_chart_maxnumb(Fl_Widget* o, int v) { |
| 527 | ((Fl_Chart*)o)->maxsize(v);} |
| 528 | inline void fl_set_chart_autosize(Fl_Widget* o, int v) { |
| 529 | ((Fl_Chart*)o)->autosize(v);} |
| 530 | inline void fl_set_chart_lstyle(Fl_Widget* o, Fl_Font v) { |
| 531 | ((Fl_Chart*)o)->textfont(v);} |
| 532 | inline void fl_set_chart_lsize(Fl_Widget* o, int v) { |
| 533 | ((Fl_Chart*)o)->textsize(v);} |
| 534 | inline void fl_set_chart_lcolor(Fl_Widget* o, Fl_Color v) { |
| 535 | ((Fl_Chart*)o)->textcolor(v);} |
| 536 | #define fl_set_chart_lcol fl_set_chart_lcolor |
| 537 | |
| 538 | #include "Fl_Choice.H" |
| 539 | |
| 540 | #define FL_NORMAL_CHOICE 0 |
| 541 | #define FL_NORMAL_CHOICE2 0 |
| 542 | #define FL_DROPLIST_CHOICE 0 |
| 543 | |
| 544 | forms_constructor(Fl_Choice, fl_add_choice) |
| 545 | inline void fl_clear_choice(Fl_Widget* o) { |
| 546 | ((Fl_Choice*)o)->clear();} |
| 547 | inline void fl_addto_choice(Fl_Widget* o, const char* s) { |
| 548 | ((Fl_Choice*)o)->add(s);} |
| 549 | inline void fl_replace_choice(Fl_Widget* o, int i, const char* s) { |
| 550 | ((Fl_Choice*)o)->replace(i-1,s);} |
| 551 | inline void fl_delete_choice(Fl_Widget* o, int i) { |
| 552 | ((Fl_Choice*)o)->remove(i-1);} |
| 553 | inline void fl_set_choice(Fl_Widget* o, int i) { |
| 554 | ((Fl_Choice*)o)->value(i-1);} |
| 555 | // inline void fl_set_choice_text(Fl_Widget*, const char*); |
| 556 | inline int fl_get_choice(Fl_Widget* o) { |
| 557 | return ((Fl_Choice*)o)->value()+1;} |
| 558 | // inline const char* fl_get_choice_item_text(Fl_Widget*, int); |
| 559 | // inline int fl_get_choice_maxitems(Fl_Widget*); |
| 560 | inline const char* fl_get_choice_text(Fl_Widget* o) { |
| 561 | return ((Fl_Choice*)o)->text();} |
| 562 | inline void fl_set_choice_fontsize(Fl_Widget* o, int x) { |
| 563 | ((Fl_Choice*)o)->textsize(x);} |
| 564 | inline void fl_set_choice_fontstyle(Fl_Widget* o, Fl_Font x) { |
| 565 | ((Fl_Choice*)o)->textfont(x);} |
| 566 | // inline void fl_set_choice_item_mode(Fl_Widget*, int, unsigned); |
| 567 | // inline void fl_set_choice_item_shortcut(Fl_Widget*, int, const char*); |
| 568 | |
| 569 | #include "Fl_Clock.H" |
| 570 | forms_constructort(Fl_Clock, fl_add_clock) |
| 571 | inline void fl_get_clock(Fl_Widget* o, int* h, int* m, int* s) { |
| 572 | *h = ((Fl_Clock*)o)->hour(); |
| 573 | *m = ((Fl_Clock*)o)->minute(); |
| 574 | *s = ((Fl_Clock*)o)->second(); |
| 575 | } |
| 576 | |
| 577 | #include "Fl_Counter.H" |
| 578 | forms_constructor(Fl_Counter, fl_add_counter) |
| 579 | inline void fl_set_counter_value(Fl_Widget* o, double v) { |
| 580 | ((Fl_Counter*)o)->value(v);} |
| 581 | inline void fl_set_counter_bounds(Fl_Widget* o, double a, double b) { |
| 582 | ((Fl_Counter*)o)->bounds(a,b);} |
| 583 | inline void fl_set_counter_step(Fl_Widget* o, double a, double b) { |
| 584 | ((Fl_Counter*)o)->step(a,b);} |
| 585 | inline void fl_set_counter_precision(Fl_Widget* o, int v) { |
| 586 | ((Fl_Counter*)o)->precision(v);} |
| 587 | inline void fl_set_counter_return(Fl_Widget* o, int v) { |
| 588 | ((Fl_Counter*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));} |
| 589 | inline double fl_get_counter_value(Fl_Widget* o) { |
| 590 | return ((Fl_Counter*)o)->value();} |
| 591 | inline void fl_get_counter_bounds(Fl_Widget* o, float* a, float* b) { |
| 592 | *a = float(((Fl_Counter*)o)->minimum()); |
| 593 | *b = float(((Fl_Counter*)o)->maximum()); |
| 594 | } |
| 595 | //inline void fl_set_counter_filter(Fl_Widget*,const char* (*)(Fl_Widget*,double,int)); |
| 596 | |
| 597 | // Cursor stuff cannot be emulated because it uses X stuff |
| 598 | inline void fl_set_cursor(Fl_Window* w, Fl_Cursor c) {w->cursor(c);} |
| 599 | #define FL_INVISIBLE_CURSOR FL_CURSOR_NONE |
| 600 | #define FL_DEFAULT_CURSOR FL_CURSOR_DEFAULT |
| 601 | |
| 602 | #include "Fl_Dial.H" |
| 603 | |
| 604 | #define FL_DIAL_COL1 FL_GRAY |
| 605 | #define FL_DIAL_COL2 37 |
| 606 | |
| 607 | forms_constructor(Fl_Dial, fl_add_dial) |
| 608 | inline void fl_set_dial_value(Fl_Widget* o, double v) { |
| 609 | ((Fl_Dial*)o)->value(v);} |
| 610 | inline double fl_get_dial_value(Fl_Widget* o) { |
| 611 | return ((Fl_Dial*)o)->value();} |
| 612 | inline void fl_set_dial_bounds(Fl_Widget* o, double a, double b) { |
| 613 | ((Fl_Dial*)o)->bounds(a, b);} |
| 614 | inline void fl_get_dial_bounds(Fl_Widget* o, float* a, float* b) { |
| 615 | *a = float(((Fl_Dial*)o)->minimum()); |
| 616 | *b = float(((Fl_Dial*)o)->maximum()); |
| 617 | } |
| 618 | inline void fl_set_dial_return(Fl_Widget* o, int i) { |
| 619 | ((Fl_Dial*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));} |
| 620 | inline void fl_set_dial_angles(Fl_Widget* o, int a, int b) { |
| 621 | ((Fl_Dial*)o)->angles((short)a, (short)b);} |
| 622 | //inline void fl_set_dial_cross(Fl_Widget* o, int); |
| 623 | // inline void fl_set_dial_direction(Fl_Widget* o, uchar d) { |
| 624 | // ((Fl_Dial*)o)->direction(d);} |
| 625 | inline void fl_set_dial_step(Fl_Widget* o, double v) { |
| 626 | ((Fl_Dial*)o)->step(v);} |
| 627 | |
| 628 | // Frames: |
| 629 | |
| 630 | inline Fl_Widget* fl_add_frame(Fl_Boxtype i,int x,int y,int w,int h,const char* l) { |
| 631 | return fl_add_box(i,x-3,y-3,w+6,h+6,l);} |
| 632 | |
| 633 | // labelframe nyi |
| 634 | inline Fl_Widget* fl_add_labelframe(Fl_Boxtype i,int x,int y,int w,int h,const char* l) { |
| 635 | Fl_Widget* o = fl_add_box(i,x-3,y-3,w+6,h+6,l); |
| 636 | o->align(FL_ALIGN_TOP_LEFT); |
| 637 | return o; |
| 638 | } |
| 639 | |
| 640 | #include "Fl_Free.H" |
| 641 | inline Fl_Free* |
| 642 | fl_add_free(int t,double x,double y,double w,double h,const char* l, |
| 643 | FL_HANDLEPTR hdl) { |
| 644 | return (Fl_Free*)(fl_add_new( |
| 645 | new Fl_Free(t,int(x),int(y),int(w),int(h),l,hdl))); |
| 646 | } |
| 647 | |
| 648 | #include "fl_ask.H" |
| 649 | #include "fl_show_colormap.H" |
| 650 | |
| 651 | inline int fl_show_question(const char* c, int = 0) {return fl_choice("%s",fl_no,fl_yes,0L,c);} |
| 652 | FL_EXPORT void fl_show_message(const char *,const char *,const char *); |
| 653 | FL_EXPORT void fl_show_alert(const char *,const char *,const char *,int=0); |
| 654 | FL_EXPORT int fl_show_question(const char *,const char *,const char *); |
| 655 | inline const char *fl_show_input(const char *l,const char*d=0) {return fl_input("%s",d,l);} |
| 656 | FL_EXPORT /*const*/ char *fl_show_simple_input(const char *label, const char *deflt = 0); |
| 657 | FL_EXPORT int fl_show_choice( |
| 658 | const char *m1, |
| 659 | const char *m2, |
| 660 | const char *m3, |
| 661 | int numb, |
| 662 | const char *b0, |
| 663 | const char *b1, |
| 664 | const char *b2); |
| 665 | |
| 666 | inline void fl_set_goodies_font(Fl_Font a, Fl_Fontsize b) {fl_message_font(a,b);} |
| 667 | #define fl_show_messages fl_message |
| 668 | inline int fl_show_choices(const char* c,int n,const char* b1,const char* b2, |
| 669 | const char* b3, int) { |
| 670 | return fl_show_choice(0,c,0,n,b1,b2,b3); |
| 671 | } |
| 672 | |
| 673 | #include "filename.H" |
| 674 | #include "Fl_File_Chooser.H" |
| 675 | inline int do_matching(char* a, const char* b) {return fl_filename_match(a,b);} |
| 676 | |
| 677 | // Forms-compatible file chooser (implementation in fselect.C): |
| 678 | FL_EXPORT char* fl_show_file_selector(const char* message,const char* dir, |
| 679 | const char* pat,const char* fname); |
| 680 | FL_EXPORT char* fl_get_directory(); |
| 681 | FL_EXPORT char* fl_get_pattern(); |
| 682 | FL_EXPORT char* fl_get_filename(); |
| 683 | |
| 684 | #include "Fl_Input.H" |
| 685 | forms_constructor(Fl_Input, fl_add_input) |
| 686 | inline void fl_set_input(Fl_Widget* o, const char* v) { |
| 687 | ((Fl_Input*)o)->value(v);} |
| 688 | inline void fl_set_input_return(Fl_Widget* o, int x) { |
| 689 | ((Fl_Input*)o)->when((Fl_When)(x | FL_WHEN_RELEASE));} |
| 690 | inline void fl_set_input_color(Fl_Widget* o, Fl_Color a, Fl_Color b) { |
| 691 | ((Fl_Input*)o)->textcolor(a); |
| 692 | ((Fl_Input*)o)->cursor_color(b); |
| 693 | } |
| 694 | // inline void fl_set_input_scroll(Fl_Widget*, int); |
| 695 | inline void fl_set_input_cursorpos(Fl_Widget* o, int x, int /*y*/) { |
| 696 | ((Fl_Input*)o)->position(x);} |
| 697 | // inline void fl_set_input_selected(Fl_Widget*, int); |
| 698 | // inline void fl_set_input_selected_range(Fl_Widget*, int, int); |
| 699 | // inline void fl_set_input_maxchars(Fl_Widget*, int); |
| 700 | // inline void fl_set_input_format(Fl_Widget*, int, int); |
| 701 | // inline void fl_set_input_hscrollbar(Fl_Widget*, int); |
| 702 | // inline void fl_set_input_vscrollbar(Fl_Widget*, int); |
| 703 | // inline void fl_set_input_xoffset(Fl_Widget*, int); |
| 704 | // inline void fl_set_input_topline(Fl_Widget*, int); |
| 705 | // inline void fl_set_input_scrollbarsize(Fl_Widget*, int, int); |
| 706 | // inline int fl_get_input_topline(Fl_Widget*); |
| 707 | // inline int fl_get_input_screenlines(Fl_Widget*); |
| 708 | inline int fl_get_input_cursorpos(Fl_Widget* o, int*x, int*y) { |
| 709 | *x = ((Fl_Input*)o)->position(); *y = 0; return *x;} |
| 710 | // inline int fl_get_input_numberoflines(Fl_Widget*); |
| 711 | // inline void fl_get_input_format(Fl_Widget*, int*, int*); |
| 712 | inline const char* fl_get_input(Fl_Widget* o) {return ((Fl_Input*)o)->value();} |
| 713 | |
| 714 | #include "Fl_Menu_Button.H" |
| 715 | |
| 716 | // types are not implemented, they all act like FL_PUSH_MENU: |
| 717 | #define FL_TOUCH_MENU 0 |
| 718 | #define FL_PUSH_MENU 1 |
| 719 | #define FL_PULLDOWN_MENU 2 |
| 720 | forms_constructor(Fl_Menu_Button, fl_add_menu) |
| 721 | |
| 722 | inline void fl_clear_menu(Fl_Widget* o) { |
| 723 | ((Fl_Menu_Button*)o)->clear();} |
| 724 | inline void fl_set_menu(Fl_Widget* o, const char* s) { |
| 725 | ((Fl_Menu_Button*)o)->clear(); ((Fl_Menu_Button*)o)->add(s);} |
| 726 | inline void fl_addto_menu(Fl_Widget* o, const char* s) { |
| 727 | ((Fl_Menu_Button*)o)->add(s);} |
| 728 | inline void fl_replace_menu_item(Fl_Widget* o, int i, const char* s) { |
| 729 | ((Fl_Menu_Button*)o)->replace(i-1,s);} |
| 730 | inline void fl_delete_menu_item(Fl_Widget* o, int i) { |
| 731 | ((Fl_Menu_Button*)o)->remove(i-1);} |
| 732 | inline void fl_set_menu_item_shortcut(Fl_Widget* o, int i, const char* s) { |
| 733 | ((Fl_Menu_Button*)o)->shortcut(i-1,fl_old_shortcut(s));} |
| 734 | inline void fl_set_menu_item_mode(Fl_Widget* o, int i, long x) { |
| 735 | ((Fl_Menu_Button*)o)->mode(i-1,x);} |
| 736 | inline void fl_show_menu_symbol(Fl_Widget*, int ) { |
| 737 | /* ((Fl_Menu_Button*)o)->show_menu_symbol(i); */} |
| 738 | // inline void fl_set_menu_popup(Fl_Widget*, int); |
| 739 | inline int fl_get_menu(Fl_Widget* o) { |
| 740 | return ((Fl_Menu_Button*)o)->value()+1;} |
| 741 | inline const char* fl_get_menu_item_text(Fl_Widget* o, int i) { |
| 742 | return ((Fl_Menu_Button*)o)->text(i);} |
| 743 | inline int fl_get_menu_maxitems(Fl_Widget* o) { |
| 744 | return ((Fl_Menu_Button*)o)->size();} |
| 745 | inline int fl_get_menu_item_mode(Fl_Widget* o, int i) { |
| 746 | return ((Fl_Menu_Button*)o)->mode(i);} |
| 747 | inline const char* fl_get_menu_text(Fl_Widget* o) { |
| 748 | return ((Fl_Menu_Button*)o)->text();} |
| 749 | |
| 750 | #include "Fl_Positioner.H" |
| 751 | #define FL_NORMAL_POSITIONER 0 |
| 752 | forms_constructor(Fl_Positioner, fl_add_positioner) |
| 753 | inline void fl_set_positioner_xvalue(Fl_Widget* o, double v) { |
| 754 | ((Fl_Positioner*)o)->xvalue(v);} |
| 755 | inline double fl_get_positioner_xvalue(Fl_Widget* o) { |
| 756 | return ((Fl_Positioner*)o)->xvalue();} |
| 757 | inline void fl_set_positioner_xbounds(Fl_Widget* o, double a, double b) { |
| 758 | ((Fl_Positioner*)o)->xbounds(a,b);} |
| 759 | inline void fl_get_positioner_xbounds(Fl_Widget* o, float* a, float* b) { |
| 760 | *a = float(((Fl_Positioner*)o)->xminimum()); |
| 761 | *b = float(((Fl_Positioner*)o)->xmaximum()); |
| 762 | } |
| 763 | inline void fl_set_positioner_yvalue(Fl_Widget* o, double v) { |
| 764 | ((Fl_Positioner*)o)->yvalue(v);} |
| 765 | inline double fl_get_positioner_yvalue(Fl_Widget* o) { |
| 766 | return ((Fl_Positioner*)o)->yvalue();} |
| 767 | inline void fl_set_positioner_ybounds(Fl_Widget* o, double a, double b) { |
| 768 | ((Fl_Positioner*)o)->ybounds(a,b);} |
| 769 | inline void fl_get_positioner_ybounds(Fl_Widget* o, float* a, float* b) { |
| 770 | *a = float(((Fl_Positioner*)o)->yminimum()); |
| 771 | *b = float(((Fl_Positioner*)o)->ymaximum()); |
| 772 | } |
| 773 | inline void fl_set_positioner_xstep(Fl_Widget* o, double v) { |
| 774 | ((Fl_Positioner*)o)->xstep(v);} |
| 775 | inline void fl_set_positioner_ystep(Fl_Widget* o, double v) { |
| 776 | ((Fl_Positioner*)o)->ystep(v);} |
| 777 | inline void fl_set_positioner_return(Fl_Widget* o, int v) { |
| 778 | ((Fl_Positioner*)o)->when((Fl_When)(v|FL_WHEN_RELEASE));} |
| 779 | |
| 780 | #include "Fl_Slider.H" |
| 781 | |
| 782 | #define FL_HOR_BROWSER_SLIDER FL_HOR_SLIDER |
| 783 | #define FL_VERT_BROWSER_SLIDER FL_VERT_SLIDER |
| 784 | |
| 785 | forms_constructort(Fl_Slider, fl_add_slider) |
| 786 | #define FL_SLIDER_COL1 FL_GRAY |
| 787 | inline void fl_set_slider_value(Fl_Widget* o, double v) { |
| 788 | ((Fl_Slider*)o)->value(v);} |
| 789 | inline double fl_get_slider_value(Fl_Widget* o) { |
| 790 | return ((Fl_Slider*)o)->value();} |
| 791 | inline void fl_set_slider_bounds(Fl_Widget* o, double a, double b) { |
| 792 | ((Fl_Slider*)o)->bounds(a, b);} |
| 793 | inline void fl_get_slider_bounds(Fl_Widget* o, float* a, float* b) { |
| 794 | *a = float(((Fl_Slider*)o)->minimum()); |
| 795 | *b = float(((Fl_Slider*)o)->maximum()); |
| 796 | } |
| 797 | inline void fl_set_slider_return(Fl_Widget* o, int i) { |
| 798 | ((Fl_Slider*)o)->when((Fl_When)(i|FL_WHEN_RELEASE));} |
| 799 | inline void fl_set_slider_step(Fl_Widget* o, double v) { |
| 800 | ((Fl_Slider*)o)->step(v);} |
| 801 | // inline void fl_set_slider_increment(Fl_Widget* o, double v, double); |
| 802 | inline void fl_set_slider_size(Fl_Widget* o, double v) { |
| 803 | ((Fl_Slider*)o)->slider_size(v);} |
| 804 | |
| 805 | #include "Fl_Value_Slider.H" |
| 806 | forms_constructor(Fl_Value_Slider, fl_add_valslider) |
| 807 | |
| 808 | inline void fl_set_slider_precision(Fl_Widget* o, int i) { |
| 809 | ((Fl_Value_Slider*)o)->precision(i);} |
| 810 | // filter function! |
| 811 | |
| 812 | // The forms text object was the same as an Fl_Box except it inverted the |
| 813 | // meaning of FL_ALIGN_INSIDE. Implementation in forms.cxx |
| 814 | class FL_EXPORT Fl_FormsText : public Fl_Widget { |
| 815 | protected: |
| 816 | void draw(); |
| 817 | public: |
| 818 | Fl_FormsText(Fl_Boxtype b, int X, int Y, int W, int H, const char* l=0) |
| 819 | : Fl_Widget(X,Y,W,H,l) {box(b); align(FL_ALIGN_LEFT);} |
| 820 | }; |
| 821 | #define FL_NORMAL_TEXT FL_NO_BOX |
| 822 | forms_constructorb(Fl_FormsText, fl_add_text) |
| 823 | |
| 824 | #include "Fl_Timer.H" |
| 825 | forms_constructort(Fl_Timer, fl_add_timer) |
| 826 | inline void fl_set_timer(Fl_Widget* o, double v) {((Fl_Timer*)o)->value(v);} |
| 827 | inline double fl_get_timer(Fl_Widget* o) {return ((Fl_Timer*)o)->value();} |
| 828 | inline void fl_suspend_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(1);} |
| 829 | inline void fl_resume_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(0);} |
| 830 | inline void fl_set_timer_countup(Fl_Widget* o,char d) {((Fl_Timer*)o)->direction(d);} |
| 831 | void fl_gettime(long* sec, long* usec); |
| 832 | |
| 833 | // Fl_XYPlot nyi |
| 834 | |
| 835 | |
| 836 | // stuff from DDForms: |
| 837 | |
| 838 | inline int fl_double_click() {return Fl::event_clicks();} |
| 839 | inline void fl_draw() {Fl::flush();} |
| 840 | |
| 841 | #endif /* define __FORMS_H__ */ |
| 842 | |
| 843 | // |
| 844 | // End of "$Id: forms.H 8623 2011-04-24 17:09:41Z AlbrechtS $". |
| 845 | // |