diff options
Diffstat (limited to 'fltk/fltk/compat')
62 files changed, 2507 insertions, 0 deletions
diff --git a/fltk/fltk/compat/FL/Enumerations.H b/fltk/fltk/compat/FL/Enumerations.H new file mode 100644 index 0000000..418cf8e --- /dev/null +++ b/fltk/fltk/compat/FL/Enumerations.H @@ -0,0 +1,357 @@ +// +// "$Id: Enumerations.H 5389 2006-09-01 15:39:19Z spitzak $" +// +// Enumerations for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2006 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// + +#ifndef Fl_Enumerations_H +#define Fl_Enumerations_H + +# include <fltk/FL_API.h> +# include <fltk/FL_VERSION.h> + +enum Fl_Event { // these should match fltk/events.h + FL_NO_EVENT = 0, + FL_PUSH = 1, + FL_RELEASE = 2, + FL_ENTER = 3, + FL_LEAVE = 4, + FL_DRAG = 5, + FL_FOCUS = 6, + FL_UNFOCUS = 7, + FL_KEYDOWN = 8, + FL_KEYBOARD = FL_KEYDOWN, + FL_KEYUP = 9, + //FL_CLOSE = 10, // not in fltk2.0 + FL_MOVE = 11, + FL_SHORTCUT = 12, + FL_DEACTIVATE = 13, + FL_ACTIVATE = 14, + FL_HIDE = 15, + FL_SHOW = 16, + FL_PASTE = 17, + //FL_SELECTIONCLEAR = 18, // not in fltk2.0 + FL_MOUSEWHEEL = 19, + FL_DND_ENTER = 20, + FL_DND_DRAG = 21, + FL_DND_LEAVE = 22, + FL_DND_RELEASE = 23 +}; + +enum Fl_When { // These should match values in fltk/Widget.h + FL_WHEN_NEVER = 0, + FL_WHEN_CHANGED = 1, + FL_WHEN_RELEASE = 4, + FL_WHEN_RELEASE_ALWAYS= 6, + FL_WHEN_ENTER_KEY = 8, + FL_WHEN_ENTER_KEY_ALWAYS=10, + FL_WHEN_ENTER_KEY_CHANGED=11, + FL_WHEN_NOT_CHANGED = 2 // modifier bit to disable changed() test +}; + +// These should match symbols in fltk/events.h: +#define FL_Button 0 // old value was 0xfee8 +#define FL_LEFT_MOUSE 1 +#define FL_MIDDLE_MOUSE 2 +#define FL_RIGHT_MOUSE 3 +#define FL_BackSpace 0xff08 +#define FL_Tab 0xff09 +#define FL_Enter 0xff0d +#define FL_Pause 0xff13 +#define FL_Scroll_Lock 0xff14 +#define FL_Escape 0xff1b +#define FL_Home 0xff50 +#define FL_Left 0xff51 +#define FL_Up 0xff52 +#define FL_Right 0xff53 +#define FL_Down 0xff54 +#define FL_Page_Up 0xff55 +#define FL_Page_Down 0xff56 +#define FL_End 0xff57 +#define FL_Print 0xff61 +#define FL_Insert 0xff63 +#define FL_Menu 0xff67 // the "menu/apps" key on XFree86 +#define FL_Help 0xff68 // the 'help' key on Mac keyboards +#define FL_Num_Lock 0xff7f +#define FL_KP 0xff80 // use FL_KP+'x' for 'x' on numeric keypad +#define FL_KP_Enter 0xff8d // same as Fl_KP+'\r' +#define FL_KP_Last 0xffbd // use to range-check keypad +#define FL_F 0xffbd // use FL_F+n for function key n +#define FL_F_Last 0xffe0 // use to range-check function keys +#define FL_Shift_L 0xffe1 +#define FL_Shift_R 0xffe2 +#define FL_Control_L 0xffe3 +#define FL_Control_R 0xffe4 +#define FL_Caps_Lock 0xffe5 +#define FL_Meta_L 0xffe7 +#define FL_Meta_R 0xffe8 +#define FL_Alt_L 0xffe9 +#define FL_Alt_R 0xffea +#define FL_Delete 0xffff + +#define FL_SHIFT 0x00010000 +#define FL_CAPS_LOCK 0x00020000 +#define FL_CTRL 0x00040000 +#define FL_ALT 0x00080000 +#define FL_NUM_LOCK 0x00100000 // most X servers do this? +#define FL_META 0x00400000 +#define FL_SCROLL_LOCK 0x00800000 +#define FL_BUTTON1 0x01000000 +#define FL_BUTTON2 0x02000000 +#define FL_BUTTON3 0x04000000 +#define FL_BUTTONS 0x7f000000 // All possible buttons +#define FL_BUTTON(n) (0x00800000<<(n)) + +#ifdef __APPLE__ +# define FL_COMMAND FL_META +#else +# define FL_COMMAND FL_CTRL +#endif // __APPLE__ + +#include <fltk/Style.h> + +typedef fltk::Box* Fl_Boxtype; + +// Box types. Many of the FRAME types are deleted in fltk2.0, these have +// been replaced with the equivalent BOX which draws it's inner area: +#define FL_NO_BOX fltk::NO_BOX +#define FL_FLAT_BOX fltk::FLAT_BOX +#define FL_UP_BOX fltk::UP_BOX +#define FL_DOWN_BOX fltk::DOWN_BOX +#define FL_UP_FRAME fltk::UP_BOX // +#define FL_DOWN_FRAME fltk::DOWN_BOX // +#define FL_THIN_UP_BOX fltk::THIN_UP_BOX +#define FL_THIN_DOWN_BOX fltk::THIN_DOWN_BOX +#define FL_THIN_UP_FRAME fltk::THIN_UP_BOX // +#define FL_THIN_DOWN_FRAME fltk::THIN_DOWN_BOX // +#define FL_ENGRAVED_BOX fltk::ENGRAVED_BOX +#define FL_EMBOSSED_BOX fltk::EMBOSSED_BOX +#define FL_ENGRAVED_FRAME fltk::ENGRAVED_BOX // +#define FL_EMBOSSED_FRAME fltk::EMBOSSED_BOX // +#define FL_BORDER_BOX fltk::BORDER_BOX +#define FL_SHADOW_BOX fltk::SHADOW_BOX +#define FL_BORDER_FRAME fltk::BORDER_FRAME +#define FL_SHADOW_FRAME fltk::SHADOW_BOX // +#define FL_ROUNDED_BOX fltk::ROUNDED_BOX +#define FL_RSHADOW_BOX fltk::RSHADOW_BOX +#define FL_ROUNDED_FRAME fltk::ROUNDED_BOX // +#define FL_RFLAT_BOX fltk::RFLAT_BOX +#define FL_ROUND_UP_BOX fltk::ROUND_UP_BOX +#define FL_ROUND_DOWN_BOX fltk::ROUND_DOWN_BOX +#define FL_DIAMOND_UP_BOX fltk::DIAMOND_UP_BOX +#define FL_DIAMOND_DOWN_BOX fltk::DIAMOND_DOWN_BOX +#define FL_OVAL_BOX fltk::OVAL_BOX +#define FL_OSHADOW_BOX fltk::OSHADOW_BOX +#define FL_OVAL_FRAME fltk::OVAL_BOX // +#define FL_OFLAT_BOX fltk::OFLAT_BOX +#define FL_PLASTIC_UP_BOX fltk::PLASTIC_UP_BOX +#define FL_PLASTIC_DOWN_BOX fltk::PLASTIC_DOWN_BOX +#define FL_PLASTIC_UP_FRAME fltk::PLASTIC_UP_BOX // +#define FL_PLASTIC_DOWN_FRAME fltk::PLASTIC_DOWN_BOX // +//#define FL_FREE_BOXTYPE not used in fltk 2.0 + +// conversions of box types to other boxtypes: +//inline Fl_Boxtype fl_down(Fl_Boxtype b) // not implemented +//inline Fl_Boxtype fl_frame(Fl_Boxtype b) + +// back-compatability box types: +#define FL_FRAME FL_ENGRAVED_FRAME +#define FL_FRAME_BOX FL_ENGRAVED_BOX +#define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX +#define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX + +// labeltypes: +#define FL_NO_LABEL fltk::NO_LABEL +#define FL_NORMAL_LABEL fltk::NORMAL_LABEL +#define FL_SHADOW_LABEL fltk::SHADOW_LABEL +#define FL_ENGRAVED_LABEL fltk::ENGRAVED_LABEL +#define FL_EMBOSSED_LABEL fltk::EMBOSSED_LABEL +//#define FL_FREE_LABELTYPE not used in fltk2.0 +#define FL_SYMBOL_LABEL FL_NORMAL_LABEL + +#define Fl_Align fltk::Flags +enum { + FL_ALIGN_CENTER = 0, + FL_ALIGN_TOP = fltk::ALIGN_TOP, + FL_ALIGN_BOTTOM = fltk::ALIGN_BOTTOM, + FL_ALIGN_LEFT = fltk::ALIGN_LEFT, + FL_ALIGN_RIGHT = fltk::ALIGN_RIGHT, + FL_ALIGN_INSIDE = fltk::ALIGN_INSIDE, + FL_ALIGN_TEXT_OVER_IMAGE = fltk::ALIGN_BOTTOM|fltk::ALIGN_INSIDE, // + FL_ALIGN_IMAGE_OVER_TEXT = 0, + FL_ALIGN_CLIP = fltk::ALIGN_CLIP, + FL_ALIGN_WRAP = fltk::ALIGN_WRAP, + FL_ALIGN_MASK = fltk::ALIGN_MASK, + FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT, + FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT, + FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT, + FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT, + FL_ALIGN_LEFT_TOP = FL_ALIGN_TOP_LEFT, + FL_ALIGN_RIGHT_TOP = FL_ALIGN_TOP_RIGHT, + FL_ALIGN_LEFT_BOTTOM = FL_ALIGN_BOTTOM_LEFT, + FL_ALIGN_RIGHT_BOTTOM = FL_ALIGN_BOTTOM_RIGHT, + FL_ALIGN_NOWRAP = 0 +}; + +#define FL_HELVETICA fltk::HELVETICA +#define FL_HELVETICA_BOLD fltk::HELVETICA_BOLD +#define FL_HELVETICA_ITALIC fltk::HELVETICA_ITALIC +#define FL_HELVETICA_BOLD_ITALIC fltk::HELVETICA_BOLD_ITALIC +#define FL_COURIER fltk::COURIER +#define FL_COURIER_BOLD fltk::COURIER_BOLD +#define FL_COURIER_ITALIC fltk::COURIER_ITALIC +#define FL_COURIER_BOLD_ITALIC fltk::COURIER_BOLD_ITALIC +#define FL_TIMES fltk::TIMES +#define FL_TIMES_BOLD fltk::TIMES_BOLD +#define FL_TIMES_ITALIC fltk::TIMES_ITALIC +#define FL_TIMES_BOLD_ITALIC fltk::TIMES_BOLD_ITALIC +#define FL_SYMBOL fltk::SYMBOL_FONT +#define FL_SCREEN fltk::SCREEN_FONT +#define FL_SCREEN_BOLD fltk::SCREEN_BOLD_FONT +#define FL_ZAPF_DINGBATS fltk::ZAPF_DINGBATS +//#define FL_FREE_FONT +// These used to be added to the above fonts but were sometimes used alone +// because FL_HELVETICA was zero. Only using these by themselves works now: +#define FL_BOLD fltk::HELVETICA_BOLD +#define FL_ITALIC fltk::HELVETICA_ITALIC + +#define FL_NORMAL_SIZE (fltk::Widget::default_style->labelsize_) +#define FL_FOREGROUND_COLOR (fltk::Widget::default_style->labelcolor_) +#define FL_BACKGROUND2_COLOR (fltk::Widget::default_style->color_) +#define FL_SELECTION_COLOR (fltk::Widget::default_style->selection_color_) + +#define Fl_Color fltk::Color +enum { + FL_GRAY0 = fltk::GRAY00, + FL_DARK3 = fltk::GRAY33, + FL_DARK2 = fltk::GRAY60, + FL_DARK1 = fltk::GRAY66, + FL_GRAY = fltk::GRAY75, + FL_BACKGROUND_COLOR = fltk::GRAY75, + FL_LIGHT1 = fltk::GRAY85, + FL_LIGHT2 = fltk::GRAY90, + FL_LIGHT3 = fltk::GRAY99, + + FL_BLACK = fltk::BLACK, + FL_RED = fltk::RED, + FL_GREEN = fltk::GREEN, + FL_YELLOW = fltk::YELLOW, + FL_BLUE = fltk::BLUE, + FL_MAGENTA = fltk::MAGENTA, + FL_CYAN = fltk::CYAN, + FL_DARK_RED = 72, + + FL_DARK_GREEN = 60, + FL_DARK_YELLOW = 76, + FL_DARK_BLUE = 136, + FL_DARK_MAGENTA = 152, + FL_DARK_CYAN = 140, + + FL_WHITE = fltk::WHITE, + + FL_FREE_COLOR = 16, + FL_NUM_FREE_COLOR = 16, + FL_GRAY_RAMP = fltk::GRAY00, + FL_NUM_GRAY = 24, + FL_COLOR_CUBE = fltk::BLACK, + FL_NUM_RED = 5, + FL_NUM_GREEN = 8, + FL_NUM_BLUE = 5 +}; + +#define fl_inactive(c) fltk::inactive(c) +#define fl_contrast(a,b) fltk::contrast(a,b) +#define fl_color_average(a,b,c) fltk::lerp(b,a,c) +#define fl_lighter(c) fltk::lerp(fltk::WHITE,c,.67f) +#define fl_darker(c) fltk::lerp(fltk::BLACK,c,.67f) +#define fl_rgb_color fltk::color +#define fl_gray_ramp(i) (fltk::GRAY00+(i)) +#define fl_color_cube(r,g,b) (((b)*5+(r))*8+(g)+fltk::BLACK) + +#include <fltk/Cursor.h> +#define Fl_Cursor fltk::Cursor* +#define FL_CURSOR_DEFAULT fltk::CURSOR_DEFAULT +#define FL_CURSOR_ARROW fltk::CURSOR_ARROW +#define FL_CURSOR_CROSS fltk::CURSOR_CROSS +#define FL_CURSOR_WAIT fltk::CURSOR_WAIT +#define FL_CURSOR_INSERT fltk::CURSOR_INSERT +#define FL_CURSOR_HAND fltk::CURSOR_HAND +#define FL_CURSOR_HELP fltk::CURSOR_HELP +#define FL_CURSOR_MOVE fltk::CURSOR_MOVE +#define FL_CURSOR_NS fltk::CURSOR_NS +#define FL_CURSOR_WE fltk::CURSOR_WE +#define FL_CURSOR_NWSE fltk::CURSOR_NWSE +#define FL_CURSOR_NESW fltk::CURSOR_NESW +#define FL_CURSOR_NO fltk::CURSOR_NO +#define FL_CURSOR_NONE fltk::CURSOR_NONE +#define FL_CURSOR_N fltk::CURSOR_NS +#define FL_CURSOR_NE fltk::CURSOR_NESW +#define FL_CURSOR_E fltk::CURSOR_WE +#define FL_CURSOR_SE fltk::CURSOR_NWSE +#define FL_CURSOR_S fltk::CURSOR_NS +#define FL_CURSOR_SW fltk::CURSOR_NESW +#define FL_CURSOR_W fltk::CURSOR_WE +#define FL_CURSOR_NW fltk::CURSOR_NWSE + +enum { // must match values in fltk/run.h + FL_READ = 1, + FL_WRITE = 4, + FL_EXCEPT = 8 +}; + +enum Fl_Mode { // must match values in fltk/visual.h + FL_RGB = 0, + FL_INDEX = 1, + FL_SINGLE = 0, + FL_DOUBLE = 2, + FL_ACCUM = 4, + FL_ALPHA = 8, + FL_DEPTH = 16, + FL_STENCIL = 32, + FL_RGB8 = 64, + FL_MULTISAMPLE= 128, + FL_STEREO = 256, + FL_FAKE_SINGLE = 512 // Fake single buffered windows using double-buffer +}; + +#include <fltk/damage.h> +enum Fl_Damage { + FL_DAMAGE_CHILD = fltk::DAMAGE_CHILD, + FL_DAMAGE_EXPOSE = fltk::DAMAGE_EXPOSE, + FL_DAMAGE_SCROLL = fltk::DAMAGE_SCROLL, + FL_DAMAGE_OVERLAY = fltk::DAMAGE_OVERLAY, + FL_DAMAGE_ALL = fltk::DAMAGE_ALL +}; + +// FLTK 1.0.x compatibility definitions... +# ifdef FLTK_1_0_COMPAT +# define contrast fl_contrast +# define down fl_down +# define frame fl_frame +# define inactive fl_inactive +# endif // FLTK_1_0_COMPAT + +#endif + +// +// End of "$Id: Enumerations.H 5389 2006-09-01 15:39:19Z spitzak $". +// diff --git a/fltk/fltk/compat/FL/Fl.H b/fltk/fltk/compat/FL/Fl.H new file mode 100644 index 0000000..7f168d9 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl.H @@ -0,0 +1,67 @@ +#ifndef Fl_H +# define Fl_H + +#include "Enumerations.H" +#include <fltk/run.h> +#include <fltk/events.h> +#include <fltk/Color.h> +#include <fltk/Font.h> +#include <fltk/Box.h> +#include <fltk/error.h> +#include <fltk/visual.h> +#include <fltk/Monitor.h> +#include <fltk/Widget.h> + +namespace Fl = fltk; + +typedef fltk::TimeoutHandler Fl_Timeout_Handler; + +namespace fltk { + + class Widget; + + // fltk2 does not keep track of selection owner: + inline fltk::Widget* selection_owner() {return 0;} + inline void selection_owner(fltk::Widget*) {} + inline void selection(fltk::Widget &owner, const char* b, int len) {copy(b,len,false);} + + inline void visible_focus(int) {} // fltk2 always acts like this is off + + inline int x() {return Monitor::all().x();} + inline int y() {return Monitor::all().y();} + inline int w() {return Monitor::all().w();} + inline int h() {return Monitor::all().h();} + + inline void set_color(Color c, uchar r, uchar g, uchar b) { + set_color_index(c,color(r,g,b)); + } + inline void set_color(Color c, Color d) {set_color_index(c,d);} + inline Color get_color(Color c) {return get_color_index(c);} + inline void get_color(Color c, uchar&r, uchar&g, uchar&b) {split_color(c,r,g,b);} + //inline void free_color(Color, bool overlay=false); + + inline const char* get_font(Font* f) {return f->system_name();} + inline const char* get_font_name(Font* f, int* attributes = 0) { + if (attributes) return f->name(attributes); + else return f->name(); + } + inline int get_font_sizes(Font* f, int*& sizep) {return f->sizes(sizep);} + + inline int box_dx(const Box* b) {return b->dx();} + inline int box_dy(const Box* b) {return b->dy();} + inline int box_dw(const Box* b) {return b->dw();} + inline int box_dh(const Box* b) {return b->dh();} + + inline int event_key(int k) {return event_key_state(k);} + + inline void add_handler(int (*h)(int)) { + // rather unsafe typecast of function: + add_event_handler((int(*)(int,Window*))(h)); + } + + inline void delete_widget(Widget* w) {delete w;} + inline void do_widget_deletion() {} + +} + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Adjuster.H b/fltk/fltk/compat/FL/Fl_Adjuster.H new file mode 100644 index 0000000..d9f0488 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Adjuster.H @@ -0,0 +1,7 @@ +#ifndef Fl_Adjuster_H +#define Fl_Adjuster_H + +#include <fltk/Adjuster.h> +typedef fltk::Adjuster Fl_Adjuster; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Box.H b/fltk/fltk/compat/FL/Fl_Box.H new file mode 100644 index 0000000..31c082d --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Box.H @@ -0,0 +1,17 @@ +// +// "$Id: Fl_Box.H 4922 2006-04-10 09:30:57Z fabien $" +// +// Back-compatability widget. + +#ifndef Fl_Box_H +#define Fl_Box_H + +#include "Fl_Widget.H" +#include <fltk/InvisibleBox.h> +typedef fltk::InvisibleBox Fl_Box; + +#endif + +// +// End of "$Id: Fl_Box.H 4922 2006-04-10 09:30:57Z fabien $". +// diff --git a/fltk/fltk/compat/FL/Fl_Browser.H b/fltk/fltk/compat/FL/Fl_Browser.H new file mode 100644 index 0000000..b94f76b --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Browser.H @@ -0,0 +1,24 @@ +#ifndef Fl_Browser_H +#define Fl_Browser_H + +#include "Fl_Scrollbar.H" +#include "Fl_Menu_.H" +#include <fltk/Browser.h> +class Fl_Browser : public fltk::Browser { +public: + Fl_Browser(int x, int y, int w, int h, const char* l = 0) + :fltk::Browser(x,y,w,h,l) {} + + void make_visible(int n) {goto_index(n); make_item_visible();} + bool load(const char* fname) {/* NYI */ return true;} + void position(int y) {goto_position(y);} +}; + +enum { + FL_NORMAL_BROWSER = fltk::Browser::NORMAL, + FL_SELECT_BROWSER = fltk::Browser::NORMAL, + FL_HOLD_BROWSER = fltk::Browser::NORMAL, + FL_MULTI_BROWSER = fltk::Browser::MULTI +}; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Button.H b/fltk/fltk/compat/FL/Fl_Button.H new file mode 100644 index 0000000..a49c809 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Button.H @@ -0,0 +1,16 @@ +#ifndef Fl_Button_H +#define Fl_Button_H + +#include "Fl_Widget.H" +#include <fltk/Button.h> +typedef fltk::Button Fl_Button; + +enum { + FL_NORMAL_BUTTON = 0, + FL_TOGGLE_BUTTON = fltk::Button::TOGGLE, + FL_RADIO_BUTTON = fltk::Button::RADIO, + FL_HIDDEN_BUTTON = fltk::Button::HIDDEN // may not work in 2.0 +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Chart.H b/fltk/fltk/compat/FL/Fl_Chart.H new file mode 100644 index 0000000..eb66b4b --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Chart.H @@ -0,0 +1,83 @@ +// +// "$Id: Fl_Chart.H 4886 2006-03-30 09:55:32Z fabien $" +// +// Forms chart header file for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2006 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// + +#ifndef Fl_Chart_H +#define Fl_Chart_H + +#include <fltk/Widget.h> + +// values for type() +#define FL_BAR_CHART 0 +#define FL_HORBAR_CHART 1 +#define FL_LINE_CHART 2 +#define FL_FILL_CHART 3 +#define FL_SPIKE_CHART 4 +#define FL_PIE_CHART 5 +#define FL_SPECIALPIE_CHART 6 + +#define FL_FILLED_CHART FL_FILL_CHART // compatibility + +#define FL_CHART_MAX 128 +#define FL_CHART_LABEL_MAX 18 + +struct FL_FORMS_API FL_CHART_ENTRY { + float val; + uchar col; + char str[FL_CHART_LABEL_MAX+1]; +}; + +class FL_FORMS_API Fl_Chart : public fltk::Widget { +public: + Fl_Chart(int,int,int,int,const char * = 0); + ~Fl_Chart(); + void clear(); + void add(double, const char * =0, uchar=0); + void insert(int, double, const char * =0, uchar=0); + void replace(int, double, const char * =0, uchar=0); + void bounds(double *a,double *b) const {*a = min; *b = max;} + void bounds(double a,double b); + int size() const {return numb;} + int maxsize() const {return maxnumb;} + void maxsize(int); + uchar autosize() const {return autosize_;} + void autosize(uchar n) {autosize_ = n;} + +protected: + void draw(); + +private: + uchar autosize_; + int numb; + int maxnumb; + int sizenumb; + FL_CHART_ENTRY *entries; + double min,max; +}; + +#endif + +// +// End of "$Id: Fl_Chart.H 4886 2006-03-30 09:55:32Z fabien $". +// diff --git a/fltk/fltk/compat/FL/Fl_Check_Button.H b/fltk/fltk/compat/FL/Fl_Check_Button.H new file mode 100644 index 0000000..7351aa0 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Check_Button.H @@ -0,0 +1,8 @@ +#ifndef Fl_Check_Button_H +#define Fl_Check_Button_H + +#include <fltk/CheckButton.h> +typedef fltk::CheckButton Fl_Check_Button; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Choice.H b/fltk/fltk/compat/FL/Fl_Choice.H new file mode 100644 index 0000000..39c2690 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Choice.H @@ -0,0 +1,8 @@ +#ifndef Fl_Choice_H +#define Fl_Choice_H + +#include "Fl_Menu_.H" +#include <fltk/Choice.h> +typedef fltk::Choice Fl_Choice; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Clock.H b/fltk/fltk/compat/FL/Fl_Clock.H new file mode 100644 index 0000000..8366d69 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Clock.H @@ -0,0 +1,18 @@ +#ifndef Fl_Clock_H +#define Fl_Clock_H + +#include "Fl_Widget.H" +#include <fltk/Clock.h> + +typedef fltk::ClockOutput Fl_Clock_Output; +typedef fltk::Clock Fl_Clock; + +enum { + FL_SQUARE_CLOCK = fltk::Clock::SQUARE, + FL_ROUND_CLOCK = fltk::Clock::ROUND, + FL_ANALOG_CLOCK = fltk::Clock::SQUARE, + FL_DIGITAL_CLOCK = fltk::Clock::DIGITAL // nyi +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Color_Chooser.H b/fltk/fltk/compat/FL/Fl_Color_Chooser.H new file mode 100644 index 0000000..6cb6965 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Color_Chooser.H @@ -0,0 +1,8 @@ +#ifndef Fl_Color_Chooser_H +#define Fl_Color_Chooser_H + +#include <fltk/ColorChooser.h> +typedef fltk::ColorChooser Fl_Color_Chooser; +#define fl_color_chooser fltk::color_chooser + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Counter.H b/fltk/fltk/compat/FL/Fl_Counter.H new file mode 100644 index 0000000..935c3d5 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Counter.H @@ -0,0 +1,15 @@ +#ifndef Fl_Counter_H +#define Fl_Counter_H + +#include <fltk/ValueInput.h> +class Fl_Counter : public fltk::ValueInput { +public: + Fl_Counter(int x, int y, int w, int h, const char* l = 0) + : fltk::ValueInput(x,y,w,h,l) {align(fltk::ALIGN_BOTTOM);} +}; + +// these don't do anything: +#define FL_NORMAL_COUNTER 0 +#define FL_SIMPLE_COUNTER 1 + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Dial.H b/fltk/fltk/compat/FL/Fl_Dial.H new file mode 100644 index 0000000..f947cf9 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Dial.H @@ -0,0 +1,15 @@ +#ifndef Fl_Dial_H +#define Fl_Dial_H + +#include "Fl_Widget.H" +#include <fltk/Dial.h> +typedef fltk::Dial Fl_Dial; + +enum { + FL_NORMAL_DIAL = fltk::Dial::NORMAL, + FL_LINE_DIAL = fltk::Dial::LINE, + FL_FILL_DIAL = fltk::Dial::FILL +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Double_Window.H b/fltk/fltk/compat/FL/Fl_Double_Window.H new file mode 100644 index 0000000..fec00af --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Double_Window.H @@ -0,0 +1,18 @@ +#ifndef Fl_Double_Window_H +#define Fl_Double_Window_H + +#include "Fl_Window.H" + +class Fl_Double_Window : public Fl_Window { + +public: + Fl_Double_Window(int x, int y, int w, int h, const char*l = 0) + : Fl_Window(x,y,w,h,l) {set_double_buffer();} + + Fl_Double_Window(int x, int y, const char*l = 0) + : Fl_Window(x,y,l) {set_double_buffer();} + +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_File_Chooser.H b/fltk/fltk/compat/FL/Fl_File_Chooser.H new file mode 100644 index 0000000..4f6a40d --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_File_Chooser.H @@ -0,0 +1,16 @@ +#ifndef Fl_File_Chooser_H +#define Fl_File_Chooser_H + +#include "Fl_Widget.H" + +#include <fltk/FileChooser.h> +typedef fltk::FileChooser Fl_File_Chooser; + +#include <fltk/file_chooser.h> + +//char *fl_dir_chooser(const char *message,const char *fname,int relative=0); +inline const char *fl_file_chooser(const char *message,const char *pat,const char *fname,int /*relative*/ = 0) { + return fltk::file_chooser(message, pat, fname); +} + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Gl_Window.H b/fltk/fltk/compat/FL/Fl_Gl_Window.H new file mode 100644 index 0000000..5b390cb --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Gl_Window.H @@ -0,0 +1,9 @@ +#ifndef Fl_Gl_Window_H +#define Fl_Gl_Window_H + +#include "Fl_Window.H" + +#include <fltk/GlWindow.h> +typedef fltk::GlWindow Fl_Gl_Window; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Group.H b/fltk/fltk/compat/FL/Fl_Group.H new file mode 100644 index 0000000..c11ac3f --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Group.H @@ -0,0 +1,16 @@ +#ifndef Fl_Group_H +#define Fl_Group_H + +#include "Fl_Widget.H" +#include <fltk/Group.h> + +class Fl_Group : public fltk::Group { + +public: + Fl_Group(int x, int y, int w, int h, const char*l = 0) + : fltk::Group(x,y,w,h,l) {begin();} + static Fl_Group* current() {return (Fl_Group*)(fltk::Group::current());} +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Hold_Browser.H b/fltk/fltk/compat/FL/Fl_Hold_Browser.H new file mode 100644 index 0000000..773d6ed --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Hold_Browser.H @@ -0,0 +1,8 @@ +#ifndef Fl_Hold_Browser_H +#define Fl_Hold_Browser_H + +#include "Fl_Browser.H" +typedef Fl_Browser Fl_Hold_Browser; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Hor_Slider.H b/fltk/fltk/compat/FL/Fl_Hor_Slider.H new file mode 100644 index 0000000..d542978 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Hor_Slider.H @@ -0,0 +1,8 @@ +#ifndef Fl_Hor_Slider_H +#define Fl_Hor_Slider_H + +#include "Fl_Slider.H" +typedef fltk::Slider Fl_Hor_Slider; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Hor_Value_Slider.H b/fltk/fltk/compat/FL/Fl_Hor_Value_Slider.H new file mode 100644 index 0000000..dbad549 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Hor_Value_Slider.H @@ -0,0 +1,8 @@ +#ifndef Fl_Hor_Value_Slider_H +#define Fl_Hor_Value_Slider_H + +#include "Fl_Value_Slider.H" +typedef fltk::ValueSlider Fl_Hor_Value_Slider; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Input.H b/fltk/fltk/compat/FL/Fl_Input.H new file mode 100644 index 0000000..7848008 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Input.H @@ -0,0 +1,27 @@ +#ifndef Fl_Input_H +#define Fl_Input_H + +#include "Fl_Widget.H" +#include <fltk/Input.h> +class Fl_Input : public fltk::Input { +public: + Fl_Input(int x, int y, int w, int h, const char* l=0) : fltk::Input(x,y,w,h,l) {} + int wrap() const { return type() == fltk::Input::WORDWRAP; } + void wrap(int b) { type(b ? fltk::Input::WORDWRAP : fltk::Input::MULTILINE);} +}; + +enum { + FL_NORMAL_INPUT = fltk::Input::NORMAL, + FL_FLOAT_INPUT = 1, // probably needs the IntInput subclass! + FL_INT_INPUT = 2, +//FL_HIDDEN_INPUT // not in fltk2.0 + FL_MULTILINE_INPUT = fltk::Input::MULTILINE, + FL_SECRET_INPUT = fltk::Input::SECRET, +//FL_INPUT_TYPE = 7, +//FL_INPUT_READONLY = 8, + FL_INPUT_WRAP = fltk::Input::WORDWRAP, + FL_MULTILINE_INPUT_WRAP = fltk::Input::WORDWRAP +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Int_Input.H b/fltk/fltk/compat/FL/Fl_Int_Input.H new file mode 100644 index 0000000..469e9aa --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Int_Input.H @@ -0,0 +1,8 @@ +#ifndef Fl_Int_Input_H +#define Fl_Int_Input_H + +#include <fltk/IntInput.h> +typedef fltk::IntInput Fl_Int_Input; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Light_Button.H b/fltk/fltk/compat/FL/Fl_Light_Button.H new file mode 100644 index 0000000..ab0ac92 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Light_Button.H @@ -0,0 +1,9 @@ +#ifndef Fl_Light_Button_H +#define Fl_Light_Button_H + +#include "Fl_Button.H" +#include <fltk/LightButton.h> +typedef fltk::LightButton Fl_Light_Button; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Menu_.H b/fltk/fltk/compat/FL/Fl_Menu_.H new file mode 100644 index 0000000..49a909e --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Menu_.H @@ -0,0 +1,8 @@ +#ifndef Fl_Menu__H +#define Fl_Menu__H + +#include "Fl_Menu_Item.H" +#include <fltk/Menu.h> +typedef fltk::Menu Fl_Menu_; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Menu_Bar.H b/fltk/fltk/compat/FL/Fl_Menu_Bar.H new file mode 100644 index 0000000..465d58e --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Menu_Bar.H @@ -0,0 +1,8 @@ +#ifndef Fl_Menu_Bar_H +#define Fl_Menu_Bar_H + +#include "Fl_Menu_.H" +#include <fltk/MenuBar.h> +typedef fltk::MenuBar Fl_Menu_Bar; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Menu_Button.H b/fltk/fltk/compat/FL/Fl_Menu_Button.H new file mode 100644 index 0000000..269e992 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Menu_Button.H @@ -0,0 +1,8 @@ +#ifndef Fl_Menu_Button_H +#define Fl_Menu_Button_H + +#include "Fl_Menu_.H" +#include <fltk/PopupMenu.h> +typedef fltk::PopupMenu Fl_Menu_Button; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Menu_Item.H b/fltk/fltk/compat/FL/Fl_Menu_Item.H new file mode 100644 index 0000000..6b7a31a --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Menu_Item.H @@ -0,0 +1,163 @@ +// +// "$Id: Fl_Menu_Item.H 4886 2006-03-30 09:55:32Z fabien $" +// +// Back-compatability menu items for FLTK. The new fltk::Menu class +// converts these tables into child fltk::Item and fltk::ItemGroup widgets. +// You should not use this for new programs. +// +// Copyright 1998-2006 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// + +#ifndef Fl_Menu_Item_h +#define Fl_Menu_Item_h + +#include <fltk/Widget.h> + +enum { // values for flags: + FL_MENU_INACTIVE = 1, + FL_MENU_TOGGLE= 2, + FL_MENU_VALUE = 4, + FL_MENU_RADIO = 8, + FL_MENU_INVISIBLE = 0x10, + FL_SUBMENU_POINTER = 0x20, + FL_SUBMENU = 0x40, + FL_MENU_DIVIDER = 0x80, + FL_MENU_HORIZONTAL = 0x100 // not used! +}; + +namespace fltk { + class FL_API Menu; +} + +struct FL_API Fl_Menu_Item { + const char *text; + int shortcut_; + fltk::Callback *callback_; + void *user_data_; + int flags; + fltk::LabelType* labeltype_; + fltk::Font* labelfont_; + unsigned labelsize_; + fltk::Color labelcolor_; + + // Used to add or set an fltk::Menu widget: + void add_to(fltk::Menu*, void* data = 0) const; + + // popup menus without using an fltk::Menu widget: + // Warning: this is now quite expensive, as it creates a temporary + // fltk::Menu and child widgets! These also do not match the fltk 1.0 + // calls, if there is any callback it is called directly (with the + // dummy fltk::Menu as an argument). + const Fl_Menu_Item* + pulldown(int X, int Y, int W, int H, + const Fl_Menu_Item* picked = 0, + const char* title = 0) const; + const Fl_Menu_Item* + popup(int X, int Y, const char* title=0, + const Fl_Menu_Item* picked = 0) const { + return pulldown(X, Y, 0, 0, picked, title);} + const Fl_Menu_Item* + test_shortcut() const; + + // return offset of terminating null item: + int size() const ; + + // advance a pointer by N items, skipping submenus: + const Fl_Menu_Item *next(int=1) const; + Fl_Menu_Item *next(int i=1) { + return (Fl_Menu_Item*)(((const Fl_Menu_Item*)this)->next(i));} + + const char* label() const {return text;} + fltk::LabelType* labeltype() const {return labeltype_;} + fltk::Color labelcolor() const {return labelcolor_;} + fltk::Font* labelfont() const {return labelfont_;} + unsigned labelsize() const {return labelsize_;} + fltk::Callback_p callback() const {return callback_;} + void* user_data() const {return user_data_;} + long argument() const {return (long)user_data_;} + int shortcut() const {return shortcut_;} + int submenu() const {return flags&(FL_SUBMENU|FL_SUBMENU_POINTER);} + int checkbox() const {return flags&FL_MENU_TOGGLE;} + int radio() const {return flags&FL_MENU_RADIO;} + int value() const {return flags&FL_MENU_VALUE;} + int visible() const {return !(flags&FL_MENU_INVISIBLE);} + int active() const {return !(flags&FL_MENU_INACTIVE);} + int activevisible() const {return !(flags&0x11);} + + void label(const char* a) {text=a;} + void label(fltk::LabelType* a,const char* b) {labeltype_ = a; text = b;} + void labeltype(fltk::LabelType* a) {labeltype_ = a;} + void labelcolor(uchar a) {labelcolor_ = a;} + void labelfont(fltk::Font* a) {labelfont_ = a;} + void labelsize(uchar a) {labelsize_ = a;} + void callback(fltk::Callback* c, void* p) {callback_=c; user_data_=p;} + void callback(fltk::Callback* c) {callback_=c;} + void callback(fltk::Callback0*c) {callback_=(fltk::Callback*)c;} + void callback(fltk::Callback1*c, long p=0) {callback_=(fltk::Callback*)c; user_data_=(void*)p;} + void user_data(void* v) {user_data_ = v;} + void argument(long v) {user_data_ = (void*)v;} + void shortcut(int s) {shortcut_ = s;} + void set() {flags |= FL_MENU_VALUE;} + void clear() {flags &= ~FL_MENU_VALUE;} + void setonly(); + void show() {flags &= ~FL_MENU_INVISIBLE;} + void hide() {flags |= FL_MENU_INVISIBLE;} + void activate() {flags &= ~FL_MENU_INACTIVE;} + void deactivate() {flags |= FL_MENU_INACTIVE;} + + const Fl_Menu_Item* find_shortcut(int *ip=0) const; + + void do_callback(fltk::Widget* o) const {callback_(o, user_data_);} + void do_callback(fltk::Widget* o,void* arg) const {callback_(o, arg);} + void do_callback(fltk::Widget* o,long arg) const {callback_(o, (void*)arg);} + + // back-compatability, do not use: + int checked() const {return flags&FL_MENU_VALUE;} + void check() {flags |= FL_MENU_VALUE;} + void uncheck() {flags &= ~FL_MENU_VALUE;} + +#if 0 + int add(const char*, int shortcut, fltk::Callback*, void* =0, int = 0); + int add(const char*a, const char* b, fltk::Callback* c, + void* d = 0, int e = 0) { + return add(a,fltk::old_shortcut(b),c,d,e);} +#endif +}; + +typedef Fl_Menu_Item Fl_Menu; // back compatability with fltk < 1.0 + +enum { // back-compatability enum: + FL_PUP_NONE = 0, + FL_PUP_GREY = FL_MENU_INACTIVE, + FL_PUP_GRAY = FL_MENU_INACTIVE, + FL_MENU_BOX = FL_MENU_TOGGLE, + FL_PUP_BOX = FL_MENU_TOGGLE, + FL_MENU_CHECK = FL_MENU_VALUE, + FL_PUP_CHECK = FL_MENU_VALUE, + FL_PUP_RADIO = FL_MENU_RADIO, + FL_PUP_INVISIBLE = FL_MENU_INVISIBLE, + FL_PUP_SUBMENU = FL_SUBMENU_POINTER +}; + +#endif + +// +// End of "$Id: Fl_Menu_Item.H 4886 2006-03-30 09:55:32Z fabien $". +// diff --git a/fltk/fltk/compat/FL/Fl_Output.H b/fltk/fltk/compat/FL/Fl_Output.H new file mode 100644 index 0000000..cd375ca --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Output.H @@ -0,0 +1,15 @@ +#ifndef Fl_Output_H +#define Fl_Output_H + +#include "Fl_Input.H" +#include <fltk/Output.h> +typedef fltk::Output Fl_Output; + +enum { + FL_NORMAL_OUTPUT = fltk::Input::NORMAL, + FL_MULTILINE_OUTPUT = fltk::Input::MULTILINE, + FL_MULTILINE_OUTPUT_WRAP = fltk::Input::WORDWRAP +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Overlay_Window.H b/fltk/fltk/compat/FL/Fl_Overlay_Window.H new file mode 100644 index 0000000..3a6641f --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Overlay_Window.H @@ -0,0 +1,8 @@ +#ifndef Fl_Overlay_Window_H +#define Fl_Overlay_Window_H + +#include "Fl_Window.H" +typedef Fl_Window Fl_Overlay_Window; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Pack.H b/fltk/fltk/compat/FL/Fl_Pack.H new file mode 100644 index 0000000..ecd3846 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Pack.H @@ -0,0 +1,15 @@ +#ifndef Fl_Pack_H +#define Fl_Pack_H + +#include "Fl_Group.H" +#include <fltk/PackedGroup.h> + +class Fl_Pack : public fltk::PackedGroup { + +public: + Fl_Pack(int x, int y, int w, int h, const char*l = 0) + : fltk::PackedGroup(x,y,w,h,l) {begin();} + +}; // Fl_Pack class + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Pixmap.H b/fltk/fltk/compat/FL/Fl_Pixmap.H new file mode 100644 index 0000000..15b0638 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Pixmap.H @@ -0,0 +1,9 @@ +#ifndef Fl_Pixmap_H +#define Fl_Pixmap_H + +#include "Fl_Widget.H" +#include "fltk/xpmImage.h" + +typedef fltk::xpmImage Fl_Pixmap; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Return_Button.H b/fltk/fltk/compat/FL/Fl_Return_Button.H new file mode 100644 index 0000000..506a297 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Return_Button.H @@ -0,0 +1,8 @@ +#ifndef Fl_Return_Button_H +#define Fl_Return_Button_H + +#include <fltk/ReturnButton.h> +typedef fltk::ReturnButton Fl_Return_Button; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Roller.H b/fltk/fltk/compat/FL/Fl_Roller.H new file mode 100644 index 0000000..6e966f1 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Roller.H @@ -0,0 +1,13 @@ +#ifndef Fl_Roller_H +#define Fl_Roller_H + +#include "Fl_Valuator.H" +#include <fltk/ThumbWheel.h> + +class Fl_Roller : public fltk::ThumbWheel { +public: + Fl_Roller(int x, int y, int w, int h, const char*l = 0) + : fltk::ThumbWheel(x,y,w,h,l) {set_vertical();} +}; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Scroll.H b/fltk/fltk/compat/FL/Fl_Scroll.H new file mode 100644 index 0000000..e677e31 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Scroll.H @@ -0,0 +1,15 @@ +#ifndef Fl_Scroll_H +#define Fl_Scroll_H + +#include "Fl_Group.H" +#include <fltk/ScrollGroup.h> + +class Fl_Scroll : public fltk::ScrollGroup { + +public: + Fl_Scroll(int x, int y, int w, int h, const char*l = 0) + : fltk::ScrollGroup(x,y,w,h,l) {begin();} +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Scrollbar.H b/fltk/fltk/compat/FL/Fl_Scrollbar.H new file mode 100644 index 0000000..922539a --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Scrollbar.H @@ -0,0 +1,13 @@ +#ifndef Fl_Scrollbar_H +#define Fl_Scrollbar_H + +#include "Fl_Slider.H" +#include <fltk/Scrollbar.h> + +class Fl_Scrollbar : public fltk::Scrollbar { +public: + Fl_Scrollbar(int x, int y, int w, int h, const char*l = 0) + : fltk::Scrollbar(x,y,w,h,l) {set_vertical();} +}; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Select_Browser.H b/fltk/fltk/compat/FL/Fl_Select_Browser.H new file mode 100644 index 0000000..ffebc0d --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Select_Browser.H @@ -0,0 +1,8 @@ +#ifndef Fl_Select_Browser_H +#define Fl_Select_Browser_H + +#include "Fl_Browser.H" +typedef Fl_Browser Fl_Select_Browser; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Shared_Image.H b/fltk/fltk/compat/FL/Fl_Shared_Image.H new file mode 100644 index 0000000..70a4de3 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Shared_Image.H @@ -0,0 +1,8 @@ +#ifndef Fl_Shared_Image_H +#define Fl_Shared_Image_H + +#include <fltk/SharedImage.h> +#define Fl_Shared_Image fltk::SharedImage +#define Fl_Image fltk::Image + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Single_Window.H b/fltk/fltk/compat/FL/Fl_Single_Window.H new file mode 100644 index 0000000..312e9b8 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Single_Window.H @@ -0,0 +1,8 @@ +#ifndef Fl_Single_Window_H +#define Fl_Single_Window_H + +#include "Fl_Window.H" +typedef Fl_Window Fl_Single_Window; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Slider.H b/fltk/fltk/compat/FL/Fl_Slider.H new file mode 100644 index 0000000..4a46afc --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Slider.H @@ -0,0 +1,24 @@ +#ifndef Fl_Slider_H +#define Fl_Slider_H + +#include "Fl_Widget.H" +#define FLTK_1_SLIDER 1 +#include <fltk/Slider.h> + +class Fl_Slider : public fltk::Slider { +public: + Fl_Slider(int x, int y, int w, int h, const char*l = 0) + : fltk::Slider(x,y,w,h,l) {set_vertical();} +}; + +enum { + FL_VERT_SLIDER = fltk::Slider::LINEAR, + FL_HOR_SLIDER = fltk::Slider::HORIZONTAL, + FL_VERT_FILL_SLIDER = fltk::Slider::FILL, + FL_HOR_FILL_SLIDER = fltk::Slider::HORIZONTAL+fltk::Slider::FILL, + FL_VERT_NICE_SLIDER = fltk::Slider::LINEAR, + FL_HOR_NICE_SLIDER = fltk::Slider::HORIZONTAL +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Tabs.H b/fltk/fltk/compat/FL/Fl_Tabs.H new file mode 100644 index 0000000..202a705 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Tabs.H @@ -0,0 +1,15 @@ +#ifndef Fl_Tabs_H +#define Fl_Tabs_H + +#include "Fl_Group.H" +#include <fltk/TabGroup.h> + +class Fl_Tabs : public fltk::TabGroup { + +public: + Fl_Tabs(int x, int y, int w, int h, const char*l = 0) + : fltk::TabGroup(x,y,w,h,l) {begin();} +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Text_Buffer.H b/fltk/fltk/compat/FL/Fl_Text_Buffer.H new file mode 100644 index 0000000..5886681 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Text_Buffer.H @@ -0,0 +1,8 @@ +#ifndef Fl_Text_Buffer_H +#define Fl_Text_Buffer_H + +#include "Fl_Widget.H" +#include <fltk/TextBuffer.h> +typedef fltk::TextBuffer Fl_Text_Buffer; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Text_Editor.H b/fltk/fltk/compat/FL/Fl_Text_Editor.H new file mode 100644 index 0000000..789b971 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Text_Editor.H @@ -0,0 +1,9 @@ +#ifndef Fl_Text_Editor_H +#define Fl_Text_Editor_H + +#include "Fl_Text_Buffer.H" +#include <fltk/TextEditor.h> +typedef fltk::TextEditor Fl_Text_Editor; +#define Style_Table_Entry StyleTableEntry + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Tile.H b/fltk/fltk/compat/FL/Fl_Tile.H new file mode 100644 index 0000000..89799ee --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Tile.H @@ -0,0 +1,15 @@ +#ifndef Fl_Tile_H +#define Fl_Tile_H + +#include "Fl_Widget.H" +#include <fltk/TiledGroup.h> + +class Fl_Tile : public fltk::TiledGroup { + +public: + Fl_Tile(int x, int y, int w, int h, const char*l = 0) + : fltk::TiledGroup(x,y,w,h,l) {begin();} +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Toggle_Button.H b/fltk/fltk/compat/FL/Fl_Toggle_Button.H new file mode 100644 index 0000000..6fc7bc6 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Toggle_Button.H @@ -0,0 +1,12 @@ +#ifndef Fl_Toggle_Button_H +#define Fl_Toggle_Button_H + +#include "Fl_Button.H" + +class Fl_Toggle_Button : public Fl_Button { +public: + Fl_Toggle_Button(int X,int Y,int W,int H,const char *l=0) + : Fl_Button(X,Y,W,H,l) {type(FL_TOGGLE_BUTTON);} +}; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Toggle_Light_Button.H b/fltk/fltk/compat/FL/Fl_Toggle_Light_Button.H new file mode 100644 index 0000000..8eae1a3 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Toggle_Light_Button.H @@ -0,0 +1,10 @@ +#ifndef Fl_Toggle_Light_Button_H +#define Fl_Toggle_Light_Button_H + + +#include "Fl_Button.H" +#include <fltk/LightButton.h> +typedef fltk::LightButton Fl_Toggle_Light_Button; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Valuator.H b/fltk/fltk/compat/FL/Fl_Valuator.H new file mode 100644 index 0000000..be391c7 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Valuator.H @@ -0,0 +1,12 @@ +#ifndef Fl_Valuator_H +#define Fl_Valuator_H + +#include <fltk/Valuator.h> +#define Fl_Valuator fltk::Valuator + +enum { + FL_VERTICAL = 0, + FL_HORIZONTAL = 1 +}; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Value_Input.H b/fltk/fltk/compat/FL/Fl_Value_Input.H new file mode 100644 index 0000000..03d719f --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Value_Input.H @@ -0,0 +1,7 @@ +#ifndef Fl_Value_Input_H +#define Fl_Value_Input_H + +#include <fltk/ValueInput.h> +typedef fltk::ValueInput Fl_Value_Input; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Value_Output.H b/fltk/fltk/compat/FL/Fl_Value_Output.H new file mode 100644 index 0000000..ea4115e --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Value_Output.H @@ -0,0 +1,11 @@ +#ifndef Fl_Value_Output_H +#define Fl_Value_Output_H + +// The fltk1.1 allowed the user to change the value by dragging the mouse. +// The fltk2.0 version is strictly for displaying a numeric value. +// If you want the user to be able to change it, replace with a Value_Input. + +#include <fltk/ValueOutput.h> +typedef fltk::ValueOutput Fl_Value_Output; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Value_Slider.H b/fltk/fltk/compat/FL/Fl_Value_Slider.H new file mode 100644 index 0000000..9afda08 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Value_Slider.H @@ -0,0 +1,14 @@ +#ifndef Fl_Value_Slider_H +#define Fl_Value_Slider_H + +#include "Fl_Slider.H" +#include <fltk/ValueSlider.h> + +class Fl_Value_Slider : public fltk::ValueSlider { +public: + Fl_Value_Slider(int x, int y, int w, int h, const char*l = 0) + : fltk::ValueSlider(x,y,w,h,l) {set_vertical();} +}; + +#endif + diff --git a/fltk/fltk/compat/FL/Fl_Widget.H b/fltk/fltk/compat/FL/Fl_Widget.H new file mode 100644 index 0000000..16b918a --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Widget.H @@ -0,0 +1,19 @@ +#ifndef Fl_Widget_H +#define Fl_Widget_H + +#include "Enumerations.H" +#define FLTK_1_WIDGET 1 +#include <fltk/Widget.h> + +typedef fltk::Widget Fl_Widget; + +typedef fltk::Callback Fl_Callback; +typedef Fl_Callback* Fl_Callback_p; // needed for BORLAND +typedef fltk::Callback0 Fl_Callback0; +typedef fltk::Callback1 Fl_Callback1; + +enum { + FL_RESERVED_TYPE = fltk::Widget::RESERVED_TYPE +}; + +#endif diff --git a/fltk/fltk/compat/FL/Fl_Window.H b/fltk/fltk/compat/FL/Fl_Window.H new file mode 100644 index 0000000..fbb3b84 --- /dev/null +++ b/fltk/fltk/compat/FL/Fl_Window.H @@ -0,0 +1,22 @@ +#ifndef Fl_Window_H +#define Fl_Window_H + +#include "Fl_Group.H" +#include <fltk/Window.h> + +class Fl_Window : public fltk::Window { + +public: + Fl_Window(int x, int y, int w, int h, const char*l = 0) + : fltk::Window(x,y,w,h,l) {begin();} + + Fl_Window(int x, int y, const char*l = 0) + : fltk::Window(x,y,l) {begin();} + + void border(bool v) { + if (!v) clear_border(); // set_border does not work + } +}; + +#endif + diff --git a/fltk/fltk/compat/FL/README b/fltk/fltk/compat/FL/README new file mode 100644 index 0000000..5301fdd --- /dev/null +++ b/fltk/fltk/compat/FL/README @@ -0,0 +1,35 @@ +These header files are for back-compatability with fltk1.x. Do not +use these header files in new programs. Use the ones in the fltk +directory. + +Most fltk1.x programs should compile with no changes by using these +header files and linking with the fltk2.0 library. + +Known changes that must be done to fltk1.1 code to make them compile: + +Widgets inside groups will need their x,y coordinates fixed as they +are now relative to the group, not the window. + +FL_BOLD, FL_ITALIC - these symbols used to be added to fonts to get +bold and italic. This no longer works. You should replace them with +the single symbol for the font (like FL_HELVETICA_BOLD in place of +FL_HELVETICA+FL_BOLD) or use font->plus(attributes). + +Drawing functions are only roughly emulated. You may need to add casts +to float to get your compiler to locate the correct functions. And if +you offset by the x,y of the widget you need to remove these offsets. + +Some new members of widgets may hide global data. For instance "width" +and "height" are now members. You can fix this by putting "::" in +front of the global data names. + +If you use the Fl_Browser you are probably going to have trouble. All +the indexes are offset by 1 from fltk1.1, ie the first item has an +index of zero, not 1. Adding items with forward slashes in them will +produce a hierarchy, which is pretty confusing when you don't plan on +it. + +Menu and browser callbacks: the widget passed is the item, not the +menu or browser. If you use o->parent() to find what window it is in +you will have to change this, in most cases you can use o->window(). + diff --git a/fltk/fltk/compat/FL/filename.H b/fltk/fltk/compat/FL/filename.H new file mode 100644 index 0000000..08dcd86 --- /dev/null +++ b/fltk/fltk/compat/FL/filename.H @@ -0,0 +1,21 @@ +#ifndef fl_filename_H +#define fl_filename_H + +#include <fltk/filename.h> +#include <string.h> + +#define fl_filename_name fltk::filename_name +#define fl_filename_ext fltk::filename_ext +#define fl_filename_match fltk::filename_match +#define fl_filename_isdir fltk::filename_isdir +#define fl_filename_list fltk::filename_list + +inline char *fl_filename_setext(char * name, const char *ext) { + strcpy(fltk::filename_ext(name), ext ? ext : ""); + return name; +} +#define FL_PATH_MAX PATH_MAX // all buffers are assummed to be at least this long +FL_API bool fl_filename_expand(char *, const char *from); +FL_API bool fl_filename_absolute(char *, const char *from, const char* pwd=0); + +#endif diff --git a/fltk/fltk/compat/FL/fl_ask.H b/fltk/fltk/compat/FL/fl_ask.H new file mode 100644 index 0000000..fdef11e --- /dev/null +++ b/fltk/fltk/compat/FL/fl_ask.H @@ -0,0 +1,13 @@ +#ifndef fl_ask_H +#define fl_ask_H + +#include <fltk/ask.h> + +#define fl_message fltk::message +#define fl_alert fltk::alert +#define fl_ask fltk::ask +#define fl_choice fltk::choice +#define fl_input fltk::input +#define fl_password fltk::password + +#endif diff --git a/fltk/fltk/compat/FL/fl_draw.H b/fltk/fltk/compat/FL/fl_draw.H new file mode 100644 index 0000000..12cd1bd --- /dev/null +++ b/fltk/fltk/compat/FL/fl_draw.H @@ -0,0 +1,214 @@ +#ifndef fl_draw_H +#define fl_draw_H + +#include "Enumerations.H" +#include <fltk/draw.h> +#include <fltk/Font.h> + +inline void fl_color(fltk::Color c) {fltk::setcolor(c);} +inline void fl_color(uchar r, uchar g, uchar b) {fltk::setcolor(fltk::color(r,g,b));} +inline fltk::Color fl_color() {return fltk::getcolor();} + +// clip: +inline void fl_push_clip(int x, int y, int w, int h) {fltk::push_clip(x,y,w,h);} +inline void fl_push_no_clip() {fltk::push_no_clip();} +#define fl_clip fl_push_clip +#define fl_pop_clip fltk::pop_clip +inline int fl_not_clipped(int x, int y, int w, int h) {return fltk::not_clipped(fltk::Rectangle(x,y,w,h));} +inline int fl_clip_box(int X, int Y, int W, int H, int& x, int& y, int& w, int& h) { + fltk::Rectangle r(X,Y,W,H); + int i = intersect_with_clip(r); + x = r.x(); y = r.y(); w = r.w(); h = r.h(); + return i; +} + +// points: +inline void fl_point(int x, int y) {fltk::drawpoint(x,y);} + +// line type: +#define fl_line_style fltk::line_style +enum { + FL_SOLID = fltk::SOLID, + FL_DASH = fltk::DASH, + FL_DOT = fltk::DOT, + FL_DASHDOT = fltk::DASHDOT, + FL_DASHDOTDOT = fltk::DASHDOTDOT, + FL_CAP_FLAT = fltk::CAP_FLAT, + FL_CAP_ROUND = fltk::CAP_ROUND, + FL_CAP_SQUARE = fltk::CAP_SQUARE, + FL_JOIN_MITER = fltk::JOIN_MITER, + FL_JOIN_ROUND = fltk::JOIN_ROUND, + FL_JOIN_BEVEL = fltk::JOIN_BEVEL +}; + +// rectangles tweaked to exactly fill the pixel rectangle: +inline void fl_rect(int x, int y, int w, int h) {fltk::strokerect(fltk::Rectangle(x,y,w,h));} +inline void fl_rect(int x, int y, int w, int h, fltk::Color c) {fltk::setcolor(c); fltk::strokerect(fltk::Rectangle(x,y,w,h));} +inline void fl_rectf(int x, int y, int w, int h) {fltk::fillrect(fltk::Rectangle(x,y,w,h));} +inline void fl_rectf(int x, int y, int w, int h, fltk::Color c) {fltk::setcolor(c); fltk::fillrect(fltk::Rectangle(x,y,w,h));} + +// line segments: +inline void fl_line(int x0,int y0, int x1,int y1) {fltk::drawline(x0,y0,x1,y1);} +inline void fl_line(int x0,int y0, int x1,int y1, int x2,int y2) { + fltk::addvertex(x0,y0); + fltk::addvertex(x1,y1); + fltk::addvertex(x2,y2); + fltk::strokepath(); +} + +// closed line segments: +inline void fl_loop(int x0,int y0, int x1,int y1, int x2,int y2) { + fltk::addvertex(x0,y0); + fltk::addvertex(x1,y1); + fltk::addvertex(x2,y2); + fltk::closepath(); + fltk::strokepath(); +} +inline void fl_loop(int x0,int y0, int x1,int y1, int x2,int y2, int x3,int y3) { + fltk::addvertex(x0,y0); + fltk::addvertex(x1,y1); + fltk::addvertex(x2,y2); + fltk::addvertex(x3,y3); + fltk::closepath(); + fltk::strokepath(); +} + +// filled polygons +inline void fl_polygon(int x0,int y0, int x1,int y1, int x2,int y2) { + fltk::addvertex(x0,y0); + fltk::addvertex(x1,y1); + fltk::addvertex(x2,y2); + fltk::closepath(); + fltk::fillpath(); +} +inline void fl_polygon(int x0,int y0, int x1,int y1, int x2,int y2, int x3,int y3) { + fltk::addvertex(x0,y0); + fltk::addvertex(x1,y1); + fltk::addvertex(x2,y2); + fltk::addvertex(x3,y3); + fltk::closepath(); + fltk::fillpath(); +} + +// draw rectilinear lines, horizontal segment first: +inline void fl_xyline(int x, int y, int x1) { + fltk::drawline(x,y,x1,y); +} +inline void fl_xyline(int x, int y, int x1, int y2) { + fltk::addvertex(x,y); + fltk::addvertex(x1,y); + fltk::addvertex(x1,y2); + fltk::strokepath(); +} +inline void fl_xyline(int x, int y, int x1, int y2, int x3) { + fltk::addvertex(x,y); + fltk::addvertex(x1,y); + fltk::addvertex(x1,y2); + fltk::addvertex(x3,y2); + fltk::strokepath(); +} + +// draw rectilinear lines, vertical segment first: +inline void fl_yxline(int x, int y, int y1) { + fltk::drawline(x,y,x,y1); +} +inline void fl_yxline(int x, int y, int y1, int x2) { + fltk::addvertex(x,y); + fltk::addvertex(x,y1); + fltk::addvertex(x2,y1); + fltk::strokepath(); +} +inline void fl_yxline(int x, int y, int y1, int x2, int y3) { + fltk::addvertex(x,y); + fltk::addvertex(x,y1); + fltk::addvertex(x2,y1); + fltk::addvertex(x2,y3); + fltk::strokepath(); +} + +inline void fl_arc(int x,int y,int w,int h,float a,float a2) {fltk::addchord(fltk::Rectangle(x,y,w,h),a,a2); fltk::strokepath();} +inline void fl_pie(int x,int y,int w,int h,float a,float a2) {fltk::addpie(fltk::Rectangle(x,y,w,h),a,a2); fltk::fillpath();} +inline void fl_chord(int x,int y,int w,int h,float a,float a2) {fltk::addchord(fltk::Rectangle(x,y,w,h),a,a2); fltk::fillpath();} + +// scalable drawing code (code in fl_vertex.C and fl_arc.C): +#define fl_push_matrix fltk::push_matrix +#define fl_pop_matrix fltk::pop_matrix +#define fl_scale fltk::scale +#define fl_translate fltk::translate +#define fl_rotate fltk::rotate +#define fl_mult_matrix fltk::concat +#define fl_begin_points fltk::newpath +#define fl_begin_line fltk::newpath +#define fl_begin_loop fltk::newpath +#define fl_begin_polygon fltk::newpath +#define fl_vertex fltk::addvertex +#define fl_curve fltk::addcurve +inline void fl_arc(float x,float y,float r, float a1, float a2) {fltk::addarc(x-r,y-r,2*r,2*r,a1,a2);} +#define fl_circle fltk::addcircle +#define fl_end_points fltk::drawpoints +#define fl_end_line fltk::strokepath +inline void fl_end_loop() {fltk::closepath();fltk::strokepath();} +#define fl_end_polygon fltk::fillpath +#define fl_begin_complex_polygon fltk::newpath +#define fl_gap fltk::closepath +#define fl_end_complex_polygon fltk::fillpath + +// current font: (size was an int in fltk1.1) +inline void fl_font(fltk::Font* f, float size) {fltk::setfont(f,size);} +inline void fl_font(int f, float size) {fltk::setfont(fltk::font(f),size);} +inline fltk::Font* fl_font() {return fltk::getfont();} +inline float fl_size() {return fltk::getsize();} + +// information you can get about the current font: +inline float fl_height() {return fltk::getascent()+fltk::getdescent();} +inline float fl_height(int, float size) {return size;} +inline float fl_descent() {return fltk::getdescent();} +inline float fl_width(const char* c) {return fltk::getwidth(c);} +inline float fl_width(const char* c, int n) {return fltk::getwidth(c,n);} +inline float fl_width(char c) {return fltk::getwidth(&c,1);} + +// draw using current font: +inline void fl_draw(const char* s, int x, int y) {fltk::drawtext(s,x,y);} +inline void fl_draw(const char* s, int n, int x, int y) {fltk::drawtext(s,n,x,y);} +inline void fl_measure(const char* s, int& x, int& y) {fltk::measure(s,x,y);} +inline void fl_draw(const char* s, int x,int y,int w,int h, fltk::Flags f) {fltk::drawtext(s,fltk::Rectangle(x,y,w,h),f);} + +// boxtypes: +//void fl_frame(const char* s, int x, int y, int w, int h); +//void fl_frame2(const char* s, int x, int y, int w, int h); +// This no longer works because boxes take a style, not a color: +// #include <fltk/Box.h> +// inline void fl_draw_box(fltk::Box* b, int x, int y, int w, int h, fltk::Color c) {b->draw(x,y,w,h,c);} + +// images: +static inline fltk::PixelType fromdelta(int d) {return d==1?fltk::MONO:d==3?fltk::RGB:fltk::RGBx;} +inline void fl_draw_image(const uchar* p, int x,int y,int w,int h, int delta, int ldelta) {fltk::drawimage(p,fromdelta(delta),fltk::Rectangle(x,y,w,h),ldelta);} +inline void fl_draw_image(const uchar* p, int x,int y,int w,int h, int delta) {fltk::drawimage(p,fromdelta(delta),fltk::Rectangle(x,y,w,h));} + +inline void fl_draw_image_mono(const uchar* p, int x,int y,int w,int h, int delta, int ldelta) {fltk::drawimage(p,fltk::MONO,fltk::Rectangle(x,y,w,h),ldelta);} +inline void fl_draw_image_mono(const uchar* p, int x,int y,int w,int h, int delta=1) {fltk::drawimage(p,fltk::MONO,fltk::Rectangle(x,y,w,h));} + +typedef fltk::DrawImageCallback Fl_Draw_Image_Cb; +inline void fl_draw_image(Fl_Draw_Image_Cb cb, void* p, int x,int y,int w,int h, int delta=3) {fltk::drawimage(cb,p,fromdelta(delta),fltk::Rectangle(x,y,w,h));} +inline void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* p, int x,int y,int w,int h, int delta=1) {fltk::drawimage(cb,p,fltk::MONO,fltk::Rectangle(x,y,w,h));} + +inline uchar *fl_read_image(uchar *p, int x,int y, int w, int h, int alpha=0) {return fltk::readimage(p, alpha?fltk::RGBA:fltk::RGB, fltk::Rectangle(x,y,w,h));} + +inline void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {fltk::setcolor(fltk::color(r,g,b)); fltk::fillrect(fltk::Rectangle(x,y,w,h));} + +#define fl_draw_pixmap fltk::draw_xpm +#define fl_measure_pixmap fltk::measure_xpm +#define fl_scroll fltk::scrollrect +#define fl_shortcut_label fltk::key_name +#define fl_overlay_rect fltk::overlay_rect +#define fl_overlay_clear fltk::overlay_clear +#define fl_draw_symbol fltk::draw_symbol +#define fl_add_symbol fltk::add_symbol +#define fl_frame fltk::drawframe2 +#define fl_frame2 fltk::drawframe + +#endif + +// +// End of "$Id: fl_draw.H 5939 2007-08-02 14:19:28Z spitzak $". +// diff --git a/fltk/fltk/compat/FL/fl_message.H b/fltk/fltk/compat/FL/fl_message.H new file mode 100644 index 0000000..4f81d69 --- /dev/null +++ b/fltk/fltk/compat/FL/fl_message.H @@ -0,0 +1 @@ +#include "fl_ask.H" diff --git a/fltk/fltk/compat/FL/forms.H b/fltk/fltk/compat/FL/forms.H new file mode 100644 index 0000000..ab96944 --- /dev/null +++ b/fltk/fltk/compat/FL/forms.H @@ -0,0 +1,857 @@ +// +// "$Id: forms.H 4886 2006-03-30 09:55:32Z fabien $" +// +// Forms emulation header file for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2006 by Bill Spitzak and others. +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. +// +// Please report all bugs and problems to "fltk-bugs@fltk.org". +// + +#ifndef __FORMS_H__ +#define __FORMS_H__ + +#include <fltk/Window.h> +#include <fltk/run.h> +#include <fltk/draw.h> +#include <fltk/Color.h> +#include <fltk/Style.h> + +typedef fltk::Widget FL_OBJECT; +typedef fltk::Window FL_FORM; + +//////////////////////////////////////////////////////////////// +// Random constants & symbols defined by forms.h file: + +#ifndef NULL +#define NULL 0 +#endif +#ifndef FALSE +#define FALSE 0 +#define TRUE 1 +#endif + +#define FL_ON 1 +#define FL_OK 1 +#define FL_VALID 1 +#define FL_PREEMPT 1 +#define FL_AUTO 2 +#define FL_WHEN_NEEDED FL_AUTO +#define FL_OFF 0 +#define FL_NONE 0 +#define FL_CANCEL 0 +#define FL_INVALID 0 +#define FL_IGNORE -1 +#define FL_CLOSE -2 + +#define FL_LCOL fltk::BLACK +#define FL_COL1 fltk::GRAY75 +#define FL_MCOL fltk::GRAY85 +#define FL_LEFT_BCOL fltk::GRAY99 +#define FL_TOP_BCOL fltk::GRAY90 +#define FL_BOTTOM_BCOL fltk::GRAY35 +#define FL_RIGHT_BCOL fltk::GRAY20 +#define FL_INACTIVE fltk::GRAY66 +#define FL_INACTIVE_COL fltk::GRAY66 +#define FL_FREE_COL1 fltk::Color(16) +#define FL_FREE_COL2 fltk::Color(17) +#define FL_FREE_COL3 fltk::Color(18) +#define FL_FREE_COL4 fltk::Color(19) +#define FL_FREE_COL5 fltk::Color(20) +#define FL_FREE_COL6 fltk::Color(21) +#define FL_FREE_COL7 fltk::Color(22) +#define FL_FREE_COL8 fltk::Color(23) +#define FL_FREE_COL9 fltk::Color(24) +#define FL_FREE_COL10 fltk::Color(25) +#define FL_FREE_COL11 fltk::Color(26) +#define FL_FREE_COL12 fltk::Color(27) +#define FL_FREE_COL13 fltk::Color(28) +#define FL_FREE_COL14 fltk::Color(29) +#define FL_FREE_COL15 fltk::Color(30) +#define FL_FREE_COL16 fltk::Color(31) +#define FL_TOMATO fltk::Color(131) +#define FL_INDIANRED fltk::Color(164) +#define FL_SLATEBLUE fltk::Color(195) +#define FL_DARKGOLD fltk::Color(84) +#define FL_PALEGREEN fltk::Color(157) +#define FL_ORCHID fltk::Color(203) +#define FL_DARKCYAN fltk::Color(189) +#define FL_DARKTOMATO fltk::Color(113) +#define FL_WHEAT fltk::Color(174) + +#define FL_ALIGN_BESIDE fltk::ALIGN_INSIDE + +#define FL_PUP_TOGGLE 2 // FL_MENU_TOGGLE +#define FL_PUP_INACTIVE 1 // FL_MENU_INACTIVE +#define FL_NO_FRAME fltk::NO_BOX +#define FL_ROUNDED3D_UPBOX fltk::ROUND_UP_BOX +#define FL_ROUNDED3D_DOWNBOX fltk::ROUND_DOWN_BOX +#define FL_OVAL3D_UPBOX fltk::ROUND_UP_BOX +#define FL_OVAL3D_DOWNBOX fltk::ROUND_DOWN_BOX + +#define FL_MBUTTON1 1 +#define FL_LEFTMOUSE 1 +#define FL_MBUTTON2 2 +#define FL_MIDDLEMOUSE 2 +#define FL_MBUTTON3 3 +#define FL_RIGHTMOUSE 3 +#define FL_MBUTTON4 4 +#define FL_MBUTTON5 5 + +#define FL_INVALID_STYLE 255 +#define FL_NORMAL_STYLE 0 +#define FL_BOLD_STYLE 1 +#define FL_ITALIC_STYLE 2 +#define FL_BOLDITALIC_STYLE 3 +#define FL_FIXED_STYLE 4 +#define FL_FIXEDBOLD_STYLE 5 +#define FL_FIXEDITALIC_STYLE 6 +#define FL_FIXEDBOLDITALIC_STYLE 7 +#define FL_TIMES_STYLE 8 +#define FL_TIMESBOLD_STYLE 9 +#define FL_TIMESITALIC_STYLE 10 +#define FL_TIMESBOLDITALIC_STYLE 11 + +// hacks to change the labeltype() when passed to fl_set_object_lstyle(): +#define FL_SHADOW_STYLE 0x100 +#define FL_ENGRAVED_STYLE 0x200 +#define FL_EMBOSSED_STYLE 0x300 + +// size values are different from XForms, match older Forms: +#define FL_TINY_SIZE 8 +#define FL_SMALL_SIZE 11 // 10 +#undef FL_NORMAL_SIZE +#define FL_NORMAL_SIZE 14 // 12 +#define FL_MEDIUM_SIZE 18 // 14 +#define FL_LARGE_SIZE 24 // 18 +#define FL_HUGE_SIZE 32 // 24 +#define FL_DEFAULT_SIZE FL_SMALL_SIZE +#define FL_TINY_FONT FL_TINY_SIZE +#define FL_SMALL_FONT FL_SMALL_SIZE +#define FL_NORMAL_FONT FL_NORMAL_SIZE +#define FL_MEDIUM_FONT FL_MEDIUM_SIZE +#define FL_LARGE_FONT FL_LARGE_SIZE +#define FL_HUGE_FONT FL_HUGE_SIZE +#define FL_NORMAL_FONT1 FL_SMALL_FONT +#define FL_NORMAL_FONT2 FL_NORMAL_FONT +#define FL_DEFAULT_FONT FL_SMALL_FONT + +#define FL_RETURN_END_CHANGED FL_WHEN_RELEASE +#define FL_RETURN_CHANGED FL_WHEN_CHANGED +#define FL_RETURN_END FL_WHEN_RELEASE_ALWAYS +#define FL_RETURN_ALWAYS (FL_WHEN_CHANGED|FL_WHEN_NOT_CHANGED) + +#define FL_BOUND_WIDTH 3 + +typedef int FL_Coord; +typedef int FL_COLOR; + +//////////////////////////////////////////////////////////////// +// fltk interaction: + +#define FL_CMD_OPT void +extern FL_FORMS_API void fl_initialize(int*, char*[], const char*, FL_CMD_OPT*, int); +inline void fl_finish() {} + +typedef void (*FL_IO_CALLBACK) (int, void*); +inline void fl_add_io_callback(int fd, short w, FL_IO_CALLBACK cb, void* v) { + Fl::add_fd(fd,w,cb,v);} +inline void fl_remove_io_callback(int fd, short, FL_IO_CALLBACK) { + Fl::remove_fd(fd);} // removes all the callbacks! + +// type of callback is different and no "id" number is returned: +inline void fl_add_timeout(long msec, void (*cb)(void*), void* v) { + Fl::add_timeout(msec*.001, (Fl_Timeout_Handler)cb, v);} +inline void fl_remove_timeout(int) {} + +// type of callback is different! +inline void fl_set_idle_callback(void (*cb)()) {Fl::set_idle(cb);} + +FL_FORMS_API Fl_Widget* fl_do_forms(void); +FL_FORMS_API Fl_Widget* fl_check_forms(); +inline Fl_Widget* fl_do_only_forms(void) {return fl_do_forms();} +inline Fl_Widget* fl_check_only_forms(void) {return fl_check_forms();} + +// because of new redraw behavior, these are no-ops: +inline void fl_freeze_object(Fl_Widget*) {} +inline void fl_unfreeze_object(Fl_Widget*) {} +inline void fl_freeze_form(Fl_Window*) {} +inline void fl_unfreeze_form(Fl_Window*) {} +inline void fl_freeze_all_forms() {} +inline void fl_unfreeze_all_forms() {} + +inline void fl_set_focus_object(Fl_Window*, Fl_Widget* o) {Fl::focus(o);} +inline void fl_reset_focus_object(Fl_Widget* o) {Fl::focus(o);} +#define fl_set_object_focus fl_set_focus_object + +// void fl_set_form_atclose(Fl_Window*w,int (*cb)(Fl_Window*,void*),void* v) +// void fl_set_atclose(int (*cb)(Fl_Window*,void*),void*) +// fl_set_form_atactivate/atdeactivate not implemented! + +//////////////////////////////////////////////////////////////// +// Fl_Widget: + +inline void fl_set_object_boxtype(Fl_Widget* o, Fl_Boxtype a) {o->box(a);} +inline void fl_set_object_lsize(Fl_Widget* o,int s) {o->label_size(s);} +FL_FORMS_API void fl_set_object_lstyle(Fl_Widget* o,int a); +inline void fl_set_object_lcol(Fl_Widget* o, unsigned a) {o->label_color((Fl_Color)a);} +#define fl_set_object_lcolor fl_set_object_lcol +inline void fl_set_object_lalign(Fl_Widget* o, Fl_Align a) { o->clear_flag(FL_ALIGN_MASK); o->set_flag(a);} +#define fl_set_object_align fl_set_object_lalign +inline void fl_set_object_color(Fl_Widget* o,unsigned a,unsigned b) {o->color((Fl_Color)a); o->selection_color((Fl_Color)b);} +inline void fl_set_object_label(Fl_Widget* o, const char* a) {o->label(a); o->redraw();} +inline void fl_set_object_position(Fl_Widget*o,int x,int y) {o->position(x,y);} +inline void fl_set_object_size(Fl_Widget* o, int w, int h) {o->size(w,h);} +inline void fl_set_object_geometry(Fl_Widget* o,int x,int y,int w,int h) {o->resize(x,y,w,h);} + +inline void fl_get_object_geometry(Fl_Widget* o,int*x,int*y,int*w,int*h) { + *x = o->x(); *y = o->y(); *w = o->w(); *h = o->h();} +inline void fl_get_object_position(Fl_Widget* o,int*x,int*y) { + *x = o->x(); *y = o->y();} + +typedef void (*Forms_CB)(Fl_Widget*, long); +inline void fl_set_object_callback(Fl_Widget*o,Forms_CB c,long a) {o->callback(c,a);} +#define fl_set_call_back fl_set_object_callback +inline void fl_call_object_callback(Fl_Widget* o) {o->do_callback();} +inline void fl_trigger_object(Fl_Widget* o) {o->do_callback();} +inline void fl_set_object_return(Fl_Widget* o, int v) { + o->when(v|FL_WHEN_RELEASE);} + +inline void fl_redraw_object(Fl_Widget* o) {o->redraw();} +inline void fl_show_object(Fl_Widget* o) {o->show();} +inline void fl_hide_object(Fl_Widget* o) {o->hide();} +inline void fl_free_object(Fl_Widget* x) {delete x;} +inline void fl_delete_object(Fl_Widget* o) {((Fl_Group*)(o->parent()))->remove(*o);} +inline void fl_activate_object(Fl_Widget* o) {o->activate();} +inline void fl_deactivate_object(Fl_Widget* o) {o->deactivate();} + +inline void fl_add_object(Fl_Window* f, Fl_Widget* x) {f->add(x);} +inline void fl_insert_object(Fl_Widget* o, Fl_Widget* b) { + ((Fl_Group*)(b->parent()))->insert(*o,b);} + +inline Fl_Window* FL_ObjWin(Fl_Widget* o) {return o->window();} + +//////////////////////////////////////////////////////////////// +// things that appered in the demos a lot that I don't emulate, but +// I did not want to edit out of all the demos... + +inline int fl_get_border_width() {return 3;} +inline void fl_set_border_width(int) {} +inline void fl_set_object_dblbuffer(Fl_Widget*, int) {} +inline void fl_set_form_dblbuffer(Fl_Window*, int) {} + +//////////////////////////////////////////////////////////////// +// Fl_Window: + +inline void fl_free_form(Fl_Window* x) {delete x;} +inline void fl_redraw_form(Fl_Window* f) {f->redraw();} + +inline Fl_Window* fl_bgn_form(Fl_Boxtype b,int w,int h) { + Fl_Window* g = new Fl_Window(w,h,0); + g->box(b); + return g; +} +inline void fl_addto_form(Fl_Window* f) {f->begin();} +inline Fl_Group* fl_bgn_group() {return new Fl_Group(0,0,0,0,0);} +inline void fl_addto_group(Fl_Widget* o) {((Fl_Group* )o)->begin();} +FL_FORMS_API void fl_end_group(); +FL_FORMS_API void fl_end_form(); +#define resizebox _ddfdesign_kludge() + +inline void fl_scale_form(Fl_Window* f, double x, double y) { + f->resizable(f); f->size(int(f->w()*x),int(f->h()*y));} +inline void fl_set_form_position(Fl_Window* f,int x,int y) {f->position(x,y);} +inline void fl_set_form_size(Fl_Window* f, int w, int h) {f->size(w,h);} +inline void fl_set_form_geometry(Fl_Window* f,int x,int y,int w,int h) { + f->resize(x,y,w,h);} +#define fl_set_initial_placement fl_set_form_geometry +inline void fl_adjust_form_size(Fl_Window*) {} + +FL_FORMS_API void fl_show_form(Fl_Window* f,int p,int b,const char* n); +enum { // "p" argument values: + FL_PLACE_FREE = 0, // make resizable + FL_PLACE_MOUSE = 1, // mouse centered on form + FL_PLACE_CENTER = 2, // center of the screen + FL_PLACE_POSITION = 4,// fixed position, resizable + FL_PLACE_SIZE = 8, // fixed size, normal fltk behavior + FL_PLACE_GEOMETRY =16,// fixed size and position + FL_PLACE_ASPECT = 32, // keep aspect ratio (ignored) + FL_PLACE_FULLSCREEN=64,// fill screen + FL_PLACE_HOTSPOT = 128,// enables hotspot + FL_PLACE_ICONIC = 256,// iconic (ignored) + FL_FREE_SIZE=(1<<14), // force resizable + FL_FIX_SIZE =(1<<15) // force off resizable +}; +#define FL_PLACE_FREE_CENTER (FL_PLACE_CENTER|FL_FREE_SIZE) +#define FL_PLACE_CENTERFREE (FL_PLACE_CENTER|FL_FREE_SIZE) +enum { // "b" arguement values: + FL_NOBORDER = 0, + FL_FULLBORDER, + FL_TRANSIENT +//FL_MODAL = (1<<8) // not implemented yet in Forms +}; +inline void fl_set_form_hotspot(Fl_Window* w,int x,int y) {w->hotspot(x,y);} +inline void fl_set_form_hotobject(Fl_Window* w, Fl_Widget* o) {w->hotspot(o);} +extern FL_FORMS_API char fl_flip; // in forms.C +inline void fl_flip_yorigin() {fl_flip = 1;} + +#define fl_prepare_form_window fl_show_form +inline void fl_show_form_window(Fl_Window*) {} + +inline void fl_raise_form(Fl_Window* f) {f->show();} + +inline void fl_hide_form(Fl_Window* f) {f->hide();} +inline void fl_pop_form(Fl_Window* f) {f->show();} + +extern FL_FORMS_API char fl_modal_next; // in forms.C +inline void fl_activate_all_forms() {} +inline void fl_deactivate_all_forms() {fl_modal_next = 1;} +inline void fl_deactivate_form(Fl_Window*w) {w->deactivate();} +inline void fl_activate_form(Fl_Window*w) {w->activate();} + +inline void fl_set_form_title(Fl_Window* f, const char* s) {f->label(s);} +inline void fl_title_form(Fl_Window* f, const char* s) {f->label(s);} + +typedef void (*Forms_FormCB)(Fl_Widget*); +inline void fl_set_form_callback(Fl_Window* f,Forms_FormCB c) {f->callback(c);} +#define fl_set_form_call_back fl_set_form_callback + +inline void fl_init() {} +inline void fl_set_graphics_mode(int r, int /*d*/) { + Fl::visual(r ? FL_RGB : FL_INDEX); + // d should add FL_DOUBLE, but that always fails in fltk 2.0 +} + +inline int fl_form_is_visible(Fl_Window* f) {return f->visible();} + +inline int fl_mouse_button() {return Fl::event_button();} +#define fl_mousebutton fl_mouse_button + +#define fl_free free +#define fl_malloc malloc +#define fl_calloc calloc +#define fl_realloc realloc + +//////////////////////////////////////////////////////////////// +// Drawing functions. Only usable inside an Fl_Free object? + +#if 0 +inline void fl_drw_box(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) { + b->draw(x,y,w,h,bgc);} +inline void fl_drw_frame(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) { + b->draw(x,y,w,h,bgc,FL_FRAME_ONLY);} +#endif + +inline void fl_drw_text(Fl_Align align, int x, int y, int w, int h, + Fl_Color fgcolor, int size, Fl_Font style, + const char* s) { + fl_font(style,size); + fl_color(fgcolor); + fl_draw(s,x,y,w,h,align); +} + +// this does not work except for CENTER... +inline void fl_drw_text_beside(Fl_Align align, int x, int y, int w, int h, + Fl_Color fgcolor, int size, Fl_Font style, + const char* s) { + fl_font(style,size); + fl_color(fgcolor); + fl_draw(s,x,y,w,h,align); +} + +//inline void fl_set_font_name(Fl_Font n,const char* s) {fl_set_font(n,s);} + +inline void fl_mapcolor(Fl_Color c, uchar r, uchar g, uchar b) { + fl_set_color(c,fl_rgb(r,g,b));} +#define fl_set_clipping(x,y,w,h) fl_clip(x,y,w,h) +#define fl_unset_clipping() fl_pop_clip() + +//////////////////////////////////////////////////////////////// +// Forms classes: + +inline Fl_Widget* fl_add_new(Fl_Widget* p) {return p;} +inline Fl_Widget* fl_add_new(uchar t,Fl_Widget* p) {p->type(t); return p;} + +#define forms_constructor(type,name) \ +inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \ + return (type*)(fl_add_new(t, new type(x,y,w,h,l)));} +#define forms_constructort(type,name) \ +inline type* name(uchar t,int x,int y,int w,int h,const char* l) { \ + return (type*)(fl_add_new(new type(t,x,y,w,h,l)));} +#define forms_constructorb(type,name) \ +inline type* name(Fl_Boxtype t,int x,int y,int w,int h,const char* l) { \ + return (type*)(fl_add_new(new type(t,x,y,w,h,l)));} + +#include "Fl_FormsBitmap.h" +#define FL_NORMAL_BITMAP FL_NO_BOX +forms_constructorb(Fl_FormsBitmap, fl_add_bitmap) +inline void fl_set_bitmap_data(Fl_Widget* o, int w, int h, const uchar* b) { + ((Fl_FormsBitmap*)o)->set(w,h,b); +} + +#include "Fl_FormsPixmap.h" +#define FL_NORMAL_PIXMAP FL_NO_BOX +forms_constructorb(Fl_FormsPixmap, fl_add_pixmap) +inline void fl_set_pixmap_data(Fl_Widget* o, char*const* b) { + ((Fl_FormsPixmap*)o)->set(b); +} +//inline void fl_set_pixmap_file(Fl_Widget*, const char*); +inline void fl_set_pixmap_align(Fl_Widget* o,Fl_Align a,int,int) { o->clear_flag(FL_ALIGN_MASK); o->set_flag(a);} +//inline void fl_set_pixmap_colorcloseness(int, int, int); + +#include <fltk/Fl_Box.h> +forms_constructorb(Fl_Box, fl_add_box) + +#include <fltk/Fl_Browser.h> +forms_constructor(Fl_Browser, fl_add_browser) + +inline void fl_clear_browser(Fl_Widget* o) { + ((Fl_Browser*)o)->clear();} +inline void fl_add_browser_line(Fl_Widget* o, const char* s) { + ((Fl_Browser*)o)->add(s);} +inline void fl_addto_browser(Fl_Widget* o, const char* s) { + ((Fl_Browser*)o)->add(s);} /* should also scroll to bottom */ +//inline void fl_addto_browser_chars(Fl_Widget*, const char*) +//#define fl_append_browser fl_addto_browser_chars +inline void fl_insert_browser_line(Fl_Widget* o, int n, const char* s) { + ((Fl_Browser*)o)->insert(n,s);} +inline void fl_delete_browser_line(Fl_Widget* o, int n) { + ((Fl_Browser*)o)->remove(n);} +inline void fl_replace_browser_line(Fl_Widget* o, int n, const char* s) { + ((Fl_Browser*)o)->replace(n,s);} +inline char* fl_get_browser_line(Fl_Widget* o, int n) { + return (char*)(((Fl_Browser*)o)->text(n));} +FL_FORMS_API int fl_load_browser(Fl_Widget* o, const char* f); +inline void fl_select_browser_line(Fl_Widget* o, int n) { + ((Fl_Browser*)o)->select(n,1);} +inline void fl_deselect_browser_line(Fl_Widget* o, int n) { + ((Fl_Browser*)o)->select(n,0);} +inline void fl_deselect_browser(Fl_Widget* o) { + ((Fl_Browser*)o)->deselect();} +inline int fl_isselected_browser_line(Fl_Widget* o, int n) { + return ((Fl_Browser*)o)->selected(n);} +inline int fl_get_browser_topline(Fl_Widget* o) { + return ((Fl_Browser*)o)->topline();} +inline int fl_get_browser(Fl_Widget* o) { + return ((Fl_Browser*)o)->value();} +inline int fl_get_browser_maxline(Fl_Widget* o) { + return ((Fl_Browser*)o)->size();} +//linline int fl_get_browser_screenlines(Fl_Widget*); +inline void fl_set_browser_topline(Fl_Widget* o, int n) { + ((Fl_Browser*)o)->topline(n);} +inline void fl_set_browser_fontsize(Fl_Widget* o, int s) { + ((Fl_Browser*)o)->text_size(s);} +inline void fl_set_browser_fontstyle(Fl_Widget* o, int s) { + ((Fl_Browser*)o)->text_font(fl_fonts+s);} +inline void fl_set_browser_specialkey(Fl_Widget* o, char c) { + ((Fl_Browser*)o)->format_char(c);} +//inline void fl_set_browser_vscrollbar(Fl_Widget*, int); +//inline void fl_set_browser_hscrollbar(Fl_Widget*, int); +//inline void fl_set_browser_leftslider(Fl_Widget*, int); +//#define fl_set_browser_leftscrollbar fl_set_browser_leftslider +//inline void fl_set_browser_line_selectable(Fl_Widget*, int, int); +//inline void fl_get_browser_dimension(Fl_Widget*,int*,int*,int*,int*); +//inline void fl_set_browser_dblclick_callback(Fl_Widget*,FL_CALLBACKPTR,long); +//inline void fl_set_browser_xoffset(Fl_Widget*, FL_Coord); +//inline void fl_set_browser_scrollbarsize(Fl_Widget*, int, int); +inline void fl_setdisplayed_browser_line(Fl_Widget* o, int n, int i) { + ((Fl_Browser*)o)->display(n,i);} +inline int fl_isdisplayed_browser_line(Fl_Widget* o, int n) { + return ((Fl_Browser*)o)->displayed(n);} + +#include <fltk/Fl_Button.h> + +#define FL_NORMAL_BUTTON 0 +//#define FL_HIDDEN_BUTTON +#define FL_TOUCH_BUTTON 4 +#define FL_INOUT_BUTTON 5 +#define FL_RETURN_BUTTON 6 +#define FL_HIDDEN_RET_BUTTON 7 +#define FL_PUSH_BUTTON FL_TOGGLE_BUTTON +#define FL_MENU_BUTTON 9 + +extern FL_FORMS_API int fl_old_shortcut(const char*); + +FL_FORMS_API Fl_Button* fl_add_button(uchar t,int x,int y,int w,int h,const char* l); +inline int fl_get_button(Fl_Widget* b) {return ((Fl_Button*)b)->value();} +inline void fl_set_button(Fl_Widget* b, int v) {((Fl_Button*)b)->value(v);} +inline int fl_get_button_numb(Fl_Widget*) {return Fl::event_button();} +inline void fl_set_object_shortcut(Fl_Widget* b, const char* s, int=0) { + b->shortcut(fl_old_shortcut(s));} +#define fl_set_button_shortcut fl_set_object_shortcut + +#include <fltk/Fl_Light_Button.h> +forms_constructor(Fl_Light_Button, fl_add_lightbutton) + +#include <fltk/Fl_Round_Button.h> +forms_constructor(Fl_Round_Button, fl_add_roundbutton) +forms_constructor(Fl_Round_Button, fl_add_round3dbutton) + +#include <fltk/Fl_Check_Button.h> +forms_constructor(Fl_Check_Button, fl_add_checkbutton) + +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;} +inline void fl_set_bitmapbutton_data(Fl_Widget* o,int a,int b,uchar* c) { + (new Fl_Bitmap(c,a,b))->label(o);} // does not delete old Fl_Bitmap! + +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;} +inline void fl_set_pixmapbutton_data(Fl_Widget* o, const char*const* c) { + (new Fl_Pixmap(c))->label(o);} // does not delete old Fl_Pixmap! + +// Fl_Canvas object not yet implemented! + +#include "Fl_Chart.h" + +forms_constructor(Fl_Chart, fl_add_chart) +inline void fl_clear_chart(Fl_Widget* o) { + ((Fl_Chart*)o)->clear();} +inline void fl_add_chart_value(Fl_Widget* o,double v,const char* s,uchar c){ + ((Fl_Chart*)o)->add(v,s,c);} +inline void fl_insert_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) { + ((Fl_Chart*)o)->insert(i,v,s,c);} +inline void fl_replace_chart_value(Fl_Widget* o, int i, double v, const char* s, uchar c) { + ((Fl_Chart*)o)->replace(i,v,s,c);} +inline void fl_set_chart_bounds(Fl_Widget* o, double a, double b) { + ((Fl_Chart*)o)->bounds(a,b);} +inline void fl_set_chart_maxnumb(Fl_Widget* o, int v) { + ((Fl_Chart*)o)->maxsize(v);} +inline void fl_set_chart_autosize(Fl_Widget* o, int v) { + ((Fl_Chart*)o)->autosize(v);} +inline void fl_set_chart_lstyle(Fl_Widget* o, Fl_Font v) { + ((Fl_Chart*)o)->text_font(v);} +inline void fl_set_chart_lsize(Fl_Widget* o, int v) { + ((Fl_Chart*)o)->text_size(v);} +inline void fl_set_chart_lcolor(Fl_Widget* o, unsigned v) { + ((Fl_Chart*)o)->text_color((Fl_Color)v);} +#define fl_set_chart_lcol fl_set_chart_lcolor + +#include <fltk/Fl_Choice.h> + +#define FL_NORMAL_CHOICE 0 +#define FL_NORMAL_CHOICE2 0 +#define FL_DROPLIST_CHOICE 0 + +forms_constructor(Fl_Choice, fl_add_choice) +inline void fl_clear_choice(Fl_Widget* o) { + ((Fl_Choice*)o)->clear();} +inline void fl_addto_choice(Fl_Widget* o, const char* s) { + ((Fl_Choice*)o)->add(s);} +inline void fl_replace_choice(Fl_Widget* o, int i, const char* s) { + ((Fl_Choice*)o)->replace(i-1,s);} +inline void fl_delete_choice(Fl_Widget* o, int i) { + ((Fl_Choice*)o)->remove(i-1);} +inline void fl_set_choice(Fl_Widget* o, int i) { + ((Fl_Choice*)o)->value(i-1);} +// inline void fl_set_choice_text(Fl_Widget*, const char*); +inline int fl_get_choice(Fl_Widget* o) { + return ((Fl_Choice*)o)->value()+1;} +// inline const char* fl_get_choice_item_text(Fl_Widget*, int); +// inline int fl_get_choice_maxitems(Fl_Widget*); +inline const char* fl_get_choice_text(Fl_Widget* o) { + return ((Fl_Choice*)o)->text();} +inline void fl_set_choice_fontsize(Fl_Widget* o, int x) { + ((Fl_Choice*)o)->text_size(x);} +inline void fl_set_choice_fontstyle(Fl_Widget* o, Fl_Font x) { + ((Fl_Choice*)o)->text_font(x);} +// inline void fl_set_choice_item_mode(Fl_Widget*, int, unsigned); +// inline void fl_set_choice_item_shortcut(Fl_Widget*, int, const char*); + +#include <fltk/Fl_Clock.h> +forms_constructor(Fl_Clock, fl_add_clock) +inline void fl_get_clock(Fl_Widget* o, int* h, int* m, int* s) { + *h = ((Fl_Clock*)o)->hour(); + *m = ((Fl_Clock*)o)->minute(); + *s = ((Fl_Clock*)o)->second(); +} + +#include <fltk/Fl_Counter.h> +forms_constructor(Fl_Counter, fl_add_counter) +inline void fl_set_counter_value(Fl_Widget* o, double v) { + ((Fl_Counter*)o)->value(v);} +inline void fl_set_counter_bounds(Fl_Widget* o, double a, double b) { + ((Fl_Counter*)o)->range(a,b);} +inline void fl_set_counter_step(Fl_Widget* o, double a, double b) { + ((Fl_Counter*)o)->step(a / b);} +inline void fl_set_counter_precision(Fl_Widget* o, int v) { +// ((Fl_Counter*)o)->precision(v);} + ((Fl_Counter*)o)->step(1/(10^v));} +inline void fl_set_counter_return(Fl_Widget* o, int v) { + ((Fl_Counter*)o)->when(v|FL_WHEN_RELEASE);} +inline double fl_get_counter_value(Fl_Widget* o) { + return ((Fl_Counter*)o)->value();} +inline void fl_get_counter_bounds(Fl_Widget* o, float* a, float* b) { + *a = float(((Fl_Counter*)o)->minimum()); + *b = float(((Fl_Counter*)o)->maximum()); +} +//inline void fl_set_counter_filter(Fl_Widget*,const char* (*)(Fl_Widget*,double,int)); + +// Cursor stuff cannot be emulated because it uses X stuff +inline void fl_set_cursor(Fl_Window* w, Fl_Cursor c) {w->cursor(c);} +#define FL_INVISIBLE_CURSOR FL_CURSOR_NONE +#define FL_DEFAULT_CURSOR FL_CURSOR_DEFAULT + +#include <fltk/Fl_Dial.h> + +#define FL_DIAL_COL1 FL_GRAY +#define FL_DIAL_COL2 37 + +forms_constructor(Fl_Dial, fl_add_dial) +inline void fl_set_dial_value(Fl_Widget* o, double v) { + ((Fl_Dial*)o)->value(v);} +inline double fl_get_dial_value(Fl_Widget* o) { + return ((Fl_Dial*)o)->value();} +inline void fl_set_dial_bounds(Fl_Widget* o, double a, double b) { + ((Fl_Dial*)o)->range(a, b);} +inline void fl_get_dial_bounds(Fl_Widget* o, float* a, float* b) { + *a = float(((Fl_Dial*)o)->minimum()); + *b = float(((Fl_Dial*)o)->maximum()); +} +inline void fl_set_dial_return(Fl_Widget* o, int i) { + ((Fl_Dial*)o)->when(i|FL_WHEN_RELEASE);} +inline void fl_set_dial_angles(Fl_Widget* o, int a, int b) { + ((Fl_Dial*)o)->angles(a, b);} +//inline void fl_set_dial_cross(Fl_Widget* o, int); +// inline void fl_set_dial_direction(Fl_Widget* o, uchar d) { +// ((Fl_Dial*)o)->direction(d);} +inline void fl_set_dial_step(Fl_Widget* o, double v) { + ((Fl_Dial*)o)->step(v);} + +// Frames: + +inline Fl_Widget* fl_add_frame(Fl_Boxtype i,int x,int y,int w,int h,const char* l) { + return fl_add_box(i,x-3,y-3,w+6,h+6,l);} + +// labelframe nyi +inline Fl_Widget* fl_add_labelframe(Fl_Boxtype i,int x,int y,int w,int h,const char* l) { + Fl_Widget* o = fl_add_box(i,x-3,y-3,w+6,h+6,l); + o->clear_flag(FL_ALIGN_MASK); + o->set_flag(FL_ALIGN_TOP | FL_ALIGN_LEFT); + return o; +} + +#include "Fl_Free.h" +inline Fl_Free* +fl_add_free(int t,double x,double y,double w,double h,const char* l, + FL_HANDLEPTR hdl) { + return (Fl_Free*)(fl_add_new( + new Fl_Free(t,int(x),int(y),int(w),int(h),l,hdl))); +} + +#include <fltk/fl_ask.h> +#include <fltk/fl_show_colormap.h> + +inline int fl_show_question(const char* c, int = 0) {return fl_ask(c);} +FL_FORMS_API void fl_show_message(const char *,const char *,const char *); +FL_FORMS_API void fl_show_alert(const char *,const char *,const char *,int=0); +FL_FORMS_API int fl_show_question(const char *,const char *,const char *); +inline const char *fl_show_input(const char *l,const char*d=0) {return fl_input(l,d);} +/*const*/ char *fl_show_simple_input(const char *label, const char *deflt = 0); +int fl_show_choice( + const char *m1, + const char *m2, + const char *m3, + int numb, + const char *b0, + const char *b1, + const char *b2); + +inline void fl_set_goodies_font(int a, unsigned b) { + fl_message_style->label_font = fl_fonts+a; + fl_message_style->label_size = b; +} +#define fl_show_messages fl_message +inline int fl_show_choices(const char* c,int n,const char* b1,const char* b2, + const char* b3, int) { + return fl_show_choice(0,c,0,n,b1,b2,b3); +} + +#include <fltk/filename.h> +#include <fltk/fl_file_chooser.h> +inline int do_matching(char* a, const char* b) {return filename_match(a,b);} + +// Forms-compatable file chooser (implementation in fselect.C): +FL_FORMS_API char* fl_show_file_selector(const char* message,const char* dir, + const char* pat,const char* fname); +FL_FORMS_API char* fl_get_directory(); +FL_FORMS_API char* fl_get_pattern(); +FL_FORMS_API char* fl_get_filename(); + +#include <fltk/Fl_Input.h> +forms_constructor(Fl_Input, fl_add_input) +inline void fl_set_input(Fl_Widget* o, const char* v) { + ((Fl_Input*)o)->value(v);} +inline void fl_set_input_return(Fl_Widget* o, int x) { + ((Fl_Input*)o)->when(x | FL_WHEN_RELEASE);} +inline void fl_set_input_color(Fl_Widget* o, unsigned a, unsigned /*b*/) { + ((Fl_Input*)o)->text_color((Fl_Color)a); +// ((Fl_Input*)o)->cursor_color((Fl_Color)b); +} +// inline void fl_set_input_scroll(Fl_Widget*, int); +inline void fl_set_input_cursorpos(Fl_Widget* o, int x, int /*y*/) { + ((Fl_Input*)o)->position(x);} +// inline void fl_set_input_selected(Fl_Widget*, int); +// inline void fl_set_input_selected_range(Fl_Widget*, int, int); +// inline void fl_set_input_maxchars(Fl_Widget*, int); +// inline void fl_set_input_format(Fl_Widget*, int, int); +// inline void fl_set_input_hscrollbar(Fl_Widget*, int); +// inline void fl_set_input_vscrollbar(Fl_Widget*, int); +// inline void fl_set_input_xoffset(Fl_Widget*, int); +// inline void fl_set_input_topline(Fl_Widget*, int); +// inline void fl_set_input_scrollbarsize(Fl_Widget*, int, int); +// inline int fl_get_input_topline(Fl_Widget*); +// inline int fl_get_input_screenlines(Fl_Widget*); +inline int fl_get_input_cursorpos(Fl_Widget* o, int*x, int*y) { + *x = ((Fl_Input*)o)->position(); *y = 0; return *x;} +// inline int fl_get_input_numberoflines(Fl_Widget*); +// inline void fl_get_input_format(Fl_Widget*, int*, int*); +inline const char* fl_get_input(Fl_Widget* o) {return ((Fl_Input*)o)->value();} + +#include <fltk/Fl_Menu_Button.h> + +// types are not implemented, they all act like FL_PUSH_MENU: +#define FL_TOUCH_MENU 0 +#define FL_PUSH_MENU 1 +#define FL_PULLDOWN_MENU 2 +forms_constructor(Fl_Menu_Button, fl_add_menu) + +inline void fl_clear_menu(Fl_Widget* o) { + ((Fl_Menu_Button*)o)->clear();} +inline void fl_set_menu(Fl_Widget* o, const char* s) { + ((Fl_Menu_Button*)o)->clear(); ((Fl_Menu_Button*)o)->add(s);} +inline void fl_addto_menu(Fl_Widget* o, const char* s) { + ((Fl_Menu_Button*)o)->add(s);} +inline void fl_replace_menu_item(Fl_Widget* o, int i, const char* s) { + ((Fl_Menu_Button*)o)->replace(i-1,s);} +inline void fl_delete_menu_item(Fl_Widget* o, int i) { + ((Fl_Menu_Button*)o)->remove(i-1);} +inline void fl_set_menu_item_shortcut(Fl_Widget* o, int i, const char* s) { + ((Fl_Menu_Button*)o)->shortcut(i-1,fl_old_shortcut(s));} +// inline void fl_set_menu_item_mode(Fl_Widget* o, int i, long x) { +// ((Fl_Menu_Button*)o)->mode(i-1,x);} +inline void fl_show_menu_symbol(Fl_Widget*, int ) { +/* ((Fl_Menu_Button*)o)->show_menu_symbol(i); */} +// inline void fl_set_menu_popup(Fl_Widget*, int); +inline int fl_get_menu(Fl_Widget* o) { + return ((Fl_Menu_Button*)o)->value()+1;} +inline const char* fl_get_menu_item_text(Fl_Widget* o, int i) { + return ((Fl_Menu_Button*)o)->text(i);} +inline int fl_get_menu_maxitems(Fl_Widget* o) { + return ((Fl_Menu_Button*)o)->size();} +inline int fl_get_menu_item_mode(Fl_Widget* o, int i) { + return ((Fl_Menu_Button*)o)->mode(i);} +inline const char* fl_get_menu_text(Fl_Widget* o) { + return ((Fl_Menu_Button*)o)->text();} + +#include "Fl_Positioner.h" +#define FL_NORMAL_POSITIONER 0 +forms_constructor(Fl_Positioner, fl_add_positioner) +inline void fl_set_positioner_xvalue(Fl_Widget* o, double v) { + ((Fl_Positioner*)o)->xvalue(v);} +inline double fl_get_positioner_xvalue(Fl_Widget* o) { + return ((Fl_Positioner*)o)->xvalue();} +inline void fl_set_positioner_xbounds(Fl_Widget* o, double a, double b) { + ((Fl_Positioner*)o)->xbounds(a,b);} +inline void fl_get_positioner_xbounds(Fl_Widget* o, float* a, float* b) { + *a = float(((Fl_Positioner*)o)->xminimum()); + *b = float(((Fl_Positioner*)o)->xmaximum()); +} +inline void fl_set_positioner_yvalue(Fl_Widget* o, double v) { + ((Fl_Positioner*)o)->yvalue(v);} +inline double fl_get_positioner_yvalue(Fl_Widget* o) { + return ((Fl_Positioner*)o)->yvalue();} +inline void fl_set_positioner_ybounds(Fl_Widget* o, double a, double b) { + ((Fl_Positioner*)o)->ybounds(a,b);} +inline void fl_get_positioner_ybounds(Fl_Widget* o, float* a, float* b) { + *a = float(((Fl_Positioner*)o)->yminimum()); + *b = float(((Fl_Positioner*)o)->ymaximum()); +} +inline void fl_set_positioner_xstep(Fl_Widget* o, double v) { + ((Fl_Positioner*)o)->xstep(v);} +inline void fl_set_positioner_ystep(Fl_Widget* o, double v) { + ((Fl_Positioner*)o)->ystep(v);} +inline void fl_set_positioner_return(Fl_Widget* o, int v) { + ((Fl_Positioner*)o)->when(v|FL_WHEN_RELEASE);} + +#include <fltk/Fl_Slider.h> + +#define FL_HOR_BROWSER_SLIDER FL_HOR_SLIDER +#define FL_VERT_BROWSER_SLIDER FL_VERT_SLIDER + +forms_constructor(Fl_Slider, fl_add_slider) +#define FL_SLIDER_COL1 FL_GRAY +inline void fl_set_slider_value(Fl_Widget* o, double v) { + ((Fl_Slider*)o)->value(v);} +inline double fl_get_slider_value(Fl_Widget* o) { + return ((Fl_Slider*)o)->value();} +inline void fl_set_slider_bounds(Fl_Widget* o, double a, double b) { + ((Fl_Slider*)o)->range(a, b);} +inline void fl_get_slider_bounds(Fl_Widget* o, float* a, float* b) { + *a = float(((Fl_Slider*)o)->minimum()); + *b = float(((Fl_Slider*)o)->maximum()); +} +inline void fl_set_slider_return(Fl_Widget* o, int i) { + ((Fl_Slider*)o)->when(i|FL_WHEN_RELEASE);} +inline void fl_set_slider_step(Fl_Widget* o, double v) { + ((Fl_Slider*)o)->step(v);} +// inline void fl_set_slider_increment(Fl_Widget* o, double v, double); +inline void fl_set_slider_size(Fl_Widget* o, double v) { + ((Fl_Slider*)o)->slider_size(v);} + +#include <fltk/Fl_Value_Slider.h> +forms_constructor(Fl_Value_Slider, fl_add_valslider) + +inline void fl_set_slider_precision(Fl_Widget* o, int i) { + double v = 1.0; + while (i--) v /= 10.0; + ((Fl_Value_Slider*)o)->step(v); +} + +// The forms text object was the same as an Fl_Box except it inverted the +// meaning of FL_ALIGN_INSIDE. Implementation in forms.C +class FL_FORMS_API Fl_FormsText : public Fl_Widget { +protected: + void draw(); +public: + Fl_FormsText(Fl_Boxtype b, int x, int y, int w, int h, const char* l=0) + : Fl_Widget(x,y,w,h,l) {box(b); clear_flag(FL_ALIGN_MASK); set_flag(FL_ALIGN_LEFT);} +}; +#define FL_NORMAL_TEXT FL_NO_BOX +forms_constructorb(Fl_FormsText, fl_add_text) + +#include "Fl_Timer.h" +forms_constructort(Fl_Timer, fl_add_timer) +inline void fl_set_timer(Fl_Widget* o, double v) {((Fl_Timer*)o)->value(v);} +inline double fl_get_timer(Fl_Widget* o) {return ((Fl_Timer*)o)->value();} +inline void fl_suspend_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(1);} +inline void fl_resume_timer(Fl_Widget* o) {((Fl_Timer*)o)->suspended(0);} +inline void fl_set_timer_countup(Fl_Widget* o,char d) {((Fl_Timer*)o)->direction(d);} +FL_FORMS_API void fl_gettime(long* sec, long* usec); + +// Fl_XYPlot nyi + + +// stuff from DDForms: + +inline int fl_double_click() {return Fl::event_clicks();} +inline void fl_draw() {Fl::flush();} + +#endif /* define __FORMS_H__ */ + +// +// End of "$Id: forms.H 4886 2006-03-30 09:55:32Z fabien $". +// diff --git a/fltk/fltk/compat/FL/gl.h b/fltk/fltk/compat/FL/gl.h new file mode 100644 index 0000000..b6cba63 --- /dev/null +++ b/fltk/fltk/compat/FL/gl.h @@ -0,0 +1,19 @@ +#ifndef FL_gl_H +#define FL_gl_H + +#include <fltk/gl.h> + +#define gl_start fltk::glstart +#define gl_finish fltk::glfinish +#define gl_color fltk::glsetcolor +#define gl_rect fltk::glstrokerect +#define gl_rectf fltk::glfillrect +#define gl_font fltk::glsetfont +inline float gl_height() {return fltk::glgetascent()+fltk::glgetdescent();} +#define gl_descent fltk::glgetdescent +#define gl_width fltk::glgetwidth +#define gl_draw fltk::gldrawtext +//void gl_measure(const char*, int& x, int& y); +#define gl_draw_image fltk::gldrawimage + +#endif // !FL_gl_H diff --git a/fltk/fltk/compat/FL/glut.H b/fltk/fltk/compat/FL/glut.H new file mode 100644 index 0000000..9545e9a --- /dev/null +++ b/fltk/fltk/compat/FL/glut.H @@ -0,0 +1,2 @@ +#include "Fl_Widget.H" +#include <fltk/glut.h> diff --git a/fltk/fltk/compat/FL/math.h b/fltk/fltk/compat/FL/math.h new file mode 100644 index 0000000..5353cc0 --- /dev/null +++ b/fltk/fltk/compat/FL/math.h @@ -0,0 +1 @@ +#include <fltk/math.h> diff --git a/fltk/fltk/compat/FL/menubar.h b/fltk/fltk/compat/FL/menubar.h new file mode 100644 index 0000000..83b3af8 --- /dev/null +++ b/fltk/fltk/compat/FL/menubar.h @@ -0,0 +1,65 @@ +// This is an additional header file for "DDForms", which was our internal +// enhancement of Forms. This defines the precursor of the Fl_Menu class. +// +// Unfortunately it defined the callbacks as taking a long rather +// than a void* argument, requiring some dubious casts to emulate it: + +#include "Fl_Menu_Bar.h" + +struct FL_API MenuEntry { + const char *text; /*initial character indicates "type", 0 = end of menu*/ + ulong bind; /* key binding in forms format (#x, etc) */ + void (*cb)(Fl_Widget *,long); /* callback */ + long data; /* value for callback */ + int flags; /* see below for flags */ + uchar labeltype; + uchar labelfont; + uchar labelsize; + uchar labelcolor; +}; + +#define CHECKED FL_MENU_CHECK +#define UNCHECKED FL_MENU_BOX +#define DISABLED FL_MENU_INACTIVE + +/* Turn a box into a menu bar: */ +inline void MenuBar(Fl_Widget *o,MenuEntry *m) { + Fl_Menu_Bar *mb = new Fl_Menu_Bar(o->x(),o->y(),o->w(),o->h()); + mb->menu((Fl_Menu_Item*)m); + mb->box(0); + Fl_Group *g = (Fl_Group *)(o->parent()); + int i = g->find(*o); + g->insert(*mb, i<g->children()-1 ? g->child(i+1) : 0); +} + +/* advance to the Nth item in menu, skipping submenus: */ +inline MenuEntry *MenuGetEntry(MenuEntry *m,int i) { + return (MenuEntry*)(((Fl_Menu_Item*)m)->next(i)); +} + +/* Init the shortcuts for a widget with a popup menu: */ +inline void MenuSetShortcuts(Fl_Widget *, MenuEntry *) {} + +inline void MenuAdd( + MenuEntry m[], + int, /* number of entries in menutable, ignored here */ + const char *text, + const char *bind, + void (*cb)(Fl_Widget *,long), + long data, + int flags) { + ((Fl_Menu_Item*)m)->add(text,bind,(Fl_Callback*)cb,(void *)data,flags); +} + +inline MenuEntry *MenuPopup(Fl_Widget *o,const char *title,MenuEntry *m, + int x, int y) { + const Fl_Menu_Item* v = ((Fl_Menu_Item*)m)->popup(x,y,title); + if (v && v->callback_) v->do_callback(o); + return (MenuEntry *)v; +} + +inline MenuEntry *MenuHandleShortcut(Fl_Widget *o,MenuEntry *m,char) { + const Fl_Menu_Item* v = ((Fl_Menu_Item*)m)->test_shortcut(); + if (v && v->callback_) v->do_callback(o); + return (MenuEntry *)v; +} diff --git a/fltk/fltk/compat/FL/x.H b/fltk/fltk/compat/FL/x.H new file mode 100644 index 0000000..3278a21 --- /dev/null +++ b/fltk/fltk/compat/FL/x.H @@ -0,0 +1,24 @@ +// This emulation header was designed to get flwm to compile. It +// probably does not work for any other x fltk program. + +#ifndef Fl_X_H +#define Fl_X_H + +#include "Enumerations.H" +#include <fltk/x.h> + +#define Fl_X fltk::CreatedWindow +#define fl_display fltk::xdisplay +#define fl_screen fltk::xscreen +#define fl_xevent (&fltk::xevent) +#define fl_colormap fltk::xcolormap +#define fl_open_display fltk::open_display +#define fl_visual fltk::xvisual +#define fl_xid(w) fltk::xid(w) +#define fl_event_time fltk::event_time +#define fl_xpixel(x) fltk::xpixel(x) +#define fl_window fltk::xwindow +#define fl_gc fltk::gc +#define fl_xfont fltk::xfont() + +#endif |