FLTK 1.4.0
Loading...
Searching...
No Matches
Fl.H
Go to the documentation of this file.
1//
2// Main header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2023 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
21#ifndef Fl_H
22# define Fl_H
23
24#include <FL/fl_config.h> // build configuration
25#include <FL/Fl_Export.H>
26#include <FL/platform_types.h> // for FL_SOCKET
27#include <FL/fl_casts.H> // experimental
28
29#ifdef FLTK_HAVE_CAIRO
30# include <FL/Fl_Cairo.H>
31#endif
32
33# include "fl_utf8.h"
34# include "Enumerations.H"
35# ifndef Fl_Object
36# define Fl_Object Fl_Widget
37# endif
38
39# ifdef check
40# undef check
41# endif
42
43# ifdef BSD
44# undef BSD
45# endif
46
47#include <string.h> // FIXME: Fl::is_scheme(): strcmp needs string.h
48
49class Fl_Widget;
50class Fl_Window;
51class Fl_Image;
52struct Fl_Label;
53class Fl_Screen_Driver;
54class Fl_System_Driver;
55
56// Pointers you can use to change FLTK to another language.
57// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
58
59extern FL_EXPORT const char* fl_local_alt;
60extern FL_EXPORT const char* fl_local_ctrl;
61extern FL_EXPORT const char* fl_local_meta;
62extern FL_EXPORT const char* fl_local_shift;
63
83typedef void (Fl_Label_Draw_F)(const Fl_Label *label, int x, int y, int w, int h, Fl_Align align);
84
86typedef void (Fl_Label_Measure_F)(const Fl_Label *label, int &width, int &height);
87
89typedef void (Fl_Box_Draw_F)(int x, int y, int w, int h, Fl_Color color);
90
94typedef void (*Fl_Timeout_Handler)(void *data);
95
97typedef void (*Fl_Awake_Handler)(void *data);
98
100typedef void (*Fl_Idle_Handler)(void *data);
101
103typedef void (*Fl_Old_Idle_Handler)();
104
106typedef void (*Fl_FD_Handler)(FL_SOCKET fd, void *data);
107
109typedef int (*Fl_Event_Handler)(int event);
110
112typedef int (*Fl_System_Handler)(void *event, void *data);
113
115typedef void (*Fl_Abort_Handler)(const char *format,...);
116
118typedef void (*Fl_Atclose_Handler)(Fl_Window *window, void *data);
119
121typedef int (*Fl_Args_Handler)(int argc, char **argv, int &i);
122
125typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w);
126
128typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data);
129
/* group callback_functions */
131
132
137class FL_EXPORT Fl {
138 friend class Fl_System_Driver;
139 Fl() {} // no constructor!
140
141private:
142
143 static int use_high_res_GL_;
144 static int draw_GL_text_with_textures_;
145 static int box_shadow_width_;
146 static int box_border_radius_max_;
147 static int selection_to_clipboard_;
148
149public:
150
151 static Fl_Screen_Driver *screen_driver();
152 static Fl_System_Driver *system_driver();
153#ifdef __APPLE__ // deprecated in 1.4 - only for compatibility with 1.3
154 static void reset_marked_text();
155 static void insertion_point_location(int x, int y, int height);
156#endif
157
158
162 static int box_shadow_width() { return box_shadow_width_; }
167 static void box_shadow_width(int W) { box_shadow_width_ = W < 1 ? 1 : W; }
168
172 static int box_border_radius_max() { return box_border_radius_max_; }
185 static void box_border_radius_max(int R) { box_border_radius_max_ = R < 5 ? 5 : R; }
186
187public: // should be private!
188
189#ifndef FL_DOXYGEN
190 static int e_number;
191 static int e_x;
192 static int e_y;
193 static int e_x_root;
194 static int e_y_root;
195 static int e_dx;
196 static int e_dy;
197 static int e_state;
198 static int e_clicks;
199 static int e_is_click;
200 static int e_keysym;
201 static char* e_text;
202 static int e_length;
203 static void *e_clipboard_data;
204 static const char *e_clipboard_type;
205 static Fl_Event_Dispatch e_dispatch;
206 static Fl_Callback_Reason callback_reason_;
207 static Fl_Widget* belowmouse_;
208 static Fl_Widget* pushed_;
209 static Fl_Widget* focus_;
210 static int damage_;
211 static Fl_Widget* selection_owner_;
212 static Fl_Window* modal_;
213 static Fl_Window* grab_;
214 static int compose_state; // used for dead keys (Windows) or marked text (MacOS)
215 static void call_screen_init(); // recompute screen number and dimensions
216#endif // FL_DOXYGEN
217
218
222 static void damage(int d) {damage_ = d;}
223
224public:
231 typedef enum {
241 OPTION_ARROW_FOCUS = 0,
242 // When switched on, FLTK will use the file chooser dialog that comes
243 // with your operating system whenever possible. When switched off, FLTK
244 // will present its own file chooser.
245 // \todo implement me
246 // OPTION_NATIVE_FILECHOOSER,
247 // When Filechooser Preview is enabled, the FLTK or native file chooser
248 // will show a preview of a selected file (if possible) before the user
249 // decides to choose the file.
250 // \todo implement me
251 //OPTION_FILECHOOSER_PREVIEW,
280 // don't change this, leave it always as the last element
282 OPTION_LAST
283 } Fl_Option;
284
285private:
286 static unsigned char options_[OPTION_LAST];
287 static unsigned char options_read_;
288 static int program_should_quit_; // non-zero means the program was asked to cleanly terminate
289
290public:
291 /*
292 Return a global setting for all FLTK applications, possibly overridden
293 by a setting specifically for this application.
294 */
295 static bool option(Fl_Option opt);
296
297 /*
298 Override an option while the application is running.
299 */
300 static void option(Fl_Option opt, bool val);
301
309 static void (*idle)();
310
311#ifndef FL_DOXYGEN
312private:
313 static Fl_Awake_Handler *awake_ring_;
314 static void **awake_data_;
315 static int awake_ring_size_;
316 static int awake_ring_head_;
317 static int awake_ring_tail_;
318public:
319 static const char* scheme_;
320 static Fl_Image* scheme_bg_;
321
322 static int e_original_keysym; // late addition
323 static int scrollbar_size_;
324 static int menu_linespacing_; // STR #2927
325#endif
326
327
328 static int add_awake_handler_(Fl_Awake_Handler, void*);
329 static int get_awake_handler_(Fl_Awake_Handler&, void*&);
330
331public:
332
333 // API version number
334 static double version();
335 static int api_version();
336
337 // ABI version number
338 static int abi_version();
339
362 static inline int abi_check(const int val = FL_ABI_VERSION) {
363 return val == abi_version();
364 }
365
366 // argument parsers:
367 static int arg(int argc, char **argv, int& i);
368 static int args(int argc, char **argv, int& i, Fl_Args_Handler cb = 0);
369 static void args(int argc, char **argv);
374 static const char* const help;
375
376 // things called by initialization:
377 static void display(const char*);
378 static int visual(int);
388 static int gl_visual(int, int *alist=0); // platform dependent
389 static void own_colormap();
390 static void get_system_colors();
391 static void foreground(uchar, uchar, uchar);
392 static void background(uchar, uchar, uchar);
393 static void background2(uchar, uchar, uchar);
394
395 // schemes:
396 static int scheme(const char *name);
398 static const char* scheme() {return scheme_;}
399
427 static int is_scheme(const char *name) {
428 return (scheme_ && name && !strcmp(name,scheme_));
429 }
430
431 static int reload_scheme(); // defined in 'src/Fl_get_system_colors.cxx'
432
433 static int scrollbar_size();
434 static void scrollbar_size(int W);
435 static int menu_linespacing();
436 static void menu_linespacing(int H);
437
438 // execution:
439 static int wait();
440 static double wait(double time);
441 static int check();
442 static int ready();
443 static int run();
450 static int program_should_quit() {return program_should_quit_;}
456 static void program_should_quit(int should_i) { program_should_quit_ = should_i; }
457 static void hide_all_windows();
458
459 static Fl_Widget* readqueue();
460
461 //
462 // cross-platform timer support
463 //
464
465 static void add_timeout(double t, Fl_Timeout_Handler cb, void *data = 0);
466 static void repeat_timeout(double t, Fl_Timeout_Handler cb, void *data = 0);
467 static int has_timeout(Fl_Timeout_Handler cb, void *data = 0);
468 static void remove_timeout(Fl_Timeout_Handler cb, void *data = 0);
469
470 static void add_check(Fl_Timeout_Handler, void* = 0);
471 static int has_check(Fl_Timeout_Handler, void* = 0);
472 static void remove_check(Fl_Timeout_Handler, void* = 0);
473
474 static Fl_Timestamp now(double offset = 0);
475 static double seconds_since(Fl_Timestamp& then);
476 static double seconds_between(Fl_Timestamp& back, Fl_Timestamp& further_back);
477 static long ticks_since(Fl_Timestamp& then);
478 static long ticks_between(Fl_Timestamp& back, Fl_Timestamp& further_back);
479
480 // private
481 static void run_idle();
482 static void run_checks();
483 static void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); // platform dependent
484 static void add_fd(int fd, Fl_FD_Handler cb, void* = 0); // platform dependent
486 static void remove_fd(int, int when); // platform dependent
488 static void remove_fd(int); // platform dependent
489
490 static void add_idle(Fl_Idle_Handler cb, void* data = 0);
491 static int has_idle(Fl_Idle_Handler cb, void* data = 0);
492 static void remove_idle(Fl_Idle_Handler cb, void* data = 0);
494 static int damage() {return damage_;}
495 static void redraw();
496 static void flush();
517 static void (*warning)(const char*, ...);
532 static void (*error)(const char*, ...);
549 static void (*fatal)(const char*, ...);
555 static Fl_Window* first_window();
556 static void first_window(Fl_Window*);
557 static Fl_Window* next_window(const Fl_Window*);
558
568 static Fl_Window* modal() {return modal_;}
574 static Fl_Window* grab() {return grab_;}
599 static void grab(Fl_Window*); // platform dependent
606 // event information:
612 static int event() {return e_number;}
617 static int event_x() {return e_x;}
622 static int event_y() {return e_y;}
629 static int event_x_root() {return e_x_root;}
636 static int event_y_root() {return e_y_root;}
641 static int event_dx() {return e_dx;}
646 static int event_dy() {return e_dy;}
655 static void get_mouse(int &,int &);
664 static int event_clicks() {return e_clicks;}
672 static void event_clicks(int i) {e_clicks = i;}
680 static int event_is_click() {return e_is_click;}
687 static void event_is_click(int i) {e_is_click = i;}
697 static int event_button() {return e_keysym-FL_Button;}
723 static int event_state() {return e_state;}
724
730 static int event_state(int mask) {return e_state&mask;}
742 static int event_key() {return e_keysym;}
751 static int event_original_key(){return e_original_keysym;}
791 static int event_key(int key);
797 static int get_key(int key); // platform dependent
812 static const char* event_text() {return e_text;}
819 static int event_length() {return e_length;}
820
824 static void *event_clipboard() { return e_clipboard_data; }
828 static const char *event_clipboard_type() {return e_clipboard_type; }
829
830
831 static int compose(int &del);
832 static void compose_reset();
833 static int event_inside(int,int,int,int);
834 static int event_inside(const Fl_Widget*);
835 static int test_shortcut(Fl_Shortcut);
836
837 static void enable_im();
838 static void disable_im();
839
840 // event destinations:
841 static int handle(int, Fl_Window*);
842 static int handle_(int, Fl_Window*);
845 static Fl_Widget* belowmouse() {return belowmouse_;}
846 static void belowmouse(Fl_Widget*);
849 static Fl_Widget* pushed() {return pushed_;}
850 static void pushed(Fl_Widget*);
852 static Fl_Widget* focus() {return focus_;}
853 static void focus(Fl_Widget*);
854 static void add_handler(Fl_Event_Handler h);
855 static void remove_handler(Fl_Event_Handler h);
856 static void add_system_handler(Fl_System_Handler h, void *data);
857 static void remove_system_handler(Fl_System_Handler h);
858 static void event_dispatch(Fl_Event_Dispatch d);
859 static Fl_Event_Dispatch event_dispatch();
860 static Fl_Callback_Reason callback_reason();
866 // cut/paste:
922 static void copy(const char *stuff, int len, int destination = 0,
923 const char *type = Fl::clipboard_plain_text);
924
952 static void selection_to_clipboard(int mode) {
953 selection_to_clipboard_ = mode ? 1 : 0;
954 }
955
961 static int selection_to_clipboard() { return selection_to_clipboard_; }
962
1005 static void paste(Fl_Widget &receiver, int source, const char *type = Fl::clipboard_plain_text);
1006
1028 static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data = 0);
1033 static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h);
1042 static int clipboard_contains(const char *type);
1045 static char const * const clipboard_plain_text;
1048 static char const * const clipboard_image;
1049
1059 static int dnd(); // platform dependent
1060
1061 // These are for back-compatibility only:
1064 static Fl_Widget* selection_owner() {return selection_owner_;}
1065 static void selection_owner(Fl_Widget*);
1066 static void selection(Fl_Widget &owner, const char*, int len);
1067 static void paste(Fl_Widget &receiver);
1087 static int x(); // via screen driver
1088 static int y(); // via screen driver
1089 static int w(); // via screen driver
1090 static int h(); // via screen driver
1091
1092 // multi-head support:
1093 static int screen_count(); // via screen driver
1094 static void screen_xywh(int &X, int &Y, int &W, int &H); // via screen driver
1095 static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my); // via screen driver
1096 static void screen_xywh(int &X, int &Y, int &W, int &H, int n); // via screen driver
1097 static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh); // via screen driver
1098 static int screen_num(int x, int y); // via screen driver
1099 static int screen_num(int x, int y, int w, int h); // via screen driver
1100 static void screen_dpi(float &h, float &v, int n=0); // via screen driver
1101 static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my); // via screen driver
1102 static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // via screen driver
1103 static void screen_work_area(int &X, int &Y, int &W, int &H); // via screen driver
1104 static float screen_scale(int n); // via screen driver
1105 static void screen_scale(int n, float factor); // via screen driver
1106 static int screen_scaling_supported();
1107 static void keyboard_screen_scaling(int value);
1108
1117 // color map:
1118 static void set_color(Fl_Color, uchar, uchar, uchar);
1119 static void set_color(Fl_Color, uchar, uchar, uchar, uchar);
1124 static void set_color(Fl_Color i, unsigned c); // platform dependent
1125 static unsigned get_color(Fl_Color i);
1126 static void get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue);
1127 static void get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue, uchar &alpha);
1133 static void free_color(Fl_Color i, int overlay = 0); // platform dependent
1134
1135 // fonts:
1136 static const char* get_font(Fl_Font);
1149 static const char* get_font_name(Fl_Font, int* attributes = 0);
1161 static int get_font_sizes(Fl_Font, int*& sizep);
1162 static void set_font(Fl_Font, const char*);
1163 static void set_font(Fl_Font, Fl_Font);
1191 static Fl_Font set_fonts(const char* = 0); // platform dependent
1192
1199 // <Hack to re-order the 'Drawing functions' group>
1202 // labeltypes:
1203 static void set_labeltype(Fl_Labeltype,Fl_Label_Draw_F*,Fl_Label_Measure_F*);
1205 static void set_labeltype(Fl_Labeltype, Fl_Labeltype from); // is it defined ?
1206
1207 // boxtypes:
1208 static Fl_Box_Draw_F *get_boxtype(Fl_Boxtype);
1209 static void set_boxtype(Fl_Boxtype, Fl_Box_Draw_F*,uchar,uchar,uchar,uchar);
1210 static void set_boxtype(Fl_Boxtype, Fl_Boxtype from);
1211 static int box_dx(Fl_Boxtype);
1212 static int box_dy(Fl_Boxtype);
1213 static int box_dw(Fl_Boxtype);
1214 static int box_dh(Fl_Boxtype);
1215
1216 static int draw_box_active();
1217 static Fl_Color box_color(Fl_Color);
1218 static void set_box_color(Fl_Color);
1219
1220 // back compatibility:
1224 static void set_abort(Fl_Abort_Handler f) {fatal = f;}
1225 static void (*atclose)(Fl_Window*,void*);
1226 static void default_atclose(Fl_Window*,void*);
1230 static void set_atclose(Fl_Atclose_Handler f) {atclose = f;}
1236 static int event_shift() {return e_state&FL_SHIFT;}
1238 static int event_ctrl() {return e_state&FL_CTRL;}
1240 static int event_command() {return e_state&FL_COMMAND;}
1242 static int event_alt() {return e_state&FL_ALT;}
1251 static int event_buttons() {return e_state&0x7f000000;}
1256 static int event_button1() {return e_state&FL_BUTTON1;}
1261 static int event_button2() {return e_state&FL_BUTTON2;}
1266 static int event_button3() {return e_state&FL_BUTTON3;}
1274 static void set_idle(Fl_Old_Idle_Handler cb) {idle = cb;}
1276 static void grab(Fl_Window& win) {grab(&win);}
1280 static void release() {grab(0);}
1281
1282 // Visible focus methods...
1288 static void visible_focus(int v) { option(OPTION_VISIBLE_FOCUS, (v!=0)); }
1294 static int visible_focus() { return option(OPTION_VISIBLE_FOCUS); }
1295
1296 // Drag-n-drop text operation methods...
1303 static void dnd_text_ops(int v) { option(OPTION_DND_TEXT, (v!=0)); }
1310 static int dnd_text_ops() { return option(OPTION_DND_TEXT); }
1315 // Multithreading support:
1316 static int lock();
1317 static void unlock();
1318 static void awake(void* message = 0);
1320 static int awake(Fl_Awake_Handler cb, void* message = 0);
1327 static void* thread_message(); // platform dependent
1359 // Widget deletion:
1360 static void delete_widget(Fl_Widget *w);
1361 static void do_widget_deletion();
1362 static void watch_widget_pointer(Fl_Widget *&w);
1363 static void release_widget_pointer(Fl_Widget *&w);
1364 static void clear_widget_pointer(Fl_Widget const *w);
1371 static void use_high_res_GL(int val) { use_high_res_GL_ = val; }
1377 static int use_high_res_GL() { return use_high_res_GL_; }
1378
1390 static void draw_GL_text_with_textures(int val) { draw_GL_text_with_textures_ = val; }
1391
1397 static int draw_GL_text_with_textures() { return draw_GL_text_with_textures_; }
1398
1399 static int system(const char *command);
1400
1401 // Convert Windows commandline arguments to UTF-8 (documented in src/Fl.cxx)
1402 static int args_to_utf8(int argc, char ** &argv);
1403
1404#ifdef FLTK_HAVE_CAIRO
1408public:
1409 // Cairo support API
1410
1411 static cairo_t *cairo_make_current(Fl_Window *w);
1412
1428 static void cairo_autolink_context(bool alink) {
1429 cairo_state_.autolink(alink);
1430 }
1431
1440 return cairo_state_.autolink();
1441 }
1442
1444 static cairo_t *cairo_cc() {
1445 return cairo_state_.cc();
1446 }
1447
1452 static void cairo_cc(cairo_t *c, bool own=false) {
1453 cairo_state_.cc(c, own);
1454 }
1455
1489 static void cairo_flush(cairo_t *c) {
1490 // flush Cairo drawings: necessary at least for Windows
1491 cairo_surface_t *s = cairo_get_target(Fl::cairo_cc());
1492 cairo_surface_flush(s);
1493 }
1494
1495private:
1496 static cairo_t *cairo_make_current(void *gc);
1497 static cairo_t *cairo_make_current(void *gc, int W, int H);
1498 static Fl_Cairo_State cairo_state_;
1499
1500public:
1503#endif // FLTK_HAVE_CAIRO
1504
1505};
1506
1549class FL_EXPORT Fl_Widget_Tracker {
1550
1551 Fl_Widget* wp_;
1552
1553public:
1554
1557
1563 Fl_Widget *widget() {return wp_;}
1564
1574 int deleted() {return wp_ == 0;}
1575
1585 int exists() {return wp_ != 0;}
1586
1587};
1588
1594#endif // !Fl_H
This file contains type definitions and general enumerations.
#define FL_BUTTON2
Mouse button 2 is pushed.
Definition Enumerations.H:578
#define FL_Button
A mouse button; use FL_Button + n for mouse button n.
Definition Enumerations.H:477
#define FL_CTRL
One of the ctrl keys is down.
Definition Enumerations.H:569
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1044
unsigned Fl_Align
FLTK type for alignment control.
Definition Enumerations.H:967
#define FL_ALT
One of the alt keys is down.
Definition Enumerations.H:570
#define FL_ABI_VERSION
The FLTK ABI (Application Binary Interface) version number as an int.
Definition Enumerations.H:171
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition Enumerations.H:1101
#define FL_BUTTON3
Mouse button 3 is pushed.
Definition Enumerations.H:579
#define FL_SHIFT
One of the shift keys is down.
Definition Enumerations.H:567
Fl_Labeltype
The labeltype() method sets the type of the label.
Definition Enumerations.H:816
Fl_Boxtype
FLTK standard box types.
Definition Enumerations.H:626
Fl_Callback_Reason
These constants describe why a callback is performed.
Definition Enumerations.H:446
#define FL_BUTTON1
Mouse button 1 is pushed.
Definition Enumerations.H:577
const char * fl_local_shift
string pointer used in shortcuts, you can change it to another language
Definition Fl.cxx:2280
const char * fl_local_ctrl
string pointer used in shortcuts, you can change it to another language
Definition Fl.cxx:2283
const char * fl_local_meta
string pointer used in shortcuts, you can change it to another language
Definition Fl.cxx:2281
const char * fl_local_alt
string pointer used in shortcuts, you can change it to another language
Definition Fl.cxx:2282
Cairo is currently supported for the following platforms: Windows, macOS, Unix/Linux (X11 + Wayland).
Contains all the necessary info on the current cairo context.
Definition Fl_Cairo.H:56
Base class for image caching, scaling and drawing.
Definition Fl_Image.H:60
This class should be used to control safe widget deletion.
Definition Fl.H:1549
int exists()
Returns 1, if the watched widget exists (has not been deleted).
Definition Fl.H:1585
int deleted()
Returns 1, if the watched widget has been deleted.
Definition Fl.H:1574
Fl_Widget * widget()
Returns a pointer to the watched widget.
Definition Fl.H:1563
Fl_Widget is the base class for all widgets in FLTK.
Definition Fl_Widget.H:104
This widget produces an actual window.
Definition Fl_Window.H:55
The Fl is the FLTK global (static) class containing state information and global methods for the curr...
Definition Fl.H:137
static int is_scheme(const char *name)
Returns whether the current scheme is the given name.
Definition Fl.H:427
static const char * scheme()
See void scheme(const char *name)
Definition Fl.H:398
static int draw_GL_text_with_textures()
returns whether whether OpenGL uses textures to draw all text.
Definition Fl.H:1397
static int program_should_quit()
Returns non-zero when a request for program termination was received and accepted.
Definition Fl.H:450
static void use_high_res_GL(int val)
sets whether GL windows should be drawn at high resolution on Apple computers with retina displays
Definition Fl.H:1371
static int box_border_radius_max()
Get the maximum border radius of all "rounded" boxtypes in pixels.
Definition Fl.H:172
@ OPTION_FNFC_USES_GTK
When switched on (default), Fl_Native_File_Chooser runs GTK file dialogs if the GTK library is availa...
Definition Fl.H:268
@ OPTION_FNFC_USES_ZENITY
Meaningful for the Wayland/X11 platform only.
Definition Fl.H:279
@ OPTION_DND_TEXT
If text drag-and-drop is enabled (default), the user can select and drag text from any text widget.
Definition Fl.H:260
@ OPTION_PRINTER_USES_GTK
When switched on (default), Fl_Printer runs the GTK printer dialog if the GTK library is available on...
Definition Fl.H:272
@ OPTION_SHOW_SCALING
When switched on (default), the library shows in a transient yellow window the zoom factor value.
Definition Fl.H:276
@ OPTION_VISIBLE_FOCUS
If visible focus is switched on (default), FLTK will draw a dotted rectangle inside the widget that w...
Definition Fl.H:256
@ OPTION_SHOW_TOOLTIPS
If tooltips are enabled (default), hovering the mouse over a widget with a tooltip text will open a l...
Definition Fl.H:264
static void damage(int d)
If true then flush() will do something.
Definition Fl.H:222
static int box_shadow_width()
Get the box shadow width of all "shadow" boxtypes in pixels.
Definition Fl.H:162
static void dnd_text_ops(int v)
Sets whether drag and drop text operations are supported.
Definition Fl.H:1303
static const char *const help
Usage string displayed if Fl::args() detects an invalid argument.
Definition Fl.H:374
static void box_border_radius_max(int R)
Set the maximum border radius of all "rounded" boxtypes in pixels.
Definition Fl.H:185
static void release()
Releases the current grabbed window, equals grab(0).
Definition Fl.H:1280
static void set_idle(Fl_Old_Idle_Handler cb)
Sets an idle callback.
Definition Fl.H:1274
static int gl_visual(int, int *alist=0)
This does the same thing as Fl::visual(int) but also requires OpenGL drawing to work.
static void program_should_quit(int should_i)
Indicate to the FLTK library whether a program termination request was received and accepted.
Definition Fl.H:456
static int use_high_res_GL()
returns whether GL windows should be drawn at high resolution on Apple computers with retina displays...
Definition Fl.H:1377
static void draw_GL_text_with_textures(int val)
sets whether OpenGL uses textures to draw all text.
Definition Fl.H:1390
static int dnd_text_ops()
Gets whether drag and drop text operations are supported.
Definition Fl.H:1310
static void grab(Fl_Window &win)
See grab(Fl_Window*)
Definition Fl.H:1276
static int damage()
If true then flush() will do something.
Definition Fl.H:494
static void box_shadow_width(int W)
Set the box shadow width of all "shadow" boxtypes in pixels.
Definition Fl.H:167
static void set_labeltype(Fl_Labeltype, Fl_Labeltype from)
Sets the functions to call to draw and measure a specific labeltype.
static void visible_focus(int v)
Gets or sets the visible keyboard focus on buttons and other non-text widgets.
Definition Fl.H:1288
static int visible_focus()
Gets or sets the visible keyboard focus on buttons and other non-text widgets.
Definition Fl.H:1294
static int abi_check(const int val=FL_ABI_VERSION)
Returns whether the runtime library ABI version is correct.
Definition Fl.H:362
unsigned int Fl_Shortcut
16-bit Unicode character + 8-bit indicator for keyboard flags.
Definition fl_types.h:55
unsigned char uchar
unsigned char
Definition fl_types.h:30
header for Unicode and UTF-8 character handling
int(* Fl_System_Handler)(void *event, void *data)
Signature of add_system_handler functions passed as parameters.
Definition Fl.H:112
void(* Fl_Timeout_Handler)(void *data)
Signature of timeout callback functions passed as parameters.
Definition Fl.H:94
int(* Fl_Event_Handler)(int event)
Signature of add_handler functions passed as parameters.
Definition Fl.H:109
void(* Fl_Old_Idle_Handler)()
Signature of set_idle callback functions passed as parameters.
Definition Fl.H:103
void(* Fl_Awake_Handler)(void *data)
Signature of some wakeup callback functions passed as parameters.
Definition Fl.H:97
void(* Fl_FD_Handler)(FL_SOCKET fd, void *data)
Signature of add_fd functions passed as parameters.
Definition Fl.H:106
int(* Fl_Event_Dispatch)(int event, Fl_Window *w)
Signature of event_dispatch functions passed as parameters.
Definition Fl.H:125
void() Fl_Label_Draw_F(const Fl_Label *label, int x, int y, int w, int h, Fl_Align align)
Signature of some label drawing functions passed as parameters.
Definition Fl.H:83
int(* Fl_Args_Handler)(int argc, char **argv, int &i)
Signature of args functions passed as parameters.
Definition Fl.H:121
void() Fl_Label_Measure_F(const Fl_Label *label, int &width, int &height)
Signature of some label measurement functions passed as parameters.
Definition Fl.H:86
void(* Fl_Abort_Handler)(const char *format,...)
Signature of set_abort functions passed as parameters.
Definition Fl.H:115
void(* Fl_Atclose_Handler)(Fl_Window *window, void *data)
Signature of set_atclose functions passed as parameters.
Definition Fl.H:118
void(* Fl_Idle_Handler)(void *data)
Signature of add_idle callback functions passed as parameters.
Definition Fl.H:100
void() Fl_Box_Draw_F(int x, int y, int w, int h, Fl_Color color)
Signature of some box drawing functions passed as parameters.
Definition Fl.H:89
void(* Fl_Clipboard_Notify_Handler)(int source, void *data)
Signature of add_clipboard_notify functions passed as parameters.
Definition Fl.H:128
static char const *const clipboard_image
Denotes image data.
Definition Fl.H:1048
static Fl_Widget * selection_owner()
back-compatibility only: Gets the widget owning the current selection
Definition Fl.H:1064
static int selection_to_clipboard()
Returns the current selection_to_clipboard mode.
Definition Fl.H:961
static char const *const clipboard_plain_text
Denotes plain textual data.
Definition Fl.H:1045
static void selection_to_clipboard(int mode)
Copies selections on X11 directly to the clipboard if enabled.
Definition Fl.H:952
static void event_clicks(int i)
Manually sets the number returned by Fl::event_clicks().
Definition Fl.H:672
static void event_is_click(int i)
Clears the value returned by Fl::event_is_click().
Definition Fl.H:687
static int event_y()
Returns the mouse position of the event relative to the Fl_Window it was passed to.
Definition Fl.H:622
static int event_key()
Gets which key on the keyboard was last pushed.
Definition Fl.H:742
static int event_alt()
Returns non-zero if the Alt key is pressed.
Definition Fl.H:1242
static Fl_Widget * focus()
Gets the current Fl::focus() widget.
Definition Fl.H:852
static int event_length()
Returns the length of the text in Fl::event_text().
Definition Fl.H:819
static int event_state(int mask)
Returns non-zero if any of the passed event state bits are turned on.
Definition Fl.H:730
static int event_dy()
Returns the current vertical mouse scrolling associated with the FL_MOUSEWHEEL event.
Definition Fl.H:646
static int event_x_root()
Returns the mouse position on the screen of the event.
Definition Fl.H:629
static Fl_Widget * pushed()
Gets the widget that is being pushed.
Definition Fl.H:849
static const char * event_clipboard_type()
Returns the type of the pasted data during an FL_PASTE event.
Definition Fl.H:828
static int event_button1()
Returns non-zero if mouse button 1 is currently held down.
Definition Fl.H:1256
static int event_button3()
Returns non-zero if button 3 is currently held down.
Definition Fl.H:1266
static int event_command()
Returns non-zero if the FL_COMMAND key is pressed, either FL_CTRL or on OSX FL_META.
Definition Fl.H:1240
static int event_button()
Gets which particular mouse button caused the current event.
Definition Fl.H:697
static int event_x()
Returns the mouse position of the event relative to the Fl_Window it was passed to.
Definition Fl.H:617
static int event_y_root()
Returns the mouse position on the screen of the event.
Definition Fl.H:636
static void * event_clipboard()
During an FL_PASTE event of non-textual data, returns a pointer to the pasted data.
Definition Fl.H:824
static int event_shift()
Returns non-zero if the Shift key is pressed.
Definition Fl.H:1236
static int event()
Returns the last event that was processed.
Definition Fl.H:612
static int event_ctrl()
Returns non-zero if the Control key is pressed.
Definition Fl.H:1238
static Fl_Widget * belowmouse()
Gets the widget that is below the mouse.
Definition Fl.H:845
static int event_button2()
Returns non-zero if button 2 is currently held down.
Definition Fl.H:1261
static int event_dx()
Returns the current horizontal mouse scrolling associated with the FL_MOUSEWHEEL event.
Definition Fl.H:641
static int event_original_key()
Returns the keycode of the last key event, regardless of the NumLock state.
Definition Fl.H:751
static int event_is_click()
Returns non-zero if the mouse has not moved far enough and not enough time has passed since the last ...
Definition Fl.H:680
static const char * event_text()
Returns the text associated with the current event, including FL_PASTE or FL_DND_RELEASE events.
Definition Fl.H:812
static int event_buttons()
Returns the mouse buttons state bits; if non-zero, then at least one button is pressed now.
Definition Fl.H:1251
static int event_state()
Returns the keyboard and mouse button states of the last event.
Definition Fl.H:723
static int event_clicks()
Returns non zero if we had a double click event.
Definition Fl.H:664
static Fl_Window * modal()
Returns the top-most modal() window currently shown.
Definition Fl.H:568
static void set_abort(Fl_Abort_Handler f)
For back compatibility, sets the void Fl::fatal handler callback.
Definition Fl.H:1224
static Fl_Window * grab()
Returns the window that currently receives all events.
Definition Fl.H:574
static void set_atclose(Fl_Atclose_Handler f)
For back compatibility, sets the Fl::atclose handler callback.
Definition Fl.H:1230
static cairo_t * cairo_cc()
Gets the current Cairo context linked with a fltk window.
Definition Fl.H:1444
static void cairo_cc(cairo_t *c, bool own=false)
Sets the current Cairo context to c.
Definition Fl.H:1452
static bool cairo_autolink_context()
Gets the current autolink mode for Cairo support.
Definition Fl.H:1439
static void cairo_flush(cairo_t *c)
Flush Cairo drawings on Cairo context c.
Definition Fl.H:1489
static void cairo_autolink_context(bool alink)
When FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, any current window dc is linked...
Definition Fl.H:1428
Definitions of platform-dependent types.
#define FL_COMMAND
An alias for FL_CTRL on Windows and X11, or FL_META on MacOS X.
Definition platform_types.h:75
opaque Fl_Timestamp
Platform-specific point in time, used for delta time calculation.
Definition platform_types.h:73
opaque FL_SOCKET
socket or file descriptor
Definition platform_types.h:57
This struct stores all information for a text or mixed graphics label.
Definition Fl_Widget.H:49