Update the changelog
[opencv] / otherlibs / _fltk / include / FL / Fl.H
1 //
2 // "$Id: Fl.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3 //
4 // Main header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2002 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
22 //
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
24 //
25
26 #ifndef Fl_H
27 #  define Fl_H
28
29 #  include "Enumerations.H"
30 #  ifndef Fl_Object
31 #    define Fl_Object Fl_Widget
32 #  endif
33
34 #  ifdef check
35 #    undef check
36 #  endif
37
38 class Fl_Widget;
39 class Fl_Window;
40 class Fl_Image;
41 struct Fl_Label;
42 typedef void (Fl_Label_Draw_F)(const Fl_Label*, int,int,int,int, Fl_Align);
43 typedef void (Fl_Label_Measure_F)(const Fl_Label*, int&, int&);
44 typedef void (Fl_Box_Draw_F)(int,int,int,int, Fl_Color);
45
46 typedef void (*Fl_Timeout_Handler)(void*);
47
48 class FL_EXPORT Fl {
49   Fl() {}; // no constructor!
50
51 public: // should be private!
52
53   static int e_number;
54   static int e_x;
55   static int e_y;
56   static int e_x_root;
57   static int e_y_root;
58   static int e_dx;
59   static int e_dy;
60   static int e_state;
61   static int e_clicks;
62   static int e_is_click;
63   static int e_keysym;
64   static char* e_text;
65   static int e_length;
66   static Fl_Widget* belowmouse_;
67   static Fl_Widget* pushed_;
68   static Fl_Widget* focus_;
69   static int damage_;
70   static Fl_Widget* selection_owner_;
71   static Fl_Window* modal_;
72   static Fl_Window* grab_;
73   static int compose_state;
74   static int visible_focus_;
75   static int dnd_text_ops_;
76   static void damage(int d) {damage_ = d;}
77
78   static void (*idle)();
79
80   static const char* scheme_;
81   static Fl_Image* scheme_bg_;
82
83 public:
84
85   // API version number
86   static double version();
87
88   // argument parsers:
89   static int arg(int, char**, int&);
90   static int args(int, char**, int&, int (*)(int,char**,int&) = 0);
91   static const char* const help;
92   static void args(int, char**);
93
94   // things called by initialization:
95   static void display(const char*);
96   static int visual(int);
97   static int gl_visual(int, int *alist=0);
98   static void own_colormap();
99   static void get_system_colors();
100   static void foreground(uchar, uchar, uchar);
101   static void background(uchar, uchar, uchar);
102   static void background2(uchar, uchar, uchar);
103
104   // schemes:
105   static int scheme(const char*);
106   static const char* scheme() {return scheme_;}
107   static int reload_scheme();
108
109   // execution:
110   static int wait();
111   static double wait(double time);
112   static int check();
113   static int ready();
114   static int run();
115   static Fl_Widget* readqueue();
116   static void add_timeout(double t, Fl_Timeout_Handler,void* = 0);
117   static void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0);
118   static int  has_timeout(Fl_Timeout_Handler, void* = 0);
119   static void remove_timeout(Fl_Timeout_Handler, void* = 0);
120   static void add_check(Fl_Timeout_Handler, void* = 0);
121   static int  has_check(Fl_Timeout_Handler, void* = 0);
122   static void remove_check(Fl_Timeout_Handler, void* = 0);
123   static void add_fd(int fd, int when, void (*cb)(int,void*),void* =0);
124   static void add_fd(int fd, void (*cb)(int, void*), void* = 0);
125   static void remove_fd(int, int when);
126   static void remove_fd(int);
127   static void add_idle(void (*cb)(void*), void* = 0);
128   static int  has_idle(void (*cb)(void*), void* = 0);
129   static void remove_idle(void (*cb)(void*), void* = 0);
130   static int damage() {return damage_;}
131   static void redraw();
132   static void flush();
133   static void (*warning)(const char*, ...);
134   static void (*error)(const char*, ...);
135   static void (*fatal)(const char*, ...);
136   static Fl_Window* first_window();
137   static void first_window(Fl_Window*);
138   static Fl_Window* next_window(const Fl_Window*);
139   static Fl_Window* modal() {return modal_;}
140   static Fl_Window* grab() {return grab_;}
141   static void grab(Fl_Window*);
142
143   // event information:
144   static int event()            {return e_number;}
145   static int event_x()  {return e_x;}
146   static int event_y()  {return e_y;}
147   static int event_x_root()     {return e_x_root;}
148   static int event_y_root()     {return e_y_root;}
149   static int event_dx() {return e_dx;}
150   static int event_dy() {return e_dy;}
151   static void get_mouse(int &,int &);
152   static int event_clicks()     {return e_clicks;}
153   static void event_clicks(int i) {e_clicks = i;}
154   static int event_is_click()   {return e_is_click;}
155   static void event_is_click(int i) {e_is_click = i;} // only 0 works!
156   static int event_button()     {return e_keysym-FL_Button;}
157   static int event_state()      {return e_state;}
158   static int event_state(int i) {return e_state&i;}
159   static int event_key()        {return e_keysym;}
160   static int event_key(int);
161   static int get_key(int);
162   static const char* event_text() {return e_text;}
163   static int event_length() {return e_length;}
164   static int compose(int &del);
165   static void compose_reset() {compose_state = 0;}
166   static int event_inside(int,int,int,int);
167   static int event_inside(const Fl_Widget*);
168   static int test_shortcut(int);
169
170   // event destinations:
171   static int handle(int, Fl_Window*);
172   static Fl_Widget* belowmouse() {return belowmouse_;}
173   static void belowmouse(Fl_Widget*);
174   static Fl_Widget* pushed()    {return pushed_;}
175   static void pushed(Fl_Widget*);
176   static Fl_Widget* focus()     {return focus_;}
177   static void focus(Fl_Widget*);
178   static void add_handler(int (*h)(int));
179   static void remove_handler(int (*h)(int));
180
181   // cut/paste:
182   static void copy(const char* stuff, int len, int clipboard = 0);
183   static void paste(Fl_Widget &receiver, int clipboard /*=0*/);
184   static int dnd();
185   // These are for back-compatability only:
186   static Fl_Widget* selection_owner() {return selection_owner_;}
187   static void selection_owner(Fl_Widget*);
188   static void selection(Fl_Widget &owner, const char*, int len);
189   static void paste(Fl_Widget &receiver);
190
191   // screen size:
192 #if defined(WIN32) || defined(__APPLE__)
193   static int x();
194   static int y();
195 #else
196   static int x() {return 0;}
197   static int y() {return 0;}
198 #endif /* WIN32 || __APPLE__ */
199   static int w();
200   static int h();
201
202   // color map:
203   static void   set_color(Fl_Color, uchar, uchar, uchar);
204   static void   set_color(Fl_Color, unsigned);
205   static unsigned get_color(Fl_Color);
206   static void   get_color(Fl_Color, uchar&, uchar&, uchar&);
207   static void   free_color(Fl_Color, int overlay = 0);
208
209   // fonts:
210   static const char* get_font(Fl_Font);
211   static const char* get_font_name(Fl_Font, int* attributes = 0);
212   static int get_font_sizes(Fl_Font, int*& sizep);
213   static void set_font(Fl_Font, const char*);
214   static void set_font(Fl_Font, Fl_Font);
215   static Fl_Font set_fonts(const char* = 0);
216
217   // labeltypes:
218   static void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);
219   static void set_labeltype(Fl_Labeltype, Fl_Labeltype from);
220
221   // boxtypes:
222   static Fl_Box_Draw_F *get_boxtype(Fl_Boxtype);
223   static void set_boxtype(Fl_Boxtype, Fl_Box_Draw_F*,uchar,uchar,uchar,uchar);
224   static void set_boxtype(Fl_Boxtype, Fl_Boxtype from);
225   static int box_dx(Fl_Boxtype);
226   static int box_dy(Fl_Boxtype);
227   static int box_dw(Fl_Boxtype);
228   static int box_dh(Fl_Boxtype);
229   static int draw_box_active();
230
231   // back compatability:
232   static void set_abort(void (*f)(const char*,...)) {fatal = f;}
233   static void (*atclose)(Fl_Window*,void*);
234   static void default_atclose(Fl_Window*,void*);
235   static void set_atclose(void (*f)(Fl_Window*,void*)) {atclose = f;}
236   static int event_shift() {return e_state&FL_SHIFT;}
237   static int event_ctrl() {return e_state&FL_CTRL;}
238   static int event_alt() {return e_state&FL_ALT;}
239   static int event_buttons() {return e_state&0x7f000000;}
240   static int event_button1() {return e_state&FL_BUTTON1;}
241   static int event_button2() {return e_state&FL_BUTTON2;}
242   static int event_button3() {return e_state&FL_BUTTON3;}
243   static void set_idle(void (*cb)()) {idle = cb;}
244   static void grab(Fl_Window&win) {grab(&win);}
245   static void release() {grab(0);}
246
247   // Visible focus methods...
248   static void visible_focus(int v) { visible_focus_ = v; }
249   static int  visible_focus() { return visible_focus_; }
250
251   // Drag-n-drop text operation methods...
252   static void dnd_text_ops(int v) { dnd_text_ops_ = v; }
253   static int  dnd_text_ops() { return dnd_text_ops_; }
254
255   // Multithreading support:
256   static void lock();
257   static void unlock();
258   static void awake(void* message = 0);
259   static void* thread_message();
260 };
261
262 #endif // !Fl_H
263
264 //
265 // End of "$Id: Fl.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
266 //