1998-10-20 01:39:29 +04:00
|
|
|
//
|
2004-04-11 08:39:01 +04:00
|
|
|
// "$Id: Fl.H,v 1.8.2.11.2.23 2004/04/11 04:38:53 easysw Exp $"
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
|
|
|
// Main header file for the Fast Light Tool Kit (FLTK).
|
|
|
|
//
|
2004-04-11 08:39:01 +04:00
|
|
|
// Copyright 1998-2004 by Bill Spitzak and others.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
// 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.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
// 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.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
// 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.
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
2000-06-06 01:21:24 +04:00
|
|
|
// Please report all bugs and problems to "fltk-bugs@fltk.org".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
#ifndef Fl_H
|
2001-11-28 23:43:44 +03:00
|
|
|
# define Fl_H
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2001-11-28 23:43:44 +03:00
|
|
|
# include "Enumerations.H"
|
|
|
|
# ifndef Fl_Object
|
|
|
|
# define Fl_Object Fl_Widget
|
|
|
|
# endif
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2002-07-17 10:09:26 +04:00
|
|
|
# ifdef check
|
|
|
|
# undef check
|
|
|
|
# endif
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
class Fl_Widget;
|
|
|
|
class Fl_Window;
|
2001-12-20 17:41:44 +03:00
|
|
|
class Fl_Image;
|
1998-10-06 22:21:25 +04:00
|
|
|
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);
|
|
|
|
|
2000-03-08 19:02:25 +03:00
|
|
|
typedef void (*Fl_Timeout_Handler)(void*);
|
|
|
|
|
2002-07-14 23:08:25 +04:00
|
|
|
class FL_EXPORT Fl {
|
1998-10-06 22:21:25 +04:00
|
|
|
Fl() {}; // no constructor!
|
|
|
|
|
|
|
|
public: // should be private!
|
|
|
|
|
2002-07-14 23:08:25 +04:00
|
|
|
static int e_number;
|
2002-08-14 20:19:48 +04:00
|
|
|
static int e_x;
|
|
|
|
static int e_y;
|
|
|
|
static int e_x_root;
|
|
|
|
static int e_y_root;
|
|
|
|
static int e_dx;
|
|
|
|
static int e_dy;
|
2002-07-14 23:08:25 +04:00
|
|
|
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 int compose_state;
|
|
|
|
static int visible_focus_;
|
|
|
|
static int dnd_text_ops_;
|
2002-08-09 05:09:49 +04:00
|
|
|
static void damage(int d) {damage_ = d;}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2002-07-14 23:08:25 +04:00
|
|
|
static void (*idle)();
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2001-12-20 17:41:44 +03:00
|
|
|
static const char* scheme_;
|
|
|
|
static Fl_Image* scheme_bg_;
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
public:
|
|
|
|
|
2001-11-28 21:00:17 +03:00
|
|
|
// API version number
|
2002-07-14 23:08:25 +04:00
|
|
|
static double version();
|
2001-11-28 21:00:17 +03:00
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// argument parsers:
|
2002-07-14 23:08:25 +04:00
|
|
|
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**);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// things called by initialization:
|
2002-07-14 23:08:25 +04:00
|
|
|
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);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2001-12-20 17:41:44 +03:00
|
|
|
// schemes:
|
|
|
|
static int scheme(const char*);
|
|
|
|
static const char* scheme() {return scheme_;}
|
|
|
|
static int reload_scheme();
|
|
|
|
|
1998-10-06 22:21:25 +04:00
|
|
|
// execution:
|
2002-07-14 23:08:25 +04:00
|
|
|
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, Fl_Timeout_Handler,void* = 0);
|
|
|
|
static void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);
|
|
|
|
static int has_timeout(Fl_Timeout_Handler, void* = 0);
|
|
|
|
static void remove_timeout(Fl_Timeout_Handler, void* = 0);
|
|
|
|
static void add_check(Fl_Timeout_Handler, void* = 0);
|
|
|
|
static int has_check(Fl_Timeout_Handler, void* = 0);
|
|
|
|
static void remove_check(Fl_Timeout_Handler, 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, int when);
|
|
|
|
static void remove_fd(int);
|
|
|
|
static void add_idle(void (*cb)(void*), void* = 0);
|
|
|
|
static int has_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 void first_window(Fl_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*);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// event information:
|
2002-07-14 23:08:25 +04:00
|
|
|
static int event() {return e_number;}
|
|
|
|
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 int event_dx() {return e_dx;}
|
|
|
|
static int event_dy() {return e_dy;}
|
|
|
|
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 compose(int &del);
|
|
|
|
static void compose_reset() {compose_state = 0;}
|
|
|
|
static int event_inside(int,int,int,int);
|
|
|
|
static int event_inside(const Fl_Widget*);
|
|
|
|
static int test_shortcut(int);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// event destinations:
|
2002-07-14 23:08:25 +04:00
|
|
|
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));
|
|
|
|
static void remove_handler(int (*h)(int));
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// cut/paste:
|
2002-07-14 23:08:25 +04:00
|
|
|
static void copy(const char* stuff, int len, int clipboard = 0);
|
|
|
|
static void paste(Fl_Widget &receiver, int clipboard /*=0*/);
|
|
|
|
static int dnd();
|
2002-03-07 22:22:58 +03:00
|
|
|
// These are for back-compatability only:
|
2002-07-14 23:08:25 +04:00
|
|
|
static Fl_Widget* selection_owner() {return selection_owner_;}
|
|
|
|
static void selection_owner(Fl_Widget*);
|
|
|
|
static void selection(Fl_Widget &owner, const char*, int len);
|
|
|
|
static void paste(Fl_Widget &receiver);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// screen size:
|
2001-11-27 20:44:08 +03:00
|
|
|
#if defined(WIN32) || defined(__APPLE__)
|
2002-07-14 23:08:25 +04:00
|
|
|
static int x();
|
|
|
|
static int y();
|
1999-02-19 18:34:09 +03:00
|
|
|
#else
|
2002-07-14 23:08:25 +04:00
|
|
|
static int x() {return 0;}
|
|
|
|
static int y() {return 0;}
|
2001-11-27 20:44:08 +03:00
|
|
|
#endif /* WIN32 || __APPLE__ */
|
2002-07-14 23:08:25 +04:00
|
|
|
static int w();
|
|
|
|
static int h();
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// color map:
|
2002-07-14 23:08:25 +04:00
|
|
|
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);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// fonts:
|
2002-07-14 23:08:25 +04:00
|
|
|
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);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// labeltypes:
|
2002-07-14 23:08:25 +04:00
|
|
|
static void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);
|
|
|
|
static void set_labeltype(Fl_Labeltype, Fl_Labeltype from);
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// boxtypes:
|
2002-07-30 18:57:02 +04:00
|
|
|
static Fl_Box_Draw_F *get_boxtype(Fl_Boxtype);
|
2002-07-14 23:08:25 +04:00
|
|
|
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);
|
|
|
|
static int draw_box_active();
|
1998-10-06 22:21:25 +04:00
|
|
|
|
|
|
|
// back compatability:
|
2002-07-14 23:08:25 +04:00
|
|
|
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;}
|
2002-08-09 05:09:49 +04:00
|
|
|
static void grab(Fl_Window&win) {grab(&win);}
|
2002-07-14 23:08:25 +04:00
|
|
|
static void release() {grab(0);}
|
1998-10-06 22:21:25 +04:00
|
|
|
|
2001-11-03 08:11:34 +03:00
|
|
|
// Visible focus methods...
|
|
|
|
static void visible_focus(int v) { visible_focus_ = v; }
|
|
|
|
static int visible_focus() { return visible_focus_; }
|
2001-12-07 01:16:49 +03:00
|
|
|
|
2002-04-14 02:17:46 +04:00
|
|
|
// Drag-n-drop text operation methods...
|
|
|
|
static void dnd_text_ops(int v) { dnd_text_ops_ = v; }
|
|
|
|
static int dnd_text_ops() { return dnd_text_ops_; }
|
|
|
|
|
2001-12-07 01:16:49 +03:00
|
|
|
// Multithreading support:
|
2002-07-14 23:08:25 +04:00
|
|
|
static void lock();
|
|
|
|
static void unlock();
|
|
|
|
static void awake(void* message = 0);
|
|
|
|
static void* thread_message();
|
1998-10-06 22:21:25 +04:00
|
|
|
};
|
|
|
|
|
2001-11-28 23:43:44 +03:00
|
|
|
#endif // !Fl_H
|
1998-10-20 01:39:29 +04:00
|
|
|
|
|
|
|
//
|
2004-04-11 08:39:01 +04:00
|
|
|
// End of "$Id: Fl.H,v 1.8.2.11.2.23 2004/04/11 04:38:53 easysw Exp $".
|
1998-10-20 01:39:29 +04:00
|
|
|
//
|