summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>1998-10-06 18:21:25 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>1998-10-06 18:21:25 +0000
commitf9039b2ae21988783feae9b362818e7923e82d14 (patch)
tree6d6fe3679d73448758f9794e7d4d4f6b22a4adad /FL
parent67e89232f9ba067825a158734a09e0fa21aacbe3 (diff)
Initial revision
git-svn-id: file:///fltk/svn/fltk/trunk@2 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
-rw-r--r--FL/Enumerations.H293
-rw-r--r--FL/Fl.H195
-rw-r--r--FL/Fl_Adjuster.H26
-rw-r--r--FL/Fl_Bitmap.H24
-rw-r--r--FL/Fl_Box.H19
-rw-r--r--FL/Fl_Browser.H86
-rw-r--r--FL/Fl_Browser_.H123
-rw-r--r--FL/Fl_Button.H48
-rw-r--r--FL/Fl_Chart.H65
-rw-r--r--FL/Fl_Check_Button.H15
-rw-r--r--FL/Fl_Choice.H20
-rw-r--r--FL/Fl_Clock.H38
-rw-r--r--FL/Fl_Color_Chooser.H71
-rw-r--r--FL/Fl_Counter.H47
-rw-r--r--FL/Fl_Dial.H43
-rw-r--r--FL/Fl_Double_Window.H23
-rw-r--r--FL/Fl_Fill_Dial.H12
-rw-r--r--FL/Fl_Fill_Slider.H12
-rw-r--r--FL/Fl_Float_Input.H12
-rw-r--r--FL/Fl_FormsBitmap.H23
-rw-r--r--FL/Fl_FormsPixmap.H23
-rw-r--r--FL/Fl_Free.H40
-rw-r--r--FL/Fl_Gl_Window.H60
-rw-r--r--FL/Fl_Group.H73
-rw-r--r--FL/Fl_Hold_Browser.H12
-rw-r--r--FL/Fl_Hor_Fill_Slider.H12
-rw-r--r--FL/Fl_Hor_Nice_Slider.H12
-rw-r--r--FL/Fl_Hor_Slider.H12
-rw-r--r--FL/Fl_Hor_Value_Slider.H12
-rw-r--r--FL/Fl_Image.H22
-rw-r--r--FL/Fl_Input.H22
-rw-r--r--FL/Fl_Input_.H107
-rw-r--r--FL/Fl_Int_Input.H12
-rw-r--r--FL/Fl_Light_Button.H23
-rw-r--r--FL/Fl_Line_Dial.H12
-rw-r--r--FL/Fl_Menu.H2
-rw-r--r--FL/Fl_Menu_.H82
-rw-r--r--FL/Fl_Menu_Bar.H27
-rw-r--r--FL/Fl_Menu_Button.H19
-rw-r--r--FL/Fl_Menu_Item.H134
-rw-r--r--FL/Fl_Menu_Window.H29
-rw-r--r--FL/Fl_Multi_Browser.H12
-rw-r--r--FL/Fl_Multi_Label.H18
-rw-r--r--FL/Fl_Multiline_Input.H12
-rw-r--r--FL/Fl_Multiline_Output.H12
-rw-r--r--FL/Fl_Nice_Slider.H12
-rw-r--r--FL/Fl_Object.H5
-rw-r--r--FL/Fl_Output.H18
-rw-r--r--FL/Fl_Overlay_Window.H31
-rw-r--r--FL/Fl_Pack.H22
-rw-r--r--FL/Fl_Pixmap.H22
-rw-r--r--FL/Fl_Positioner.H51
-rw-r--r--FL/Fl_Radio_Button.H12
-rw-r--r--FL/Fl_Radio_Light_Button.H12
-rw-r--r--FL/Fl_Radio_Round_Button.H12
-rw-r--r--FL/Fl_Repeat_Button.H18
-rw-r--r--FL/Fl_Return_Button.H19
-rw-r--r--FL/Fl_Roller.H19
-rw-r--r--FL/Fl_Round_Button.H15
-rw-r--r--FL/Fl_Round_Clock.H12
-rw-r--r--FL/Fl_Scroll.H50
-rw-r--r--FL/Fl_Scrollbar.H30
-rw-r--r--FL/Fl_Secret_Input.H12
-rw-r--r--FL/Fl_Select_Browser.H12
-rw-r--r--FL/Fl_Simple_Counter.H12
-rw-r--r--FL/Fl_Single_Window.H20
-rw-r--r--FL/Fl_Slider.H46
-rw-r--r--FL/Fl_Tabs.H31
-rw-r--r--FL/Fl_Tile.H18
-rw-r--r--FL/Fl_Timer.H38
-rw-r--r--FL/Fl_Toggle_Button.H12
-rw-r--r--FL/Fl_Toggle_Light_Button.H6
-rw-r--r--FL/Fl_Toggle_Round_Button.H6
-rw-r--r--FL/Fl_Valuator.H59
-rw-r--r--FL/Fl_Value_Input.H50
-rw-r--r--FL/Fl_Value_Output.H32
-rw-r--r--FL/Fl_Value_Slider.H26
-rw-r--r--FL/Fl_Widget.H178
-rw-r--r--FL/Fl_Window.H90
-rw-r--r--FL/dirent.h4
-rw-r--r--FL/filename.H41
-rw-r--r--FL/fl_ask.H51
-rw-r--r--FL/fl_draw.H135
-rw-r--r--FL/fl_file_chooser.H9
-rw-r--r--FL/fl_message.H2
-rw-r--r--FL/fl_show_colormap.H10
-rw-r--r--FL/fl_show_input.H2
-rw-r--r--FL/forms.H810
-rw-r--r--FL/gl.h42
-rw-r--r--FL/gl2opengl.h35
-rw-r--r--FL/gl_draw.H2
-rw-r--r--FL/glut.H443
-rw-r--r--FL/math.h27
-rw-r--r--FL/menubar.h64
-rw-r--r--FL/win32.H80
-rw-r--r--FL/x.H87
96 files changed, 4848 insertions, 0 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H
new file mode 100644
index 000000000..e8237ff74
--- /dev/null
+++ b/FL/Enumerations.H
@@ -0,0 +1,293 @@
+#ifndef Fl_Enumerations_H
+#define Fl_Enumerations_H
+
+const double FL_VERSION = 0.99;
+
+typedef unsigned char uchar;
+typedef unsigned long ulong;
+typedef unsigned int u32; // you must fix if not 32 bits on your machine!
+
+enum Fl_Event { // events
+ 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_KEYBOARD = 8,
+ FL_CLOSE = 9,
+ FL_MOVE = 10,
+ FL_SHORTCUT = 11,
+ FL_DEACTIVATE = 13,
+ FL_ACTIVATE = 14,
+ FL_HIDE = 15,
+ FL_SHOW = 16,
+ FL_PASTE = 17,
+ FL_SELECTIONCLEAR = 18
+};
+
+enum Fl_When { // Fl_Widget::when():
+ 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_NOT_CHANGED = 2 // modifier bit to disable changed() test
+};
+
+// Fl::event_key() and Fl::get_key(n) (use ascii letters for all other keys):
+#define FL_Button 0xfee8 // use Fl_Button+n for mouse button n
+#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_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 // the left MSWindows key on XFree86
+#define FL_Meta_R 0xffe8 // the right MSWindows key on XFree86
+#define FL_Alt_L 0xffe9
+#define FL_Alt_R 0xffea
+#define FL_Delete 0xffff
+
+// Fl::event_state():
+#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 // correct for XFree86
+#define FL_SCROLL_LOCK 0x00800000 // correct for XFree86
+#define FL_BUTTON1 0x01000000
+#define FL_BUTTON2 0x02000000
+#define FL_BUTTON3 0x04000000
+
+enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
+ FL_NO_BOX = 0, FL_FLAT_BOX,
+
+ FL_UP_BOX, FL_DOWN_BOX,
+ FL_UP_FRAME, FL_DOWN_FRAME,
+ FL_THIN_UP_BOX, FL_THIN_DOWN_BOX,
+ FL_THIN_UP_FRAME, FL_THIN_DOWN_FRAME,
+ FL_ENGRAVED_BOX, FL_EMBOSSED_BOX,
+ FL_ENGRAVED_FRAME, FL_EMBOSSED_FRAME,
+ FL_BORDER_BOX, _FL_SHADOW_BOX,
+ FL_BORDER_FRAME, _FL_SHADOW_FRAME,
+ _FL_ROUNDED_BOX, _FL_RSHADOW_BOX,
+ _FL_ROUNDED_FRAME, _FL_RFLAT_BOX,
+ _FL_ROUND_UP_BOX, _FL_ROUND_DOWN_BOX,
+ _FL_DIAMOND_UP_BOX, _FL_DIAMOND_DOWN_BOX,
+ _FL_OVAL_BOX, _FL_OSHADOW_BOX,
+ _FL_OVAL_FRAME, _FL_OFLAT_BOX
+};
+extern Fl_Boxtype define_FL_ROUND_UP_BOX();
+#define FL_ROUND_UP_BOX define_FL_ROUND_UP_BOX()
+#define FL_ROUND_DOWN_BOX (Fl_Boxtype)(define_FL_ROUND_UP_BOX()+1)
+extern Fl_Boxtype define_FL_SHADOW_BOX();
+#define FL_SHADOW_BOX define_FL_SHADOW_BOX()
+#define FL_SHADOW_FRAME (Fl_Boxtype)(define_FL_SHADOW_BOX()+2)
+extern Fl_Boxtype define_FL_ROUNDED_BOX();
+#define FL_ROUNDED_BOX define_FL_ROUNDED_BOX()
+#define FL_ROUNDED_FRAME (Fl_Boxtype)(define_FL_ROUNDED_BOX()+2)
+extern Fl_Boxtype define_FL_RFLAT_BOX();
+#define FL_RFLAT_BOX define_FL_RFLAT_BOX()
+extern Fl_Boxtype define_FL_RSHADOW_BOX();
+#define FL_RSHADOW_BOX define_FL_RSHADOW_BOX()
+extern Fl_Boxtype define_FL_DIAMOND_BOX();
+#define FL_DIAMOND_UP_BOX define_FL_DIAMOND_BOX()
+#define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(define_FL_DIAMOND_BOX()+1)
+extern Fl_Boxtype define_FL_OVAL_BOX();
+#define FL_OVAL_BOX define_FL_OVAL_BOX()
+#define FL_OSHADOW_BOX (Fl_Boxtype)(define_FL_OVAL_BOX()+1)
+#define FL_OVAL_FRAME (Fl_Boxtype)(define_FL_OVAL_BOX()+2)
+#define FL_OFLAT_BOX (Fl_Boxtype)(define_FL_OVAL_BOX()+3)
+
+// conversions of box types to other boxtypes:
+inline Fl_Boxtype down(Fl_Boxtype b) {return (Fl_Boxtype)(b|1);}
+inline Fl_Boxtype frame(Fl_Boxtype b) {return (Fl_Boxtype)(b|2);}
+
+// 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
+
+enum Fl_Labeltype { // labeltypes:
+ FL_NORMAL_LABEL = 0,
+ FL_NO_LABEL,
+ _FL_SYMBOL_LABEL,
+ _FL_SHADOW_LABEL,
+ _FL_ENGRAVED_LABEL,
+ _FL_EMBOSSED_LABEL,
+ _FL_BITMAP_LABEL,
+ _FL_PIXMAP_LABEL,
+ _FL_IMAGE_LABEL,
+ _FL_MULTI_LABEL,
+ FL_FREE_LABELTYPE
+};
+extern Fl_Labeltype define_FL_SYMBOL_LABEL();
+#define FL_SYMBOL_LABEL define_FL_SYMBOL_LABEL()
+extern Fl_Labeltype define_FL_SHADOW_LABEL();
+#define FL_SHADOW_LABEL define_FL_SHADOW_LABEL()
+extern Fl_Labeltype define_FL_ENGRAVED_LABEL();
+#define FL_ENGRAVED_LABEL define_FL_ENGRAVED_LABEL()
+extern Fl_Labeltype define_FL_EMBOSSED_LABEL();
+#define FL_EMBOSSED_LABEL define_FL_EMBOSSED_LABEL()
+
+enum Fl_Align { // align() values
+ FL_ALIGN_CENTER = 0,
+ FL_ALIGN_TOP = 1,
+ FL_ALIGN_BOTTOM = 2,
+ FL_ALIGN_LEFT = 4,
+ FL_ALIGN_RIGHT = 8,
+ FL_ALIGN_INSIDE = 16,
+ FL_ALIGN_CLIP = 64,
+ FL_ALIGN_WRAP = 128,
+ 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 // for back compatability
+};
+
+enum Fl_Font { // standard fonts
+ FL_HELVETICA = 0,
+ FL_HELVETICA_BOLD,
+ FL_HELVETICA_ITALIC,
+ FL_HELVETICA_BOLD_ITALIC,
+ FL_COURIER,
+ FL_COURIER_BOLD,
+ FL_COURIER_ITALIC,
+ FL_COURIER_BOLD_ITALIC,
+ FL_TIMES,
+ FL_TIMES_BOLD,
+ FL_TIMES_ITALIC,
+ FL_TIMES_BOLD_ITALIC,
+ FL_SYMBOL,
+ FL_SCREEN,
+ FL_SCREEN_BOLD,
+ FL_ZAPF_DINGBATS,
+
+ FL_FREE_FONT = 16, // first one to allocate
+ FL_BOLD = 1, // add this to helvetica, courier, or times
+ FL_ITALIC = 2 // add this to helvetica, courier, or times
+};
+
+#define FL_NORMAL_SIZE 14 // default size of all labels & text
+
+enum Fl_Color { // standard colors
+ FL_BLACK = 0,
+ FL_RED = 1,
+ FL_GREEN = 2,
+ FL_YELLOW = 3,
+ FL_BLUE = 4,
+ FL_MAGENTA = 5,
+ FL_CYAN = 6,
+ FL_WHITE = 7,
+ FL_INACTIVE_COLOR = 8,
+ FL_SELECTION_COLOR = 15,
+
+ FL_FREE_COLOR = 16,
+ FL_NUM_FREE_COLOR = 16,
+
+ FL_GRAY_RAMP = 32,
+
+ // boxtypes limit themselves to these colors so whole ramp is not allocated:
+ FL_GRAY0 = 32, // 'A'
+ FL_DARK3 = 39, // 'H'
+ FL_DARK2 = 45, // 'N'
+ FL_DARK1 = 47, // 'P'
+ FL_GRAY = 49, // 'R' default color
+ FL_LIGHT1 = 50, // 'S'
+ FL_LIGHT2 = 52, // 'U'
+ FL_LIGHT3 = 54, // 'W'
+
+ FL_COLOR_CUBE = 56
+};
+
+inline Fl_Color inactive(Fl_Color c) {return (Fl_Color)(c|8);}
+Fl_Color contrast(Fl_Color fg, Fl_Color bg);
+#define FL_NUM_GRAY 24
+inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
+#define FL_NUM_RED 5
+#define FL_NUM_GREEN 8
+#define FL_NUM_BLUE 5
+inline Fl_Color fl_color_cube(int r, int g, int b) {
+ return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
+
+enum Fl_Cursor { // standard cursors
+ FL_CURSOR_DEFAULT = 0,
+ FL_CURSOR_ARROW = 35,
+ FL_CURSOR_CROSS = 66,
+ FL_CURSOR_WAIT = 76,
+ FL_CURSOR_INSERT = 77,
+ FL_CURSOR_HAND = 31,
+ FL_CURSOR_HELP = 47,
+ FL_CURSOR_MOVE = 27,
+ // fltk provides bitmaps for these:
+ FL_CURSOR_NS = 78,
+ FL_CURSOR_WE = 79,
+ FL_CURSOR_NWSE = 80,
+ FL_CURSOR_NESW = 81,
+ FL_CURSOR_NONE = 255,
+ // for back compatability (non MSWindows ones):
+ FL_CURSOR_N = 70,
+ FL_CURSOR_NE = 69,
+ FL_CURSOR_E = 49,
+ FL_CURSOR_SE = 8,
+ FL_CURSOR_S = 9,
+ FL_CURSOR_SW = 7,
+ FL_CURSOR_W = 36,
+ FL_CURSOR_NW = 68
+ //FL_CURSOR_NS = 22,
+ //FL_CURSOR_WE = 55,
+};
+
+enum { // values for "when" passed to Fl::add_fd()
+ FL_READ = 1,
+ FL_WRITE = 4,
+ FL_EXCEPT = 8
+};
+
+enum Fl_Mode { // visual types and Fl_Gl_Window::mode() (values match Glut)
+ 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
+};
+
+#endif
diff --git a/FL/Fl.H b/FL/Fl.H
new file mode 100644
index 000000000..b0cc41fd4
--- /dev/null
+++ b/FL/Fl.H
@@ -0,0 +1,195 @@
+// Fl.H
+
+// fltk (Fast Light Tool Kit) version 0.99
+// Copyright (C) 1998 Bill Spitzak
+
+// 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.
+
+// Written by Bill Spitzak spitzak@d2.com
+
+#ifndef Fl_H
+#define Fl_H
+
+#include "Enumerations.H"
+#ifndef Fl_Object
+#define Fl_Object Fl_Widget
+#endif
+
+class Fl_Widget;
+class Fl_Window;
+struct Fl_Label;
+typedef void (Fl_Label_Draw_F)(const Fl_Label*, int,int,int,int, Fl_Align);
+typedef void (Fl_Label_Measure_F)(const Fl_Label*, int&, int&);
+typedef void (Fl_Box_Draw_F)(int,int,int,int, Fl_Color);
+
+class Fl {
+ Fl() {}; // no constructor!
+
+public: // should be private!
+
+ static int e_x,e_y,e_x_root,e_y_root;
+ static int e_state;
+ static int e_clicks;
+ static int e_is_click;
+ static int e_keysym;
+ static char* e_text;
+ static int e_length;
+ static Fl_Widget* belowmouse_;
+ static Fl_Widget* pushed_;
+ static Fl_Widget* focus_;
+ static int damage_;
+ static Fl_Widget* selection_owner_;
+ static Fl_Window* modal_;
+ static Fl_Window* grab_;
+
+ static void damage(int x) {damage_ = x;}
+
+ static void (*idle)();
+
+public:
+
+ // argument parsers:
+ static int arg(int, char**, int&);
+ static int args(int, char**, int&, int (*)(int,char**,int&) = 0);
+ static const char* const help;
+ static void args(int, char**);
+
+ // things called by initialization:
+ static void display(const char*);
+ static int visual(int);
+ static int gl_visual(int, int *alist=0);
+ static void own_colormap();
+ static void get_system_colors();
+ static void foreground(uchar, uchar, uchar);
+ static void background(uchar, uchar, uchar);
+ static void background2(uchar, uchar, uchar);
+
+ // execution:
+ static int wait();
+ static double wait(double time);
+ static int check();
+ static int ready();
+ static int run();
+ static Fl_Widget* readqueue();
+ static void add_timeout(double t,void (*cb)(void*),void* = 0);
+ static void remove_timeout(void (*cb)(void*), void* = 0);
+ static void add_fd(int fd, int when, void (*cb)(int, void*), void* = 0);
+ static void add_fd(int fd, void (*cb)(int, void*), void* = 0);
+ static void remove_fd(int);
+ static void add_idle(void (*cb)(void*), void* = 0);
+ static void remove_idle(void (*cb)(void*), void* = 0);
+ static int damage() {return damage_;}
+ static void redraw();
+ static void flush();
+ static void (*warning)(const char*, ...);
+ static void (*error)(const char*, ...);
+ static void (*fatal)(const char*, ...);
+ static Fl_Window* first_window();
+ static Fl_Window* next_window(const Fl_Window*);
+ static Fl_Window* modal() {return modal_;}
+ static Fl_Window* grab() {return grab_;}
+ static void grab(Fl_Window&);
+ static void release();
+
+ // event information:
+ static int event_x() {return e_x;}
+ static int event_y() {return e_y;}
+ static int event_x_root() {return e_x_root;}
+ static int event_y_root() {return e_y_root;}
+ static void get_mouse(int &,int &);
+ static int event_clicks() {return e_clicks;}
+ static void event_clicks(int i) {e_clicks = i;}
+ static int event_is_click() {return e_is_click;}
+ static void event_is_click(int i) {e_is_click = i;} // only 0 works!
+ static int event_button() {return e_keysym-FL_Button;}
+ static int event_state() {return e_state;}
+ static int event_state(int i) {return e_state&i;}
+ static int event_key() {return e_keysym;}
+ static int event_key(int);
+ static int get_key(int);
+ static const char* event_text() {return e_text;}
+ static int event_length() {return e_length;}
+ static int event_inside(int,int,int,int);
+ static int event_inside(const Fl_Widget*);
+ static int test_shortcut(int);
+
+ // event destinations:
+ static int handle(int, Fl_Window*);
+ static Fl_Widget* belowmouse() {return belowmouse_;}
+ static void belowmouse(Fl_Widget*);
+ static Fl_Widget* pushed() {return pushed_;}
+ static void pushed(Fl_Widget*);
+ static Fl_Widget* focus() {return focus_;}
+ static void focus(Fl_Widget*);
+ static void add_handler(int (*h)(int));
+
+ // cut/paste:
+ static Fl_Widget* selection_owner() {return selection_owner_;}
+ static void selection_owner(Fl_Widget*);
+ static void selection(Fl_Widget &owner, const char* stuff, int len);
+ static void paste(Fl_Widget &receiver);
+
+ // screen size:
+ static int x() {return 0;}
+ static int y() {return 0;}
+ static int w();
+ static int h();
+
+ // color map:
+ static void set_color(Fl_Color, uchar, uchar, uchar);
+ static void set_color(Fl_Color, unsigned);
+ static unsigned get_color(Fl_Color);
+ static void get_color(Fl_Color, uchar&, uchar&, uchar&);
+ static void free_color(Fl_Color, int overlay = 0);
+
+ // fonts:
+ static const char* get_font(Fl_Font);
+ static const char* get_font_name(Fl_Font, int* attributes = 0);
+ static int get_font_sizes(Fl_Font, int*& sizep);
+ static void set_font(Fl_Font, const char*);
+ static void set_font(Fl_Font, Fl_Font);
+ static Fl_Font set_fonts(const char* = 0);
+
+ // labeltypes:
+ static void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);
+ static void set_labeltype(Fl_Labeltype, Fl_Labeltype from);
+ static void enable_symbols();
+
+ // boxtypes:
+ static void set_boxtype(Fl_Boxtype, Fl_Box_Draw_F*,uchar,uchar,uchar,uchar);
+ static void set_boxtype(Fl_Boxtype, Fl_Boxtype from);
+ static int box_dx(Fl_Boxtype);
+ static int box_dy(Fl_Boxtype);
+ static int box_dw(Fl_Boxtype);
+ static int box_dh(Fl_Boxtype);
+
+ // back compatability:
+ static void set_abort(void (*f)(const char*,...)) {fatal = f;}
+ static void (*atclose)(Fl_Window*,void*);
+ static void default_atclose(Fl_Window*,void*);
+ static void set_atclose(void (*f)(Fl_Window*,void*)) {atclose = f;}
+ static int event_shift() {return e_state&FL_SHIFT;}
+ static int event_ctrl() {return e_state&FL_CTRL;}
+ static int event_alt() {return e_state&FL_ALT;}
+ static int event_buttons() {return e_state&0x7f000000;}
+ static int event_button1() {return e_state&FL_BUTTON1;}
+ static int event_button2() {return e_state&FL_BUTTON2;}
+ static int event_button3() {return e_state&FL_BUTTON3;}
+ static void set_idle(void (*cb)()) {idle = cb;}
+
+};
+
+#endif
diff --git a/FL/Fl_Adjuster.H b/FL/Fl_Adjuster.H
new file mode 100644
index 000000000..df4a2cdd1
--- /dev/null
+++ b/FL/Fl_Adjuster.H
@@ -0,0 +1,26 @@
+// Fl_Adjuster.H
+
+// 3-button "slider", made for Nuke
+
+#ifndef Fl_Adjuster_H
+#define Fl_Adjuster_H
+
+#ifndef Fl_Valuator_H
+#include "Fl_Valuator.H"
+#endif
+
+class Fl_Adjuster : public Fl_Valuator {
+ int drag;
+ int ix;
+ int soft_;
+protected:
+ void draw();
+ int handle(int);
+ void value_damage();
+public:
+ Fl_Adjuster(int x,int y,int w,int h,const char *l=0);
+ void soft(int x) {soft_ = x;}
+ int soft() const {return soft_;}
+};
+
+#endif
diff --git a/FL/Fl_Bitmap.H b/FL/Fl_Bitmap.H
new file mode 100644
index 000000000..2707cf1ed
--- /dev/null
+++ b/FL/Fl_Bitmap.H
@@ -0,0 +1,24 @@
+/* Fl_Bitmap.H */
+
+#ifndef Fl_Bitmap_H
+#define Fl_Bitmap_H
+
+class Fl_Widget;
+struct Fl_Menu_Item;
+
+struct Fl_Bitmap {
+ const uchar *array;
+ int w, h;
+ ulong id; // for internal use
+ Fl_Bitmap(const uchar *bits, int W, int H) :
+ array(bits), w(W), h(H), id(0) {}
+ Fl_Bitmap(const char *bits, int W, int H) :
+ array((const uchar *)bits), w(W), h(H), id(0) {}
+ ~Fl_Bitmap();
+ void label(Fl_Widget*);
+ void label(Fl_Menu_Item*);
+ void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
+ void draw(int X, int Y) {draw(X, Y, w, h, 0, 0);}
+};
+
+#endif
diff --git a/FL/Fl_Box.H b/FL/Fl_Box.H
new file mode 100644
index 000000000..a1936a094
--- /dev/null
+++ b/FL/Fl_Box.H
@@ -0,0 +1,19 @@
+/* Fl_Box.H */
+
+#ifndef Fl_Box_H
+#define Fl_Box_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+class Fl_Box : public Fl_Widget {
+ void draw();
+public:
+ Fl_Box(int x, int y, int w, int h, const char *l=0)
+ : Fl_Widget(x,y,w,h,l) {}
+ Fl_Box(Fl_Boxtype b, int x, int y, int w, int h, const char *l)
+ : Fl_Widget(x,y,w,h,l) {box(b);}
+};
+
+#endif
diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H
new file mode 100644
index 000000000..aaf2975d5
--- /dev/null
+++ b/FL/Fl_Browser.H
@@ -0,0 +1,86 @@
+/* Fl_Browser.H
+
+ Forms-compatable browser. Probably useful for other
+ lists of textual data. Notice that the line numbers
+ start from 1, and 0 means "no line".
+
+*/
+
+#ifndef Fl_Browser_H
+#define Fl_Browser_H
+
+#include "Fl_Browser_.H"
+
+struct FL_BLINE;
+
+class Fl_Browser : public Fl_Browser_ {
+
+ // required routines for Fl_Browser_ subclass:
+ void* item_first() const ;
+ void* item_next(void*) const ;
+ void* item_prev(void*) const ;
+ int item_selected(void*) const ;
+ void item_select(void*, int);
+ int item_height(void*) const ;
+ int item_width(void*) const ;
+ void item_draw(void*, int, int, int, int) const ;
+ int full_height() const ;
+ int incr_height() const ;
+
+ FL_BLINE *first; // the array of lines
+ FL_BLINE *last;
+ FL_BLINE *cache;
+ int cacheline; // line number of cache
+ int lines; // Number of lines
+ int full_height_;
+ const int* column_widths_;
+ char format_char_; // alternative to @-sign
+ char column_char_; // alternative to tab
+ FL_BLINE* find_line(int) const ;
+ FL_BLINE* _remove(int) ;
+ void insert(int, FL_BLINE*);
+ int lineno(void*) const ;
+
+public:
+
+ void remove(int);
+ void add(const char*, void* = 0);
+ void insert(int, const char*, void* = 0);
+ void move(int to, int from);
+ int load(const char* filename);
+ void clear();
+
+ int size() const {return lines;}
+ int topline() const ;
+ void topline(int);
+
+ int select(int, int=1);
+ int selected(int) const ;
+ void show(int n);
+ void hide(int n);
+ int visible(int n) const ;
+
+ int value() const ;
+ void value(int v) {select(v);}
+ const char* text(int) const ;
+ void text(int, const char*);
+ void* data(int) const ;
+ void data(int, void* v);
+
+ Fl_Browser(int, int, int, int, const char* = 0);
+
+ char format_char() const {return format_char_;}
+ void format_char(char c) {format_char_ = c;}
+ char column_char() const {return column_char_;}
+ void column_char(char c) {column_char_ = c;}
+ const int* column_widths() const {return column_widths_;}
+ void column_widths(const int* l) { column_widths_=l; }
+
+ int displayed(int n) const {return Fl_Browser_::displayed(find_line(n));}
+
+ // for back compatability only:
+ void replace(int a, const char* b) {text(a, b);}
+ void display(int, int=1);
+};
+
+#endif
diff --git a/FL/Fl_Browser_.H b/FL/Fl_Browser_.H
new file mode 100644
index 000000000..f3ff3b521
--- /dev/null
+++ b/FL/Fl_Browser_.H
@@ -0,0 +1,123 @@
+// Fl_Browser_.H
+
+// This is the base class for browsers. To be useful it must
+// be subclassed and several virtual functions defined. The
+// Forms-compatable browser and the file chooser's browser are
+// subclassed off of this.
+
+// Yes, I know this should be a template...
+
+#ifndef Fl_Browser__H
+#define Fl_Browser__H
+
+#ifndef Fl_Group_H
+#include "Fl_Group.H"
+#endif
+#include "Fl_Scrollbar.H"
+
+#define FL_NORMAL_BROWSER 0
+#define FL_SELECT_BROWSER 1
+#define FL_HOLD_BROWSER 2
+#define FL_MULTI_BROWSER 3
+
+class Fl_Browser_ : public Fl_Group {
+ int position_; // where user wants it scrolled to
+ int real_position_; // the current vertical scrolling position
+ int hposition_; // where user wants it panned to
+ int real_hposition_; // the current horizontal scrolling position
+ int offset_; // how far down top_ item the real_position is
+ int max_width; // widest object seen so far
+ uchar textfont_, textsize_, textcolor_;
+ uchar has_scrollbar_; // which scrollbars are enabled
+ void* top_; // which item scrolling position is in
+ void* selection_; // which is selected (except for FL_MULTI_BROWSER)
+ void *redraw1,*redraw2; // minimal update pointers
+ void* max_width_item; // which item has max_width_
+
+ static int scrollbar_width_;
+
+ void update_top();
+
+protected:
+
+ // All of the following must be supplied by the subclass:
+ virtual void *item_first() const = 0;
+ virtual void *item_next(void *) const = 0;
+ virtual void *item_prev(void *) const = 0;
+ virtual int item_height(void *) const = 0;
+ virtual int item_width(void *) const = 0;
+ virtual int item_quick_height(void *) const ;
+ virtual void item_draw(void *,int,int,int,int) const = 0;
+ // you don't have to provide these but it may help speed it up:
+ virtual int full_width() const ; // current width of all items
+ virtual int full_height() const ; // current height of all items
+ virtual int incr_height() const ; // average height of an item
+ // These only need to be done by subclass if you want a multi-browser:
+ virtual void item_select(void *,int=1);
+ virtual int item_selected(void *) const ;
+
+ // things the subclass may want to call:
+ void *top() const {return top_;}
+ void *selection() const {return selection_;}
+ void new_list(); // completely clobber all data, as though list replaced
+ void deleting(void *a); // get rid of any pointers to a
+ void replacing(void *a,void *b); // change a pointers to b
+ void inserting(void *a,void *b); // insert a before b
+ int displayed(void *) const ; // true if this line is visible
+ void redraw_line(void *); // minimal update, no change in size
+ void redraw_lines() {damage(4);} // redraw all of them
+ void bbox(int&,int&,int&,int&) const;
+ int leftedge() const; // x position after scrollbar & border
+ void *find_item(int my); // item under mouse
+ void draw(int,int,int,int);
+ int handle(int,int,int,int,int);
+
+ void draw();
+ int handle(int);
+ Fl_Browser_(int,int,int,int,const char * = 0);
+
+public:
+
+ Fl_Scrollbar scrollbar; // Vertical scrollbar
+ Fl_Scrollbar hscrollbar; // Horizontal scrollbar
+
+ void resize(int,int,int,int);
+
+ int select(void *,int=1,int docallbacks=0);
+ int select_only(void *,int docallbacks=0);
+ int deselect(int docallbacks=0);
+ int position() const {return position_;}
+ int hposition() const {return hposition_;}
+ void position(int); // scroll to here
+ void hposition(int); // pan to here
+ void display(void*); // scroll so this item is shown
+
+ uchar has_scrollbar() const {return has_scrollbar_;}
+ void has_scrollbar(uchar i) {has_scrollbar_ = i;}
+ enum { // values for has_scrollbar()
+ HORIZONTAL = 1,
+ VERTICAL = 2,
+ BOTH = 3,
+ ALWAYS_ON = 4,
+ HORIZONTAL_ALWAYS = 5,
+ VERTICAL_ALWAYS = 6,
+ BOTH_ALWAYS = 7
+ };
+
+ Fl_Font textfont() const {return (Fl_Font)textfont_;}
+ void textfont(uchar s) {textfont_ = s;}
+ uchar textsize() const {return textsize_;}
+ void textsize(uchar s) {textsize_ = s;}
+ Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ void textcolor(uchar n) {textcolor_ = n;}
+
+ static void scrollbar_width(int b) {scrollbar_width_ = b;}
+ static int scrollbar_width() {return scrollbar_width_;}
+
+ // for back compatability:
+ void scrollbar_right() {scrollbar.align(FL_ALIGN_RIGHT);}
+ void scrollbar_left() {scrollbar.align(FL_ALIGN_LEFT);}
+
+};
+
+#endif
diff --git a/FL/Fl_Button.H b/FL/Fl_Button.H
new file mode 100644
index 000000000..49f4b98cb
--- /dev/null
+++ b/FL/Fl_Button.H
@@ -0,0 +1,48 @@
+// Fl_Button.H
+
+#ifndef Fl_Button_H
+#define Fl_Button_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+// values for type()
+#define FL_TOGGLE_BUTTON 1
+#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2)
+#define FL_HIDDEN_BUTTON 3 // for Forms compatability
+
+extern int fl_old_shortcut(const char*);
+
+class Fl_Button : public Fl_Widget {
+
+ int shortcut_;
+ char value_;
+ char oldval;
+ uchar down_box_;
+
+protected:
+
+ virtual void draw();
+
+public:
+
+ virtual int handle(int);
+ Fl_Button(int,int,int,int,const char * = 0);
+ int value(int);
+ char value() const {return value_;}
+ int set() {return value(1);}
+ int clear() {return value(0);}
+ void setonly(); // this should only be called on FL_RADIO_BUTTONs
+ int shortcut() const {return shortcut_;}
+ void shortcut(int s) {shortcut_ = s;}
+ Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
+ void down_box(Fl_Boxtype b) {down_box_ = b;}
+
+ // back compatability:
+ void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
+ Fl_Color down_color() const {return selection_color();}
+ void down_color(uchar c) {selection_color(c);}
+};
+
+#endif
diff --git a/FL/Fl_Chart.H b/FL/Fl_Chart.H
new file mode 100644
index 000000000..08a58f32e
--- /dev/null
+++ b/FL/Fl_Chart.H
@@ -0,0 +1,65 @@
+/* Fl_Chart.H
+
+ Emulation of the Forms Chart widget.
+ I did not try to improve this much, as I doubt it is used.
+
+*/
+
+#ifndef Fl_Chart_H
+#define Fl_Chart_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+// 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_CHART_ENTRY {
+ float val;
+ uchar col;
+ char str[FL_CHART_LABEL_MAX+1];
+};
+
+class Fl_Chart : public Fl_Widget {
+ int numb;
+ int maxnumb;
+ FL_CHART_ENTRY entries[FL_CHART_MAX+1];
+ double min,max;
+ uchar autosize_;
+ uchar textfont_,textsize_,textcolor_;
+protected:
+ void draw();
+public:
+ Fl_Chart(int,int,int,int,const char * = 0);
+ 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);
+ Fl_Font textfont() const {return (Fl_Font)textfont_;}
+ void textfont(uchar s) {textfont_ = s;}
+ uchar textsize() const {return textsize_;}
+ void textsize(uchar s) {textsize_ = s;}
+ Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ void textcolor(uchar n) {textcolor_ = n;}
+ uchar autosize() const {return autosize_;}
+ void autosize(uchar n) {autosize_ = n;}
+};
+
+#endif
diff --git a/FL/Fl_Check_Button.H b/FL/Fl_Check_Button.H
new file mode 100644
index 000000000..bc935a45d
--- /dev/null
+++ b/FL/Fl_Check_Button.H
@@ -0,0 +1,15 @@
+// Fl_Check_Button.H
+
+// Fl_Light_Button with a diamond down_box() and a red color.
+
+#ifndef Fl_Check_Button_H
+#define Fl_Check_Button_H
+
+#include "Fl_Light_Button.H"
+
+class Fl_Check_Button : public Fl_Light_Button {
+public:
+ Fl_Check_Button(int x,int y,int w,int h,const char *l = 0);
+};
+
+#endif
diff --git a/FL/Fl_Choice.H b/FL/Fl_Choice.H
new file mode 100644
index 000000000..8d5d3462f
--- /dev/null
+++ b/FL/Fl_Choice.H
@@ -0,0 +1,20 @@
+// Fl_Choice.H
+
+// Popup menu with last-picked item displayed in button
+
+#ifndef Fl_Choice_H
+#define Fl_Choice_H
+
+#include "Fl_Menu_.H"
+
+class Fl_Choice : public Fl_Menu_ {
+protected:
+ void draw();
+public:
+ int handle(int);
+ Fl_Choice(int,int,int,int,const char * = 0);
+ int value(int i);
+ int value() const {return Fl_Menu_::value();}
+};
+
+#endif
diff --git a/FL/Fl_Clock.H b/FL/Fl_Clock.H
new file mode 100644
index 000000000..b442e5474
--- /dev/null
+++ b/FL/Fl_Clock.H
@@ -0,0 +1,38 @@
+// Fl_Clock.H
+
+#ifndef Fl_Clock_H
+#define Fl_Clock_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+// values for type:
+#define FL_SQUARE_CLOCK 0
+#define FL_ROUND_CLOCK 1
+#define FL_ANALOG_CLOCK FL_SQUARE_CLOCK
+#define FL_DIGITAL_CLOCK FL_SQUARE_CLOCK // nyi
+
+class Fl_Clock : public Fl_Widget {
+ int hour_, minute_, second_;
+ ulong value_;
+ void drawhands(Fl_Color,Fl_Color); // part of draw
+protected:
+ void draw(int, int, int, int);
+ void draw();
+ void _Fl_Clock();
+ int handle(int);
+public:
+ Fl_Clock(int x,int y,int w,int h, const char *l = 0);
+ Fl_Clock(uchar t,int x,int y,int w,int h, const char *l);
+ ~Fl_Clock();
+ void value(ulong v); // set to this Unix time
+ void value(int,int,int); // set hour, minute, second
+ ulong value() const {return value_;}
+ int hour() const {return hour_;}
+ int minute() const {return minute_;}
+ int second() const {return second_;}
+};
+
+#endif
+
diff --git a/FL/Fl_Color_Chooser.H b/FL/Fl_Color_Chooser.H
new file mode 100644
index 000000000..e8f01cd56
--- /dev/null
+++ b/FL/Fl_Color_Chooser.H
@@ -0,0 +1,71 @@
+// Fl_Color_Chooser.H
+
+// The color chooser object and the color chooser popup. The popup
+// is just a window containing a single color chooser and some boxes
+// to indicate the current and cancelled color.
+
+#ifndef Fl_Color_Chooser_H
+#define Fl_Color_Chooser_H
+
+#include <FL/Fl_Group.H>
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Return_Button.H>
+#include <FL/Fl_Choice.H>
+#include <FL/Fl_Value_Input.H>
+
+class Flcc_HueBox : public Fl_Widget {
+ int handle(int);
+ void draw();
+ int px, py;
+public:
+ Flcc_HueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
+ px = py = 0;}
+};
+
+class Flcc_ValueBox : public Fl_Widget {
+ int handle(int);
+ void draw();
+ int py;
+public:
+ Flcc_ValueBox(int X, int Y, int W, int H) : Fl_Widget(X,Y,W,H) {
+ py = 0;}
+};
+
+class Flcc_Value_Input : public Fl_Value_Input {
+public:
+ int format(char*);
+ Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {}
+};
+
+class Fl_Color_Chooser : public Fl_Group {
+ Flcc_HueBox huebox;
+ Flcc_ValueBox valuebox;
+ Fl_Choice choice;
+ Flcc_Value_Input rvalue;
+ Flcc_Value_Input gvalue;
+ Flcc_Value_Input bvalue;
+ Fl_Box resize_box;
+ double hue_, saturation_, value_;
+ double r_, g_, b_;
+ void set_valuators();
+ static void rgb_cb(Fl_Widget*, void*);
+ static void mode_cb(Fl_Widget*, void*);
+public:
+ int mode() {return choice.value();}
+ double hue() const {return hue_;}
+ double saturation() const {return saturation_;}
+ double value() const {return value_;}
+ double r() const {return r_;}
+ double g() const {return g_;}
+ double b() const {return b_;}
+ int hsv(double,double,double);
+ int rgb(double,double,double);
+ static void hsv2rgb(double, double, double,double&,double&,double&);
+ static void rgb2hsv(double, double, double,double&,double&,double&);
+ Fl_Color_Chooser(int,int,int,int,const char* = 0);
+};
+
+int fl_color_chooser(const char* name, double& r, double& g, double& b);
+int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b);
+
+#endif
diff --git a/FL/Fl_Counter.H b/FL/Fl_Counter.H
new file mode 100644
index 000000000..33c0002d2
--- /dev/null
+++ b/FL/Fl_Counter.H
@@ -0,0 +1,47 @@
+// Fl_Counter.H
+
+// A numerical value with up/down step buttons. From Forms.
+
+#ifndef Fl_Counter_H
+#define Fl_Counter_H
+
+#ifndef Fl_Valuator_H
+#include "Fl_Valuator.H"
+#endif
+
+// values for type():
+#define FL_NORMAL_COUNTER 0
+#define FL_SIMPLE_COUNTER 1
+
+class Fl_Counter : public Fl_Valuator {
+
+ uchar textfont_, textsize_, textcolor_;
+ double lstep_;
+ uchar mouseobj;
+ static void repeat_callback(void *);
+ int calc_mouseobj();
+ void increment_cb();
+
+protected:
+
+ void draw();
+
+public:
+
+ int handle(int);
+ Fl_Counter(int,int,int,int,const char * = 0);
+ ~Fl_Counter();
+ void lstep(double a) {lstep_ = a;}
+ void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
+ void step(double a) {Fl_Valuator::step(a);}
+ Fl_Font textfont() const {return (Fl_Font)textfont_;}
+ void textfont(uchar s) {textfont_ = s;}
+ uchar textsize() const {return textsize_;}
+ void textsize(uchar s) {textsize_ = s;}
+ Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ void textcolor(uchar s) {textcolor_ = s;}
+
+};
+
+#endif
+
diff --git a/FL/Fl_Dial.H b/FL/Fl_Dial.H
new file mode 100644
index 000000000..a6b74c7b1
--- /dev/null
+++ b/FL/Fl_Dial.H
@@ -0,0 +1,43 @@
+// Fl_Dial.H
+
+// A circular dial control, like xv uses. From Forms.
+
+#ifndef Fl_Dial_H
+#define Fl_Dial_H
+
+#ifndef Fl_Valuator_H
+#include "Fl_Valuator.H"
+#endif
+
+// values for type():
+#define FL_NORMAL_DIAL 0
+#define FL_LINE_DIAL 1
+#define FL_FILL_DIAL 2
+
+#define FL_DIAL_CW 0
+#define FL_DIAL_CCW 1
+
+class Fl_Dial : public Fl_Valuator {
+
+ short a1,a2;
+ uchar direction_;
+
+protected:
+
+ // these allow subclasses to put the dial in a smaller area:
+ void draw(int, int, int, int);
+ int handle(int, int, int, int, int);
+ void draw();
+
+public:
+
+ int handle(int);
+ Fl_Dial(int x,int y,int w,int h, const char *l = 0);
+ void angles(short a, short b) {a1=a; a2=b;}
+ void direction(uchar d) {direction_ = d;}
+ uchar direction() const {return direction_;}
+
+};
+
+#endif
+
diff --git a/FL/Fl_Double_Window.H b/FL/Fl_Double_Window.H
new file mode 100644
index 000000000..ba7a42d90
--- /dev/null
+++ b/FL/Fl_Double_Window.H
@@ -0,0 +1,23 @@
+// Fl_Double_Window.H
+
+#ifndef Fl_Double_Window_H
+#define Fl_Double_Window_H
+
+#include "Fl_Window.H"
+
+class Fl_Double_Window : public Fl_Window {
+protected:
+ void _flush(int); // used by Fl_Overlay_Window
+public:
+ void show();
+ void show(int a, char **b) {Fl_Window::show(a,b);}
+ void flush();
+ void resize(int,int,int,int);
+ void hide();
+ ~Fl_Double_Window();
+ Fl_Double_Window(int W, int H, const char *l = 0) : Fl_Window(W,H,l) {}
+ Fl_Double_Window(int X, int Y, int W, int H, const char *l = 0)
+ : Fl_Window(X,Y,W,H,l) {}
+};
+
+#endif
diff --git a/FL/Fl_Fill_Dial.H b/FL/Fl_Fill_Dial.H
new file mode 100644
index 000000000..a0e699a72
--- /dev/null
+++ b/FL/Fl_Fill_Dial.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Fill_Dial_H
+#define Fl_Fill_Dial_H
+
+#include "Fl_Dial.H"
+
+class Fl_Fill_Dial : public Fl_Dial {
+public:
+ Fl_Fill_Dial(int x,int y,int w,int h, const char *l = 0)
+ : Fl_Dial(x,y,w,h,l) {type(FL_FILL_DIAL);}
+};
+
+#endif
diff --git a/FL/Fl_Fill_Slider.H b/FL/Fl_Fill_Slider.H
new file mode 100644
index 000000000..7fa946db0
--- /dev/null
+++ b/FL/Fl_Fill_Slider.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Fill_Slider_H
+#define Fl_Fill_Slider_H
+
+#include "Fl_Slider.H"
+
+class Fl_Fill_Slider : public Fl_Slider {
+public:
+ Fl_Fill_Slider(int x,int y,int w,int h,const char *l=0)
+ : Fl_Slider(x,y,w,h,l) {type(FL_VERT_FILL_SLIDER);}
+};
+
+#endif
diff --git a/FL/Fl_Float_Input.H b/FL/Fl_Float_Input.H
new file mode 100644
index 000000000..fc70bbebc
--- /dev/null
+++ b/FL/Fl_Float_Input.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Float_Input_H
+#define Fl_Float_Input_H
+
+#include "Fl_Input.H"
+
+class Fl_Float_Input : public Fl_Input {
+public:
+ Fl_Float_Input(int x,int y,int w,int h,const char *l = 0)
+ : Fl_Input(x,y,w,h,l) {type(FL_FLOAT_INPUT);}
+};
+
+#endif
diff --git a/FL/Fl_FormsBitmap.H b/FL/Fl_FormsBitmap.H
new file mode 100644
index 000000000..2790f66f9
--- /dev/null
+++ b/FL/Fl_FormsBitmap.H
@@ -0,0 +1,23 @@
+/* Fl_FormsBitmap.H
+
+ Forms compatability widget
+
+*/
+
+#ifndef Fl_FormsBitmap_H
+#define Fl_FormsBitmap_H
+
+#include "Fl_Bitmap.H"
+
+class Fl_FormsBitmap : public Fl_Widget {
+ Fl_Bitmap *b;
+protected:
+ void draw();
+public:
+ Fl_FormsBitmap(Fl_Boxtype, int, int, int, int, const char * = 0);
+ void set(int W, int H, const uchar *bits);
+ void bitmap(Fl_Bitmap *B) {b = B;}
+ Fl_Bitmap *bitmap() const {return b;}
+};
+
+#endif
diff --git a/FL/Fl_FormsPixmap.H b/FL/Fl_FormsPixmap.H
new file mode 100644
index 000000000..f5515848c
--- /dev/null
+++ b/FL/Fl_FormsPixmap.H
@@ -0,0 +1,23 @@
+/* Fl_FormsPixmap.H
+
+ Forms compatability widget
+
+*/
+
+#ifndef Fl_FormsPixmap_H
+#define Fl_FormsPixmap_H
+
+#include "Fl_Pixmap.H"
+
+class Fl_FormsPixmap : public Fl_Widget {
+ Fl_Pixmap *b;
+protected:
+ void draw();
+public:
+ Fl_FormsPixmap(Fl_Boxtype, int, int, int, int, const char * = 0);
+ void set(/*const*/char * const * bits);
+ void Pixmap(Fl_Pixmap *B) {b = B;}
+ Fl_Pixmap *Pixmap() const {return b;}
+};
+
+#endif
diff --git a/FL/Fl_Free.H b/FL/Fl_Free.H
new file mode 100644
index 000000000..edba73fb8
--- /dev/null
+++ b/FL/Fl_Free.H
@@ -0,0 +1,40 @@
+// Fl_Free.H
+
+// Emulation of the Forms "free" widget. This emulation allows the
+// free demo to run, but it is not clear if it is sufficient to make
+// porting programs any easier.
+
+#ifndef Fl_Free_H
+#define Fl_Free_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+#define FL_NORMAL_FREE 1
+#define FL_SLEEPING_FREE 2
+#define FL_INPUT_FREE 3
+#define FL_CONTINUOUS_FREE 4
+#define FL_ALL_FREE 5
+
+typedef int (*FL_HANDLEPTR)(Fl_Widget *, int , float, float, char);
+
+class Fl_Free : public Fl_Widget {
+ FL_HANDLEPTR hfunc;
+ static void step(void *);
+ void draw();
+ int handle(int);
+public:
+ Fl_Free(uchar t,int x,int y,int w,int h,const char *l,FL_HANDLEPTR hdl);
+ ~Fl_Free();
+};
+
+// old event names for compatability:
+#define FL_MOUSE FL_DRAG
+#define FL_DRAW 0
+#define FL_STEP 9
+#define FL_FREEMEM 12
+#define FL_FREEZE FL_UNMAP
+#define FL_THAW FL_MAP
+
+#endif
diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H
new file mode 100644
index 000000000..1cc083c53
--- /dev/null
+++ b/FL/Fl_Gl_Window.H
@@ -0,0 +1,60 @@
+#ifndef Fl_Gl_Window_H
+#define Fl_Gl_Window_H
+
+#include "Fl_Window.H"
+
+class Fl_Gl_Choice; // structure to hold result of glXChooseVisual
+
+class Fl_Gl_Window : public Fl_Window {
+
+ int mode_;
+ const int *alist;
+ Fl_Gl_Choice *g;
+ void * context; // actually a GLXContext
+ char valid_;
+ char damage1_; // damage() of back buffer
+ virtual void draw_overlay();
+ void init();
+
+ void *overlay;
+ void make_overlay();
+ friend class _Fl_Gl_Overlay;
+
+ static int can_do(int, const int *);
+ int mode(int, const int *);
+
+public:
+
+ void show();
+ void show(int a, char **b) {Fl_Window::show(a,b);}
+ void flush();
+ void hide();
+ void resize(int,int,int,int);
+
+ char valid() const {return valid_;}
+ void valid(char i) {valid_ = i;}
+ void invalidate();
+
+ static int can_do(int i) {return can_do(i,0);}
+ static int can_do(const int *i) {return can_do(0, i);}
+ int can_do() {return can_do(mode_,alist);}
+ Fl_Mode mode() const {return (Fl_Mode)mode_;}
+ int mode(int a) {return mode(a,0);}
+ int mode(const int *a) {return mode(0, a);}
+
+ int can_do_overlay();
+ void redraw_overlay();
+ void hide_overlay();
+
+ void make_current();
+ void make_overlay_current();
+ void swap_buffers();
+ void ortho();
+
+ ~Fl_Gl_Window();
+ Fl_Gl_Window(int W, int H, const char *l=0) : Fl_Window(W,H,l) {init();}
+ Fl_Gl_Window(int X, int Y, int W, int H, const char *l=0)
+ : Fl_Window(X,Y,W,H,l) {init();}
+};
+
+#endif
diff --git a/FL/Fl_Group.H b/FL/Fl_Group.H
new file mode 100644
index 000000000..c64af5312
--- /dev/null
+++ b/FL/Fl_Group.H
@@ -0,0 +1,73 @@
+// Fl_Group.H
+
+#ifndef Fl_Group_H
+#define Fl_Group_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+class Fl_Group : public Fl_Widget {
+
+ Fl_Widget** array_;
+ Fl_Widget* savedfocus_;
+ Fl_Widget* resizable_;
+ int children_;
+ short *sizes_; // remembered initial sizes of children
+
+ int navigation(int = 0);
+ static Fl_Group *current_;
+
+protected:
+
+ void draw();
+ int handle(int);
+ void draw_child(Fl_Widget&) const;
+ void update_child(Fl_Widget&) const;
+ void draw_outside_label(const Fl_Widget&) const ;
+ short* sizes();
+
+public:
+
+ void begin() {current_ = this;}
+ void end() {current_ = (Fl_Group*)parent();}
+ static Fl_Group *current() {return current_;}
+ static void current(Fl_Group *g) {current_ = g;}
+
+ int children() const {return children_;}
+ Fl_Widget* child(int n) const {return array()[n];}
+ int find(const Fl_Widget*) const;
+ int find(const Fl_Widget& o) const {return find(&o);}
+ Fl_Widget* const* array() const;
+
+ void resize(int,int,int,int);
+ Fl_Group(int,int,int,int, const char * = 0);
+ virtual ~Fl_Group();
+ void add(Fl_Widget&);
+ void add(Fl_Widget* o) {add(*o);}
+ void insert(Fl_Widget&, int i);
+ void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
+ void remove(Fl_Widget&);
+ void remove(Fl_Widget* o) {remove(*o);}
+ void clear();
+
+ void resizable(Fl_Widget& o) {resizable_ = &o;}
+ void resizable(Fl_Widget* o) {resizable_ = o;}
+ Fl_Widget* resizable() const {return resizable_;}
+ void add_resizable(Fl_Widget& o) {resizable_ = &o; add(o);}
+ void init_sizes();
+
+ // back compatability function:
+ void focus(Fl_Widget* o) {o->take_focus();}
+ Fl_Widget* & _ddfdesign_kludge() {return resizable_;}
+ void forms_end();
+};
+
+// dummy class used to end child groups in constructors for complex
+// subclasses of Fl_Group:
+class Fl_End {
+public:
+ Fl_End() {Fl_Group::current()->end();}
+};
+
+#endif
diff --git a/FL/Fl_Hold_Browser.H b/FL/Fl_Hold_Browser.H
new file mode 100644
index 000000000..19faf82f0
--- /dev/null
+++ b/FL/Fl_Hold_Browser.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Hold_Browser_H
+#define Fl_Hold_Browser_H
+
+#include "Fl_Browser.H"
+
+class Fl_Hold_Browser : public Fl_Browser {
+public:
+ Fl_Hold_Browser(int x,int y,int w,int h,const char *l=0)
+ : Fl_Browser(x,y,w,h,l) {type(FL_HOLD_BROWSER);}
+};
+
+#endif
diff --git a/FL/Fl_Hor_Fill_Slider.H b/FL/Fl_Hor_Fill_Slider.H
new file mode 100644
index 000000000..f049b6f75
--- /dev/null
+++ b/FL/Fl_Hor_Fill_Slider.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Hor_Fill_Slider_H
+#define Fl_Hor_Fill_Slider_H
+
+#include "Fl_Slider.H"
+
+class Fl_Hor_Fill_Slider : public Fl_Slider {
+public:
+ Fl_Hor_Fill_Slider(int x,int y,int w,int h,const char *l=0)
+ : Fl_Slider(x,y,w,h,l) {type(FL_HOR_FILL_SLIDER);}
+};
+
+#endif
diff --git a/FL/Fl_Hor_Nice_Slider.H b/FL/Fl_Hor_Nice_Slider.H
new file mode 100644
index 000000000..5fd141a9e
--- /dev/null
+++ b/FL/Fl_Hor_Nice_Slider.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Hor_Nice_Slider_H
+#define Fl_Hor_Nice_Slider_H
+
+#include "Fl_Slider.H"
+
+class Fl_Hor_Nice_Slider : public Fl_Slider {
+public:
+ Fl_Hor_Nice_Slider(int x,int y,int w,int h,const char *l=0)
+ : Fl_Slider(x,y,w,h,l) {type(FL_HOR_NICE_SLIDER); box(FL_FLAT_BOX);}
+};
+
+#endif
diff --git a/FL/Fl_Hor_Slider.H b/FL/Fl_Hor_Slider.H
new file mode 100644
index 000000000..0e9e54fa0
--- /dev/null
+++ b/FL/Fl_Hor_Slider.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Hor_Slider_H
+#define Fl_Hor_Slider_H
+
+#include "Fl_Slider.H"
+
+class Fl_Hor_Slider : public Fl_Slider {
+public:
+ Fl_Hor_Slider(int x,int y,int w,int h,const char *l=0)
+ : Fl_Slider(x,y,w,h,l) {type(FL_HOR_SLIDER);}
+};
+
+#endif
diff --git a/FL/Fl_Hor_Value_Slider.H b/FL/Fl_Hor_Value_Slider.H
new file mode 100644
index 000000000..e0fc43db3
--- /dev/null
+++ b/FL/Fl_Hor_Value_Slider.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Hor_Value_Slider_H
+#define Fl_Hor_Value_Slider_H
+
+#include "Fl_Value_Slider.H"
+
+class Fl_Hor_Value_Slider : public Fl_Value_Slider {
+public:
+ Fl_Hor_Value_Slider(int x,int y,int w,int h,const char *l=0)
+ : Fl_Value_Slider(x,y,w,h,l) {type(FL_HOR_SLIDER);}
+};
+
+#endif
diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H
new file mode 100644
index 000000000..7e03a70aa
--- /dev/null
+++ b/FL/Fl_Image.H
@@ -0,0 +1,22 @@
+/* Fl_Image.H */
+
+#ifndef Fl_Image_H
+#define Fl_Image_H
+
+class Fl_Widget;
+struct Fl_Menu_Item;
+
+struct Fl_Image {
+ const uchar *array;
+ int w, h, d, ld;
+ ulong id; // for internal use
+ Fl_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
+ array(bits), w(W), h(H), d(D), ld(LD), id(0) {}
+ ~Fl_Image();
+ void label(Fl_Widget*);
+ void label(Fl_Menu_Item*);
+ void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
+ void draw(int X, int Y) {draw(X, Y, w, h, 0, 0);}
+};
+
+#endif
diff --git a/FL/Fl_Input.H b/FL/Fl_Input.H
new file mode 100644
index 000000000..172a30447
--- /dev/null
+++ b/FL/Fl_Input.H
@@ -0,0 +1,22 @@
+// Fl_Input.H
+
+// This is the "user interface", it decodes user actions into what to
+// do to the text. See also Fl_Input_.H for text manipulation functions.
+
+#ifndef Fl_Input_H
+#define Fl_Input_H
+
+#include "Fl_Input_.H"
+
+class Fl_Input : public Fl_Input_ {
+ int handle_key();
+ int shift_position(int p);
+ int shift_up_down_position(int p);
+ void handle_mouse(int keepmark=0);
+public:
+ void draw();
+ int handle(int);
+ Fl_Input(int,int,int,int,const char * = 0);
+};
+
+#endif
diff --git a/FL/Fl_Input_.H b/FL/Fl_Input_.H
new file mode 100644
index 000000000..696ffe829
--- /dev/null
+++ b/FL/Fl_Input_.H
@@ -0,0 +1,107 @@
+// Fl_Input_.H
+
+#ifndef Fl_Input__H
+#define Fl_Input__H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+#define FL_NORMAL_INPUT 0
+#define FL_FLOAT_INPUT 1
+#define FL_INT_INPUT 2
+#define FL_HIDDEN_INPUT 3
+#define FL_MULTILINE_INPUT 4
+#define FL_SECRET_INPUT 5
+
+class Fl_Input_ : public Fl_Widget {
+
+ const char* value_;
+ char* buffer;
+
+ int size_;
+ int bufsize;
+ int position_;
+ int mark_;
+ int xscroll_, yscroll_;
+ int mu_p;
+ int maximum_size_;
+
+ uchar textfont_;
+ uchar textsize_;
+ uchar textcolor_;
+ uchar cursor_color_;
+ uchar erase_cursor_only;
+
+ const char* expand(const char*, char*) const;
+ double expandpos(const char*, const char*, const char*, int*) const;
+ void minimal_update(int, int);
+ void minimal_update(int p);
+ void put_in_buffer(int newsize);
+
+ static Fl_Boxtype default_box_;
+ static Fl_Font default_font_;
+ static int default_size_;
+ void setfont() const;
+
+protected:
+
+ int wordboundary(int i) const;
+ int lineboundary(int i) const;
+ void drawtext(int, int, int, int);
+ int up_down_position(int, int keepmark=0);
+ void handle_mouse(int, int, int, int, int keepmark=0);
+ int handletext(int e, int, int, int, int);
+ void maybe_do_callback();
+ int xscroll() const {return xscroll_;}
+ int yscroll() const {return yscroll_;}
+
+public:
+
+ void resize(int, int, int, int);
+
+ Fl_Input_(int, int, int, int, const char* = 0);
+ ~Fl_Input_();
+
+ int value(const char*);
+ int value(const char*, int);
+ int static_value(const char*);
+ int static_value(const char*, int);
+ const char* value() const {return value_;}
+ char index(int i) const {return value_[i];}
+ int size() const {return size_;}
+ int maximum_size() const {return maximum_size_;}
+ void maximum_size(int m) {maximum_size_ = m;}
+
+ int position() const {return position_;}
+ int mark() const {return mark_;}
+ int position(int p, int m);
+ int position(int p) {return position(p, p);}
+ int mark(int m) {return position(position(), m);}
+ int replace(int, int, const char*, int=0);
+ int cut() {return replace(position(), mark(), 0);}
+ int cut(int n) {return replace(position(), position()+n, 0);}
+ int cut(int a, int b) {return replace(a, b, 0);}
+ int insert(const char* t, int l=0){return replace(position_, mark_, t, l);}
+ int copy();
+ int undo();
+ int copy_cuts();
+
+ Fl_Font textfont() const {return (Fl_Font)textfont_;}
+ void textfont(uchar s) {textfont_ = s;}
+ uchar textsize() const {return textsize_;}
+ void textsize(uchar s) {textsize_ = s;}
+ Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ void textcolor(uchar n) {textcolor_ = n;}
+ Fl_Color cursor_color() const {return (Fl_Color)cursor_color_;}
+ void cursor_color(uchar n) {cursor_color_ = n;}
+
+ static void default_box(Fl_Boxtype b) {default_box_ = b;}
+ static Fl_Boxtype default_box() {return default_box_;}
+ static void default_font(Fl_Font b) {default_font_ = b;}
+ static Fl_Font default_font() {return default_font_;}
+ static void default_size(int b) {default_size_ = b;}
+ static int default_size() {return default_size_;}
+};
+
+#endif
diff --git a/FL/Fl_Int_Input.H b/FL/Fl_Int_Input.H
new file mode 100644
index 000000000..97648e5fa
--- /dev/null
+++ b/FL/Fl_Int_Input.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Int_Input_H
+#define Fl_Int_Input_H
+
+#include "Fl_Input.H"
+
+class Fl_Int_Input : public Fl_Input {
+public:
+ Fl_Int_Input(int x,int y,int w,int h,const char *l = 0)
+ : Fl_Input(x,y,w,h,l) {type(FL_INT_INPUT);}
+};
+
+#endif
diff --git a/FL/Fl_Light_Button.H b/FL/Fl_Light_Button.H
new file mode 100644
index 000000000..cd55ded00
--- /dev/null
+++ b/FL/Fl_Light_Button.H
@@ -0,0 +1,23 @@
+// Fl_Light_Button.H
+
+// Subclass of Fl_Button where the "box" indicates whether it is
+// pushed or not, and the "down box" is drawn small and square on
+// the left to indicate the current state.
+
+// The default down_box of zero draws a rectangle designed to look
+// just like Flame's buttons.
+
+#ifndef Fl_Light_Button_H
+#define Fl_Light_Button_H
+
+#include "Fl_Button.H"
+
+class Fl_Light_Button : public Fl_Button {
+protected:
+ virtual void draw();
+public:
+ virtual int handle(int);
+ Fl_Light_Button(int x,int y,int w,int h,const char *l = 0);
+};
+
+#endif
diff --git a/FL/Fl_Line_Dial.H b/FL/Fl_Line_Dial.H
new file mode 100644
index 000000000..c4eb48dd4
--- /dev/null
+++ b/FL/Fl_Line_Dial.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Line_Dial_H
+#define Fl_Line_Dial_H
+
+#include "Fl_Dial.H"
+
+class Fl_Line_Dial : public Fl_Dial {
+public:
+ Fl_Line_Dial(int x,int y,int w,int h, const char *l = 0)
+ : Fl_Dial(x,y,w,h,l) {type(FL_LINE_DIAL);}
+};
+
+#endif
diff --git a/FL/Fl_Menu.H b/FL/Fl_Menu.H
new file mode 100644
index 000000000..6aad15936
--- /dev/null
+++ b/FL/Fl_Menu.H
@@ -0,0 +1,2 @@
+// this include file is for back compatability only
+#include "Fl_Menu_Item.H"
diff --git a/FL/Fl_Menu_.H b/FL/Fl_Menu_.H
new file mode 100644
index 000000000..658ad74a7
--- /dev/null
+++ b/FL/Fl_Menu_.H
@@ -0,0 +1,82 @@
+// Fl_Menu_.H
+
+// This is a base class for all items that have a menu:
+// Fl_Menu_Bar, Fl_Menu_Button, Fl_Choice
+// This provides storage for a menu item, functions to add/modify/delete
+// items, and a call for when the user picks a menu item.
+// Implementation in Fl_Menu.C
+
+#ifndef Fl_Menu__H
+#define Fl_Menu__H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+#include "Fl_Menu_Item.H"
+
+class Fl_Menu_ : public Fl_Widget {
+
+ Fl_Menu_Item *menu_;
+ const Fl_Menu_Item *value_;
+ static Fl_Font default_font_;
+ static int default_size_;
+
+protected:
+
+ const Fl_Menu_Item* picked(const Fl_Menu_Item*);
+ uchar down_box_;
+ uchar textfont_;
+ uchar textsize_;
+ uchar textcolor_;
+ uchar alloc;
+
+public:
+
+ Fl_Menu_(int,int,int,int,const char * =0);
+ ~Fl_Menu_();
+
+ const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
+ void global();
+
+ const Fl_Menu_Item *menu() const {return menu_;}
+ void menu(const Fl_Menu_Item *m);
+ int add(const char*, int shortcut, Fl_Callback*, void* = 0, int = 0);
+ int add(const char* a, const char* b, Fl_Callback* c,
+ void* d = 0, int e = 0) {return add(a,fl_old_shortcut(b),c,d,e);}
+ int size() const ;
+ void clear();
+ int add(const char *);
+ void replace(int,const char *);
+ void remove(int);
+ void shortcut(int i, int s) {menu_[i].shortcut(s);}
+ void mode(int i,int x) {menu_[i].flags = x;}
+ int mode(int i) const {return menu_[i].flags;}
+
+ const Fl_Menu_Item *mvalue() const {return value_;}
+ int value() const {return value_-menu_;}
+ int value(const Fl_Menu_Item*);
+ int value(int i) {return value(menu_+i);}
+ const char *text() const {return value_ ? value_->text : 0;}
+ const char *text(int i) const {return menu_[i].text;}
+
+ Fl_Font textfont() const {return (Fl_Font)textfont_;}
+ void textfont(uchar c) {textfont_=c;}
+ uchar textsize() const {return textsize_;}
+ void textsize(uchar c) {textsize_=c;}
+ Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ void textcolor(uchar c) {textcolor_=c;}
+
+ static void default_font(Fl_Font b) {default_font_ = b;}
+ static Fl_Font default_font() {return default_font_;}
+ static void default_size(int b) {default_size_ = b;}
+ static int default_size() {return default_size_;}
+
+ Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
+ void down_box(Fl_Boxtype b) {down_box_ = b;}
+
+ // back compatability:
+ Fl_Color down_color() const {return selection_color();}
+ void down_color(uchar c) {selection_color(c);}
+};
+
+#endif
diff --git a/FL/Fl_Menu_Bar.H b/FL/Fl_Menu_Bar.H
new file mode 100644
index 000000000..0985b7dbe
--- /dev/null
+++ b/FL/Fl_Menu_Bar.H
@@ -0,0 +1,27 @@
+// Fl_Menu_Bar.H
+
+// The implementation is in Fl_Menu.C
+
+#ifndef Fl_Menu_Bar_H
+#define Fl_Menu_Bar_H
+
+#include "Fl_Menu_.H"
+
+class Fl_Menu_Bar : public Fl_Menu_ {
+protected:
+ int handle(int);
+ void draw();
+public:
+ Fl_Menu_Bar(int x,int y,int w,int h,const char *l=0)
+ : Fl_Menu_(x,y,w,h,l) {}
+};
+
+#endif
+
+
+
+
+
+
+
+
diff --git a/FL/Fl_Menu_Button.H b/FL/Fl_Menu_Button.H
new file mode 100644
index 000000000..81d7d1af0
--- /dev/null
+++ b/FL/Fl_Menu_Button.H
@@ -0,0 +1,19 @@
+// Fl_Menu_Button.C
+
+#ifndef Fl_Menu_Button_H
+#define Fl_Menu_Button_H
+
+#include "Fl_Menu_.H"
+
+class Fl_Menu_Button : public Fl_Menu_ {
+protected:
+ void draw();
+public:
+ // values for type:
+ enum {POPUP1 = 1, POPUP2, POPUP12, POPUP3, POPUP13, POPUP23, POPUP123};
+ int handle(int);
+ const Fl_Menu_Item* popup();
+ Fl_Menu_Button(int,int,int,int,const char * =0);
+};
+
+#endif
diff --git a/FL/Fl_Menu_Item.H b/FL/Fl_Menu_Item.H
new file mode 100644
index 000000000..99085a8b6
--- /dev/null
+++ b/FL/Fl_Menu_Item.H
@@ -0,0 +1,134 @@
+// Fl_Menu_Item.H
+
+// The Fl_Menu_ widget has a pointer to an array of these structures.
+// These are designed so that the array can be built efficiently using
+// a C initialization constant.
+
+#ifndef Fl_Menu_Item_H
+#define Fl_Menu_Item_H
+
+#ifndef Fl_Widget_H
+// used to get the Fl_Callback typedefs:
+#include "Fl_Widget.H"
+#endif
+
+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
+};
+
+extern int fl_old_shortcut(const char*);
+
+class Fl_Menu_;
+
+struct Fl_Menu_Item {
+ const char *text; // label()
+ int shortcut_;
+ Fl_Callback *callback_;
+ void *user_data_;
+ int flags;
+ uchar labeltype_;
+ uchar labelfont_;
+ uchar labelsize_;
+ uchar labelcolor_;
+
+ // advance 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));}
+
+ // methods on menu items:
+ const char* label() const {return text;}
+ void label(const char* a) {text=a;}
+ void label(Fl_Labeltype a,const char* b) {labeltype_ = a; text = b;}
+ Fl_Labeltype labeltype() const {return (Fl_Labeltype)labeltype_;}
+ void labeltype(Fl_Labeltype a) {labeltype_ = a;}
+ Fl_Color labelcolor() const {return (Fl_Color)labelcolor_;}
+ void labelcolor(uchar a) {labelcolor_ = a;}
+ Fl_Font labelfont() const {return (Fl_Font)labelfont_;}
+ void labelfont(uchar a) {labelfont_ = a;}
+ uchar labelsize() const {return labelsize_;}
+ void labelsize(uchar a) {labelsize_ = a;}
+ Fl_Callback* callback() const {return callback_;}
+ void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
+ void callback(Fl_Callback* c) {callback_=c;}
+ void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
+ void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
+ void* user_data() const {return user_data_;}
+ void user_data(void* v) {user_data_ = v;}
+ long argument() const {return (long)user_data_;}
+ void argument(long v) {user_data_ = (void*)v;}
+ int shortcut() const {return shortcut_;}
+ void shortcut(int s) {shortcut_ = s;}
+ 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;}
+ void set() {flags |= FL_MENU_VALUE;}
+ void clear() {flags &= ~FL_MENU_VALUE;}
+ void setonly();
+ int visible() const {return !(flags&FL_MENU_INVISIBLE);}
+ void show() {flags &= ~FL_MENU_INVISIBLE;}
+ void hide() {flags |= FL_MENU_INVISIBLE;}
+ int active() const {return !(flags&FL_MENU_INACTIVE);}
+ void activate() {flags &= ~FL_MENU_INACTIVE;}
+ void deactivate() {flags |= FL_MENU_INACTIVE;}
+ int activevisible() const {return !(flags&0x11);}
+
+ // used by menubar:
+ int measure(int* h, const Fl_Menu_*) const;
+ void draw(int x, int y, int w, int h, const Fl_Menu_*, int t=0) const;
+
+ // popup menus without using an Fl_Menu_ widget:
+ const Fl_Menu_Item* popup(
+ int X, int Y,
+ const char *title = 0,
+ const Fl_Menu_Item* picked=0,
+ const Fl_Menu_* = 0) const;
+ const Fl_Menu_Item* pulldown(
+ int X, int Y, int W, int H,
+ const Fl_Menu_Item* picked = 0,
+ const Fl_Menu_* = 0,
+ const Fl_Menu_Item* title = 0,
+ int menubar=0) const;
+ const Fl_Menu_Item* test_shortcut() const;
+ const Fl_Menu_Item* find_shortcut(int *ip=0) const;
+
+ void do_callback(Fl_Widget* o) const {callback_(o, user_data_);}
+ void do_callback(Fl_Widget* o,void* arg) const {callback_(o, arg);}
+ void do_callback(Fl_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;}
+ int add(const char*, int shortcut, Fl_Callback*, void* =0, int = 0);
+ int add(const char*a, const char* b, Fl_Callback* c,
+ void* d = 0, int e = 0) {
+ return add(a,fl_old_shortcut(b),c,d,e);}
+ int size() const ;
+};
+
+typedef Fl_Menu_Item Fl_Menu; // back compatability
+
+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
diff --git a/FL/Fl_Menu_Window.H b/FL/Fl_Menu_Window.H
new file mode 100644
index 000000000..081827e2b
--- /dev/null
+++ b/FL/Fl_Menu_Window.H
@@ -0,0 +1,29 @@
+// Fl_Menu_Window.H
+
+// This is the window type used by Fl_Menu to make the pop-ups. It
+// draws in the overlay planes, if possible, and does other fun things
+// such as turning on override_redirect.
+
+#ifndef Fl_Menu_Window_H
+#define Fl_Menu_Window_H
+
+#include "Fl_Single_Window.H"
+
+class Fl_Menu_Window : public Fl_Single_Window {
+ enum {NO_OVERLAY = 128};
+public:
+ void show();
+ void erase();
+ void flush();
+ void hide();
+ int overlay() {return !(flags()&NO_OVERLAY);}
+ void set_overlay() {clear_flag(NO_OVERLAY);}
+ void clear_overlay() {set_flag(NO_OVERLAY);}
+ ~Fl_Menu_Window();
+ Fl_Menu_Window(int W, int H, const char *l = 0)
+ : Fl_Single_Window(W,H,l) {}
+ Fl_Menu_Window(int X, int Y, int W, int H, const char *l = 0)
+ : Fl_Single_Window(X,Y,W,H,l) {}
+};
+
+#endif
diff --git a/FL/Fl_Multi_Browser.H b/FL/Fl_Multi_Browser.H
new file mode 100644
index 000000000..69a986759
--- /dev/null
+++ b/FL/Fl_Multi_Browser.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Multi_Browser_H
+#define Fl_Multi_Browser_H
+
+#include "Fl_Browser.H"
+
+class Fl_Multi_Browser : public Fl_Browser {
+public:
+ Fl_Multi_Browser(int x,int y,int w,int h,const char *l=0)
+ : Fl_Browser(x,y,w,h,l) {type(FL_MULTI_BROWSER);}
+};
+
+#endif
diff --git a/FL/Fl_Multi_Label.H b/FL/Fl_Multi_Label.H
new file mode 100644
index 000000000..7a30a7497
--- /dev/null
+++ b/FL/Fl_Multi_Label.H
@@ -0,0 +1,18 @@
+// Fl_Multi_Label.H
+
+#ifndef Fl_Multi_Label_H
+#define Fl_Multi_Label_H
+
+class Fl_Widget;
+struct Fl_Menu_Item;
+
+struct Fl_Multi_Label {
+ const char* labela;
+ const char* labelb;
+ uchar typea;
+ uchar typeb;
+ void label(Fl_Widget*);
+ void label(Fl_Menu_Item*);
+};
+
+#endif
diff --git a/FL/Fl_Multiline_Input.H b/FL/Fl_Multiline_Input.H
new file mode 100644
index 000000000..83bc2bd35
--- /dev/null
+++ b/FL/Fl_Multiline_Input.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Multiline_Input_H
+#define Fl_Multiline_Input_H
+
+#include "Fl_Input.H"
+
+class Fl_Multiline_Input : public Fl_Input {
+public:
+ Fl_Multiline_Input(int x,int y,int w,int h,const char *l = 0)
+ : Fl_Input(x,y,w,h,l) {type(FL_MULTILINE_INPUT);}
+};
+
+#endif
diff --git a/FL/Fl_Multiline_Output.H b/FL/Fl_Multiline_Output.H
new file mode 100644
index 000000000..0bf99e5d0
--- /dev/null
+++ b/FL/Fl_Multiline_Output.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Multiline_Output_H
+#define Fl_Multiline_Output_H
+
+#include "Fl_Output.H"
+
+class Fl_Multiline_Output : public Fl_Output {
+public:
+ Fl_Multiline_Output(int x,int y,int w,int h,const char *l = 0)
+ : Fl_Output(x,y,w,h,l) {type(FL_MULTILINE_INPUT);}
+};
+
+#endif
diff --git a/FL/Fl_Nice_Slider.H b/FL/Fl_Nice_Slider.H
new file mode 100644
index 000000000..1bb49b47c
--- /dev/null
+++ b/FL/Fl_Nice_Slider.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Nice_Slider_H
+#define Fl_Nice_Slider_H
+
+#include "Fl_Slider.H"
+
+class Fl_Nice_Slider : public Fl_Slider {
+public:
+ Fl_Nice_Slider(int x,int y,int w,int h,const char *l=0)
+ : Fl_Slider(x,y,w,h,l) {type(FL_VERT_NICE_SLIDER); box(FL_FLAT_BOX);}
+};
+
+#endif
diff --git a/FL/Fl_Object.H b/FL/Fl_Object.H
new file mode 100644
index 000000000..18c1fc110
--- /dev/null
+++ b/FL/Fl_Object.H
@@ -0,0 +1,5 @@
+// This file is provided for back compatability only. Please use Fl_Widget
+#ifndef Fl_Object
+#define Fl_Object Fl_Widget
+#endif
+#include "Fl_Widget.H"
diff --git a/FL/Fl_Output.H b/FL/Fl_Output.H
new file mode 100644
index 000000000..784e3202a
--- /dev/null
+++ b/FL/Fl_Output.H
@@ -0,0 +1,18 @@
+// Fl_Output.H
+// a non-editable subclass of Fl_Input_
+
+#ifndef Fl_Output_H
+#define Fl_Output_H
+
+#include "Fl_Input_.H"
+
+class Fl_Output : public Fl_Input_ {
+protected:
+ void draw();
+public:
+ int handle(int);
+ Fl_Output(int x, int y, int w, int h, const char *l = 0)
+ : Fl_Input_(x, y, w, h, l) {}
+};
+
+#endif
diff --git a/FL/Fl_Overlay_Window.H b/FL/Fl_Overlay_Window.H
new file mode 100644
index 000000000..76bf5bcf3
--- /dev/null
+++ b/FL/Fl_Overlay_Window.H
@@ -0,0 +1,31 @@
+// Fl_Overlay_Window.H
+
+// A window using double-buffering and able to draw an overlay
+// on top of that. Uses the hardware to draw the overlay if
+// possible, otherwise it just draws in the front buffer.
+
+#ifndef Fl_Overlay_Window_H
+#define Fl_Overlay_Window_H
+
+#include "Fl_Double_Window.H"
+
+class Fl_Overlay_Window : public Fl_Double_Window {
+ friend class _Fl_Overlay;
+ virtual void draw_overlay() = 0;
+ Fl_Window *overlay_;
+public:
+ void show();
+ void flush();
+ void hide();
+ void resize(int,int,int,int);
+ ~Fl_Overlay_Window();
+ int can_do_overlay();
+ void redraw_overlay();
+ Fl_Overlay_Window(int W, int H, const char *l=0)
+ : Fl_Double_Window(W,H,l) {overlay_ = 0;}
+ Fl_Overlay_Window(int X, int Y, int W, int H, const char *l=0)
+ : Fl_Double_Window(X,Y,W,H,l) {overlay_ = 0;}
+ void show(int a, char **b) {Fl_Double_Window::show(a,b);}
+};
+
+#endif
diff --git a/FL/Fl_Pack.H b/FL/Fl_Pack.H
new file mode 100644
index 000000000..5cc59439f
--- /dev/null
+++ b/FL/Fl_Pack.H
@@ -0,0 +1,22 @@
+// Fl_Pack.H
+
+#ifndef Fl_Pack_H
+#define Fl_Pack_H
+
+#include <FL/Fl_Group.H>
+
+class Fl_Pack : public Fl_Group {
+ int spacing_;
+public:
+ enum { // values for type(int)
+ VERTICAL = 0,
+ HORIZONTAL = 1
+ };
+ void draw();
+ Fl_Pack(int x,int y,int w ,int h,const char *l = 0);
+ int spacing() const {return spacing_;}
+ void spacing(int i) {spacing_ = i;}
+ uchar horizontal() const {return type();}
+};
+
+#endif
diff --git a/FL/Fl_Pixmap.H b/FL/Fl_Pixmap.H
new file mode 100644
index 000000000..128761521
--- /dev/null
+++ b/FL/Fl_Pixmap.H
@@ -0,0 +1,22 @@
+/* Fl_Pixmap.H */
+
+#ifndef Fl_Pixmap_H
+#define Fl_Pixmap_H
+
+class Fl_Widget;
+struct Fl_Menu_Item;
+
+struct Fl_Pixmap {
+ /*const*/ char * const * data;
+ int w, h; // set by first draw...
+ ulong id; // for internal use (the pixmap)
+ ulong mask; // for internal use (mask bitmap)
+ Fl_Pixmap(/*const*/char * const * d) : data(d), w(-1), h(0), id(0),mask(0) {}
+ ~Fl_Pixmap();
+ void label(Fl_Widget*);
+ void label(Fl_Menu_Item*);
+ void draw(int X, int Y, int W, int H, int cx=0, int cy=0);
+ void draw(int X, int Y) {draw(X, Y, w, h, 0, 0);}
+};
+
+#endif
diff --git a/FL/Fl_Positioner.H b/FL/Fl_Positioner.H
new file mode 100644
index 000000000..6b8d4f346
--- /dev/null
+++ b/FL/Fl_Positioner.H
@@ -0,0 +1,51 @@
+// Fl_Positioner.H
+
+// The positioner widget from Forms, gives 2D input
+
+#ifndef Fl_Positioner_H
+#define Fl_Positioner_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+class Fl_Positioner : public Fl_Widget {
+
+ double xmin, ymin;
+ double xmax, ymax;
+ double xvalue_, yvalue_;
+ double xstep_, ystep_;
+
+protected:
+
+ // these allow subclasses to put the dial in a smaller area:
+ void draw(int, int, int, int);
+ int handle(int, int, int, int, int);
+ void draw();
+
+public:
+
+ int handle(int);
+ Fl_Positioner(int x,int y,int w,int h, const char *l=0);
+ double xvalue() const {return xvalue_;}
+ double yvalue() const {return yvalue_;}
+ int xvalue(double);
+ int yvalue(double);
+ int value(double,double);
+ void xbounds(double, double);
+ double xminimum() const {return xmin;}
+ void xminimum(double a) {xbounds(a,xmax);}
+ double xmaximum() const {return xmax;}
+ void xmaximum(double a) {xbounds(xmin,a);}
+ void ybounds(double, double);
+ double yminimum() const {return ymin;}
+ void yminimum(double a) {ybounds(a,ymax);}
+ double ymaximum() const {return ymax;}
+ void ymaximum(double a) {ybounds(ymin,a);}
+ void xstep(double a) {xstep_ = a;}
+ void ystep(double a) {ystep_ = a;}
+
+};
+
+#endif
+
diff --git a/FL/Fl_Radio_Button.H b/FL/Fl_Radio_Button.H
new file mode 100644
index 000000000..494ea03d2
--- /dev/null
+++ b/FL/Fl_Radio_Button.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Radio_Button_H
+#define Fl_Radio_Button_H
+
+#include "Fl_Button.H"
+
+class Fl_Radio_Button : public Fl_Button {
+public:
+ Fl_Radio_Button(int x,int y,int w,int h,const char *l=0)
+ : Fl_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
+};
+
+#endif
diff --git a/FL/Fl_Radio_Light_Button.H b/FL/Fl_Radio_Light_Button.H
new file mode 100644
index 000000000..54bb16c93
--- /dev/null
+++ b/FL/Fl_Radio_Light_Button.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Radio_Light_Button_H
+#define Fl_Radio_Light_Button_H
+
+#include "Fl_Light_Button.H"
+
+class Fl_Radio_Light_Button : public Fl_Light_Button {
+public:
+ Fl_Radio_Light_Button(int x,int y,int w,int h,const char *l=0)
+ : Fl_Light_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
+};
+
+#endif
diff --git a/FL/Fl_Radio_Round_Button.H b/FL/Fl_Radio_Round_Button.H
new file mode 100644
index 000000000..119a9a5ff
--- /dev/null
+++ b/FL/Fl_Radio_Round_Button.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Radio_Round_Button_H
+#define Fl_Radio_Round_Button_H
+
+#include "Fl_Round_Button.H"
+
+class Fl_Radio_Round_Button : public Fl_Round_Button {
+public:
+ Fl_Radio_Round_Button(int x,int y,int w,int h,const char *l=0)
+ : Fl_Round_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
+};
+
+#endif
diff --git a/FL/Fl_Repeat_Button.H b/FL/Fl_Repeat_Button.H
new file mode 100644
index 000000000..849902a4b
--- /dev/null
+++ b/FL/Fl_Repeat_Button.H
@@ -0,0 +1,18 @@
+// Fl_Repeat_Button.H
+
+// When held down, this generates callbacks repeatedly.
+// Forms called this a "touch" button.
+
+#ifndef Fl_Repeat_Button_H
+#define Fl_Repeat_Button_H
+#include "Fl_Button.H"
+
+class Fl_Repeat_Button : public Fl_Button {
+ static void repeat_callback(void *);
+public:
+ int handle(int);
+ Fl_Repeat_Button(int x,int y,int w,int h,const char *l=0)
+ : Fl_Button(x,y,w,h,l) {}
+};
+
+#endif
diff --git a/FL/Fl_Return_Button.H b/FL/Fl_Return_Button.H
new file mode 100644
index 000000000..793e578f3
--- /dev/null
+++ b/FL/Fl_Return_Button.H
@@ -0,0 +1,19 @@
+// Fl_Return_Button.H
+
+// Just like a normal button except it has a built-in shortcut for
+// the Enter key and it draws a user-friendly arrow on the button.
+
+#ifndef Fl_Return_Button_H
+#define Fl_Return_Button_H
+#include "Fl_Button.H"
+
+class Fl_Return_Button : public Fl_Button {
+protected:
+ void draw();
+public:
+ int handle(int);
+ Fl_Return_Button(int x,int y,int w,int h,const char *l=0)
+ : Fl_Button(x,y,w,h,l) {}
+};
+
+#endif
diff --git a/FL/Fl_Roller.H b/FL/Fl_Roller.H
new file mode 100644
index 000000000..ef0da9361
--- /dev/null
+++ b/FL/Fl_Roller.H
@@ -0,0 +1,19 @@
+// Fl_Roller.H
+
+// Rapid-App style knob
+
+#ifndef Fl_Roller_H
+#define Fl_Roller_H
+
+#ifndef Fl_Valuator_H
+#include "Fl_Valuator.H"
+#endif
+
+class Fl_Roller : public Fl_Valuator {
+ void draw();
+public:
+ int handle(int);
+ Fl_Roller(int X,int Y,int W,int H,const char* L=0);
+};
+
+#endif
diff --git a/FL/Fl_Round_Button.H b/FL/Fl_Round_Button.H
new file mode 100644
index 000000000..9b7bb22d8
--- /dev/null
+++ b/FL/Fl_Round_Button.H
@@ -0,0 +1,15 @@
+// Fl_Round_Button.H
+
+// A Fl_Light_Button with a round down_box() and a red color.
+
+#ifndef Fl_Round_Button_H
+#define Fl_Round_Button_H
+
+#include "Fl_Light_Button.H"
+
+class Fl_Round_Button : public Fl_Light_Button {
+public:
+ Fl_Round_Button(int x,int y,int w,int h,const char *l = 0);
+};
+
+#endif
diff --git a/FL/Fl_Round_Clock.H b/FL/Fl_Round_Clock.H
new file mode 100644
index 000000000..9ad9b0042
--- /dev/null
+++ b/FL/Fl_Round_Clock.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Round_Clock_H
+#define Fl_Round_Clock_H
+
+#include "Fl_Clock.H"
+
+class Fl_Round_Clock : public Fl_Clock {
+public:
+ Fl_Round_Clock(int x,int y,int w,int h, const char *l = 0)
+ : Fl_Clock(x,y,w,h,l) {type(FL_ROUND_CLOCK); box(FL_NO_BOX);}
+};
+
+#endif
diff --git a/FL/Fl_Scroll.H b/FL/Fl_Scroll.H
new file mode 100644
index 000000000..ce8c83c02
--- /dev/null
+++ b/FL/Fl_Scroll.H
@@ -0,0 +1,50 @@
+// Fl_Scroll.H
+// A scrolling area of child widgets.
+
+#ifndef Fl_Scroll_H
+#define Fl_Scroll_H
+
+#include "Fl_Group.H"
+#include "Fl_Scrollbar.H"
+
+class Fl_Scroll : public Fl_Group {
+
+ int xposition_, yposition_;
+ int width_, height_;
+ int oldx, oldy;
+ static void hscrollbar_cb(Fl_Widget*, void*);
+ static void scrollbar_cb(Fl_Widget*, void*);
+ void fix_scrollbar_order();
+ static void draw_clip(void*,int,int,int,int);
+ void bbox(int&,int&,int&,int&);
+
+protected:
+
+ void draw();
+
+public:
+
+ Fl_Scrollbar scrollbar;
+ Fl_Scrollbar hscrollbar;
+
+ void resize(int,int,int,int);
+ int handle(int);
+
+ Fl_Scroll(int X,int Y,int W,int H,const char*l=0);
+
+ enum { // values for type()
+ HORIZONTAL = 1,
+ VERTICAL = 2,
+ BOTH = 3,
+ ALWAYS_ON = 4,
+ HORIZONTAL_ALWAYS = 5,
+ VERTICAL_ALWAYS = 6,
+ BOTH_ALWAYS = 7
+ };
+
+ int xposition() const {return xposition_;}
+ int yposition() const {return yposition_;}
+ void position(int, int);
+};
+
+#endif
diff --git a/FL/Fl_Scrollbar.H b/FL/Fl_Scrollbar.H
new file mode 100644
index 000000000..cac210f46
--- /dev/null
+++ b/FL/Fl_Scrollbar.H
@@ -0,0 +1,30 @@
+// Fl_Scrollbar.H
+
+#ifndef Fl_Scrollbar_H
+#define Fl_Scrollbar_H
+
+#include "Fl_Slider.H"
+
+class Fl_Scrollbar : public Fl_Slider {
+
+ int linesize_;
+ int pushed_;
+ void draw();
+ int handle(int);
+ static void timeout_cb(void*);
+ void increment_cb();
+
+public:
+
+ Fl_Scrollbar(int x,int y,int w,int h, const char *l = 0);
+
+ int value() {return int(Fl_Slider::value());}
+ int value(int position, int size, int top, int total) {
+ return scrollvalue(position, size, top, total);
+ }
+ int linesize() const {return linesize_;}
+ void linesize(int i) {linesize_ = i;}
+
+};
+
+#endif
diff --git a/FL/Fl_Secret_Input.H b/FL/Fl_Secret_Input.H
new file mode 100644
index 000000000..2a4fac8a3
--- /dev/null
+++ b/FL/Fl_Secret_Input.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Secret_Input_H
+#define Fl_Secret_Input_H
+
+#include "Fl_Input.H"
+
+class Fl_Secret_Input : public Fl_Input {
+public:
+ Fl_Secret_Input(int x,int y,int w,int h,const char *l = 0)
+ : Fl_Input(x,y,w,h,l) {type(FL_SECRET_INPUT);}
+};
+
+#endif
diff --git a/FL/Fl_Select_Browser.H b/FL/Fl_Select_Browser.H
new file mode 100644
index 000000000..205b31f38
--- /dev/null
+++ b/FL/Fl_Select_Browser.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Select_Browser_H
+#define Fl_Select_Browser_H
+
+#include "Fl_Browser.H"
+
+class Fl_Select_Browser : public Fl_Browser {
+public:
+ Fl_Select_Browser(int x,int y,int w,int h,const char *l=0)
+ : Fl_Browser(x,y,w,h,l) {type(FL_SELECT_BROWSER);}
+};
+
+#endif
diff --git a/FL/Fl_Simple_Counter.H b/FL/Fl_Simple_Counter.H
new file mode 100644
index 000000000..bbb316e81
--- /dev/null
+++ b/FL/Fl_Simple_Counter.H
@@ -0,0 +1,12 @@
+#ifndef Fl_Simple_Counter_H
+#define Fl_Simple_Counter_H
+
+#include "Fl_Counter.H"
+
+class Fl_Simple_Counter : public Fl_Counter {
+public:
+ Fl_Simple_Counter(int x,int y,int w,int h, const char *l = 0)
+ : Fl_Counter(x,y,w,h,l) {type(FL_SIMPLE_COUNTER);}
+};
+
+#endif
diff --git a/FL/Fl_Single_Window.H b/FL/Fl_Single_Window.H
new file mode 100644
index 000000000..79b0349c2
--- /dev/null
+++ b/FL/Fl_Single_Window.H
@@ -0,0 +1,20 @@
+// Fl_Single_Window.H
+
+#ifndef Fl_Single_Window_H
+#define Fl_Single_Window_H
+
+#include "Fl_Window.H"
+
+class Fl_Single_Window : public Fl_Window {
+public:
+ void show();
+ void show(int a, char **b) {Fl_Window::show(a,b);}
+ void flush();
+ Fl_Single_Window(int W, int H, const char *l=0)
+ : Fl_Window(W,H,l) {}
+ Fl_Single_Window(int X, int Y, int W, int H, const char *l=0)
+ : Fl_Window(X,Y,W,H,l) {}
+ int make_current();
+};
+
+#endif
diff --git a/FL/Fl_Slider.H b/FL/Fl_Slider.H
new file mode 100644
index 000000000..148f761be
--- /dev/null
+++ b/FL/Fl_Slider.H
@@ -0,0 +1,46 @@
+// Fl_Slider.H
+
+#ifndef Fl_Slider_H
+#define Fl_Slider_H
+
+#ifndef Fl_Valuator_H
+#include "Fl_Valuator.H"
+#endif
+
+// values for type(), lowest bit indicate horizontal:
+#define FL_VERT_SLIDER 0
+#define FL_HOR_SLIDER 1
+#define FL_VERT_FILL_SLIDER 2
+#define FL_HOR_FILL_SLIDER 3
+#define FL_VERT_NICE_SLIDER 4
+#define FL_HOR_NICE_SLIDER 5
+
+class Fl_Slider : public Fl_Valuator {
+
+ float slider_size_;
+ uchar slider_;
+ void _Fl_Slider();
+ void draw_bg(int, int, int, int);
+
+protected:
+
+ // these allow subclasses to put the slider in a smaller area:
+ void draw(int, int, int, int);
+ int handle(int, int, int, int, int);
+
+public:
+
+ void draw();
+ int handle(int);
+ Fl_Slider(int x,int y,int w,int h, const char *l = 0);
+ Fl_Slider(uchar t,int x,int y,int w,int h, const char *l);
+
+ int scrollvalue(int windowtop,int windowsize,int first,int totalsize);
+ void bounds(double a, double b);
+ float slider_size() const {return slider_size_;}
+ void slider_size(double v);
+ Fl_Boxtype slider() const {return (Fl_Boxtype)slider_;}
+ void slider(Fl_Boxtype c) {slider_ = c;}
+};
+
+#endif
diff --git a/FL/Fl_Tabs.H b/FL/Fl_Tabs.H
new file mode 100644
index 000000000..2af820908
--- /dev/null
+++ b/FL/Fl_Tabs.H
@@ -0,0 +1,31 @@
+// Fl_Tabs.C
+
+// This is the "file card tabs" interface to allow you to put lots and lots
+// of buttons and switches in a panel, as popularized by many toolkits.
+
+// Each child widget is a card, and it's label() is printed on the card tab.
+// Clicking the tab makes that card visible.
+
+#ifndef Fl_Tabs_H
+#define Fl_Tabs_H
+
+#include "Fl_Group.H"
+
+class Fl_Tabs : public Fl_Group {
+ Fl_Widget *value_;
+ Fl_Widget *push_;
+ void draw();
+ int tab_positions(int*, int*);
+ int tab_height();
+ void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int sel=0);
+public:
+ int handle(int);
+ Fl_Widget *value();
+ int value(Fl_Widget *);
+ Fl_Widget *push() const {return push_;}
+ int push(Fl_Widget *);
+ Fl_Tabs(int,int,int,int,const char * = 0);
+ Fl_Widget *which(int event_x, int event_y);
+};
+
+#endif
diff --git a/FL/Fl_Tile.H b/FL/Fl_Tile.H
new file mode 100644
index 000000000..118fd2cc4
--- /dev/null
+++ b/FL/Fl_Tile.H
@@ -0,0 +1,18 @@
+// Fl_Tile.H - Group of 2,3 or 4 "tiles" that can be resized by
+// dragging the borders between them. May be improved in the future
+// to handle more tiles in arbitrary layout.
+
+#ifndef Fl_Tile_H
+#define Fl_Tile_H
+
+#include "Fl_Group.H"
+
+class Fl_Tile : public Fl_Group {
+ int handle(int);
+public:
+ Fl_Tile(int X,int Y,int W,int H,const char*l=0) : Fl_Group(X,Y,W,H,l) {}
+ void resize(int, int, int, int);
+ void position(int, int, int, int);
+};
+
+#endif
diff --git a/FL/Fl_Timer.H b/FL/Fl_Timer.H
new file mode 100644
index 000000000..7ed9e018b
--- /dev/null
+++ b/FL/Fl_Timer.H
@@ -0,0 +1,38 @@
+// Fl_Timer.H
+
+// Emulate the forms Timer widget
+
+#ifndef Fl_Timer_H
+#define Fl_Timer_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+// values for type():
+#define FL_NORMAL_TIMER 0
+#define FL_VALUE_TIMER 1
+#define FL_HIDDEN_TIMER 2
+
+class Fl_Timer : public Fl_Widget {
+ static void stepcb(void *);
+ void step();
+ char on, direction_;
+ double delay, total;
+ long lastsec,lastusec;
+protected:
+ void draw();
+public:
+ int handle(int);
+ Fl_Timer(uchar t,int x,int y,int w,int h, const char *l);
+ ~Fl_Timer();
+ void value(double);
+ double value() const {return delay>0.0?delay:0.0;}
+ char direction() const {return direction_;}
+ void direction(char d) {direction_ = d;}
+ char suspended() const {return !on;}
+ void suspended(char d);
+};
+
+#endif
+
diff --git a/FL/Fl_Toggle_Button.H b/FL/Fl_Toggle_Button.H
new file mode 100644
index 000000000..12da9a577
--- /dev/null
+++ b/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/FL/Fl_Toggle_Light_Button.H b/FL/Fl_Toggle_Light_Button.H
new file mode 100644
index 000000000..5ac3c1b16
--- /dev/null
+++ b/FL/Fl_Toggle_Light_Button.H
@@ -0,0 +1,6 @@
+// provided for back-compatability only
+
+#ifndef Fl_Toggle_Light_Button
+#include "Fl_Light_Button.H"
+#define Fl_Toggle_Light_Button Fl_Light_Button
+#endif
diff --git a/FL/Fl_Toggle_Round_Button.H b/FL/Fl_Toggle_Round_Button.H
new file mode 100644
index 000000000..18f74f7b8
--- /dev/null
+++ b/FL/Fl_Toggle_Round_Button.H
@@ -0,0 +1,6 @@
+// provided for back-compatability only
+
+#ifndef Fl_Toggle_Round_Button
+#include "Fl_Round_Button.H"
+#define Fl_Toggle_Round_Button Fl_Round_Button
+#endif
diff --git a/FL/Fl_Valuator.H b/FL/Fl_Valuator.H
new file mode 100644
index 000000000..4444bdd8d
--- /dev/null
+++ b/FL/Fl_Valuator.H
@@ -0,0 +1,59 @@
+// Fl_Valuator.H
+
+// Base class for sliders and all other one-value "knobs"
+
+#ifndef Fl_Valuator_H
+#define Fl_Valuator_H
+
+#ifndef Fl_Widget_H
+#include "Fl_Widget.H"
+#endif
+
+// shared type() values for classes that work in both directions:
+#define FL_VERTICAL 0
+#define FL_HORIZONTAL 1
+
+class Fl_Valuator : public Fl_Widget {
+
+ double value_;
+ double previous_value_;
+ double min, max; // truncates to this range *after* rounding
+ double A; int B; // rounds to multiples of A/B, or no rounding if A is zero
+
+protected:
+
+ int horizontal() const {return type()&1;}
+ Fl_Valuator(int X, int Y, int W, int H, const char* L);
+
+ double previous_value() const {return previous_value_;}
+ void handle_push() {previous_value_ = value_;}
+ double softclamp(double);
+ void handle_drag(double newvalue);
+ void handle_release(); // use drag() value
+ virtual void value_damage(); // cause damage() due to value() changing
+
+public:
+
+ void bounds(double a, double b) {min=a; max=b;}
+ double minimum() const {return min;}
+ void minimum(double a) {min = a;}
+ double maximum() const {return max;}
+ void maximum(double a) {max = a;}
+ void range(double a, double b) {min = a; max = b;}
+ void step(int a) {A = a; B = 1;}
+ void step(double a, int b) {A = a; B = b;}
+ void step(double s);
+ double step() const {return A/B;}
+ void precision(int);
+
+ double value() const {return value_;}
+ int value(double);
+
+ virtual int format(char*);
+ double round(double); // round to nearest multiple of step
+ double clamp(double); // keep in range
+ double increment(double, int); // add n*step to value
+};
+
+#endif
+
diff --git a/FL/Fl_Value_Input.H b/FL/Fl_Value_Input.H
new file mode 100644
index 000000000..ddb557b05
--- /dev/null
+++ b/FL/Fl_Value_Input.H
@@ -0,0 +1,50 @@
+// Fl_Value_Input.H
+
+// Edit text or drag to adjust floating point value.
+// as suggested by Pierre Jasmin
+
+// Current behavior:
+// Dragging left mouse moves by step()
+// Middle mouse is 5*step()
+// Right mouse is 20*step()
+// clicking any mouse button puts insertion cursor there
+// You can also navigate there with tab
+
+// Bugs (?):
+// No way to select region of text
+// Hard to paste in new values
+
+#ifndef Fl_Value_Input_H
+#define Fl_Value_Input_H
+
+#include "Fl_Valuator.H"
+#include "Fl_Input.H"
+
+class Fl_Value_Input : public Fl_Valuator {
+public:
+ Fl_Input input;
+private:
+ char soft_;
+ static void input_cb(Fl_Widget*,void*);
+ virtual void value_damage(); // cause damage() due to value() changing
+public:
+ int handle(int);
+ void draw();
+ void resize(int,int,int,int);
+ Fl_Value_Input(int x,int y,int w,int h,const char *l=0);
+
+ void soft(char x) {soft_ = x;}
+ char soft() const {return soft_;}
+
+ Fl_Font textfont() const {return input.textfont();}
+ void textfont(uchar s) {input.textfont(s);}
+ uchar textsize() const {return input.textsize();}
+ void textsize(uchar s) {input.textsize(s);}
+ Fl_Color textcolor() const {return input.textcolor();}
+ void textcolor(uchar n) {input.textcolor(n);}
+ Fl_Color cursor_color() const {return input.cursor_color();}
+ void cursor_color(uchar n) {input.cursor_color(n);}
+
+};
+
+#endif
diff --git a/FL/Fl_Value_Output.H b/FL/Fl_Value_Output.H
new file mode 100644
index 000000000..0d1e10a7a
--- /dev/null
+++ b/FL/Fl_Value_Output.H
@@ -0,0 +1,32 @@
+// Fl_Value_Output.H
+
+// Fltk widget for drag-adjusting a floating point value.
+// This is much lighter than Fl_Value_Input because it has no text editor
+// If you deactivate() it, it can be used to display a floating-point value
+
+#ifndef Fl_Value_Output_H
+#define Fl_Value_Output_H
+
+#ifndef Fl_Valuator_H
+#include "Fl_Valuator.H"
+#endif
+
+class Fl_Value_Output : public Fl_Valuator {
+ uchar textfont_, textsize_, textcolor_, soft_;
+public:
+ int handle(int);
+ void draw();
+ Fl_Value_Output(int x,int y,int w,int h,const char *l=0);
+
+ void soft(uchar x) {soft_ = x;}
+ uchar soft() const {return soft_;}
+
+ Fl_Font textfont() const {return (Fl_Font)textfont_;}
+ void textfont(uchar s) {textfont_ = s;}
+ uchar textsize() const {return textsize_;}
+ void textsize(uchar s) {textsize_ = s;}
+ Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ void textcolor(uchar s) {textcolor_ = s;}
+};
+
+#endif
diff --git a/FL/Fl_Value_Slider.H b/FL/Fl_Value_Slider.H
new file mode 100644
index 000000000..defc8ccde
--- /dev/null
+++ b/FL/Fl_Value_Slider.H
@@ -0,0 +1,26 @@
+/* Fl_Value_Slider.H
+
+ A slider with a box displaying the current value
+
+*/
+
+#ifndef Fl_Value_Slider_H
+#define Fl_Value_Slider_H
+
+#include "Fl_Slider.H"
+
+class Fl_Value_Slider : public Fl_Slider {
+ uchar textfont_, textsize_, textcolor_;
+public:
+ void draw();
+ int handle(int);
+ Fl_Value_Slider(int x,int y,int w,int h, const char *l = 0);
+ Fl_Font textfont() const {return (Fl_Font)textfont_;}
+ void textfont(uchar s) {textfont_ = s;}
+ uchar textsize() const {return textsize_;}
+ void textsize(uchar s) {textsize_ = s;}
+ Fl_Color textcolor() const {return (Fl_Color)textcolor_;}
+ void textcolor(uchar s) {textcolor_ = s;}
+};
+
+#endif
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
new file mode 100644
index 000000000..d49fced1b
--- /dev/null
+++ b/FL/Fl_Widget.H
@@ -0,0 +1,178 @@
+// Fl_Widget.H
+
+// fltk (Fast Light Tool Kit) version 0.99
+// Copyright (C) 1998 Bill Spitzak
+
+#ifndef Fl_Widget_H
+#define Fl_Widget_H
+
+#include "Enumerations.H"
+
+class Fl_Widget;
+class Fl_Window;
+
+typedef void (Fl_Callback )(Fl_Widget*, void*);
+typedef void (Fl_Callback0)(Fl_Widget*);
+typedef void (Fl_Callback1)(Fl_Widget*, long);
+
+struct Fl_Label {
+ const char* value;
+ uchar type;
+ uchar font;
+ uchar size;
+ uchar color;
+ void draw(int,int,int,int, Fl_Align) const ;
+ void measure(int&, int&) const ;
+};
+
+class Fl_Widget {
+ friend class Fl_Group;
+
+ Fl_Widget* parent_;
+ Fl_Callback* callback_;
+ void* user_data_;
+ short x_,y_,w_,h_;
+ Fl_Label label_;
+ uchar type_;
+ uchar flags_;
+ uchar damage_;
+ uchar box_;
+ uchar color_;
+ uchar color2_;
+ uchar align_;
+ uchar when_;
+
+ // "de-implement" the copy constructors:
+ Fl_Widget & operator=(const Fl_Widget &);
+ Fl_Widget(const Fl_Widget &);
+
+protected:
+
+ Fl_Widget(int,int,int,int,const char* =0);
+
+ void x(int v) {x_ = v;}
+ void y(int v) {y_ = v;}
+ void w(int v) {w_ = v;}
+ void h(int v) {h_ = v;}
+
+ uchar flags() const {return flags_;}
+ void set_flag(int c) {flags_ |= c;}
+ void clear_flag(int c) {flags_ &= ~c;}
+ enum {INACTIVE=1, INVISIBLE=2, OUTPUT=4, SHORTCUT_LABEL=64, CHANGED=128};
+
+ void draw_box() const;
+ void draw_box(Fl_Boxtype, Fl_Color) const;
+ void draw_box(Fl_Boxtype, int,int,int,int, Fl_Color) const;
+ void draw_label() const;
+ void draw_label(int, int, int, int) const;
+
+ static Fl_Font default_font_;
+ static int default_size_;
+
+public:
+
+ virtual ~Fl_Widget();
+
+ virtual void draw() = 0;
+ virtual int handle(int);
+ Fl_Widget* parent() const {return parent_;}
+ void parent(Fl_Widget* w) {parent_ = w;} // for hacks only
+
+ uchar type() const {return type_;}
+ void type(uchar t) {type_ = t;}
+
+ int x() const {return x_;}
+ int y() const {return y_;}
+ int w() const {return w_;}
+ int h() const {return h_;}
+ virtual void resize(int,int,int,int);
+ int damage_resize(int,int,int,int);
+ void position(int X,int Y) {resize(X,Y,w_,h_);}
+ void size(int W,int H) {resize(x_,y_,W,H);}
+
+ Fl_Align align() const {return (Fl_Align)align_;}
+ void align(uchar a) {align_ = a;}
+ Fl_Boxtype box() const {return (Fl_Boxtype)box_;}
+ void box(Fl_Boxtype a) {box_ = a;}
+ Fl_Color color() const {return (Fl_Color)color_;}
+ void color(uchar a) {color_ = a;}
+ Fl_Color selection_color() const {return (Fl_Color)color2_;}
+ void selection_color(uchar a) {color2_ = a;}
+ void color(uchar a, uchar b) {color_=a; color2_=b;}
+ const char* label() const {return label_.value;}
+ void label(const char* a) {label_.value=a;}
+ void label(Fl_Labeltype a,const char* b) {label_.type = a; label_.value = b;}
+ Fl_Labeltype labeltype() const {return (Fl_Labeltype)label_.type;}
+ void labeltype(Fl_Labeltype a) {label_.type = a;}
+ Fl_Color labelcolor() const {return (Fl_Color)label_.color;}
+ void labelcolor(uchar a) {label_.color=a;}
+ Fl_Font labelfont() const {return (Fl_Font)label_.font;}
+ void labelfont(uchar a) {label_.font=a;}
+ uchar labelsize() const {return label_.size;}
+ void labelsize(uchar a) {label_.size=a;}
+ Fl_Callback* callback() const {return callback_;}
+ void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
+ void callback(Fl_Callback* c) {callback_=c;}
+ void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
+ void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
+ void* user_data() const {return user_data_;}
+ void user_data(void* v) {user_data_ = v;}
+ long argument() const {return (long)user_data_;}
+ void argument(long v) {user_data_ = (void*)v;}
+ Fl_When when() const {return (Fl_When)when_;}
+ void when(uchar i) {when_ = i;}
+
+ static void default_font(Fl_Font b) {default_font_ = b;}
+ static Fl_Font default_font() {return default_font_;}
+ static void default_size(int b) {default_size_ = b;}
+ static int default_size() {return default_size_;}
+
+ int visible() const {return !(flags_&INVISIBLE);}
+ int visible_r() const;
+ void show();
+ void hide();
+ void set_visible() {flags_ &= ~INVISIBLE;}
+ void clear_visible() {flags_ |= INVISIBLE;}
+ int active() const {return !(flags_&INACTIVE);}
+ int active_r() const;
+ void activate();
+ void deactivate();
+ int output() const {return (flags_&OUTPUT);}
+ void set_output() {flags_ |= OUTPUT;}
+ void clear_output() {flags_ &= ~OUTPUT;}
+ int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
+ int changed() const {return flags_&CHANGED;}
+ void set_changed() {flags_ |= CHANGED;}
+ void clear_changed() {flags_ &= ~CHANGED;}
+ int take_focus();
+
+ static void default_callback(Fl_Widget*, void*);
+ void do_callback() {callback_(this,user_data_);}
+ void do_callback(Fl_Widget* o,void* arg=0) {callback_(o,arg);}
+ void do_callback(Fl_Widget* o,long arg) {callback_(o,(void*)arg);}
+ int test_shortcut();
+ static int test_shortcut(const char*);
+ int contains(const Fl_Widget*) const ;
+ int inside(const Fl_Widget* o) const {return o ? o->contains(this) : 0;}
+
+ void redraw();
+ uchar damage() const {return damage_;}
+ void clear_damage(uchar c = 0) {damage_ = c;}
+ void damage(uchar c);
+ void damage(uchar c,int,int,int,int);
+ void draw_label(int, int, int, int, Fl_Align) const;
+ void measure_label(int& x, int& y) {label_.measure(x,y);}
+
+ Fl_Window* window() const ;
+
+ // back compatability only:
+ Fl_Color color2() const {return (Fl_Color)color2_;}
+ void color2(uchar a) {color2_ = a;}
+};
+
+// reserved type numbers (necessary for my cheapo RTTI) start here.
+// grep the header files for "RESERVED_TYPE" to find the next available
+// number.
+#define FL_RESERVED_TYPE 100
+
+#endif
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
new file mode 100644
index 000000000..b365f67cf
--- /dev/null
+++ b/FL/Fl_Window.H
@@ -0,0 +1,90 @@
+// Fl_Window.H
+
+// fltk (Fast Light Tool Kit) version 0.99
+// Copyright (C) 1998 Bill Spitzak
+
+#ifndef Fl_Window_H
+#define Fl_Window_H
+
+#include "Fl_Group.H"
+
+#define FL_WINDOW 0xF0 // all subclasses have type() >= this
+
+class Fl_Window : public Fl_Group {
+
+ friend class Fl_X; Fl_X *i; // points at the system-specific stuff
+
+ const char* iconlabel_;
+ const char* xclass_;
+ // size_range stuff:
+ short minw, minh, maxw, maxh;
+ uchar dw, dh, aspect, size_range_set;
+ void size_range_();
+ // values for flags():
+ enum {
+ FL_MODAL = 64,
+ FL_NOBORDER = 8,
+ FL_FORCE_POSITION = 16,
+ FL_NON_MODAL = 32
+ };
+ static Fl_Window *current_;
+ void _Fl_Window(); // constructor innards
+
+protected:
+
+ virtual void draw();
+ virtual void flush();
+
+public:
+
+ Fl_Window(int,int,int,int, const char* = 0);
+ Fl_Window(int,int, const char* = 0);
+ virtual ~Fl_Window();
+
+ virtual int handle(int);
+
+ virtual void resize(int,int,int,int);
+ void border(int b);
+ void clear_border() {set_flag(FL_NOBORDER);}
+ int border() const {return !(flags() & FL_NOBORDER);}
+ void set_modal() {set_flag(FL_MODAL);}
+ uchar modal() const {return flags() & FL_MODAL;}
+ void set_non_modal() {set_flag(FL_NON_MODAL);}
+ uchar non_modal() const {return flags() & (FL_NON_MODAL|FL_MODAL);}
+
+ void hotspot(int x, int y, int offscreen = 0);
+ void hotspot(const Fl_Widget*, int offscreen = 0);
+ void hotspot(const Fl_Widget& p, int offscreen = 0) {hotspot(&p,offscreen);}
+ void free_position() {clear_flag(FL_FORCE_POSITION);}
+ void size_range(int a, int b, int c=0, int d=0, int e=0, int f=0, int g=0) {
+ minw=a; minh=b; maxw=c; maxh=d; dw=e; dh=f; aspect=g; size_range_();}
+
+ const char* label() const {return Fl_Widget::label();}
+ const char* iconlabel() const {return iconlabel_;}
+ void label(const char*);
+ void iconlabel(const char*);
+ void label(const char* label, const char* iconlabel);
+ const char* xclass() const {return xclass_;}
+ void xclass(const char* c) {xclass_ = c;}
+
+ int shown() {return i != 0;}
+ virtual void show();
+ virtual void hide();
+ void show(int, char**);
+ void fullscreen();
+ void fullscreen_off(int,int,int,int);
+ void iconize();
+
+ int x_root() const ;
+ int y_root() const ;
+
+ static Fl_Window *current() {return current_;}
+ void make_current();
+
+ // for back-compatability only:
+ void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
+ static void default_callback(Fl_Window*, void* v);
+
+};
+
+#endif
diff --git a/FL/dirent.h b/FL/dirent.h
new file mode 100644
index 000000000..2ddc15dae
--- /dev/null
+++ b/FL/dirent.h
@@ -0,0 +1,4 @@
+// this file is for back-compatability only
+#include "fl_scandir.H"
+
+
diff --git a/FL/filename.H b/FL/filename.H
new file mode 100644
index 000000000..2952108e7
--- /dev/null
+++ b/FL/filename.H
@@ -0,0 +1,41 @@
+// filename.H
+
+// fltk filename utilities. These are used by the file chooser but may
+// be useful to other programs.
+
+#ifndef FL_PATH_MAX
+
+#define FL_PATH_MAX 256 // all buffers are this length
+
+const char *filename_name(const char *); // return pointer to name
+const char *filename_ext(const char *); // return pointer to .ext
+char *filename_setext(char *,const char *ext); // clobber .ext
+int filename_expand(char *, const char *from); // do $x and ~x
+int filename_absolute(char *, const char *from); // prepend getcwd()
+int filename_match(const char *, const char *pattern); // glob match
+int filename_isdir(const char*);
+
+// Portable "scandir" function. Ugly but apparently necessary...
+
+#ifdef WIN32
+
+struct dirent {char d_name[1];};
+
+#else
+
+#include <sys/types.h>
+#include <dirent.h>
+// warning: on some systems (very few nowadays?) <dirent.h> may not exist.
+// The correct information is in one of these files:
+//#include <sys/ndir.h>
+//#include <sys/dir.h>
+//#include <ndir.h>
+// plus you must do the following #define:
+//#define dirent direct
+// It would be best to create a <dirent.h> file that does this...
+
+#endif
+
+int filename_list(const char *d, dirent ***list);
+
+#endif
diff --git a/FL/fl_ask.H b/FL/fl_ask.H
new file mode 100644
index 000000000..8671e0140
--- /dev/null
+++ b/FL/fl_ask.H
@@ -0,0 +1,51 @@
+// fl_ask.H
+
+// Pop-up window utilities
+// This header file is usable without including any other fltk headers
+
+#ifndef fl_ask_H
+#define fl_ask_H
+
+class Fl_Widget;
+
+void fl_message(const char *);
+void fl_alert(const char *);
+int fl_ask(const char *);
+int fl_choice(const char *q,const char *b0,const char *b1,const char *b2);
+const char *fl_input(const char *label, const char *deflt, unsigned char type);
+const char *fl_input(const char *label, const char *deflt = 0);
+inline const char *fl_password(const char *label, const char *deflt = 0) {
+ return fl_input(label, deflt, 5);
+}
+Fl_Widget *fl_message_icon();
+extern unsigned char fl_message_font_;
+extern unsigned char fl_message_size_;
+inline void fl_message_font(unsigned char f,unsigned char s) {
+ fl_message_font_ = f; fl_message_size_ = s;}
+
+// pointers you can use to change fltk to a foreign language:
+extern const char* fl_no;
+extern const char* fl_yes;
+extern const char* fl_ok;
+extern const char* fl_cancel;
+
+// back compatability and XForms compatability functions:
+
+inline int fl_show_question(const char *c) {return fl_ask(c);}
+void fl_show_message(const char *,const char *,const char *);
+void fl_show_alert(const char *,const char *,const char *);
+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);
+
+// all are implemented using this:
+int fl_show_choice(
+ const char *m1,
+ const char *m2,
+ const char *m3,
+ int numb,
+ const char *b0,
+ const char *b1,
+ const char *b2);
+
+#endif
diff --git a/FL/fl_draw.H b/FL/fl_draw.H
new file mode 100644
index 000000000..49b7c51c4
--- /dev/null
+++ b/FL/fl_draw.H
@@ -0,0 +1,135 @@
+// fl_draw.H
+// Portable drawing functions
+
+#ifndef fl_draw_H
+#define fl_draw_H
+
+#include "Enumerations.H" // for the color names
+
+// Colors:
+void fl_color(Fl_Color); // select indexed color
+inline void fl_color(int c) {fl_color((Fl_Color)c);} // for back compatability
+void fl_color(uchar, uchar, uchar); // select actual color
+extern Fl_Color fl_color_; inline Fl_Color fl_color() {return fl_color_;}
+
+// clip:
+void fl_clip(int x, int y, int w, int h);
+#define fl_push_clip fl_clip
+void fl_push_no_clip();
+void fl_pop_clip();
+int fl_not_clipped(int x, int y, int w, int h);
+int fl_clip_box(int, int, int, int, int& x, int& y, int& w, int& h);
+
+// points:
+void fl_point(int x, int y);
+
+// rectangles tweaked to exactly fill the pixel rectangle:
+void fl_rect(int x, int y, int w, int h);
+void fl_rectf(int x, int y, int w, int h);
+
+// line segments:
+void fl_line(int,int, int,int);
+void fl_line(int,int, int,int, int,int);
+
+// closed line segments:
+void fl_loop(int,int, int,int, int,int);
+void fl_loop(int,int, int,int, int,int, int,int);
+
+// filled polygons
+void fl_polygon(int,int, int,int, int,int);
+void fl_polygon(int,int, int,int, int,int, int,int);
+
+// draw rectilinear lines, horizontal segment first:
+void fl_xyline(int x, int y, int x1);
+void fl_xyline(int x, int y, int x1, int y2);
+void fl_xyline(int x, int y, int x1, int y2, int x3);
+
+// draw rectilinear lines, vertical segment first:
+void fl_yxline(int x, int y, int y1);
+void fl_yxline(int x, int y, int y1, int x2);
+void fl_yxline(int x, int y, int y1, int x2, int y3);
+
+// circular lines and pie slices (code in fl_arci.C):
+void fl_arc(int x, int y, int w, int h, double a1, double a2);
+void fl_pie(int x, int y, int w, int h, double a1, double a2);
+void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi
+
+// scalable drawing code (code in fl_vertex.C and fl_arc.C):
+void fl_push_matrix();
+void fl_pop_matrix();
+void fl_scale(double x, double y);
+void fl_scale(double x);
+void fl_translate(double x, double y);
+void fl_rotate(double d);
+void fl_mult_matrix(double a, double b, double c, double d, double x,double y);
+void fl_begin_points();
+void fl_begin_line();
+void fl_begin_loop();
+void fl_begin_polygon();
+void fl_vertex(double x, double y);
+void fl_curve(double, double, double, double, double, double, double, double);
+void fl_arc(double x, double y, double r, double start, double a);
+void fl_circle(double x, double y, double r);
+void fl_end_points();
+void fl_end_line();
+void fl_end_loop();
+void fl_end_polygon();
+void fl_begin_complex_polygon();
+void fl_gap();
+void fl_end_complex_polygon();
+// get and use transformed positions:
+double fl_transform_x(double x, double y);
+double fl_transform_y(double x, double y);
+double fl_transform_dx(double x, double y);
+double fl_transform_dy(double x, double y);
+void fl_transformed_vertex(double x, double y);
+
+// current font:
+void fl_font(int face, int size);
+void fl_font(int face, int size, Fl_Font default_font, int default_size);
+extern int fl_font_; inline int fl_font() {return fl_font_;}
+extern int fl_size_; inline int fl_size() {return fl_size_;}
+
+// information you can get about the current font:
+int fl_height(); // using "size" should work ok
+int fl_descent();
+double fl_width(const char*);
+double fl_width(const char*, int n);
+double fl_width(uchar);
+
+// draw using current font:
+void fl_draw(const char*, int x, int y);
+void fl_draw(const char*, int n, int x, int y);
+void fl_draw(const char*, int x, int y, int w, int h, Fl_Align);
+void fl_measure(const char*, int& x, int& y);
+
+// 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);
+void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
+
+// images:
+void fl_draw_image(const uchar*, int,int,int,int, int delta=3, int ldelta=0);
+void fl_draw_image_mono(const uchar*, int,int,int,int, int delta=1, int ld=0);
+typedef void (*Fl_Draw_Image_Cb)(void*,int,int,int,uchar*);
+void fl_draw_image(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=3);
+void fl_draw_image_mono(Fl_Draw_Image_Cb, void*, int,int,int,int, int delta=1);
+void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
+
+// pixmaps:
+int fl_draw_pixmap(/*const*/ char* const* data, int x,int y,Fl_Color=FL_GRAY);
+int fl_measure_pixmap(/*const*/ char* const* data, int &w, int &h);
+
+// other:
+extern void fl_scroll(int X, int Y, int W, int H, int dx, int dy,
+ void (*draw_area)(void*, int,int,int,int), void* data);
+const char* fl_shortcut_label(int);
+void fl_overlay_rect(int,int,int,int);
+void fl_overlay_clear();
+void fl_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
+
+// XForms symbols:
+int fl_draw_symbol(const char* label,int x,int y,int w,int h, Fl_Color);
+int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scalable);
+
+#endif
diff --git a/FL/fl_file_chooser.H b/FL/fl_file_chooser.H
new file mode 100644
index 000000000..82fef8bbc
--- /dev/null
+++ b/FL/fl_file_chooser.H
@@ -0,0 +1,9 @@
+// fl_file_chooser.H
+
+#ifndef fl_file_chooser_H
+#define fl_file_chooser_H
+
+char *fl_file_chooser(const char *message,const char *pat,const char *fname);
+void fl_file_chooser_callback(void (*cb)(const char *));
+
+#endif
diff --git a/FL/fl_message.H b/FL/fl_message.H
new file mode 100644
index 000000000..c03141c07
--- /dev/null
+++ b/FL/fl_message.H
@@ -0,0 +1,2 @@
+// fl_message.H
+#include "fl_ask.H"
diff --git a/FL/fl_show_colormap.H b/FL/fl_show_colormap.H
new file mode 100644
index 000000000..eb6b0f361
--- /dev/null
+++ b/FL/fl_show_colormap.H
@@ -0,0 +1,10 @@
+// fl_show_colormap.H
+
+// Color picker copied from Forms
+
+#ifndef fl_show_colormap_H
+#define fl_show_colormap_H
+
+Fl_Color fl_show_colormap(Fl_Color oldcol);
+
+#endif
diff --git a/FL/fl_show_input.H b/FL/fl_show_input.H
new file mode 100644
index 000000000..9635836ad
--- /dev/null
+++ b/FL/fl_show_input.H
@@ -0,0 +1,2 @@
+// fl_show_input.H
+#include "fl_ask.H"
diff --git a/FL/forms.H b/FL/forms.H
new file mode 100644
index 000000000..87ca5afc0
--- /dev/null
+++ b/FL/forms.H
@@ -0,0 +1,810 @@
+// forms.h
+
+// Include file for emulating the original Mark Overmars
+// Forms library. Based on version 0.86, 3/22/97
+// Warning: emulation is in no way 100%!!
+
+#ifndef __FORMS_H__
+#define __FORMS_H__
+
+#include "Fl.H"
+#include "Fl_Group.H"
+#include "Fl_Window.H"
+#include "fl_draw.H"
+
+typedef Fl_Widget FL_OBJECT;
+typedef Fl_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 FL_BLACK
+#define FL_COL1 FL_GRAY
+#define FL_MCOL FL_LIGHT1
+#define FL_LEFT_BCOL FL_LIGHT3 // 53 is better match
+#define FL_TOP_BCOL FL_LIGHT2 // 51
+#define FL_BOTTOM_BCOL FL_DARK2 // 40
+#define FL_RIGHT_BCOL FL_DARK3 // 36
+#define FL_INACTIVE FL_INACTIVE_COLOR
+#define FL_INACTIVE_COL FL_INACTIVE_COLOR
+#define FL_FREE_COL1 FL_FREE_COLOR
+#define FL_FREE_COL2 ((Fl_Color)(FL_FREE_COLOR+1))
+#define FL_FREE_COL3 ((Fl_Color)(FL_FREE_COLOR+2))
+#define FL_FREE_COL4 ((Fl_Color)(FL_FREE_COLOR+3))
+#define FL_FREE_COL5 ((Fl_Color)(FL_FREE_COLOR+4))
+#define FL_FREE_COL6 ((Fl_Color)(FL_FREE_COLOR+5))
+#define FL_FREE_COL7 ((Fl_Color)(FL_FREE_COLOR+6))
+#define FL_FREE_COL8 ((Fl_Color)(FL_FREE_COLOR+7))
+#define FL_FREE_COL9 ((Fl_Color)(FL_FREE_COLOR+8))
+#define FL_FREE_COL10 ((Fl_Color)(FL_FREE_COLOR+9))
+#define FL_FREE_COL11 ((Fl_Color)(FL_FREE_COLOR+10))
+#define FL_FREE_COL12 ((Fl_Color)(FL_FREE_COLOR+11))
+#define FL_FREE_COL13 ((Fl_Color)(FL_FREE_COLOR+12))
+#define FL_FREE_COL14 ((Fl_Color)(FL_FREE_COLOR+13))
+#define FL_FREE_COL15 ((Fl_Color)(FL_FREE_COLOR+14))
+#define FL_FREE_COL16 ((Fl_Color)(FL_FREE_COLOR+15))
+#define FL_TOMATO ((Fl_Color)(131))
+#define FL_INDIANRED ((Fl_Color)(164))
+#define FL_SLATEBLUE ((Fl_Color)(195))
+#define FL_DARKGOLD ((Fl_Color)(84))
+#define FL_PALEGREEN ((Fl_Color)(157))
+#define FL_ORCHID ((Fl_Color)(203))
+#define FL_DARKCYAN ((Fl_Color)(189))
+#define FL_DARKTOMATO ((Fl_Color)(113))
+#define FL_WHEAT ((Fl_Color)(174))
+
+#define FL_ALIGN_BESIDE FL_ALIGN_INSIDE
+
+#define FL_PUP_TOGGLE 2 // FL_MENU_TOGGLE
+#define FL_PUP_INACTIVE 1 // FL_MENU_INACTIVE
+#define FL_NO_FRAME FL_NO_BOX
+#define FL_ROUNDED3D_UPBOX FL_ROUND_UP_BOX
+#define FL_ROUNDED3D_DOWNBOX FL_ROUND_DOWN_BOX
+#define FL_OVAL3D_UPBOX FL_ROUND_UP_BOX
+#define FL_OVAL3D_DOWNBOX FL_ROUND_DOWN_BOX
+
+#define FL_MBUTTON1 1
+#define FL_LEFT_MOUSE 1
+#define FL_LEFTMOUSE 1
+#define FL_MBUTTON2 2
+#define FL_MIDDLE_MOUSE 2
+#define FL_MIDDLEMOUSE 2
+#define FL_MBUTTON3 3
+#define FL_RIGHT_MOUSE 3
+#define FL_RIGHTMOUSE 3
+#define FL_MBUTTON4 4
+#define FL_MBUTTON5 5
+
+#define FL_INVALID_STYLE 255
+#define FL_NORMAL_STYLE FL_HELVETICA
+#define FL_BOLD_STYLE FL_HELVETICA_BOLD
+#define FL_ITALIC_STYLE FL_HELVETICA_ITALIC
+#define FL_BOLDITALIC_STYLE FL_HELVETICA_BOLD_ITALIC
+#define FL_FIXED_STYLE FL_COURIER
+#define FL_FIXEDBOLD_STYLE FL_COURIER_BOLD
+#define FL_FIXEDITALIC_STYLE FL_COURIER_ITALIC
+#define FL_FIXEDBOLDITALIC_STYLE FL_COURIER_BOLD_ITALIC
+#define FL_TIMES_STYLE FL_TIMES
+#define FL_TIMESBOLD_STYLE FL_TIMES_BOLD
+#define FL_TIMESITALIC_STYLE FL_TIMES_ITALIC
+#define FL_TIMESBOLDITALIC_STYLE FL_TIMES_BOLD_ITALIC
+
+// hacks to change the labeltype() when passed to fl_set_object_lstyle():
+#define FL_SHADOW_STYLE (FL_SHADOW_LABEL<<8)
+#define FL_ENGRAVED_STYLE (FL_ENGRAVED_LABEL<<8)
+#define FL_EMBOSSED_STYLE (FL_EMBOSSED_LABEL<<0)
+
+// size values are different from XForms, match older Forms:
+#define FL_TINY_SIZE 8
+#define FL_SMALL_SIZE 11 // 10
+#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 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, 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_Widget* fl_do_forms(void);
+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->labelsize(s);}
+inline void fl_set_object_lstyle(Fl_Widget* o,int a) {
+ o->labelfont((uchar)a); o->labeltype((Fl_Labeltype)(a>>8));}
+inline void fl_set_object_lcol(Fl_Widget* o, uchar a) {o->labelcolor(a);}
+#define fl_set_object_lcolor fl_set_object_lcol
+inline void fl_set_object_lalign(Fl_Widget* o, Fl_Align a) {o->align(a);}
+#define fl_set_object_align fl_set_object_lalign
+inline void fl_set_object_color(Fl_Widget* o,uchar a,uchar b) {o->color(a,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((Fl_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;
+}
+void fl_end_form();
+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_end_group() {Fl_Group::current()->forms_end();}
+inline void fl_addto_group(Fl_Widget* o) {((Fl_Group* )o)->begin();}
+#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*) {}
+
+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 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 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() {}
+void fl_set_graphics_mode(int,int);
+
+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?
+
+inline void fl_drw_box(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color bgc,int=3) {
+ fl_draw_box(b,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) {
+ fl_draw_box(b,x,y,w,h,bgc);}
+
+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,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->align(a);}
+//inline void fl_set_pixmap_colorcloseness(int, int, int);
+
+#include "Fl_Box.H"
+forms_constructorb(Fl_Box, fl_add_box)
+
+#include "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));}
+inline int fl_load_browser(Fl_Widget* o, const char* f) {
+ return ((Fl_Browser*)o)->load(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)->textsize(s);}
+inline void fl_set_browser_fontstyle(Fl_Widget* o, Fl_Font s) {
+ ((Fl_Browser*)o)->textfont(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 "Fl_Button.H"
+
+#define FL_NORMAL_BUTTON 0
+#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
+
+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_button_shortcut(Fl_Widget* b, const char* s,int=0) {
+ ((Fl_Button*)b)->shortcut(s);}
+//#define fl_set_object_shortcut(b,s) fl_set_button_shortcut(b,s)
+
+#include "Fl_Light_Button.H"
+forms_constructor(Fl_Light_Button, fl_add_lightbutton)
+
+#include "Fl_Round_Button.H"
+forms_constructor(Fl_Round_Button, fl_add_roundbutton)
+forms_constructor(Fl_Round_Button, fl_add_round3dbutton)
+
+#include "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, 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)->textfont(v);}
+inline void fl_set_chart_lsize(Fl_Widget* o, int v) {
+ ((Fl_Chart*)o)->textsize(v);}
+inline void fl_set_chart_lcolor(Fl_Widget* o, uchar v) {
+ ((Fl_Chart*)o)->textcolor(v);}
+#define fl_set_chart_lcol fl_set_chart_lcolor
+
+#include "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)->textsize(x);}
+inline void fl_set_choice_fontstyle(Fl_Widget* o, Fl_Font x) {
+ ((Fl_Choice*)o)->textfont(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 "Fl_Clock.H"
+forms_constructort(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 "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)->bounds(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);}
+inline void fl_set_counter_return(Fl_Widget* o, int v) {
+ ((Fl_Counter*)o)->when((Fl_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 "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)->bounds(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((Fl_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->align(FL_ALIGN_TOP_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 "fl_ask.H"
+#include "fl_show_colormap.H"
+
+inline int fl_show_question(const char* c, int) {return fl_ask(c);}
+inline void fl_show_alert(const char* a,const char*b,const char*c,int) {
+ fl_show_alert(a,b,c);}
+inline void fl_set_goodies_font(uchar a, uchar b) {fl_message_font(a,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 "filename.H"
+#include "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):
+char* fl_show_file_selector(const char* message,const char* dir,
+ const char* pat,const char* fname);
+char* fl_get_directory();
+char* fl_get_pattern();
+char* fl_get_filename();
+
+#include "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((Fl_When)(x | FL_WHEN_RELEASE));}
+inline void fl_set_input_color(Fl_Widget* o, uchar a, uchar b) {
+ ((Fl_Input*)o)->textcolor(a);
+ ((Fl_Input*)o)->cursor_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 "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((Fl_When)(v|FL_WHEN_RELEASE));}
+
+#include "Fl_Slider.H"
+
+#define FL_HOR_BROWSER_SLIDER FL_HOR_SLIDER
+#define FL_VERT_BROWSER_SLIDER FL_VERT_SLIDER
+
+forms_constructort(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)->bounds(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((Fl_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 "Fl_Value_Slider.H"
+forms_constructor(Fl_Value_Slider, fl_add_valslider)
+
+inline void fl_set_slider_precision(Fl_Widget* o, int i) {
+ ((Fl_Value_Slider*)o)->precision(i);}
+// filter function!
+
+// 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_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); align(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);}
+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__ */
diff --git a/FL/gl.h b/FL/gl.h
new file mode 100644
index 000000000..5db50e046
--- /dev/null
+++ b/FL/gl.h
@@ -0,0 +1,42 @@
+// gl.H
+// Fltk gl drawing functions.
+// You must include this instead of GL/gl.h to get around a stupid
+// fuck up by our good friends at Microsloth.
+// This file also provides "missing" OpenGL functions, and
+// gl_start() and gl_finish() to allow OpenGL to be used in any window
+
+#ifndef gl_draw_H
+#define gl_draw_H
+
+#include "Enumerations.H" // for color names
+#ifdef WIN32
+# include <windows.h>
+#endif
+#include <GL/gl.h>
+
+void gl_start();
+void gl_finish();
+
+void gl_color(Fl_Color);
+inline void gl_color(int c) {gl_color((Fl_Color)c);} // back compatability
+
+void gl_rect(int x,int y,int w,int h);
+inline void gl_rectf(int x,int y,int w,int h) {glRecti(x,y,x+w,y+h);}
+
+void gl_font(int fontid, int size);
+int gl_height();
+int gl_descent();
+double gl_width(const char *);
+double gl_width(const char *, int n);
+double gl_width(uchar);
+
+void gl_draw(const char*);
+void gl_draw(const char*, int n);
+void gl_draw(const char*, int x, int y);
+void gl_draw(const char*, int n, int x, int y);
+void gl_draw(const char*, int x, int y, int w, int h, Fl_Align);
+void gl_measure(const char*, int& x, int& y);
+
+void gl_draw_image(const uchar *, int x,int y,int w,int h, int d=3, int ld=0);
+
+#endif
diff --git a/FL/gl2opengl.h b/FL/gl2opengl.h
new file mode 100644
index 000000000..b89614e0f
--- /dev/null
+++ b/FL/gl2opengl.h
@@ -0,0 +1,35 @@
+/* gl.h
+
+ GL to OpenGL translator.
+ If you include this, you might be able to port old GL programs.
+ There are also much better emulators available on the net.
+
+*/
+
+#include <FL/gl.h>
+#include "gl_draw.H"
+
+inline void clear() {glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);}
+#define RGBcolor(r,g,b) glColor3ub(r,g,b)
+#define bgnline() glBegin(GL_LINE_STRIP)
+#define bgnpolygon() glBegin(GL_POLYGON)
+#define bgnclosedline() glBegin(GL_LINE_LOOP)
+#define endline() glEnd()
+#define endpolygon() glEnd()
+#define endclosedline() glEnd()
+#define v2f(v) glVertex2fv(v)
+#define v2s(v) glVertex2sv(v)
+#define cmov(x,y,z) glRasterPos3f(x,y,z)
+#define charstr(s) gl_draw(s)
+#define fmprstr(s) gl_draw(s)
+typedef float Matrix[4][4];
+inline void pushmatrix() {glPushMatrix();}
+inline void popmatrix() {glPopMatrix();}
+inline void multmatrix(Matrix m) {glMultMatrixf((float *)m);}
+inline void color(int n) {glIndexi(n);}
+inline void rect(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);}
+inline void rectf(int x,int y,int r,int t) {glRectf(x,y,r+1,t+1);}
+inline void recti(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);}
+inline void rectfi(int x,int y,int r,int t) {glRecti(x,y,r+1,t+1);}
+inline void rects(int x,int y,int r,int t) {gl_rect(x,y,r-x,t-y);}
+inline void rectfs(int x,int y,int r,int t) {glRects(x,y,r+1,t+1);}
diff --git a/FL/gl_draw.H b/FL/gl_draw.H
new file mode 100644
index 000000000..b65c50f1f
--- /dev/null
+++ b/FL/gl_draw.H
@@ -0,0 +1,2 @@
+// gl_draw.H
+#include "gl.h"
diff --git a/FL/glut.H b/FL/glut.H
new file mode 100644
index 000000000..0d72acb9f
--- /dev/null
+++ b/FL/glut.H
@@ -0,0 +1,443 @@
+// glut.h
+
+// Emulation of Glut using fltk.
+
+// GLUT is Copyright (c) Mark J. Kilgard, 1994, 1995, 1996:
+// "This program is freely distributable without licensing fees and is
+// provided without guarantee or warrantee expressed or implied. This
+// program is -not- in the public domain."
+
+// Although I have copied the GLUT API, none of my code is based on
+// any Glut implementation details and is therefore covered by the LGPL.
+
+// Fltk does not include the Glut drawing functions (such as
+// glutWireTeapot()) or the stroke fonts but the declarations for the
+// drawing functions are included here because otherwise there is no
+// way to get them along with this. To use them you will have to
+// link in the original Glut library, put -lglut *after* -lfltk.
+
+// Commented out lines indicate parts of Glut that are not emulated.
+
+#ifndef __glut_h__
+#define __glut_h__
+
+#include <FL/gl.h>
+#include <GL/glu.h>
+
+////////////////////////////////////////////////////////////////
+// Glut is emulated using this window class and these static variables
+// (plus several more static variables hidden in glut.C):
+
+#include "Fl.H"
+#include "Fl_Gl_Window.H"
+
+class Fl_Glut_Window : public Fl_Gl_Window {
+ void draw();
+ void draw_overlay();
+ int handle(int);
+ void _init();
+ int mouse_down;
+public: // so the inline functions work
+ int number;
+ int menu[3];
+ void make_current();
+ void (*display)();
+ void (*overlaydisplay)();
+ void (*reshape)(int w, int h);
+ void (*keyboard)(uchar, int x, int y);
+ void (*mouse)(int b, int state, int x, int y);
+ void (*motion)(int x, int y);
+ void (*passivemotion)(int x, int y);
+ void (*entry)(int);
+ void (*visibility)(int);
+ void (*special)(int, int x, int y);
+ Fl_Glut_Window(int w, int h, const char *);
+ Fl_Glut_Window(int x, int y, int w, int h, const char *);
+ ~Fl_Glut_Window();
+};
+
+extern Fl_Glut_Window *glut_window; // the current window
+extern int glut_menu; // the current menu
+
+// function pointers that are not per-window:
+extern void (*glut_idle_function)();
+extern void (*glut_menustate_function)(int);
+extern void (*glut_menustatus_function)(int,int,int);
+
+////////////////////////////////////////////////////////////////
+
+//#define GLUT_API_VERSION This does not match any version of Glut exactly...
+
+void glutInit(int *argcp, char **argv); // creates first window
+
+void glutInitDisplayMode(unsigned int mode);
+// the FL_ symbols have the same value as the GLUT ones:
+#define GLUT_RGB FL_RGB
+#define GLUT_RGBA FL_RGB
+#define GLUT_INDEX FL_INDEX
+#define GLUT_SINGLE FL_SINGLE
+#define GLUT_DOUBLE FL_DOUBLE
+#define GLUT_ACCUM FL_ACCUM
+#define GLUT_ALPHA FL_ALPHA
+#define GLUT_DEPTH FL_DEPTH
+#define GLUT_STENCIL FL_STENCIL
+#define GLUT_MULTISAMPLE FL_MULTISAMPLE
+// #define GLUT_STEREO 256
+// #define GLUT_LUMINANCE 512
+
+void glutInitWindowPosition(int x, int y);
+
+void glutInitWindowSize(int w, int h);
+
+void glutMainLoop();
+
+int glutCreateWindow(char *title);
+
+int glutCreateSubWindow(int win, int x, int y, int width, int height);
+
+void glutDestroyWindow(int win);
+
+inline void glutPostRedisplay() {glut_window->redraw();}
+
+void glutSwapBuffers();
+
+inline int glutGetWindow() {return glut_window->number;}
+
+void glutSetWindow(int win);
+
+inline void glutSetWindowTitle(char *t) {glut_window->label(t);}
+
+inline void glutSetIconTitle(char *t) {glut_window->iconlabel(t);}
+
+inline void glutPositionWindow(int x, int y) {glut_window->position(x,y);}
+
+inline void glutReshapeWindow(int w, int h) {glut_window->size(w,h);}
+
+inline void glutPopWindow() {glut_window->show();}
+
+//inline void glutPushWindow();
+
+inline void glutIconifyWindow() {glut_window->iconize();}
+
+inline void glutShowWindow() {glut_window->show();}
+
+inline void glutHideWindow() {glut_window->hide();}
+
+inline void glutFullScreen() {glut_window->fullscreen();}
+
+inline void glutSetCursor(Fl_Cursor cursor) {glut_window->cursor(cursor);}
+// notice that the numeric values are different than glut:
+#define GLUT_CURSOR_RIGHT_ARROW ((Fl_Cursor)2)
+#define GLUT_CURSOR_LEFT_ARROW ((Fl_Cursor)67)
+#define GLUT_CURSOR_INFO FL_CURSOR_HAND
+#define GLUT_CURSOR_DESTROY ((Fl_Cursor)45)
+#define GLUT_CURSOR_HELP FL_CURSOR_HELP
+#define GLUT_CURSOR_CYCLE ((Fl_Cursor)26)
+#define GLUT_CURSOR_SPRAY ((Fl_Cursor)63)
+#define GLUT_CURSOR_WAIT FL_CURSOR_WAIT
+#define GLUT_CURSOR_TEXT FL_CURSOR_INSERT
+#define GLUT_CURSOR_CROSSHAIR FL_CURSOR_CROSS
+#define GLUT_CURSOR_UP_DOWN FL_CURSOR_NS
+#define GLUT_CURSOR_LEFT_RIGHT FL_CURSOR_WE
+#define GLUT_CURSOR_TOP_SIDE FL_CURSOR_N
+#define GLUT_CURSOR_BOTTOM_SIDE FL_CURSOR_S
+#define GLUT_CURSOR_LEFT_SIDE FL_CURSOR_W
+#define GLUT_CURSOR_RIGHT_SIDE FL_CURSOR_E
+#define GLUT_CURSOR_TOP_LEFT_CORNER FL_CURSOR_NW
+#define GLUT_CURSOR_TOP_RIGHT_CORNER FL_CURSOR_NE
+#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER FL_CURSOR_SE
+#define GLUT_CURSOR_BOTTOM_LEFT_CORNER FL_CURSOR_SW
+#define GLUT_CURSOR_INHERIT FL_CURSOR_DEFAULT
+#define GLUT_CURSOR_NONE FL_CURSOR_NONE
+#define GLUT_CURSOR_FULL_CROSSHAIR FL_CURSOR_CROSS
+
+//inline void glutWarpPointer(int x, int y);
+
+inline void glutEstablishOverlay() {glut_window->make_overlay_current();}
+
+inline void glutRemoveOverlay() {glut_window->hide_overlay();}
+
+inline void glutUseLayer(GLenum layer) {
+ layer ? glut_window->make_overlay_current() : glut_window->make_current();}
+enum {GLUT_NORMAL, GLUT_OVERLAY};
+
+inline void glutPostOverlayRedisplay() {glut_window->redraw_overlay();}
+
+inline void glutShowOverlay() {glut_window->redraw_overlay();}
+
+inline void glutHideOverlay() {glut_window->hide_overlay();}
+
+int glutCreateMenu(void (*)(int));
+
+void glutDestroyMenu(int menu);
+
+inline int glutGetMenu() {return glut_menu;}
+
+inline void glutSetMenu(int m) {glut_menu = m;}
+
+void glutAddMenuEntry(char *label, int value);
+
+void glutAddSubMenu(char *label, int submenu);
+
+void glutChangeToMenuEntry(int item, char *label, int value);
+
+void glutChangeToSubMenu(int item, char *label, int submenu);
+
+void glutRemoveMenuItem(int item);
+
+inline void glutAttachMenu(int b) {glut_window->menu[b] = glut_menu;}
+
+inline void glutDetachMenu(int b) {glut_window->menu[b] = 0;}
+
+inline void glutDisplayFunc(void (*f)()) {glut_window->display = f;}
+
+inline void glutReshapeFunc(void (*f)(int w, int h)) {glut_window->reshape=f;}
+
+inline void glutKeyboardFunc(void (*f)(uchar key, int x, int y)) {
+ glut_window->keyboard = f;}
+
+inline void glutMouseFunc(void (*f)(int b, int state, int x, int y)) {
+ glut_window->mouse = f;}
+#define GLUT_LEFT_BUTTON 0
+#define GLUT_MIDDLE_BUTTON 1
+#define GLUT_RIGHT_BUTTON 2
+#define GLUT_DOWN 0
+#define GLUT_UP 1
+
+inline void glutMotionFunc(void (*f)(int x, int y)) {glut_window->motion= f;}
+
+inline void glutPassiveMotionFunc(void (*f)(int x, int y)) {
+ glut_window->passivemotion= f;}
+
+inline void glutEntryFunc(void (*f)(int s)) {glut_window->entry = f;}
+enum {GLUT_LEFT, GLUT_ENTERED};
+
+inline void glutVisibilityFunc(void (*f)(int s)) {glut_window->visibility=f;}
+enum {GLUT_NOT_VISIBLE, GLUT_VISIBLE};
+
+inline void glutIdleFunc(void (*f)()) {Fl::set_idle(f);}
+
+// Warning: this cast may not work on all machines:
+inline void glutTimerFunc(unsigned int msec, void (*f)(int), int value) {
+ Fl::add_timeout(msec*.001, (void (*)(void *))f, (void *)value);
+}
+
+inline void glutMenuStateFunc(void (*f)(int state)) {
+ glut_menustate_function = f;}
+
+inline void glutMenuStatusFunc(void (*f)(int status, int x, int y)) {
+ glut_menustatus_function = f;}
+enum {GLUT_MENU_NOT_IN_USE, GLUT_MENU_IN_USE};
+
+inline void glutSpecialFunc(void (*f)(int key, int x, int y)) {
+ glut_window->special = f;}
+#define GLUT_KEY_F1 1
+#define GLUT_KEY_F2 2
+#define GLUT_KEY_F3 3
+#define GLUT_KEY_F4 4
+#define GLUT_KEY_F5 5
+#define GLUT_KEY_F6 6
+#define GLUT_KEY_F7 7
+#define GLUT_KEY_F8 8
+#define GLUT_KEY_F9 9
+#define GLUT_KEY_F10 10
+#define GLUT_KEY_F11 11
+#define GLUT_KEY_F12 12
+// WARNING: Different values than Glut uses:
+#define GLUT_KEY_LEFT FL_Left
+#define GLUT_KEY_UP FL_Up
+#define GLUT_KEY_RIGHT FL_Right
+#define GLUT_KEY_DOWN FL_Down
+#define GLUT_KEY_PAGE_UP FL_Page_Up
+#define GLUT_KEY_PAGE_DOWN FL_Page_Down
+#define GLUT_KEY_HOME FL_Home
+#define GLUT_KEY_END FL_End
+#define GLUT_KEY_INSERT FL_Insert
+
+//inline void glutSpaceballMotionFunc(void (*)(int x, int y, int z));
+
+//inline void glutSpaceballRotateFunc(void (*)(int x, int y, int z));
+
+//inline void glutSpaceballButtonFunc(void (*)(int button, int state));
+
+//inline void glutButtonBoxFunc(void (*)(int button, int state));
+
+//inline void glutDialsFunc(void (*)(int dial, int value));
+
+//inline void glutTabletMotionFunc(void (*)(int x, int y));
+
+//inline void glutTabletButtonFunc(void (*)(int button, int state, int x, int y));
+
+inline void glutOverlayDisplayFunc(void (*f)()) {
+ glut_window->overlaydisplay = f;}
+
+//inline void glutWindowStatusFunc(void (*)(int state));
+//enum {GLUT_HIDDEN, GLUT_FULLY_RETAINED, GLUT_PARTIALLY_RETAINED,
+// GLUT_FULLY_COVERED};
+
+//inline void glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
+
+//inline GLfloat glutGetColor(int ndx, int component);
+//#define GLUT_RED 0
+//#define GLUT_GREEN 1
+//#define GLUT_BLUE 2
+
+//inline void glutCopyColormap(int win);
+
+// Warning: values are changed from Glut!
+// Also relies on the GL_ symbols having values greater than 100
+int glutGet(GLenum type);
+enum {
+ GLUT_RETURN_ZERO = 0,
+ GLUT_WINDOW_X,
+ GLUT_WINDOW_Y,
+ GLUT_WINDOW_WIDTH,
+ GLUT_WINDOW_HEIGHT,
+ GLUT_WINDOW_PARENT,
+//GLUT_WINDOW_NUM_CHILDREN,
+//GLUT_WINDOW_CURSOR,
+ GLUT_SCREEN_WIDTH,
+ GLUT_SCREEN_HEIGHT,
+//GLUT_SCREEN_WIDTH_MM,
+//GLUT_SCREEN_HEIGHT_MM,
+ GLUT_MENU_NUM_ITEMS,
+ GLUT_DISPLAY_MODE_POSSIBLE,
+ GLUT_INIT_WINDOW_X,
+ GLUT_INIT_WINDOW_Y,
+ GLUT_INIT_WINDOW_WIDTH,
+ GLUT_INIT_WINDOW_HEIGHT,
+ GLUT_INIT_DISPLAY_MODE,
+//GLUT_ELAPSED_TIME,
+ GLUT_WINDOW_BUFFER_SIZE
+};
+
+#define GLUT_WINDOW_STENCIL_SIZE GL_STENCIL_BITS
+#define GLUT_WINDOW_DEPTH_SIZE GL_DEPTH_BITS
+#define GLUT_WINDOW_RED_SIZE GL_RED_BITS
+#define GLUT_WINDOW_GREEN_SIZE GL_GREEN_BITS
+#define GLUT_WINDOW_BLUE_SIZE GL_BLUE_BITS
+#define GLUT_WINDOW_ALPHA_SIZE GL_ALPHA_BITS
+#define GLUT_WINDOW_ACCUM_RED_SIZE GL_ACCUM_RED_BITS
+#define GLUT_WINDOW_ACCUM_GREEN_SIZE GL_ACCUM_GREEN_BITS
+#define GLUT_WINDOW_ACCUM_BLUE_SIZE GL_ACCUM_BLUE_BITS
+#define GLUT_WINDOW_ACCUM_ALPHA_SIZE GL_ACCUM_ALPHA_BITS
+#define GLUT_WINDOW_DOUBLEBUFFER GL_DOUBLEBUFFER
+#define GLUT_WINDOW_RGBA GL_RGBA
+#define GLUT_WINDOW_COLORMAP_SIZE GL_INDEX_BITS
+#ifdef GL_SAMPLES_SGIS
+#define GLUT_WINDOW_NUM_SAMPLES GL_SAMPLES_SGIS
+#else
+#define GLUT_WINDOW_NUM_SAMPLES GLUT_RETURN_ZERO
+#endif
+#define GLUT_WINDOW_STEREO GL_STEREO
+
+//int glutDeviceGet(GLenum type);
+//#define GLUT_HAS_KEYBOARD 600
+//#define GLUT_HAS_MOUSE 601
+//#define GLUT_HAS_SPACEBALL 602
+//#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
+//#define GLUT_HAS_TABLET 604
+//#define GLUT_NUM_MOUSE_BUTTONS 605
+//#define GLUT_NUM_SPACEBALL_BUTTONS 606
+//#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
+//#define GLUT_NUM_DIALS 608
+//#define GLUT_NUM_TABLET_BUTTONS 609
+
+inline int glutGetModifiers() {return Fl::event_state();}
+// WARNING: these values are different than Glut uses:
+#define GLUT_ACTIVE_SHIFT FL_SHIFT
+#define GLUT_ACTIVE_CTRL FL_CTRL
+#define GLUT_ACTIVE_ALT FL_ALT
+
+int glutLayerGet(GLenum);
+#define GLUT_OVERLAY_POSSIBLE 800
+//#define GLUT_LAYER_IN_USE 801
+//#define GLUT_HAS_OVERLAY 802
+#define GLUT_TRANSPARENT_INDEX 803
+#define GLUT_NORMAL_DAMAGED 804
+#define GLUT_OVERLAY_DAMAGED 805
+
+//inline int glutVideoResizeGet(GLenum param);
+//#define GLUT_VIDEO_RESIZE_POSSIBLE 900
+//#define GLUT_VIDEO_RESIZE_IN_USE 901
+//#define GLUT_VIDEO_RESIZE_X_DELTA 902
+//#define GLUT_VIDEO_RESIZE_Y_DELTA 903
+//#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
+//#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
+//#define GLUT_VIDEO_RESIZE_X 906
+//#define GLUT_VIDEO_RESIZE_Y 907
+//#define GLUT_VIDEO_RESIZE_WIDTH 908
+//#define GLUT_VIDEO_RESIZE_HEIGHT 909
+
+//inline void glutSetupVideoResizing();
+
+//inline void glutStopVideoResizing();
+
+//inline void glutVideoResize(int x, int y, int width, int height);
+
+//inline void glutVideoPan(int x, int y, int width, int height);
+
+////////////////////////////////////////////////////////////////
+// Emulated Glut drawing functions:
+
+// Font argument must be a void* for compatability, so...
+extern struct Glut_Bitmap_Font {uchar font; int size;}
+ glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10,
+ glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12,
+ glutBitmapHelvetica18;
+#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
+#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
+#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
+#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
+#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
+#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
+#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
+
+void glutBitmapCharacter(void *font, int character);
+int glutBitmapWidth(void *font, int character);
+
+////////////////////////////////////////////////////////////////
+// Glut drawing functions. These are NOT emulated but you can
+// link in the glut library to get them. This assummes the object
+// files in Glut remain as they currently are so that there are
+// not symbol conflicts with the above.
+
+extern "C" {
+
+extern int glutExtensionSupported(char *name);
+
+/* Stroke font opaque addresses (use constants instead in source code). */
+extern void *glutStrokeRoman;
+extern void *glutStrokeMonoRoman;
+
+/* Stroke font constants (use these in GLUT program). */
+#define GLUT_STROKE_ROMAN (&glutStrokeRoman)
+#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
+
+/* GLUT font sub-API */
+extern void glutStrokeCharacter(void *font, int character);
+extern int glutStrokeWidth(void *font, int character);
+
+/* GLUT pre-built models sub-API */
+extern void glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
+extern void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
+extern void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
+extern void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
+extern void glutWireCube(GLdouble size);
+extern void glutSolidCube(GLdouble size);
+extern void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
+extern void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
+extern void glutWireDodecahedron();
+extern void glutSolidDodecahedron();
+extern void glutWireTeapot(GLdouble size);
+extern void glutSolidTeapot(GLdouble size);
+extern void glutWireOctahedron();
+extern void glutSolidOctahedron();
+extern void glutWireTetrahedron();
+extern void glutSolidTetrahedron();
+extern void glutWireIcosahedron();
+extern void glutSolidIcosahedron();
+
+}
+
+#endif /* __glut_h__ */
diff --git a/FL/math.h b/FL/math.h
new file mode 100644
index 000000000..57dc3f9c8
--- /dev/null
+++ b/FL/math.h
@@ -0,0 +1,27 @@
+#include <math.h>
+
+#ifdef WIN32
+// things missing from <math.h>:
+
+#define M_PI 3.14159265358979323846
+#define M_PI_2 1.57079632679489661923
+#define M_PI_4 0.78539816339744830962
+#define M_1_PI 0.31830988618379067154
+#define M_2_PI 0.63661977236758134308
+#define M_SQRT2 1.41421356237309504880
+#define M_SQRT1_2 0.70710678118654752440
+
+#else
+
+#ifdef __EMX__
+#include <float.h>
+#endif
+
+#endif
+
+#if defined(WIN32) || defined(CRAY)
+
+inline double rint(double v) {return floor(v+.5);}
+inline double copysign(double a, double b) {return b<0 ? -a : a;}
+
+#endif
diff --git a/FL/menubar.h b/FL/menubar.h
new file mode 100644
index 000000000..1dc7cc8bd
--- /dev/null
+++ b/FL/menubar.h
@@ -0,0 +1,64 @@
+// 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 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,double x,double 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/FL/win32.H b/FL/win32.H
new file mode 100644
index 000000000..1572c9e73
--- /dev/null
+++ b/FL/win32.H
@@ -0,0 +1,80 @@
+// win32.H
+
+// Do not directly include this file, instead use <FL/x.H>. It will
+// include this file if WIN32 is defined. This is to encourage
+// portability of even the system-specific code...
+
+#include <windows.h>
+#ifndef LPMINMAXINFO
+// the gcc header files are missing some stuff:
+#define LPMINMAXINFO MINMAXINFO*
+#define VK_LWIN 0x5B
+#define VK_RWIN 0x5C
+#define VK_APPS 0x5D
+#endif
+
+// some random X equivalents
+#define Window HWND
+#define XPoint POINT
+struct XRectangle {int x, y, width, height;};
+struct Region {int x, y, r, b; void operator=(int x) {r = x;}};
+inline void XClipBox(Region& i, XRectangle* o) {
+ o->x = i.x; o->y = i.y; o->width = i.r-i.x; o->height = i.b-i.y;}
+#define fl_clip_region(R) fl_clip((R).x,(R).y,(R).r-(R).x,(R).b-(R).y)
+#define XDestroyWindow(a,b) DestroyWindow(b)
+#define XMapWindow(a,b) ShowWindow(b, SW_RESTORE)
+#define XUnmapWindow(a,b) ShowWindow(b, SW_HIDE)
+
+#include "Fl_Window.H"
+// this object contains all win32-specific stuff about a window:
+// Warning: this object is highly subject to change!
+class Fl_X {
+public:
+ Window xid;
+ HBITMAP other_xid; // for double-buffered windows
+ Fl_Window* w;
+ Region region;
+ Fl_X *next;
+ HDC private_dc; // used for OpenGL
+ HCURSOR cursor;
+ static Fl_X* first;
+ static Fl_X* i(const Fl_Window* w) {return w->i;}
+ void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
+ void flush() {w->flush();}
+ void set_minmax(LPMINMAXINFO minmax);
+ void mapraise();
+ static Fl_X* make(Fl_Window*);
+};
+extern HCURSOR fl_default_cursor;
+inline Window fl_xid(const Fl_Window*w) {return Fl_X::i(w)->xid;}
+Fl_Window* fl_find(Window xid);
+extern char fl_override_redirect; // hack into Fl_Window::make_xid()
+extern int fl_background_pixel; // hack into Fl_Window::make_xid()
+
+// most recent fl_color() or fl_rgbcolor() points at one of these:
+extern struct Fl_XMap {
+ COLORREF rgb; // this should be the type the RGB() macro returns
+ HPEN pen; // pen, 0 if none created yet
+ int brush; // ref to solid brush, 0 if none created yet
+} *fl_current_xmap;
+inline COLORREF fl_RGB() {return fl_current_xmap->rgb;}
+inline HPEN fl_pen() {return fl_current_xmap->pen;}
+HBRUSH fl_brush(); // allocates a brush if necessary
+
+extern HINSTANCE fl_display;
+extern Window fl_window;
+extern HDC fl_gc;
+extern HPALETTE fl_palette; // non-zero only on 8-bit displays!
+extern HDC fl_DC(Window);
+extern MSG fl_msg;
+
+// off-screen pixmaps: create, destroy, draw into, copy to window
+#define Fl_Offscreen HBITMAP
+#define fl_create_offscreen(w, h) CreateCompatibleBitmap(fl_gc, w, h)
+extern void fl_switch_offscreen(HBITMAP);
+#define fl_begin_offscreen(b) HDC _sw=fl_gc; fl_switch_offscreen(b)
+#define fl_end_offscreen() fl_gc = _sw
+void fl_make_current(HBITMAP bitmap);
+void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
+#define fl_delete_offscreen(bitmap) DeleteObject(bitmap);
+
diff --git a/FL/x.H b/FL/x.H
new file mode 100644
index 000000000..39d1e7bb3
--- /dev/null
+++ b/FL/x.H
@@ -0,0 +1,87 @@
+// x.H
+
+// These are internal fltk symbols that are necessary or useful for
+// calling Xlib. You should include this file if (and ONLY if) you
+// need to call Xlib directly. These symbols may not exist on non-X
+// systems.
+
+#ifndef Fl_X_H
+#define Fl_X_H
+
+#include "Enumerations.H"
+
+#ifdef WIN32
+
+#include "win32.H"
+
+#else
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>
+#include "Fl_Window.H"
+
+void fl_open_display();
+void fl_close_display();
+
+// constant info about the X server connection:
+extern Display *fl_display;
+extern int fl_screen;
+extern XVisualInfo *fl_visual;
+extern Colormap fl_colormap;
+
+// drawing functions:
+extern GC fl_gc;
+extern Window fl_window;
+ulong fl_xpixel(Fl_Color i);
+ulong fl_xpixel(uchar r, uchar g, uchar b);
+void fl_clip_region(Region);
+
+// feed events into fltk:
+int fl_handle(const XEvent&);
+
+// you can use these in Fl::add_handler() to look at events:
+extern const XEvent* fl_xevent;
+extern ulong fl_event_time;
+
+// off-screen pixmaps: create, destroy, draw into, copy to window:
+#define Fl_Offscreen ulong
+#define fl_create_offscreen(w,h) \
+XCreatePixmap(fl_display, fl_window, w, h, fl_visual->depth)
+#define fl_begin_offscreen(pixmap) Window _sw=fl_window;fl_window=pixmap;fl_push_no_clip()
+#define fl_end_offscreen() fl_pop_clip();fl_window = _sw
+#define fl_copy_offscreen(x,y,w,h,pixmap,srcx,srcy) \
+ XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y)
+#define fl_delete_offscreen(pixmap) XFreePixmap(fl_display, pixmap)
+
+// this object contains all X-specific stuff about a window:
+// Warning: this object is highly subject to change! It's definition
+// is only here so that fl_xid can be declared inline:
+class Fl_X {
+public:
+ Window xid;
+ Window other_xid;
+ Fl_Window *w;
+ Region region;
+ Fl_X *next;
+ static Fl_X* first;
+ static Fl_X* i(const Fl_Window* w) {return w->i;}
+ void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
+ void sendxjunk();
+ static void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
+ static Fl_X* set_xid(Fl_Window*, Window);
+ // kludges to get around protection:
+ void flush() {w->flush();}
+ static void x(Fl_Window* w, int X) {w->x(X);}
+ static void y(Fl_Window* w, int Y) {w->y(Y);}
+};
+
+// convert xid <-> Fl_Window:
+inline Window fl_xid(const Fl_Window*w) {return Fl_X::i(w)->xid;}
+Fl_Window* fl_find(Window xid);
+
+extern char fl_override_redirect; // hack into Fl_X::make_xid()
+extern int fl_background_pixel; // hack into Fl_X::make_xid()
+
+#endif
+#endif