#ifndef FL_WIN_H
#define FL_WIN_H

#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <time.h>
#include <windows.h>

/* special */
#define FL_TABBOX		(1001)
#define FL_EDITOR		(1002)

#define Display             HDC
#define Window              HANDLE
#define XPoint              POINT
#define XRectangle          RECT
#define LineSolid           PS_SOLID
#define LineOnOffDash       PS_DASH
#define LineDoubleDash      PS_DASHDOT
#define XFontStruct         LOGFONT
#define Pixmap              BITMAP
#define XVisualInfo         HDC
#define Colormap            LOGPALETTE
#define Cursor              HCURSOR
#define XC_hand2            IDC_SIZEALL
#define KeySym              long
#define FL_CMD_OPT          int

#define fl_malloc           malloc
#define fl_calloc           calloc
#define fl_realloc          realloc
#define fl_free             free
#define fl_strdup           strdup

/* X11 Event-Record */
//#define	XK_Return           VK_RETURN
#define	XK_Return           13
//#define	XK_Tab              VK_TAB
#define	XK_Tab              9
//#define	XK_Up               VK_UP
#define	XK_Up               65362
//#define	XK_Down             VK_DOWN
#define	XK_Down             65364
#define	XK_Shift_L          VK_LSHIFT
#define	XK_Shift_R          VK_RSHIFT
#define	XK_Alt_L            VK_LMENU
#define	XK_Alt_R            VK_RMENU
#define	XK_Control_L        VK_LCONTROL
#define	XK_Control_R        VK_RCONTROL
#define	XK_F1               65482
#define	XK_F2               65471
#define	XK_F3               VK_F3
#define	XK_F4               VK_F4
#define	XK_F5               VK_F5
#define	XK_F6               VK_F6
#define	XK_F7               VK_F7
#define	XK_F9               VK_F9
//#define	XK_Left             VK_LEFT
#define	XK_Left             65361
//#define	XK_Right            VK_RIGHT
#define	XK_Right            65363
//#define	XK_Home             VK_HOME
#define	XK_Home             65360
//#define	XK_End              0x23
#define	XK_End              65367
//#define	XK_Page_Up          VK_NUMPAD9
#define	XK_Page_Up          65365
//#define	XK_Page_Down        VK_NUMPAD3
#define	XK_Page_Down        65366
/* wab 12.7.2001 */
#define XK_ESC              39

typedef enum {
    KeyPress = 0,
    KeyRelease,
    EnterNotify,
    LeaveNotify
} FL_EVENT_TYPES;

typedef enum {
    KeyPressMask = 0,
    KeyReleaseMask,
    ButtonPressMask,
    ButtonReleaseMask,
    EnterWindowMask,
    LeaveWindowMask
} FL_EVENT_MASKS;

typedef struct {
    FL_EVENT_TYPES type;
    KeySym keysym;
    HANDLE window;
    time_t time;
} FL_EVENT;

#define _FL_PUP_ITEMS   20

#define FL_EXPORT extern

/* special */

FL_EXPORT void ConsoleOut(char * strg);
FL_EXPORT void fl_show_console(int bordersize);
FL_EXPORT void fl_hide_console(void);
FL_EXPORT void fl_minimize_console(void);
FL_EXPORT void fl_restore_console(void);
FL_EXPORT void fl_clear_console(void);
FL_EXPORT void fl_addto_console(const char * pstrg);
FL_EXPORT void fl_set_console_scroll(int x, int y);
FL_EXPORT void fl_set_console_position(int x, int y);
FL_EXPORT void fl_set_console_size(int w, int h);

/* 8.8.2001 */
FL_EXPORT int fl_system(char * cmd);

FL_EXPORT void ExitMsg(char * log_filename);

/* ---------------------------------- */

/* for compatibilities */
#ifndef FALSE
#define FALSE 0
#define TRUE  1
#endif


/* some general constants */
enum
{
    FL_ON = 1,
    FL_OK = 1,
    FL_VALID = 1,
    FL_PREEMPT = 1,
    FL_AUTO = 2,
    FL_WHEN_NEEDED = FL_AUTO,

    FL_OFF = 0,
    FL_CANCEL = 0,
    FL_INVALID = 0,

    /* FL_NONE = 0,  defined elsewhere */

    /* WM_DELETE_WINDOW callback return */
    FL_IGNORE = -1,
    FL_CLOSE = -2
};


/*
 * The screen coordinate unit, FL_Coord, must be of signed type.
 * If FL_Coord is float, FL_CoordIsFloat must be defined to be 1 so that
 */

typedef int FL_Coord;
#define FL_COORD        FL_Coord


typedef unsigned long FL_COLOR;


/*
 * All object classes.
 */

typedef enum
{
    FL_INVALID_CLASS,
    FL_BUTTON, FL_LIGHTBUTTON,
    FL_ROUNDBUTTON, FL_ROUND3DBUTTON,
    FL_CHECKBUTTON, FL_BITMAPBUTTON, FL_PIXMAPBUTTON,
    FL_BITMAP, FL_PIXMAP,
    FL_BOX, FL_TEXT,
    FL_MENU, FL_CHART, FL_CHOICE,
    FL_COUNTER, FL_SLIDER, FL_VALSLIDER, FL_INPUT,
    FL_BROWSER,
    FL_DIAL,
    FL_TIMER,
    FL_CLOCK,
    FL_POSITIONER,
    FL_FREE,
    FL_XYPLOT,
    FL_FRAME,
    FL_LABELFRAME,
    FL_CANVAS,
    FL_GLCANVAS,
    FL_TABFOLDER,
    FL_SCROLLBAR,
    FL_SCROLLBUTTON,
    FL_MENUBAR,
    FL_TEXTBOX,			/* for internal use only   */
    FL_LABELBUTTON,
    FL_COMBOBOX,
    FL_IMAGECANVAS,
    FL_THUMBWHEEL,
    FL_COLORWHEEL,
    FL_FORMBROWSER,
    /* sentinal */
    FL_CLASS_END
}
FL_CLASS;


#define FL_BEGIN_GROUP    10000
#define FL_END_GROUP      20000

#define FL_USER_CLASS_START   1001	/* min. user class value */
#define FL_USER_CLASS_END     9999	/* max. user class value */

/* how to display a form onto screen */

typedef enum
{
    FL_PLACE_FREE = 0,		/* size remain resizable      */
    FL_PLACE_MOUSE = 1,		/* mouse centered on form     */
    FL_PLACE_CENTER = 2,	/* center of the screen       */
    FL_PLACE_POSITION = 4,	/* specific size              */
    FL_PLACE_SIZE = 8,		/* specific size              */
    FL_PLACE_GEOMETRY = 16,	/* specific position          */
    FL_PLACE_ASPECT = 32,	/* keep aspect ratio          */
    FL_PLACE_FULLSCREEN = 64,	/* scale to fit screen        */
    FL_PLACE_HOTSPOT = 128,	/* so mouse fall on (x,y)     */
    FL_PLACE_ICONIC = 256,
    /* modifier */
    FL_FREE_SIZE = (1 << 14),
    FL_FIX_SIZE = (1 << 15)
}
FL_PLACE;

#define FL_PLACE_FREE_CENTER (FL_PLACE_CENTER|FL_FREE_SIZE)
#define FL_PLACE_CENTERFREE  (FL_PLACE_CENTER|FL_FREE_SIZE)

/* Window manager decoration request and forms attributes */
enum
{
    FL_FULLBORDER = 1,		/* normal */
    FL_TRANSIENT,		/* set TRANSIENT_FOR property             */
    FL_NOBORDER,		/* use override_redirect to supress decor. */
    FL_MODAL = 1 << 8		/* not implemented yet                    */
};


/* All box types */
typedef enum
{
    FL_NO_BOX,
    FL_UP_BOX,
    FL_DOWN_BOX,
    FL_BORDER_BOX,
    FL_SHADOW_BOX,
    FL_FRAME_BOX,
    FL_ROUNDED_BOX,
    FL_EMBOSSED_BOX,
    FL_FLAT_BOX,
    FL_RFLAT_BOX,
    FL_RSHADOW_BOX,
    FL_OVAL_BOX,
    FL_ROUNDED3D_UPBOX,
    FL_ROUNDED3D_DOWNBOX,
    FL_OVAL3D_UPBOX,
    FL_OVAL3D_DOWNBOX,
    FL_OVAL3D_FRAMEBOX,
    FL_OVAL3D_EMBOSSEDBOX,
    /* for internal use only */
    FL_TOPTAB_UPBOX,
    FL_SELECTED_TOPTAB_UPBOX,
    FL_BOTTOMTAB_UPBOX,
    FL_SELECTED_BOTTOMTAB_UPBOX,
    FL_OSHADOW_BOX,		/* not used */
    /* sentinel */
    FL_MAX_BOX_STYLES

}
FL_BOX_TYPE;


/* How to place text relative to a box */
typedef enum
{
    FL_ALIGN_CENTER,
    FL_ALIGN_TOP = 1,
    FL_ALIGN_BOTTOM = 2,
    FL_ALIGN_LEFT = 4,
    FL_ALIGN_RIGHT = 8,
    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_INSIDE = (1 << 13),
    FL_ALIGN_VERT = (1 << 14),	/* not functional yet  */

    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;


/* mouse buttons. Don't have to be consecutive */
enum
{
    FL_MBUTTON1 = 1, FL_MBUTTON2, FL_MBUTTON3,
    FL_MBUTTON4, FL_MBUTTON5
};

#define FL_LEFT_MOUSE    FL_MBUTTON1
#define FL_MIDDLE_MOUSE  FL_MBUTTON2
#define FL_RIGHT_MOUSE   FL_MBUTTON3

#define FL_LEFTMOUSE     FL_LEFT_MOUSE
#define FL_MIDDLEMOUSE   FL_MIDDLE_MOUSE
#define FL_RIGHTMOUSE    FL_RIGHT_MOUSE

/* control when to reutrn input, slider and dial object. */
enum
{
    FL_RETURN_END_CHANGED = 0,
    FL_RETURN_CHANGED = 1,
    FL_RETURN_END = 2,
    FL_RETURN_ALWAYS = 3,
    FL_RETURN_DBLCLICK = 4
};


/*
 *  Some special color indeces for FL private colormap. It does not matter
 *  what the value of each enum is, but it must start from 0 and be
 *  consecutive.
 */
typedef enum
{
    FL_BLACK, FL_RED, FL_GREEN, FL_YELLOW,
    FL_BLUE, FL_MAGENTA, FL_CYAN, FL_WHITE,

    FL_TOMATO, FL_INDIANRED, FL_SLATEBLUE,

    FL_COL1, FL_RIGHT_BCOL, FL_BOTTOM_BCOL, FL_TOP_BCOL, FL_LEFT_BCOL,
    FL_MCOL,

    FL_INACTIVE, FL_PALEGREEN, FL_DARKGOLD,

    FL_ORCHID, FL_DARKCYAN, FL_DARKTOMATO, FL_WHEAT, FL_DARKORANGE,
    FL_DEEPPINK, FL_CHARTREUSE, FL_DARKVIOLET, FL_SPRINGGREEN,
    FL_DODGERBLUE,

    /* these two colors can be used to shade COL1 */
    FL_LIGHTER_COL1,		/* a little lighter than COL1 */
    FL_DARKER_COL1,		/* a little darker  than COL1 */

    FL_FREE_COL1 = 256, FL_FREE_COL2,
    FL_FREE_COL3, FL_FREE_COL4,
    FL_FREE_COL5, FL_FREE_COL6,
    FL_FREE_COL7, FL_FREE_COL8,
    FL_FREE_COL9, FL_FREE_COL10,
    FL_FREE_COL11, FL_FREE_COL12,
    FL_FREE_COL13, FL_FREE_COL14,
    FL_FREE_COL15, FL_FREE_COL16
}
FL_PD_COL;

/* Some aliases for the color. This is actually backwards ... */

#define FL_GRAY16           FL_RIGHT_BCOL
#define FL_GRAY35           FL_BOTTOM_BCOL
#define FL_GRAY80           FL_TOP_BCOL
#define FL_GRAY90           FL_LEFT_BCOL
#define FL_GRAY63           FL_COL1
#define FL_GRAY75           FL_MCOL

#define  FL_LCOL            FL_BLACK


/* Events that a form reacts to.  */
typedef enum
{
    FL_NOEVENT,
    FL_DRAW,
    FL_PUSH,
    FL_RELEASE,
    FL_ENTER,
    FL_LEAVE,
    FL_MOUSE,
    FL_DRAG = FL_MOUSE,
    FL_FOCUS,
    FL_UNFOCUS,
    FL_KEYBOARD,
    FL_KEYPRESS = FL_KEYBOARD,
    FL_MOTION,
    FL_STEP,
    FL_SHORTCUT,
    FL_FREEMEM,
    FL_OTHER,			/* property, selection etc */
    FL_DRAWLABEL,
    FL_DBLCLICK,		/* double click            */
    FL_TRPLCLICK,		/* triple click            */
    FL_ATTRIB,			/* attribute change        */
    FL_KEYRELEASE,
    FL_PS			/* dump a form into EPS    */
}
FL_EVENTS;

#define FL_MOVE   FL_MOTION	/* for compatibility */

/* Resize policies */
typedef enum
{
    FL_RESIZE_NONE, FL_RESIZE_X, FL_RESIZE_Y,
    FL_RESIZE_ALL = (FL_RESIZE_X | FL_RESIZE_Y)
}
FL_RESIZE_T;


/* Keyboard focus control */
typedef enum
{
    FL_KEY_NORMAL = 1,		/* normal keys(0-255) - tab +left/right */
    FL_KEY_TAB = 2,		/* normal keys + 4 direction cursor     */
    FL_KEY_SPECIAL = 4,		/* only needs special keys(>255)        */
    FL_KEY_ALL = 7		/* all keys                             */
}
FL_KEY;

#define FL_ALT_MASK      (1L<<25)	/* alt + Key --> FL_ALT_VAL + key */
#define FL_CONTROL_MASK  (1L<<26)
#define FL_SHIFT_MASK    (1L<<27)
#define FL_ALT_VAL       FL_ALT_MASK


/*
 *  Pop-up menu item attributes. NOTE if more than 8, need to change
 *  choice and menu class where mode is kept by a single byte
 */
enum
{
    FL_PUP_NONE,
    FL_PUP_GREY = 1,
    FL_PUP_BOX = 2,
    FL_PUP_CHECK = 4,
    FL_PUP_RADIO = 8
};

#define FL_PUP_GRAY      FL_PUP_GREY
#define FL_PUP_TOGGLE    FL_PUP_BOX
#define FL_PUP_INACTIVE  FL_PUP_GREY


/* popup and menu entries */
typedef int (*FL_PUP_CB) (int);	/* call back prototype  */
typedef struct
{
    const char *text;		/* label of a popup/menu item    */
    FL_PUP_CB callback;		/* the callback function         */
    const char *shortcut;	/* hotkeys                       */
    int mode;			/* FL_PUP_GRAY, FL_PUP_CHECK etc */
    long reserved[2];
}
FL_PUP_ENTRY;

#define FL_MENU_ENTRY  FL_PUP_ENTRY


/*******************************************************************
 * FONTS
 ******************************************************************/

#define FL_MAXFONTS     48	/* max number of fonts */

typedef enum
{
    FL_INVALID_STYLE = -1,
    FL_NORMAL_STYLE,
    FL_BOLD_STYLE,
    FL_ITALIC_STYLE,
    FL_BOLDITALIC_STYLE,

    FL_FIXED_STYLE,
    FL_FIXEDBOLD_STYLE,
    FL_FIXEDITALIC_STYLE,
    FL_FIXEDBOLDITALIC_STYLE,

    FL_TIMES_STYLE,
    FL_TIMESBOLD_STYLE,
    FL_TIMESITALIC_STYLE,
    FL_TIMESBOLDITALIC_STYLE,

    FL_MISC_STYLE,
    FL_MISCBOLD_STYLE,
    FL_MISCITALIC_STYLE,
    FL_SYMBOL_STYLE,

    /* modfier masks. Need to fit a short  */
    FL_SHADOW_STYLE = (1 << 9),
    FL_ENGRAVED_STYLE = (1 << 10),
    FL_EMBOSSED_STYLE = (1 << 11)
}
FL_TEXT_STYLE;


#define FL_FONT_STYLE FL_TEXT_STYLE

#define special_style(a)  (a >=FL_SHADOW_STYLE &&\
                           a <= (FL_EMBOSSED_STYLE+FL_MAXFONTS))

/* Standard sizes in XForms */
#define FL_TINY_SIZE       8
#define FL_SMALL_SIZE      10
#define FL_NORMAL_SIZE     12
#define FL_MEDIUM_SIZE     14
#define FL_LARGE_SIZE      18
#define FL_HUGE_SIZE       24

#define FL_DEFAULT_SIZE   FL_SMALL_SIZE

/* Defines for compatibility */
#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


/*
 *  Definition of basic struct that holds an object
 */

#define  FL_CLICK_TIMEOUT  400	/* double click interval */

struct forms_;
struct fl_pixmap;

typedef struct flobjs_
{
    struct forms_ *form;	/* the form this object belongs to     */
    void *u_vdata;		/* anything the user likes             */
    char *u_cdata;		/* anything the user likes             */
    long u_ldata;		/* anything the user likes             */

    int objclass;		/* class of object, button, slider etc */
    int type;			/* type within the class               */
    int boxtype;		/* what kind of box type               */
    FL_Coord x, y, w, h;	/* obj. location and size              */
    FL_Coord bw;
    FL_COLOR col1, col2;	/* colors of obj                       */
    char *label;		/* object label                        */
    FL_COLOR lcol;		/* label color                         */
    int align;
    int lsize, lstyle;		/* label size and style                */
    char *shortcut;
    int (*handle) (struct flobjs_ *, int, FL_Coord, FL_Coord, int, void *);
    void (*object_callback) (struct flobjs_ *, long);
    long argument;
    void *spec;			/* instantiation                      */

    int (*prehandle) (struct flobjs_ *, int, FL_Coord, FL_Coord, int, void *);
    int (*posthandle) (struct flobjs_ *, int, FL_Coord, FL_Coord, int, void *);

    /* re-configure preference */
    unsigned int resize;	/* what to do if WM resizes the FORM     */
    unsigned int nwgravity;	/* how to re-position top-left corner    */
    unsigned int segravity;	/* how to re-position lower-right corner */

    struct flobjs_ *prev;	/* prev. obj in form                     */
    struct flobjs_ *next;	/* next. obj in form                     */

    struct flobjs_ *parent;
    struct flobjs_ *child;
    struct flobjs_ *nc;
    int is_child;

    void *flpixmap;		/* pixmap double buffering stateinfo     */
    int use_pixmap;		/* true to use pixmap double buffering   */

    /* some interaction flags */
    int double_buffer;		/* only used by mesa/gl canvas           */
    int pushed;
    int focus;
    int belowmouse;
    int active;			/* if accept event */
    int input;
    int wantkey;
    int radio;
    int automatic;
    int redraw;
    int visible;
    int clip;
    unsigned long click_timeout;
    void *c_vdata;		/* for class use            */
    char *c_cdata;		/* for class use            */
    long c_ldata;		/* for class use            */
    unsigned int spec_size;	/* for internal use         */
    FL_COLOR aux_col1, aux_col2;	/* aux colors               */
    FL_COLOR dbl_background;	/* double buffer background */
    int how_return;
    char *tooltip;
    int tipID;
    int group_id;
    /* special */
    HANDLE hwnd;
    char * _strg;
    int _istrg;
    int show_shortcut;
    char * menudata;
    HMENU hmenu;
    int selectid;
    int hmenu_mode[_FL_PUP_ITEMS];
    char * hmenu_shortcut[_FL_PUP_ITEMS];
    int keysym;
}
FL_OBJECT;

/* callback function for an entire form */
typedef void (*FL_FORMCALLBACKPTR) (struct flobjs_ *, void *);

/* object callback function      */
typedef void (*FL_CALLBACKPTR) (FL_OBJECT *, long);

/* preemptive callback function  */
typedef int (*FL_RAW_CALLBACK) (struct forms_ *, void *);

/* at close (WM menu delete/close etc.) */
typedef int (*FL_FORM_ATCLOSE) (struct forms_ *, void *);

/* deactivate/activate callback */
typedef void (*FL_FORM_ATDEACTIVATE) (struct forms_ *, void *);
typedef void (*FL_FORM_ATACTIVATE) (struct forms_ *, void *);

typedef int (*FL_HANDLEPTR) (FL_OBJECT *, int, FL_Coord, FL_Coord, int, void *);

/*FL_EXPORT FL_OBJECT *FL_EVENT;*/

/*** FORM ****/

/* form visibility state: form->visible */
enum {
  FL_BEING_HIDDEN = -1,
  FL_HIDDEN = 0,
  FL_INVISIBLE = FL_HIDDEN,
  FL_VISIBLE = 1
};

typedef struct forms_
{
    void *fdui;			/* for fdesign              */
    void *u_vdata;		/* for application          */
    char *u_cdata;		/* for application          */
    long u_ldata;		/* for application          */

    char *label;		/* window title             */
    HANDLE window;	/* X resource ID for window */
    FL_Coord x, y, w, h;	/* current geometry info    */
    FL_Coord hotx, hoty;	/* hot-spot of the form     */

    struct flobjs_ *first;
    struct flobjs_ *last;
    struct flobjs_ *focusobj;

    FL_FORMCALLBACKPTR form_callback;
    FL_FORM_ATACTIVATE activate_callback;
    FL_FORM_ATDEACTIVATE deactivate_callback;
    void *form_cb_data, *activate_data, *deactivate_data;

    FL_RAW_CALLBACK key_callback;
    FL_RAW_CALLBACK push_callback;
    FL_RAW_CALLBACK crossing_callback;
    FL_RAW_CALLBACK motion_callback;
    FL_RAW_CALLBACK all_callback;

    unsigned long compress_mask;
    unsigned long evmask;

    /* WM_DELETE_WINDOW message handler */
    FL_FORM_ATCLOSE close_callback;
    void *close_data;

    void *flpixmap;		/* back buffer             */

    unsigned long icon_pixmap;
    unsigned long icon_mask;

    /* interaction and other flags */
    int vmode;			/* current X visual class  */
    int deactivated;		/* true if sensitive       */
    int use_pixmap;		/* true if dbl buffering   */
    int frozen;			/* true if sync change     */
    int visible;		/* true if mapped          */
    int wm_border;		/* window manager info     */
    unsigned int prop;		/* other attributes        */
    int has_auto;
    int top;
    int sort_of_modal;		/* internal use.           */
    struct forms_ *parent;
    struct forms_ *child;
    struct flobjs_ *parent_obj;
    /* special */
    int dx;
    int dy;
    int min_width;
    int min_height;
    int max_width;
    int max_height;
}
FL_FORM;

/*
 * All FD_xxx structure emitted by fdesign contains at least the
 * following
 */
typedef struct
{
    FL_FORM *form;
    void *vdata;
    char *cdata;
    long ldata;
}
FD_Any;


/*
 *  Basic public routine prototypes
 */

FL_EXPORT int fl_library_version(int *, int *);

/** Generic routines that deal with FORMS **/

FL_EXPORT FL_FORM *fl_bgn_main_form(int, FL_Coord, FL_Coord);

FL_EXPORT FL_FORM *fl_bgn_form(int, FL_Coord, FL_Coord);
FL_EXPORT void fl_end_form(void);
FL_EXPORT FL_OBJECT *fl_do_forms(void);
FL_EXPORT FL_OBJECT *fl_check_forms(void);
FL_EXPORT FL_OBJECT *fl_do_only_forms(void);
FL_EXPORT FL_OBJECT *fl_check_only_forms(void);
FL_EXPORT void fl_freeze_form(FL_FORM *);

FL_EXPORT void fl_set_focus_object(FL_FORM *, FL_OBJECT *);
FL_EXPORT FL_OBJECT *fl_get_focus_object(FL_FORM *);
FL_EXPORT void fl_reset_focus_object(FL_OBJECT *);
#define fl_set_object_focus   fl_set_focus_object

FL_EXPORT FL_FORM_ATCLOSE fl_set_form_atclose(FL_FORM *, FL_FORM_ATCLOSE, void *);
FL_EXPORT FL_FORM_ATCLOSE fl_set_atclose(FL_FORM_ATCLOSE, void *);

FL_EXPORT FL_FORM_ATACTIVATE fl_set_form_atactivate(FL_FORM *,
						FL_FORM_ATACTIVATE, void *);
FL_EXPORT FL_FORM_ATDEACTIVATE fl_set_form_atdeactivate(FL_FORM *,
					      FL_FORM_ATDEACTIVATE, void *);

FL_EXPORT void fl_unfreeze_form(FL_FORM *);
FL_EXPORT void fl_deactivate_form(FL_FORM *);
FL_EXPORT void fl_activate_form(FL_FORM *);
FL_EXPORT void fl_deactivate_all_forms(void);
FL_EXPORT void fl_activate_all_forms(void);
FL_EXPORT void fl_freeze_all_forms(void);
FL_EXPORT void fl_unfreeze_all_forms(void);
FL_EXPORT void fl_scale_form(FL_FORM *, double, double);
FL_EXPORT void fl_set_form_position(FL_FORM *, FL_Coord, FL_Coord);
FL_EXPORT void fl_set_form_title(FL_FORM *, const char *);

FL_EXPORT void fl_set_form_property(FL_FORM *, unsigned);
FL_EXPORT void fl_set_app_mainform(FL_FORM *);
FL_EXPORT FL_FORM *fl_get_app_mainform(void);
FL_EXPORT void fl_set_app_nomainform(int);

FL_EXPORT void fl_set_form_callback(FL_FORM *, FL_FORMCALLBACKPTR, void *);
#define  fl_set_form_call_back    fl_set_form_callback

FL_EXPORT void fl_set_form_size(FL_FORM *, FL_Coord, FL_Coord);
FL_EXPORT void fl_set_form_hotspot(FL_FORM *, FL_Coord, FL_Coord);
FL_EXPORT void fl_set_form_hotobject(FL_FORM *, FL_OBJECT *);
FL_EXPORT void fl_set_form_minsize(FL_FORM *, FL_Coord, FL_Coord);
FL_EXPORT void fl_set_form_maxsize(FL_FORM *, FL_Coord, FL_Coord);
FL_EXPORT void fl_set_form_event_cmask(FL_FORM *, unsigned long);
FL_EXPORT unsigned long fl_get_form_event_cmask(FL_FORM *);

FL_EXPORT void fl_set_form_geometry(FL_FORM *, FL_Coord, FL_Coord,
				    FL_Coord, FL_Coord);

#define fl_set_initial_placement fl_set_form_geometry

FL_EXPORT long fl_show_form(FL_FORM *, int, int, const char *);
FL_EXPORT void fl_hide_form(FL_FORM *);
FL_EXPORT void fl_free_form(FL_FORM *);
FL_EXPORT void fl_redraw_form(FL_FORM *);
FL_EXPORT void fl_set_form_dblbuffer(FL_FORM *, int);
FL_EXPORT long fl_prepare_form_window(FL_FORM *, int, int, const char *);
FL_EXPORT long fl_show_form_window(FL_FORM *);
FL_EXPORT double fl_adjust_form_size(FL_FORM *);
FL_EXPORT int fl_form_is_visible(FL_FORM *);

FL_EXPORT FL_RAW_CALLBACK fl_register_raw_callback(FL_FORM *, unsigned long,
						   FL_RAW_CALLBACK);

#define fl_register_call_back fl_register_raw_callback

FL_EXPORT FL_OBJECT *fl_bgn_group(void);
FL_EXPORT FL_OBJECT *fl_end_group(void);
FL_EXPORT void fl_addto_group(FL_OBJECT *);

/****** Routines that deal with FL_OBJECTS ********/

FL_EXPORT void fl_set_object_boxtype(FL_OBJECT *, int);
FL_EXPORT void fl_set_object_bw(FL_OBJECT *, int);
FL_EXPORT void fl_set_object_resize(FL_OBJECT *, unsigned);
FL_EXPORT void fl_set_object_gravity(FL_OBJECT *, unsigned, unsigned);
FL_EXPORT void fl_set_object_lsize(FL_OBJECT *, int);
FL_EXPORT void fl_set_object_lstyle(FL_OBJECT *, int);
FL_EXPORT void fl_set_object_lcol(FL_OBJECT *, FL_COLOR);
FL_EXPORT void fl_set_object_return(FL_OBJECT *, int);
FL_EXPORT void fl_set_object_lalign(FL_OBJECT *, int);	/* to be removed */
FL_EXPORT void fl_set_object_shortcut(FL_OBJECT *, const char *, int);
FL_EXPORT void fl_set_object_shortcutkey(FL_OBJECT *, unsigned int);
FL_EXPORT void fl_set_object_dblbuffer(FL_OBJECT *, int);
FL_EXPORT void fl_set_object_color(FL_OBJECT *, FL_COLOR, FL_COLOR);
FL_EXPORT void fl_set_object_label(FL_OBJECT *, const char *);
FL_EXPORT void fl_set_object_helper(FL_OBJECT *, const char *);
FL_EXPORT void fl_set_object_position(FL_OBJECT *, FL_Coord, FL_Coord);
FL_EXPORT void fl_set_object_size(FL_OBJECT *, FL_Coord, FL_Coord);
FL_EXPORT void fl_set_object_automatic(FL_OBJECT *, int);
FL_EXPORT void fl_draw_object_label(FL_OBJECT *);
FL_EXPORT void fl_draw_object_label_outside(FL_OBJECT *);
FL_EXPORT FL_OBJECT *fl_get_object_component(FL_OBJECT *, int, int, int);
FL_EXPORT void fl_for_all_objects(FL_FORM *, int (*)(FL_OBJECT *, void *),
				  void *);
#define fl_draw_object_outside_label fl_draw_object_label_outside
#define  fl_set_object_dblclick(ob, timeout)  (ob)->click_timeout = (timeout);
FL_EXPORT void fl_set_object_geometry(FL_OBJECT *, FL_Coord, FL_Coord,
				      FL_Coord, FL_Coord);
FL_EXPORT void fl_move_object(FL_OBJECT *, FL_Coord, FL_Coord);

#define fl_set_object_lcolor  fl_set_object_lcol

FL_EXPORT void fl_fit_object_label(FL_OBJECT *, FL_Coord, FL_Coord);

FL_EXPORT void fl_get_object_geometry(FL_OBJECT * ob, FL_Coord *, FL_Coord *,
				      FL_Coord *, FL_Coord *);

FL_EXPORT void fl_get_object_position(FL_OBJECT *, FL_Coord *, FL_Coord *);

FL_EXPORT const char *fl_get_object_label(FL_OBJECT *);

/* this one takes into account the label */
FL_EXPORT void fl_get_object_bbox(FL_OBJECT *, FL_Coord *, FL_Coord *,
				  FL_Coord *, FL_Coord *);

#define fl_compute_object_geometry   fl_get_object_bbox

FL_EXPORT void fl_call_object_callback(FL_OBJECT *);
FL_EXPORT FL_HANDLEPTR fl_set_object_prehandler(FL_OBJECT *, FL_HANDLEPTR);
FL_EXPORT FL_HANDLEPTR fl_set_object_posthandler(FL_OBJECT *, FL_HANDLEPTR);
FL_EXPORT FL_CALLBACKPTR fl_set_object_callback(FL_OBJECT *, FL_CALLBACKPTR, long);

#define fl_set_object_align   fl_set_object_lalign
#define fl_set_call_back      fl_set_object_callback

FL_EXPORT void fl_redraw_object(FL_OBJECT *);
FL_EXPORT void fl_scale_object(FL_OBJECT *, double, double);
FL_EXPORT void fl_show_object(FL_OBJECT *);
FL_EXPORT void fl_hide_object(FL_OBJECT *);
FL_EXPORT void fl_free_object(FL_OBJECT *);
FL_EXPORT void fl_delete_object(FL_OBJECT *);
FL_EXPORT void fl_trigger_object(FL_OBJECT *);
FL_EXPORT void fl_activate_object(FL_OBJECT *);
FL_EXPORT void fl_deactivate_object(FL_OBJECT *);

FL_EXPORT int fl_enumerate_fonts(void (*)(const char *s), int);
FL_EXPORT int fl_set_font_name(int, const char *);
FL_EXPORT void fl_set_font(int, int);

/* utilities for new objects */
FL_EXPORT FL_FORM *fl_current_form;
FL_EXPORT void fl_add_object(FL_FORM *, FL_OBJECT *);
FL_EXPORT void fl_addto_form(FL_FORM *);
FL_EXPORT FL_OBJECT *fl_make_object(int, int, FL_Coord, FL_Coord,
			    FL_Coord, FL_Coord, const char *, FL_HANDLEPTR);

/* routines that facilitate free object */

FL_EXPORT int fl_get_char_height(int, int, int *, int *);
FL_EXPORT int fl_get_char_width(int, int);
FL_EXPORT int fl_get_string_height(int, int, const char *, int, int *, int *);
FL_EXPORT int fl_get_string_width(int, int, const char *, int);
FL_EXPORT int fl_get_string_widthTAB(int, int, const char *, int);
FL_EXPORT void fl_get_string_dimension(int, int, const char *, int, int *, int *);

#define fl_get_string_size  fl_get_string_dimension

FL_EXPORT void fl_get_align_xy(int, int, int, int, int, int, int,
			       int, int, int *, int *);

FL_EXPORT void fl_drw_text(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
			   FL_COLOR, int, int, char *);

FL_EXPORT void fl_drw_text_beside(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
				  FL_COLOR, int, int, char *);

#if 0
#define fl_draw_text(a,x,y,w,h,c,st,sz,s)    \
      (((a) & FL_ALIGN_INSIDE) ? fl_drw_text:fl_drw_text_beside)\
      (a,x,y,w,h,c,st,sz,s)
#endif

FL_EXPORT void fl_drw_text_cursor(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
				  FL_COLOR, int, int, char *, int, int);

FL_EXPORT void fl_drw_box(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
			  FL_COLOR, int);

typedef void (*FL_DRAWPTR) (FL_Coord x, FL_Coord y, FL_Coord w, FL_Coord h,
			    int, FL_COLOR);
FL_EXPORT int fl_add_symbol(const char *, FL_DRAWPTR, int);
FL_EXPORT int fl_draw_symbol(const char *, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
			     FL_COLOR);


/***** Global variables ******/

FL_EXPORT Display *fl_display;
FL_EXPORT int fl_screen;
FL_EXPORT Window fl_root;	/* root window                */
FL_EXPORT Window fl_vroot;	/* virtual root window        */
FL_EXPORT int fl_scrh, fl_scrw;	/* screen dimension in pixels */
FL_EXPORT int fl_vmode;

/*
 * Some basic drawing routines
 */

typedef XPoint FL_POINT;
typedef XRectangle FL_RECT;

/* rectangles */
FL_EXPORT void fl_rectangle(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord, FL_COLOR);
FL_EXPORT void fl_rectbound(FL_Coord, FL_Coord, FL_Coord, FL_Coord, FL_COLOR);
#define fl_rectf(x,y,w,h,c)   fl_rectangle(1, x,y,w,h,c)
#define fl_rect(x,y,w,h,c)    fl_rectangle(0, x,y,w,h,c)

/* rectangle with rounded-corners */
FL_EXPORT void fl_roundrectangle(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord, FL_COLOR);
#define fl_roundrectf(x,y,w,h,c) fl_roundrectangle(1,x,y,w,h,c)
#define fl_roundrect(x,y,w,h,c) fl_roundrectangle(0,x,y,w,h,c)

/* general polygon and polylines */
FL_EXPORT void fl_polygon(int, FL_POINT *, int n, FL_COLOR);
#define fl_polyf(p,n,c)  fl_polygon(1, p, n, c)
#define fl_polyl(p,n,c)  fl_polygon(0, p, n, c)
#define fl_polybound(p,n,c) do {fl_polyf(p,n,c);fl_polyl(p,n,FL_BLACK);}while(0)

FL_EXPORT void fl_lines(FL_POINT *, int n, FL_COLOR);
FL_EXPORT void fl_line(FL_Coord, FL_Coord, FL_Coord, FL_Coord, FL_COLOR);
FL_EXPORT void fl_point(FL_Coord, FL_Coord, FL_COLOR);
FL_EXPORT void fl_points(FL_POINT *, int, FL_COLOR);
#define fl_simple_line fl_line

FL_EXPORT void  fl_dashedlinestyle(const char *, int);
FL_EXPORT void  fl_update_display(int);


#define fl_diagline(x,y,w,h,c) fl_line(x,y,(x)+(w)-1,(y)+(h)-1,c)

/* line attributes */
enum
{
    FL_SOLID = LineSolid,
    FL_USERDASH = LineOnOffDash,
    FL_USERDOUBLEDASH = LineDoubleDash,
    FL_DOT,
    FL_DOTDASH,
    FL_DASH,
    FL_LONGDASH
};
FL_EXPORT void fl_linewidth(int);
FL_EXPORT void fl_linestyle(int);
FL_EXPORT void fl_drawmode(int);

FL_EXPORT int fl_get_linewidth(void);
FL_EXPORT int fl_get_linestyle(void);
FL_EXPORT int fl_get_drawmode(void);

#define fl_set_linewidth    fl_linewidth
#define fl_set_linestyle    fl_linestyle
#define fl_set_drawmode     fl_drawmode


/** ellipses **/
FL_EXPORT void fl_oval(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord, FL_COLOR);
FL_EXPORT void fl_ovalbound(FL_Coord, FL_Coord, FL_Coord, FL_Coord, FL_COLOR);
FL_EXPORT void fl_ovalarc(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
			  int, int, FL_COLOR);

#define fl_ovalf(x,y,w,h,c)     fl_oval(1,x,y,w,h,c)
#define fl_ovall(x,y,w,h,c)     fl_oval(0,x,y,w,h,c)
#define fl_oval_bound           fl_ovalbound

#define fl_circf(x,y,r,col)  fl_oval(1,(x)-(r),(y)-(r),2*(r),2*(r),col)
#define fl_circ(x,y,r,col)   fl_oval(0,(x)-(r),(y)-(r),2*(r),2*(r),col)

/* arcs */
FL_EXPORT void fl_pieslice(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
			   int, int, FL_COLOR);

#define fl_arcf(x,y,r,a1,a2,c)  fl_pieslice(1,(x)-(r),(y)-(r),\
                                (2*(r)),(2*(r)), a1,a2,c)

#define fl_arc(x,y,r,a1,a2,c)  fl_pieslice(0,(x)-(r),(y)-(r), \
                               (2*(r)),(2*(r)), a1,a2,c)

/* misc. stuff */
FL_EXPORT void fl_add_vertex(FL_Coord, FL_Coord);
FL_EXPORT void fl_add_float_vertex(float, float);
FL_EXPORT void fl_reset_vertex(void);
FL_EXPORT void fl_endline(void), fl_endpolygon(void), fl_endclosedline(void);

#define fl_bgnline       fl_reset_vertex
#define fl_bgnclosedline fl_reset_vertex
#define fl_bgnpolygon    fl_reset_vertex
#define fl_v2s(v)        fl_add_vertex(v[0], v[1])
#define fl_v2i(v)        fl_add_vertex(v[0], v[1])
#define fl_v2f(v)        fl_add_float_vertex(v[0], v[1])
#define fl_v2d(v)        fl_add_float_vertex(v[0], v[1])

/* high level drawing routines */
FL_EXPORT void fl_drw_frame(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
			    FL_COLOR, int);
FL_EXPORT void fl_drw_checkbox(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
			       FL_COLOR, int);

/*
 * Interfaces
 */
FL_EXPORT XFontStruct *fl_get_fontstruct(int, int);
#define fl_get_font_struct fl_get_fontstruct
#define fl_get_fntstruct fl_get_font_struct

FL_EXPORT Window fl_get_mouse(FL_Coord *, FL_Coord *, unsigned int *);
FL_EXPORT void fl_set_mouse(FL_Coord, FL_Coord);
FL_EXPORT Window fl_get_win_mouse(Window, FL_Coord *, FL_Coord *, unsigned *);
FL_EXPORT Window fl_get_form_mouse(FL_FORM *, FL_Coord *, FL_Coord *, unsigned *);
FL_EXPORT FL_FORM *fl_win_to_form(Window);
FL_EXPORT void fl_set_form_icon(FL_FORM *, Pixmap, Pixmap);

/* 14.8.2001
#define fl_raise_form(f) do {if(f->window) \
  SetWindowPos(f->window, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); \
  }while(0)
*/
#define fl_raise_form(f) do {if(f->window) { \
  ShowWindow(f->window, SW_RESTORE); \
  SetWindowPos(f->window, HWND_TOP, 0, 0, 0, 0, /*SWP_SHOWWINDOW |*/ SWP_NOMOVE | SWP_NOSIZE); \
  } \
  }while(0)

#define fl_lower_form(f) do {if(f->window) \
  SetWindowPos(f->window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); \
  }while(0)

#define fl_set_foreground(gc,c) XSetForeground(fl_display,gc,fl_get_pixel(c))
#define fl_set_background(gc,c) XSetBackground(fl_display,gc,fl_get_pixel(c))

/* General windowing support */

FL_EXPORT Window fl_wincreate(const char *);
FL_EXPORT Window fl_winshow(Window);
FL_EXPORT Window fl_winopen(const char *);
FL_EXPORT void   fl_winhide(Window);
FL_EXPORT void   fl_winclose(Window);
FL_EXPORT void   fl_winset(Window);
FL_EXPORT int    fl_winreparent(Window, Window);
FL_EXPORT void   fl_winfocus(Window win);
FL_EXPORT Window fl_winget(void);
FL_EXPORT int    fl_iconify(Window win);

FL_EXPORT void fl_winresize(Window, FL_Coord, FL_Coord);
FL_EXPORT void fl_winmove(Window, FL_Coord, FL_Coord);
FL_EXPORT void fl_winreshape(Window, FL_Coord, FL_Coord, FL_Coord, FL_Coord);
FL_EXPORT void fl_winicon(Window, Pixmap, Pixmap);
FL_EXPORT void fl_winbackground(Window, unsigned long);
FL_EXPORT void fl_winstepunit(Window, FL_Coord, FL_Coord);
FL_EXPORT int fl_winisvalid(Window);
FL_EXPORT void fl_wintitle(Window, const char *);
FL_EXPORT void fl_winicontitle(Window, const char *);
FL_EXPORT void fl_winposition(FL_Coord, FL_Coord);

#define fl_pref_winposition fl_winposition
#define fl_win_background     fl_winbackground
#define fl_set_winstepunit    fl_winstepunit


FL_EXPORT void fl_winminsize(Window, FL_Coord, FL_Coord);
FL_EXPORT void fl_winmaxsize(Window, FL_Coord, FL_Coord);
FL_EXPORT void fl_winaspect(Window, FL_Coord, FL_Coord);
FL_EXPORT void fl_reset_winconstraints(Window);

FL_EXPORT void fl_winsize(FL_Coord, FL_Coord);
FL_EXPORT void fl_initial_winsize(FL_Coord, FL_Coord);
#define fl_pref_winsize  fl_winsize

FL_EXPORT void fl_initial_winstate(int);

FL_EXPORT Colormap fl_create_colormap(XVisualInfo *, int);


FL_EXPORT void fl_wingeometry(FL_Coord, FL_Coord, FL_Coord, FL_Coord);
#define fl_pref_wingeometry  fl_wingeometry
FL_EXPORT void fl_initial_wingeometry(FL_Coord, FL_Coord, FL_Coord, FL_Coord);

FL_EXPORT void fl_noborder(void);
FL_EXPORT void fl_transient(void);

FL_EXPORT void fl_get_winsize(Window, FL_Coord *, FL_Coord *);
FL_EXPORT void fl_get_winorigin(Window, FL_Coord *, FL_Coord *);
FL_EXPORT void fl_get_wingeometry(Window, FL_Coord *, FL_Coord *,
				  FL_Coord *, FL_Coord *);

/* for compatibility */
#define fl_get_win_size          fl_get_winsize
#define fl_get_win_origin        fl_get_winorigin
#define fl_get_win_geometry      fl_get_wingeometry
#define fl_initial_winposition   fl_pref_winposition

#define fl_get_display()           fl_display
#define FL_FormDisplay(form)       fl_display
#define FL_ObjectDisplay(object)   fl_display
#define FL_IS_CANVAS(o) (o->objclass == FL_CANVAS||o->objclass == FL_GLCANVAS)

/* the window an object belongs. For drawing */
//#define FL_ObjWin(o) (FL_IS_CANVAS(o) ? fl_get_canvas_id(o): o->form->window)
FL_EXPORT Window FL_ObjWin(FL_OBJECT * obj);

/* --- */
FL_EXPORT void fl_set_cursor(Window, int cursor);

FL_EXPORT Window fl_get_real_object_window(FL_OBJECT *);

#define FL_OBJECT_WID  FL_ObjWin

/*  all registerable events, including Client Message */
#define FL_ALL_EVENT  (KeyPressMask|KeyReleaseMask|      \
                      ButtonPressMask|ButtonReleaseMask|\
                      EnterWindowMask|LeaveWindowMask|    \
                      ButtonMotionMask|PointerMotionMask)



FL_EXPORT Display *fl_initialize(int *, char *[], const char *,
                                 FL_CMD_OPT *, int);
FL_EXPORT Display *fl_initialize_icon(int * pargc, char *argv[], const char * name,
                                      FL_CMD_OPT * opt, int param, int icon_id);
FL_EXPORT Display *fl_init(void);

FL_EXPORT void fl_finish(void);

/* special
FL_EXPORT const char *fl_get_resource(const char *, const char *,
				      FL_RTYPE, const char *, void *, int);
FL_EXPORT void fl_set_resource(const char *str, const char *val);

FL_EXPORT void fl_get_app_resources(FL_resource *, int n);
FL_EXPORT void fl_set_graphics_mode(int, int);
FL_EXPORT void fl_set_visualID(long);
*/

FL_EXPORT int fl_keysym_pressed(KeySym);


/*
 * $Id: browser.h,v 0.89 1999/07/17 03:17:52 zhao Beta $
 *
 *  Object class Browser
 */
#ifndef FL_BROWSER_H
#define FL_BROWSER_H


/***** Types    *****/
typedef enum
{
    FL_NORMAL_BROWSER,
    FL_SELECT_BROWSER,
    FL_HOLD_BROWSER,
    FL_MULTI_BROWSER
}
FL_BROWSER_TYPE;

/***** Defaults *****/

#define FL_BROWSER_BOXTYPE	FL_DOWN_BOX
#define FL_BROWSER_COL1		FL_COL1
#define FL_BROWSER_COL2		FL_YELLOW
#define FL_BROWSER_LCOL		FL_LCOL
#define FL_BROWSER_ALIGN	FL_ALIGN_BOTTOM

/***** Others   *****/

#define FL_BROWSER_SLCOL	FL_COL1
#define FL_BROWSER_LINELENGTH	2048
#define FL_BROWSER_FONTSIZE     FL_SMALL_FONT

/***** Routines *****/

FL_EXPORT FL_OBJECT *fl_create_browser(int, FL_Coord, FL_Coord, FL_Coord,
				       FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_add_browser(int, FL_Coord, FL_Coord, FL_Coord,
				    FL_Coord, const char *);
FL_EXPORT void fl_clear_browser(FL_OBJECT *);
FL_EXPORT void fl_add_browser_line(FL_OBJECT *, const char *);
FL_EXPORT void fl_addto_browser(FL_OBJECT *, const char *);
FL_EXPORT void fl_addto_browser_chars(FL_OBJECT *, const char *);
#define fl_append_browser  fl_addto_browser_chars
FL_EXPORT void fl_insert_browser_line(FL_OBJECT *, int, const char *);
FL_EXPORT void fl_delete_browser_line(FL_OBJECT *, int);
FL_EXPORT void fl_replace_browser_line(FL_OBJECT *, int, const char *);
FL_EXPORT const char *fl_get_browser_line(FL_OBJECT *, int);
FL_EXPORT int fl_load_browser(FL_OBJECT *, const char *);

FL_EXPORT void fl_select_browser_line(FL_OBJECT *, int);
FL_EXPORT void fl_deselect_browser_line(FL_OBJECT *, int);
FL_EXPORT void fl_deselect_browser(FL_OBJECT *);
FL_EXPORT int fl_isselected_browser_line(FL_OBJECT *, int);

FL_EXPORT int fl_get_browser_topline(FL_OBJECT *);
FL_EXPORT int fl_get_browser(FL_OBJECT *);
FL_EXPORT int fl_get_browser_maxline(FL_OBJECT *);
FL_EXPORT int fl_get_browser_screenlines(FL_OBJECT *);

FL_EXPORT void fl_set_browser_topline(FL_OBJECT *, int);
FL_EXPORT void fl_set_browser_fontsize(FL_OBJECT *, int);
FL_EXPORT void fl_set_browser_fontstyle(FL_OBJECT *, int);
FL_EXPORT void fl_set_browser_specialkey(FL_OBJECT *, int);
FL_EXPORT void fl_set_browser_vscrollbar(FL_OBJECT *, int);
FL_EXPORT void fl_set_browser_hscrollbar(FL_OBJECT *, int);
FL_EXPORT void fl_set_browser_line_selectable(FL_OBJECT *, int, int);
FL_EXPORT void fl_get_browser_dimension(FL_OBJECT *, FL_Coord *, FL_Coord *,
					FL_Coord *, FL_Coord *);
FL_EXPORT void fl_set_browser_dblclick_callback(FL_OBJECT *,
						FL_CALLBACKPTR, long);

FL_EXPORT void fl_set_browser_xoffset(FL_OBJECT *, FL_Coord);
FL_EXPORT FL_Coord fl_get_browser_xoffset(FL_OBJECT *);
FL_EXPORT void fl_set_browser_scrollbarsize(FL_OBJECT *, int, int);
FL_EXPORT void fl_show_browser_line(FL_OBJECT *, int);
FL_EXPORT int fl_set_default_browser_maxlinelength(int);

#ifndef FL_BROWSER_SCROLL_CALLBACKt
#define FL_BROWSER_SCROLL_CALLBACKt
typedef void (*FL_BROWSER_SCROLL_CALLBACK)(FL_OBJECT *ob, int, void *);
#endif

FL_EXPORT void fl_set_browser_hscroll_callback(FL_OBJECT *,
                                     FL_BROWSER_SCROLL_CALLBACK,
                                     void *);
FL_EXPORT void fl_set_browser_vscroll_callback(FL_OBJECT *,
                                     FL_BROWSER_SCROLL_CALLBACK,
                                     void *);

FL_EXPORT FL_BROWSER_SCROLL_CALLBACK fl_get_browser_hscroll_callback(
                                         FL_OBJECT *);
FL_EXPORT FL_BROWSER_SCROLL_CALLBACK fl_get_browser_vscroll_callback(
                                         FL_OBJECT *);

/* 12.3.2002 */

FL_EXPORT int fl_get_input_browser_maxline(FL_OBJECT *);
FL_EXPORT char * fl_get_input_browser_line(FL_OBJECT *, int);

#endif


/*
 * $Id: button.h,v 0.89 1999/07/17 03:17:52 zhao Beta $
 *
 * All Buttons: regular button, light button and round button
 *
 */

#ifndef FL_BUTTON_H
#define FL_BUTTON_H


typedef enum
{
    FL_NORMAL_BUTTON,
    FL_PUSH_BUTTON,
    FL_RADIO_BUTTON,
    FL_HIDDEN_BUTTON,
    FL_TOUCH_BUTTON,
    FL_INOUT_BUTTON,
    FL_RETURN_BUTTON,
    FL_HIDDEN_RET_BUTTON,
    FL_MENU_BUTTON
}
FL_BUTTON_TYPE;

#define FL_TOGGLE_BUTTON    FL_PUSH_BUTTON

typedef struct
{
    Pixmap pixmap, mask;
    unsigned bits_w, bits_h;
    int val;			/* whether on */
    int mousebut;		/* mouse button that caused the push     */
    int timdel;			/* time since last touch (TOUCH buttons) */
    int event;			/* what event triggers redraw            */
    long cspecl;		/* reserved for class specfic stuff      */
    void *cspecv;		/* misc. things                          */
    char *filename;
    Pixmap focus_pixmap, focus_mask;
    char *focus_filename;
    long reserverd[2];
}
FL_BUTTON_SPEC;

#define FL_BUTTON_STRUCT FL_BUTTON_SPEC

typedef void (*FL_DrawButton) (FL_OBJECT *);
typedef void (*FL_CleanupButton) (FL_BUTTON_STRUCT *);

#define FL_DRAWBUTTON      FL_DrawButton
#define FL_CLEANUPBUTTON   FL_CleanupButton

/*
 *  normal button default
 */
#define FL_BUTTON_BOXTYPE	FL_UP_BOX
#define FL_BUTTON_COL1		FL_COL1
#define FL_BUTTON_COL2		FL_COL1
#define FL_BUTTON_LCOL		FL_LCOL
#define FL_BUTTON_ALIGN		FL_ALIGN_CENTER
#define FL_BUTTON_MCOL1		FL_MCOL
#define FL_BUTTON_MCOL2		FL_MCOL
#define FL_BUTTON_BW		FL_BOUND_WIDTH

/*
 *  light button defaults
 */
#define FL_LIGHTBUTTON_BOXTYPE	FL_UP_BOX
#define FL_LIGHTBUTTON_COL1	FL_COL1
#define FL_LIGHTBUTTON_COL2	FL_YELLOW
#define FL_LIGHTBUTTON_LCOL	FL_LCOL
#define FL_LIGHTBUTTON_ALIGN	FL_ALIGN_CENTER
#define FL_LIGHTBUTTON_TOPCOL	FL_COL1
#define FL_LIGHTBUTTON_MCOL	FL_MCOL
#define FL_LIGHTBUTTON_MINSIZE	(FL_Coord)12

/** round button defaults ***/

#define FL_ROUNDBUTTON_BOXTYPE FL_NO_BOX
#define FL_ROUNDBUTTON_COL1	 FL_MCOL
#define FL_ROUNDBUTTON_COL2	 FL_YELLOW
#define FL_ROUNDBUTTON_LCOL	 FL_LCOL
#define FL_ROUNDBUTTON_ALIGN	 FL_ALIGN_CENTER
#define FL_ROUNDBUTTON_TOPCOL	 FL_COL1
#define FL_ROUNDBUTTON_MCOL	 FL_MCOL

/* round3d button defaults   */

#define FL_ROUND3DBUTTON_BOXTYPE FL_NO_BOX
#define FL_ROUND3DBUTTON_COL1	 FL_COL1
#define FL_ROUND3DBUTTON_COL2	 FL_BLACK
#define FL_ROUND3DBUTTON_LCOL	 FL_LCOL
#define FL_ROUND3DBUTTON_ALIGN	 FL_ALIGN_CENTER
#define FL_ROUND3DBUTTON_TOPCOL	 FL_COL1
#define FL_ROUND3DBUTTON_MCOL	 FL_MCOL

/** check button defaults ***/

#define FL_CHECKBUTTON_BOXTYPE	FL_NO_BOX
#define FL_CHECKBUTTON_COL1	FL_COL1
#define FL_CHECKBUTTON_COL2	FL_YELLOW
#define FL_CHECKBUTTON_LCOL	FL_LCOL
#define FL_CHECKBUTTON_ALIGN	FL_ALIGN_CENTER

#define FL_CHECKBUTTON_TOPCOL	FL_COL1
#define FL_CHECKBUTTON_MCOL	FL_MCOL

/** bitmap button defaults **/
#define FL_BITMAPBUTTON_BOXTYPE	FL_UP_BOX
#define FL_BITMAPBUTTON_COL1	FL_COL1		/* bitmap background  */
#define FL_BITMAPBUTTON_COL2	FL_BLUE		/* "focus" color       */
#define FL_BITMAPBUTTON_LCOL	FL_LCOL		/* bitmap foreground   */
#define FL_BITMAPBUTTON_ALIGN	FL_ALIGN_BOTTOM

/** bitmap button defaults **/
#define FL_PIXMAPBUTTON_BOXTYPE	FL_UP_BOX
#define FL_PIXMAPBUTTON_COL1	FL_COL1		/* box col    */
#define FL_PIXMAPBUTTON_COL2	FL_YELLOW	/* bound rect */
#define FL_PIXMAPBUTTON_LCOL	FL_LCOL
#define FL_PIXMAPBUTTON_ALIGN	FL_ALIGN_BOTTOM

/***** Routines *****/

FL_EXPORT FL_OBJECT *fl_create_button(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
				      const char *);
FL_EXPORT FL_OBJECT *fl_create_roundbutton(int, FL_Coord, FL_Coord, FL_Coord,
					   FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_create_round3dbutton(int, FL_Coord, FL_Coord, FL_Coord,
					     FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_create_lightbutton(int, FL_Coord, FL_Coord, FL_Coord,
					   FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_create_checkbutton(int, FL_Coord, FL_Coord, FL_Coord,
					   FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_create_bitmapbutton(int, FL_Coord, FL_Coord, FL_Coord,
					    FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_create_pixmapbutton(int, FL_Coord, FL_Coord, FL_Coord,
					    FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_create_scrollbutton(int, FL_Coord, FL_Coord, FL_Coord,
					    FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_create_labelbutton(int, FL_Coord, FL_Coord, FL_Coord,
					   FL_Coord, const char *);

FL_EXPORT FL_OBJECT *fl_add_roundbutton(int, FL_Coord, FL_Coord,
					FL_Coord, FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_add_round3dbutton(int, FL_Coord, FL_Coord,
					  FL_Coord, FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_add_lightbutton(int, FL_Coord, FL_Coord,
					FL_Coord, FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_add_checkbutton(int, FL_Coord, FL_Coord,
					FL_Coord, FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_add_button(int, FL_Coord, FL_Coord, FL_Coord,
				   FL_Coord, const char *);

FL_EXPORT FL_OBJECT *fl_add_bitmapbutton(int, FL_Coord, FL_Coord, FL_Coord,
					 FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_add_scrollbutton(int, FL_Coord, FL_Coord, FL_Coord,
					 FL_Coord, const char *);
FL_EXPORT FL_OBJECT *fl_add_labelbutton(int, FL_Coord, FL_Coord, FL_Coord,
					FL_Coord, const char *);

FL_EXPORT void fl_set_bitmapbutton_file(FL_OBJECT *, const char *);
FL_EXPORT void fl_set_bitmapbutton_data(FL_OBJECT *, int, int, unsigned char *);

#define fl_set_bitmapbutton_datafile  fl_set_bitmapbutton_file

FL_EXPORT FL_OBJECT *fl_add_pixmapbutton(int, FL_Coord, FL_Coord, FL_Coord,
					 FL_Coord, const char *);

#define fl_set_pixmapbutton_data       fl_set_pixmap_data
#define fl_set_pixmapbutton_file       fl_set_pixmap_file
#define fl_set_pixmapbutton_pixmap     fl_set_pixmap_pixmap
#define fl_get_pixmapbutton_pixmap     fl_get_pixmap_pixmap
#define fl_set_pixmapbutton_align      fl_set_pixmap_align
#define fl_free_pixmapbutton_pixmap    fl_free_pixmap_pixmap
#define fl_set_pixmapbutton_datafile   fl_set_pixmapbutton_file
#define fl_set_pixmapbutton_show_focus fl_set_pixmapbutton_focus_outline

FL_EXPORT void fl_set_pixmapbutton_focus_outline(FL_OBJECT *, int);
FL_EXPORT void fl_set_pixmapbutton_focus_data(FL_OBJECT *, char **);
FL_EXPORT void fl_set_pixmapbutton_focus_file(FL_OBJECT *, const char *);
FL_EXPORT void fl_set_pixmapbutton_focus_pixmap(FL_OBJECT *, Pixmap, Pixmap);

FL_EXPORT int fl_get_button(FL_OBJECT *);
FL_EXPORT void fl_set_button(FL_OBJECT *, int);
FL_EXPORT int fl_get_button_numb(FL_OBJECT *);

#define fl_set_button_shortcut  fl_set_object_shortcut

FL_EXPORT FL_OBJECT *fl_create_generic_button(int, int, FL_Coord, FL_Coord,
					  FL_Coord, FL_Coord, const char *);
FL_EXPORT void fl_add_button_class(int, FL_DRAWBUTTON, FL_CLEANUPBUTTON);


#endif


/*
 * $Id: frame.h,v 0.11 1995/04/01 00:39:31 zhao Exp $
 *
 */

#ifndef FL_FRAME_H
#define FL_FRAME_H		/* { */

/* types of frames */
enum
{
    FL_NO_FRAME,
    FL_UP_FRAME,
    FL_DOWN_FRAME,
    FL_BORDER_FRAME,
    FL_SHADOW_FRAME,
    FL_ENGRAVED_FRAME,
    FL_ROUNDED_FRAME,
    FL_EMBOSSED_FRAME,
    FL_OVAL_FRAME
};

#define FL_FRAME_COL1   FL_BLACK   /* border color     */
#define FL_FRAME_COL2   FL_COL1    /* label background */
#define FL_FRAME_LCOL   FL_BLACK   /* label color      */

FL_EXPORT FL_OBJECT *fl_create_frame(int, FL_Coord, FL_Coord,
                                  FL_Coord, FL_Coord, const char *);

FL_EXPORT FL_OBJECT *fl_add_frame(int,FL_Coord,FL_Coord,
                             FL_Coord,FL_Coord, const char *);

/* labeld frame */
FL_EXPORT FL_OBJECT *fl_create_labelframe(int, FL_Coord, FL_Coord,
                                  FL_Coord, FL_Coord, const char *);

FL_EXPORT FL_OBJECT *fl_add_labelframe(int,FL_Coord,FL_Coord,
                             FL_Coord,FL_Coord, const char *);

/* wab 25.2.2002 */
FL_EXPORT FL_OBJECT *fl_add_box(int type, FL_Coord xpos, FL_Coord ypos, FL_Coord width,
				                        FL_Coord height, const char * label);

#endif /* !def FRAME_H } */


/*
 * $Id: goodies.h,v 0.88 1998/08/25 04:35:44 zhao Beta $
 */
#ifndef FL_GOODIES_H
#define FL_GOODIES_H		/* { */

/***** Resources and misc. goodie routines ******/
#define FLAlertDismissLabel     "flAlert.dismiss.label"
#define FLAlertTitle            "flAlert.title"

#define FLQuestionYesLabel      "flQuestion.yes.label"
#define FLQuestionNoLabel       "flQuestion.no.label"
#define FLQuestionTitle         "flQuestion.title"

#define FLOKLabel               "flInput.ok.label"
#define FLInputClearLabel       "flInput.clear.label"
#define FLInputCancelLabel      "flInput.cancel.label"
#define FLInputTitle            "flInput.title"

#define FLChoiceTitle           "flChoice.title"

FL_EXPORT void fl_set_goodies_font(int, int);

/*********** messages and questions **************/

FL_EXPORT void fl_show_message(const char *, const char *, const char *);
FL_EXPORT void fl_show_messages(const char *);
FL_EXPORT void fl_hide_message(void);

FL_EXPORT int fl_show_question(const char *, int);
FL_EXPORT void fl_hide_question(void);

FL_EXPORT void fl_show_alert(const char *, const char *, const char *, int);
FL_EXPORT void fl_hide_alert(void);

FL_EXPORT const char *fl_show_input(const char *, const char *);
FL_EXPORT void fl_hide_input(void);
FL_EXPORT const char *fl_show_simple_input(const char *, const char *);

FL_EXPORT int fl_show_colormap(int);
FL_EXPORT int fl_goodie_atclose(FL_FORM *, FL_OBJECT *);

/********* choices *****************/
FL_EXPORT int fl_show_choices(const char *, int,
			      const char *, const char *, const char *, int);

FL_EXPORT int fl_show_choice(const char *, const char *, const char *, int,
			     const char *, const char *, const char *, int);
FL_EXPORT void fl_hide_choice(void);

FL_EXPORT void fl_set_choice_shortcut(const char *, const char *, const char *);
#define fl_set_choices_shortcut fl_set_choice_shortcut

/************ one liner ***************/

FL_EXPORT void fl_show_oneliner(const char *, FL_Coord, FL_Coord);
FL_EXPORT void fl_hide_oneliner(void);
FL_EXPORT void fl_set_oneliner_font(int, int);
FL_EXPORT void fl_set_oneliner_color(FL_COLOR, FL_COLOR);

FL_EXPORT void fl_set_tooltip_font(int, int);
FL_EXPORT void fl_set_tooltip_color(FL_COLOR, FL_COLOR);
FL_EXPORT void fl_set_tooltip_boxtype(int);
FL_EXPORT void fl_set_tooltip_lalign(int);

/************* command log **************/

typedef struct
{
    FL_FORM *form;
    void *vdata;
    char *cdata;
    long  ldata;
    FL_OBJECT *browser;
    FL_OBJECT *close_browser;
    FL_OBJECT *clear_browser;
}
FD_CMDLOG;

#ifdef FL_WIN32
#define FL_PID_T HANDLE
#else
#define FL_PID_T long
#endif

FL_EXPORT FL_PID_T fl_exe_command(const char *, int);
FL_EXPORT int fl_end_command(FL_PID_T);
FL_EXPORT int fl_check_command(FL_PID_T);
FL_EXPORT FILE *fl_popen(const char *, const char *);
FL_EXPORT int fl_pclose(FILE *);
FL_EXPORT int fl_end_all_command(void);
FL_EXPORT void fl_show_command_log(int);
FL_EXPORT void fl_hide_command_log(void);
FL_EXPORT void fl_clear_command_log(void);
FL_EXPORT void fl_addto_command_log(const char *s);
FL_EXPORT void fl_set_command_log_position(int, int);
FL_EXPORT FD_CMDLOG *fl_get_command_log_fdstruct(void);

/* aliases */
#define fl_open_command    fl_exe_command
#define fl_close_command   fl_end_command

/******* file selector *****************/

#define FL_MAX_FSELECTOR  6

typedef struct
{
    FL_FORM *fselect;
    void *vdata;
    void *cdata;
    long  ldata;
    FL_OBJECT *browser, *input, *prompt, *resbutt;
    FL_OBJECT *patbutt, *dirbutt, *cancel, *ready;
    FL_OBJECT *dirlabel, *patlabel;
    FL_OBJECT *appbutt[3];
}
FD_FSELECTOR;

FL_EXPORT int fl_use_fselector(int);
FL_EXPORT const char *fl_show_fselector(const char *, const char *,
					const char *, const char *);
FL_EXPORT void fl_hide_fselector(void);

FL_EXPORT void fl_set_fselector_fontsize(int);
FL_EXPORT void fl_set_fselector_fontstyle(int);
FL_EXPORT void fl_set_fselector_placement(int);
FL_EXPORT void fl_set_fselector_border(int);

#define fl_set_fselector_transient(b)   \
                     fl_set_fselector_border((b)?FL_TRANSIENT:FL_FULLBORDER)

FL_EXPORT void fl_set_fselector_callback(int (*)(const char *, void *), void *);
FL_EXPORT const char *fl_get_filename(void);
FL_EXPORT const char *fl_get_directory(void);
FL_EXPORT const char *fl_get_pattern(void);
FL_EXPORT int fl_set_directory(const char *);
FL_EXPORT void fl_set_pattern(const char *);
FL_EXPORT void fl_refresh_fselector(void);
FL_EXPORT void fl_add_fselector_appbutton(const char *, void (*)(void *), void *);
FL_EXPORT void fl_remove_fselector_appbutton(const char *);
FL_EXPORT void fl_disable_fselector_cache(int);
FL_EXPORT void fl_invalidate_fselector_cache(void);
FL_EXPORT FL_FORM *fl_get_fselector_form(void);
FL_EXPORT FD_FSELECTOR *fl_get_fselector_fdstruct(void);
FL_EXPORT void fl_hide_fselector(void);

FL_EXPORT void fl_set_fselector_filetype_marker(int dir, int fifo,
					      int sock, int cdev, int bdev);

#define fl_show_file_selector     fl_show_fselector
#define fl_set_fselector_cb       fl_set_fselector_callback
#define fl_set_fselector_title(s) fl_set_form_title(fl_get_fselector_form(),s)

#endif /* } */
/*
 * $Id: input.h,v 0.88 1998/08/25 04:35:44 zhao Beta $
 *
 */
#ifndef FL_INPUT_H
#define FL_INPUT_H		/* { */


/***** Types    *****/

typedef enum
{
    FL_NORMAL_INPUT,
    FL_FLOAT_INPUT,
    FL_INT_INPUT,
    FL_DATE_INPUT,
    FL_MULTILINE_INPUT,
    FL_HIDDEN_INPUT,
    FL_SECRET_INPUT
}
FL_INPUT_TYPE;

/* for date input */
enum
{
    FL_INPUT_MMDD, FL_INPUT_DDMM
};

/***** Defaults *****/

#define FL_INPUT_BOXTYPE	FL_DOWN_BOX
#define FL_INPUT_COL1		FL_COL1
#define FL_INPUT_COL2		FL_MCOL
#define FL_INPUT_LCOL		FL_LCOL
#define FL_INPUT_ALIGN		FL_ALIGN_LEFT

/***** Others   *****/

#define FL_INPUT_TCOL		FL_LCOL
#define FL_INPUT_CCOL		FL_BLUE

#define FL_RINGBELL             (1<<4)

/***** Routines *****/

FL_EXPORT FL_OBJECT *fl_create_input(int, FL_Coord, FL_Coord, FL_Coord,
				     FL_Coord, const char *);

FL_EXPORT FL_OBJECT *fl_add_input(int, FL_Coord, FL_Coord, FL_Coord,
				  FL_Coord, const char *);

FL_EXPORT void fl_set_input(FL_OBJECT *, const char *);
FL_EXPORT void fl_set_input_return(FL_OBJECT *, int);
FL_EXPORT void fl_set_input_color(FL_OBJECT *, int, int);
FL_EXPORT void fl_set_input_scroll(FL_OBJECT *, int);
FL_EXPORT void fl_set_input_cursorpos(FL_OBJECT *, int, int);
FL_EXPORT void fl_set_input_selected(FL_OBJECT *, int);
FL_EXPORT void fl_set_input_selected_range(FL_OBJECT *, int, int);
FL_EXPORT const char *fl_get_input_selected_range(FL_OBJECT *, int *, int *);
FL_EXPORT void fl_set_input_maxchars(FL_OBJECT *, int);
FL_EXPORT void fl_set_input_format(FL_OBJECT *, int, int);
FL_EXPORT void fl_set_input_hscrollbar(FL_OBJECT *, int);
FL_EXPORT void fl_set_input_vscrollbar(FL_OBJECT *, int);
FL_EXPORT void fl_set_input_topline(FL_OBJECT *, int);
FL_EXPORT void fl_set_input_scrollbarsize(FL_OBJECT *, int, int);
FL_EXPORT void fl_set_input_xoffset(FL_OBJECT *, int);
FL_EXPORT int fl_get_input_xoffset(FL_OBJECT *);
FL_EXPORT int fl_set_input_fieldchar(FL_OBJECT *, int);

FL_EXPORT int fl_get_input_topline(FL_OBJECT *);
FL_EXPORT int fl_get_input_screenlines(FL_OBJECT *);
FL_EXPORT int fl_get_input_cursorpos(FL_OBJECT *, int *, int *);
FL_EXPORT void fl_set_input_cursor_visible(FL_OBJECT *, int);
FL_EXPORT int fl_get_input_numberoflines(FL_OBJECT *);
FL_EXPORT void fl_get_input_format(FL_OBJECT *, int *, int *);
FL_EXPORT const char *fl_get_input(FL_OBJECT *);

typedef int (*FL_INPUTVALIDATOR) (FL_OBJECT *, const char *, const char *, int);
FL_EXPORT FL_INPUTVALIDATOR fl_set_input_filter(FL_OBJECT *, FL_INPUTVALIDATOR);
#define fl_set_input_shortcut fl_set_object_shortcut

/* edit keys. */
typedef struct
{
    /* basic editing */
    long del_prev_char;		/* delete previous char    */
    long del_next_char;		/* delete next char        */
    long del_prev_word;		/* delete previous word    */
    long del_next_word;		/* delete next word        */

    /* movement */
    long moveto_prev_line;	/* one line  up             */
    long moveto_next_line;	/* one line down            */
    long moveto_prev_char;	/* one char left            */
    long moveto_next_char;	/* one char right           */
    long moveto_prev_word;	/* one word left            */
    long moveto_next_word;	/* one word right           */
    long moveto_prev_page;	/* one page up              */
    long moveto_next_page;	/* one page down            */
    long moveto_bol;		/* move to begining of line */
    long moveto_eol;		/* move to end of line      */
    long moveto_bof;		/* move to begin of file    */
    long moveto_eof;		/* move to end of file      */

    /* misc. stuff */
    long transpose;		/* switch two char positions */
    long paste;			/* paste the edit buffer    */
    long backspace;		/* another  del_prev_char   */
    long del_to_bol;		/* cut to begining of line  */
    long del_to_eol;		/* cut to end of line       */
    long clear_field;		/* delete everything        */
    long del_to_eos;		/* not implemented          */
    long reserverd[4];		/* filler                  */
}
FL_EditKeymap;

FL_EXPORT void fl_set_input_editkeymap(const FL_EditKeymap *);

#endif /* Input_H  } */
/*
 * $Id: menu.h,v 0.88 1998/08/25 04:35:44 zhao Beta $
 *
 */
#ifndef FL_MENU_H
#define FL_MENU_H		/* { */


/************   Object Class: Menu         ************/

typedef enum
{
    FL_TOUCH_MENU,
    FL_PUSH_MENU,
    FL_PULLDOWN_MENU
}
FL_MENU_TYPE;

/***** Defaults *****/

#define FL_MENU_BOXTYPE		FL_BORDER_BOX
#define FL_MENU_COL1		FL_COL1
#define FL_MENU_COL2		FL_MCOL
#define FL_MENU_LCOL		FL_LCOL
#define FL_MENU_ALIGN		FL_ALIGN_CENTER

/***** Others   *****/

#define FL_MENU_MAXITEMS	128
#define FL_MENU_MAXSTR		64

/***** Routines *****/

FL_EXPORT FL_OBJECT *fl_create_menu(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
				    const char *);

FL_EXPORT FL_OBJECT *fl_add_menu(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
				 const char *);

FL_EXPORT void fl_clear_menu(FL_OBJECT *);
FL_EXPORT void fl_set_menu(FL_OBJECT *, const char *);
FL_EXPORT int fl_addto_menu(FL_OBJECT *, const char *);
FL_EXPORT void fl_replace_menu_item(FL_OBJECT *, int, const char *);
FL_EXPORT void fl_delete_menu_item(FL_OBJECT *, int);

FL_EXPORT void fl_set_menu_item_shortcut(FL_OBJECT *, int, const char *);
FL_EXPORT void fl_set_menu_item_mode(FL_OBJECT *, int, unsigned);
FL_EXPORT void fl_show_menu_symbol(FL_OBJECT *, int);
FL_EXPORT void fl_set_menu_popup(FL_OBJECT *, int);
FL_EXPORT int fl_get_menu_popup(FL_OBJECT *);

FL_EXPORT int fl_get_menu(FL_OBJECT *);
FL_EXPORT const char *fl_get_menu_item_text(FL_OBJECT *, int);
FL_EXPORT int fl_get_menu_maxitems(FL_OBJECT *);
FL_EXPORT unsigned fl_get_menu_item_mode(FL_OBJECT *, int);
FL_EXPORT const char *fl_get_menu_text(FL_OBJECT *);
FL_EXPORT int fl_set_menu_entries(FL_OBJECT *, FL_PUP_ENTRY *);

#endif /* MENU } */


/*
 * $Id: popup.h,v 0.88 1998/08/25 04:35:44 zhao Beta $
 *
 *  Prototypes for pop-up menus
 */

#ifndef FL_POPUP_H
#define FL_POPUP_H		/* { */


#define FL_MAXPUPI     128	/* max item each pup        */
#define FL_PUP_PADH    4	/* space between each items */

typedef void (*FL_PUP_ENTERCB) (int, void *);	/* call back prototype  */
typedef void (*FL_PUP_LEAVECB) (int, void *);	/* call back prototype  */

FL_EXPORT int fl_setpup_entries(int, FL_PUP_ENTRY *);
FL_EXPORT int fl_newpup(Window);
FL_EXPORT int fl_defpup(Window, const char *,...);
FL_EXPORT int fl_addtopup(int, const char *,...);
FL_EXPORT int fl_setpup_mode(int, int, unsigned);
FL_EXPORT void fl_freepup(int);
FL_EXPORT int fl_dopup(int);

FL_EXPORT Cursor fl_setpup_default_cursor(int);

/* setpup_{colors|fontsize} etc will be removed in next revision
 * use fl_set_default_xxx instead
 */
FL_EXPORT void fl_setpup_color(FL_COLOR, FL_COLOR);
FL_EXPORT void fl_setpup_checkcolor(FL_COLOR);
FL_EXPORT int fl_setpup_fontsize(int);
FL_EXPORT int fl_setpup_fontstyle(int);

#define fl_setpup_default_fontsize    fl_setpup_fontsize
#define fl_setpup_default_fontstyle   fl_setpup_fontstyle
#define fl_setpup_default_color       fl_setpup_color
#define fl_setpup_default_checkcolor  fl_setpup_checkcolor

FL_EXPORT int fl_setpup_default_bw(int);
FL_EXPORT void fl_setpup_shortcut(int, int, const char *);
FL_EXPORT void fl_setpup_position(int, int);
FL_EXPORT void fl_setpup_selection(int, int);
FL_EXPORT void fl_setpup_shadow(int, int);
FL_EXPORT void fl_setpup_softedge(int, int);
FL_EXPORT void fl_setpup_bw(int, int);
FL_EXPORT void fl_setpup_title(int, const char *);
FL_EXPORT FL_PUP_ENTERCB fl_setpup_entercb(int, FL_PUP_ENTERCB, void *);
FL_EXPORT FL_PUP_LEAVECB fl_setpup_leavecb(int, FL_PUP_LEAVECB, void *);
FL_EXPORT void fl_setpup_pad(int, int, int);
FL_EXPORT Cursor fl_setpup_cursor(int, int);
FL_EXPORT int fl_setpup_maxpup(int);
FL_EXPORT unsigned fl_getpup_mode(int, int);
FL_EXPORT const char *fl_getpup_text(int, int);
FL_EXPORT void fl_showpup(int);
FL_EXPORT void fl_hidepup(int);
FL_EXPORT int fl_getpup_items(int);
FL_EXPORT int fl_current_pup(void);

#define fl_setpup_hotkey    fl_setpup_shortcut

FL_EXPORT FL_PUP_CB fl_setpup_itemcb(int, int, FL_PUP_CB);
FL_EXPORT FL_PUP_CB fl_setpup_menucb(int, FL_PUP_CB);
FL_EXPORT void fl_setpup_submenu(int, int, int);

#define fl_setpup    fl_setpup_mode

#endif /* Xpopup } */


/*
 * $Id: text.h,v 1.1 1995/04/01 00:39:31 zhao Exp $
 *
 */
#ifndef FL_TEXT_H
#define FL_TEXT_H

enum
{
    FL_NORMAL_TEXT
};

#define FL_TEXT_BOXTYPE    FL_FLAT_BOX
#define FL_TEXT_COL1       FL_COL1
#define FL_TEXT_COL2       FL_MCOL
#define FL_TEXT_LCOL       FL_LCOL
#define FL_TEXT_ALIGN      FL_ALIGN_LEFT

FL_EXPORT FL_OBJECT *fl_create_text(int, FL_Coord, FL_Coord, FL_Coord,
                  FL_Coord, const char *);

FL_EXPORT FL_OBJECT *fl_add_text(int, FL_Coord, FL_Coord, FL_Coord, FL_Coord,
                  const char *);

#endif


#endif /* FL_WIN_H */
