1 //
2 // Enumerations for the Fast Light Tool Kit (FLTK).
3 //
4 // Copyright 1998-2021 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 
17 /** \file
18     This file contains type definitions and general enumerations.
19  */
20 
21 #ifndef Fl_Enumerations_H
22 #define Fl_Enumerations_H
23 
24 /*
25  ******************************************************************************
26  * Notes on FL_ABI_VERSION and deprecated (obsolete) FLTK_ABI_VERSION:
27  *
28  * (1)	FLTK_ABI_VERSION is deprecated, but still defined below.
29  *	Do NOT define FLTK_ABI_VERSION here - it would be overwritten later.
30  *
31  * (2)	FL_ABI_VERSION is now (as of FLTK 1.3.4) defined by configure
32  *	or CMake. Do NOT define it here. Its definition will be included
33  *	below by "#include <FL/abi-version.h>".
34  *
35  * (3)	If you use the provided IDE files (Windows VC++ or Xcode) you should
36  *	edit the definition in the provided file abi-version.ide. The correct
37  *	file is `/path/to/fltk/abi-version.ide' .
38  *
39  ******************************************************************************
40  * For more informations on FL_ABI_VERSION see README.abi-version.txt.
41  ******************************************************************************
42  */
43 
44 #include <FL/abi-version.h>
45 
46 #  include "Fl_Export.H"
47 #  include "fl_types.h"
48 
49 /** \name Version Numbers
50 
51     FLTK defines some constants to help the programmer to
52     find out, for which FLTK version a program is compiled.
53 
54     The following constants are defined:
55  */
56 /*@{*/
57 
58 /**
59    The major release version of this FLTK library.
60    \sa FL_VERSION
61  */
62 #define FL_MAJOR_VERSION	1
63 
64 /**
65    The minor release version for this library.
66 
67    FLTK remains mostly source-code compatible between minor version changes.
68  */
69 #define FL_MINOR_VERSION	3
70 
71 /**
72    The patch version for this library.
73 
74    FLTK remains binary compatible between patches.
75  */
76 #define FL_PATCH_VERSION	8
77 
78 /**
79     The FLTK version number as a \em double.
80 
81     FL_VERSION is a \em double that describes the major, minor, and patch
82     version numbers.
83 
84     Version 1.2.3 is actually stored as 1.0203 to allow for more than 9
85     minor and patch releases.
86 
87     \deprecated This \p double version number is retained for compatibility
88     with existing program code. New code should use \em int FL_API_VERSION
89     instead. FL_VERSION is deprecated because comparisons of floating point
90     values may fail due to rounding errors. However, there are currently no
91     plans to remove this deprecated constant.
92 
93     FL_VERSION is equivalent to <em>(double)FL_API_VERSION / 10000</em>.
94 
95     \see Fl::version() (deprecated as well)
96     \see FL_API_VERSION
97     \see Fl::api_version()
98  */
99 #define FL_VERSION	( (double)FL_MAJOR_VERSION + \
100 			  (double)FL_MINOR_VERSION * 0.01 + \
101 			  (double)FL_PATCH_VERSION * 0.0001 )
102 
103 /**
104     The FLTK API version number as an \em int.
105 
106     FL_API_VERSION is an \em int that describes the major, minor, and patch
107     version numbers.
108 
109     Version 1.2.3 is actually stored as 10203 to allow for more than 9
110     minor and patch releases.
111 
112     The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
113     give the integral values for the major, minor, and patch releases
114     respectively.
115 
116     \note FL_API_VERSION is intended to replace the deprecated
117     \em double FL_VERSION.
118 
119     \see Fl::api_version()
120  */
121 #define FL_API_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100 + FL_PATCH_VERSION)
122 
123 /**
124     The FLTK ABI (Application Binary Interface) version number as an \em int.
125 
126     FL_ABI_VERSION is an \em int that describes the major, minor, and patch
127     ABI version numbers in the same format as FL_API_VERSION.
128 
129     The ABI version number \p FL_ABI_VERSION is usually the same as the
130     API version \p FL_API_VERSION with the last two digits set to '00'.
131 
132     FLTK retains the ABI (Application Binary Interface) during patch
133     releases of the same major and minor versions. Examples:
134 
135     \verbatim
136       FLTK Version  FL_API_VERSION  FL_ABI_VERSION  FL_VERSION (deprecated)
137         1.3.0          10300           10300           1.0300
138 	1.3.4          10304           10300           1.0304
139     \endverbatim
140 
141     Version 1.2.3 is actually stored as 10203 to allow for more than 9
142     minor and patch releases.
143 
144     The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
145     give the integral values for the major, minor, and patch releases
146     respectively.
147 
148     To enable new ABI-breaking features in patch releases you can configure
149     FLTK to use a higher FL_ABI_VERSION.
150 
151     \see README.abi-version.txt
152  */
153 #ifndef FL_ABI_VERSION
154 #define FL_ABI_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100)
155 #endif
156 
157 /*
158   Check if FL_ABI_VERSION is out of allowed range; redefine if necessary.
159 
160   This is done to prevent users from defining an illegal ABI version.
161 
162   Rule: FL_MAJOR_VERSION * 10000 + FL_MINOR_VERSION * 100
163 	  <= FL_ABI_VERSION <= FL_API_VERSION.
164 
165   Example (FLTK 1.3.4):
166 
167     10300 <= FL_ABI_VERSION <= 10304
168 
169   Note: configure + CMake can be used to define FL_ABI_VERSION, but they
170   do not check validity. This is done here.
171 */
172 
173 #if FL_ABI_VERSION < FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100
174 
175 # undef FL_ABI_VERSION
176 # define FL_ABI_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100)
177 
178 #elif FL_ABI_VERSION > FL_API_VERSION
179 
180 # undef FL_ABI_VERSION
181 # define FL_ABI_VERSION FL_API_VERSION
182 
183 #endif
184 
185 /*
186   FLTK_ABI_VERSION is deprecated (replaced by FL_ABI_VERSION).
187 
188   This deprecated constant will be removed in FLTK 1.4.0 and later.
189   Please use FL_ABI_VERSION when FLTK 1.4.0 has been released.
190 */
191 
192 #ifdef FLTK_ABI_VERSION
193 #undef FLTK_ABI_VERSION
194 #endif
195 
196 #define FLTK_ABI_VERSION FL_ABI_VERSION
197 
198 /*@}*/	// group: Version Numbers
199 
200 /**
201     Every time a user moves the mouse pointer, clicks a button,
202     or presses a key, an event is generated and sent to your
203     application. Events can also come from other programs like the
204     window manager.
205 
206     Events are identified by the integer argument passed to the
207     Fl_Widget::handle() virtual method. Other information about the
208     most recent event is stored in static locations and acquired  by
209     calling the Fl::event_*() methods. This static information remains
210     valid until the next event is read from the window system, so it
211     is ok to look at it outside of the handle() method.
212 
213     Event numbers can be converted to their actual names using the
214     \ref fl_eventnames[] array defined in \#include &lt;FL/names.h&gt;
215 
216     \sa Fl::event_text(), Fl::event_key(), class Fl::
217  */
218 // DEV NOTE: Keep this list in sync with FL/names.H
219 enum Fl_Event {	// events
220   /** No event. */
221   FL_NO_EVENT		= 0,
222 
223   /** A mouse button has gone down with the mouse pointing at this
224       widget. You can find out what button by calling Fl::event_button().
225       You find out the mouse position by calling Fl::event_x() and
226       Fl::event_y().
227 
228       A widget indicates that it "wants" the mouse click by returning non-zero
229       from its Fl_Widget::handle() method. It will then become the
230       Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events.
231       If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH
232       to another widget.
233    */
234   FL_PUSH		= 1,
235 
236   /** A mouse button has been released. You can find out what button by
237       calling Fl::event_button().
238 
239       In order to receive the FL_RELEASE event, the widget must return
240       non-zero when handling FL_PUSH.
241    */
242   FL_RELEASE		= 2,
243 
244   /** The mouse has been moved to point at this widget.  This can
245       be used for highlighting feedback.  If a widget wants to
246       highlight or otherwise track the mouse, it indicates this by
247       returning non-zero from its handle() method. It then
248       becomes the Fl::belowmouse() widget and will receive
249       FL_MOVE and FL_LEAVE events.
250    */
251   FL_ENTER		= 3,
252 
253   /** The mouse has moved out of the widget.
254       In order to receive the FL_LEAVE event, the widget must
255       return non-zero when handling FL_ENTER.
256    */
257   FL_LEAVE		= 4,
258 
259   /** The mouse has moved with a button held down. The current button state
260       is in Fl::event_state(). The mouse position is in Fl::event_x() and
261       Fl::event_y().
262 
263       In order to receive FL_DRAG events, the widget must return non-zero
264       when handling FL_PUSH.
265    */
266   FL_DRAG		= 5,
267 
268   /** This indicates an <I>attempt</I> to give a widget the keyboard focus.
269 
270       If a widget wants the focus, it should change itself to display the
271       fact that it has the focus, and return non-zero from its handle() method.
272       It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP,
273       and FL_UNFOCUS events.
274 
275       The focus will change either because the window manager changed which
276       window gets the focus, or because the user tried to navigate using tab,
277       arrows, or other keys. You can check Fl::event_key() to figure out why
278       it moved. For navigation it will be the key pressed and for interaction
279       with the window manager it will be zero.
280    */
281   FL_FOCUS		= 6,
282 
283   /** This event is sent to the previous Fl::focus() widget when another
284       widget gets the focus or the window loses focus.
285    */
286   FL_UNFOCUS		= 7,
287 
288   /** A key was pressed (FL_KEYDOWN) or released (FL_KEYUP).
289       Fl_KEYBOARD is a synonym for FL_KEYDOWN.
290       The key can be found in Fl::event_key().
291       The text that the key should insert can be found with Fl::event_text()
292       and its length is in Fl::event_length(). If you use the key handle()
293       should return 1. If you return zero then FLTK assumes you ignored the
294       key and will then attempt to send it to a parent widget. If none of
295       them want it, it will change the event into a FL_SHORTCUT event.
296 
297       To receive FL_KEYBOARD events you must also respond to the FL_FOCUS
298       and FL_UNFOCUS events.
299 
300       If you are writing a text-editing widget you may also want to call
301       the Fl::compose() function to translate individual keystrokes into
302       non-ASCII characters.
303 
304       FL_KEYUP events are sent to the widget that currently has focus. This
305       is not necessarily the same widget that received the corresponding
306       FL_KEYDOWN event because focus may have changed between events.
307    */
308   FL_KEYDOWN		= 8,
309 
310   /** Equivalent to FL_KEYDOWN.
311       \see FL_KEYDOWN
312    */
313   FL_KEYBOARD		= 8,
314 
315   /** Key release event.
316       \see FL_KEYDOWN
317    */
318   FL_KEYUP		= 9,
319 
320   /** The user clicked the close button of a window.
321       This event is used internally only to trigger the callback of
322       Fl_Window derived classed. The default callback closes the
323       window calling Fl_Window::hide().
324    */
325   FL_CLOSE		= 10,
326 
327   /** The mouse has moved without any mouse buttons held down.
328       This event is sent to the Fl::belowmouse() widget.
329 
330       In order to receive FL_MOVE events, the widget must return
331       non-zero when handling FL_ENTER.
332    */
333   FL_MOVE		= 11,
334 
335   /** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD
336       event then FLTK tries sending this event to every widget it
337       can, until one of them returns non-zero. FL_SHORTCUT is first
338       sent to the Fl::belowmouse() widget, then its parents and siblings,
339       and eventually to every widget in the window, trying to find an
340       object that returns non-zero. FLTK tries really hard to not to ignore
341       any keystrokes!
342 
343       You can also make "global" shortcuts by using Fl::add_handler(). A
344       global shortcut will work no matter what windows are displayed or
345       which one has the focus.
346    */
347   FL_SHORTCUT		= 12,
348 
349   /** This widget is no longer active, due to Fl_Widget::deactivate()
350       being called on it or one of its parents. Fl_Widget::active() may
351       still be true after this, the widget is only active if Fl_Widget::active()
352       is true on it and all its parents (use Fl_Widget::active_r() to check this).
353    */
354   FL_DEACTIVATE		= 13,
355 
356   /** This widget is now active, due to Fl_Widget::activate() being
357       called on it or one of its parents.
358    */
359   FL_ACTIVATE		= 14,
360 
361   /** This widget is no longer visible, due to Fl_Widget::hide() being
362       called on it or one of its parents, or due to a parent window being
363       minimized.  Fl_Widget::visible() may still be true after this, but the
364       widget is visible only if visible() is true for it and all its
365       parents (use Fl_Widget::visible_r() to check this).
366    */
367   FL_HIDE		= 15,
368 
369   /** This widget is visible again, due to Fl_Widget::show() being called on
370       it or one of its parents, or due to a parent window being restored.
371       Child Fl_Windows respond to this by actually creating the window if not
372       done already, so if you subclass a window, be sure to pass FL_SHOW
373       to the base class Fl_Widget::handle() method!
374    */
375   FL_SHOW		= 16,
376 
377   /** You should get this event some time after you call Fl::paste().
378       The contents of Fl::event_text() is the text to insert and the number
379       of characters is in Fl::event_length().
380    */
381   FL_PASTE		= 17,
382 
383   /** The Fl::selection_owner() will get this event before the selection is
384       moved to another widget. This indicates that some other widget or program
385       has claimed the selection. Motif programs used this to clear the selection
386       indication. Most modern programs ignore this.
387    */
388   FL_SELECTIONCLEAR	= 18,
389 
390   /** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy()
391       methods can be used to find the amount to scroll horizontally and vertically.
392    */
393   FL_MOUSEWHEEL		= 19,
394 
395   /** The mouse has been moved to point at this widget. A widget that is
396       interested in receiving drag'n'drop data must return 1 to receive
397       FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.
398    */
399   FL_DND_ENTER		= 20,
400 
401   /** The mouse has been moved inside a widget while dragging data.  A
402       widget that is interested in receiving drag'n'drop data should
403       indicate the possible drop position.
404    */
405   FL_DND_DRAG		= 21,
406 
407   /** The mouse has moved out of the widget.
408    */
409   FL_DND_LEAVE		= 22,
410 
411   /** The user has released the mouse button dropping data into the widget.
412       If the widget returns 1, it will receive the data in the immediately
413       following FL_PASTE event.
414    */
415   FL_DND_RELEASE	= 23,
416   /** The screen configuration (number, positions) was changed.
417    Use Fl::add_handler() to be notified of this event.
418    */
419   FL_SCREEN_CONFIGURATION_CHANGED = 24,
420   /** The fullscreen state of the window has changed
421    */
422   FL_FULLSCREEN         = 25,
423   /** The user has made a zoom/pinch/magnification gesture.
424       The Fl::event_dy() method can be used to find magnification amount,
425       Fl::event_x() and Fl::event_y() are set as well.
426      */
427   FL_ZOOM_GESTURE	= 26
428 };
429 
430 /** \name When Conditions */
431 /*@{*/
432 /** These constants determine when a callback is performed.
433 
434     \sa Fl_Widget::when();
435     \todo doxygen comments for values are incomplete and maybe wrong or unclear
436  */
437 enum Fl_When { // Fl_Widget::when():
438   FL_WHEN_NEVER		= 0,	///< Never call the callback
439   FL_WHEN_CHANGED	= 1,	///< Do the callback only when the widget value changes
440   FL_WHEN_NOT_CHANGED	= 2,	///< Do the callback whenever the user interacts with the widget
441   FL_WHEN_RELEASE	= 4,	///< Do the callback when the button or key is released and the value changes
442   FL_WHEN_RELEASE_ALWAYS= 6,	///< Do the callback when the button or key is released, even if the value doesn't change
443   FL_WHEN_ENTER_KEY	= 8,	///< Do the callback when the user presses the ENTER key and the value changes
444   FL_WHEN_ENTER_KEY_ALWAYS=10,	///< Do the callback when the user presses the ENTER key, even if the value doesn't change
445   FL_WHEN_ENTER_KEY_CHANGED=11	///< ?
446 };
447 
448 /*@}*/		// group: When Conditions
449 
450 /** \name Mouse and Keyboard Events
451 
452 	This and the following constants define the non-ASCII keys on the
453 	keyboard for FL_KEYBOARD and FL_SHORTCUT events.
454 
455 	\todo	FL_Button and FL_key... constants could be structured better
456 		(use an enum or some doxygen grouping ?)
457 
458 	\sa	Fl::event_key() and Fl::get_key(int) (use ascii letters for all other keys):
459  */
460 
461 /*@{*/
462 
463 // FIXME: These codes collide with valid Unicode keys
464 
465 #define FL_Button	0xfee8	///< A mouse button; use Fl_Button + n for mouse button n.
466 #define FL_BackSpace	0xff08	///< The backspace key.
467 #define FL_Tab		0xff09	///< The tab key.
468 #define FL_Iso_Key	0xff0c  ///< The additional key of ISO keyboards.
469 #define FL_Enter	0xff0d	///< The enter key.
470 #define FL_Pause	0xff13	///< The pause key.
471 #define FL_Scroll_Lock	0xff14	///< The scroll lock key.
472 #define FL_Escape	0xff1b	///< The escape key.
473 #define FL_Kana         0xff2e  ///< The Kana key of JIS keyboards.
474 #define FL_Eisu         0xff2f  ///< The Eisu key of JIS keyboards.
475 #define FL_Yen          0xff30  ///< The Yen key of JIS keyboards.
476 #define FL_JIS_Underscore 0xff31 ///< The underscore key of JIS keyboards.
477 #define FL_Home		0xff50	///< The home key.
478 #define FL_Left		0xff51	///< The left arrow key.
479 #define FL_Up		0xff52	///< The up arrow key.
480 #define FL_Right	0xff53	///< The right arrow key.
481 #define FL_Down		0xff54	///< The down arrow key.
482 #define FL_Page_Up	0xff55	///< The page-up key.
483 #define FL_Page_Down	0xff56	///< The page-down key.
484 #define FL_End		0xff57	///< The end key.
485 #define FL_Print	0xff61	///< The print (or print-screen) key.
486 #define FL_Insert	0xff63	///< The insert key.
487 #define FL_Menu		0xff67	///< The menu key.
488 #define FL_Help		0xff68	///< The 'help' key on Mac keyboards
489 #define FL_Num_Lock	0xff7f	///< The num lock key.
490 #define FL_KP		0xff80	///< One of the keypad numbers; use FL_KP + 'n' for digit n.
491 #define FL_KP_Enter	0xff8d	///< The enter key on the keypad, same as Fl_KP+'\\r'.
492 #define FL_KP_Last	0xffbd	///< The last keypad key; use to range-check keypad.
493 #define FL_F		0xffbd	///< One of the function keys; use FL_F + n for function key n.
494 #define FL_F_Last	0xffe0	///< The last function key; use to range-check function keys.
495 #define FL_Shift_L	0xffe1	///< The lefthand shift key.
496 #define FL_Shift_R	0xffe2	///< The righthand shift key.
497 #define FL_Control_L	0xffe3	///< The lefthand control key.
498 #define FL_Control_R	0xffe4	///< The righthand control key.
499 #define FL_Caps_Lock	0xffe5	///< The caps lock key.
500 #define FL_Meta_L	0xffe7	///< The left meta/Windows key.
501 #define FL_Meta_R	0xffe8	///< The right meta/Windows key.
502 #define FL_Alt_L	0xffe9	///< The left alt key.
503 #define FL_Alt_R	0xffea	///< The right alt key.
504 #define FL_Delete	0xffff	///< The delete key.
505 
506 // These use the Private Use Area (PUA) of the Basic Multilingual Plane
507 // of Unicode. Guaranteed not to conflict with a proper Unicode character.
508 
509 // These primarily map to the XFree86 keysym range
510 #define FL_Volume_Down  0xEF11   /* Volume control down        */
511 #define FL_Volume_Mute  0xEF12   /* Mute sound from the system */
512 #define FL_Volume_Up    0xEF13   /* Volume control up          */
513 #define FL_Media_Play   0xEF14   /* Start playing of audio     */
514 #define FL_Media_Stop   0xEF15   /* Stop playing audio         */
515 #define FL_Media_Prev   0xEF16   /* Previous track             */
516 #define FL_Media_Next   0xEF17   /* Next track                 */
517 #define FL_Home_Page    0xEF18   /* Display user's home page   */
518 #define FL_Mail         0xEF19   /* Invoke user's mail program */
519 #define FL_Search       0xEF1B   /* Search                     */
520 #define FL_Back         0xEF26   /* Like back on a browser     */
521 #define FL_Forward      0xEF27   /* Like forward on a browser  */
522 #define FL_Stop         0xEF28   /* Stop current operation     */
523 #define FL_Refresh      0xEF29   /* Refresh the page           */
524 #define FL_Sleep        0xEF2F   /* Put system to sleep        */
525 #define FL_Favorites    0xEF30   /* Show favorite locations    */
526 
527 /*@}*/	// group: Mouse and Keyboard Events
528 
529 /** \name Mouse Buttons
530 
531 	These constants define the button numbers for FL_PUSH and FL_RELEASE events.
532 
533 	\sa Fl::event_button()
534 */
535 
536 /*@{*/
537 
538 #define FL_LEFT_MOUSE	1	///< The left mouse button
539 #define FL_MIDDLE_MOUSE	2	///< The middle mouse button
540 #define FL_RIGHT_MOUSE	3	///< The right mouse button
541 
542 /*@}*/		// group: Mouse Buttons
543 
544 
545 /** \name	Event States
546 
547 	The following constants define bits in the Fl::event_state() value.
548 */
549 
550 /*@{*/		// group: Event States
551 
552 // FIXME: it would be nice to have the modifiers in the upper 8 bit so that
553 //        a unicode ke (24bit) can be sent as an unsigned with the modifiers.
554 
555 #define FL_SHIFT	0x00010000	///< One of the shift keys is down
556 #define FL_CAPS_LOCK	0x00020000	///< The caps lock is on
557 #define FL_CTRL		0x00040000	///< One of the ctrl keys is down
558 #define FL_ALT		0x00080000	///< One of the alt keys is down
559 #define FL_NUM_LOCK	0x00100000	///< The num lock is on
560 					// most X servers do this?
561 #define FL_META		0x00400000	///< One of the meta/Windows keys is down
562 					// correct for XFree86
563 #define FL_SCROLL_LOCK	0x00800000	///< The scroll lock is on
564 					// correct for XFree86
565 #define FL_BUTTON1	0x01000000	///< Mouse button 1 is pushed
566 #define FL_BUTTON2	0x02000000	///< Mouse button 2 is pushed
567 #define FL_BUTTON3	0x04000000	///< Mouse button 3 is pushed
568 #define FL_BUTTONS	0x7f000000	///< Any mouse button is pushed
569 #define FL_BUTTON(n)	(0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed
570 
571 #define FL_KEY_MASK 0x0000ffff		///< All keys are 16 bit for now
572 					//   FIXME: Unicode needs 24 bits!
573 
574 #ifdef __APPLE__
575 #  define FL_COMMAND	FL_META		///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
576 #  define FL_CONTROL 	FL_CTRL		///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
577 #else
578 #  define FL_COMMAND	FL_CTRL		///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
579 #  define FL_CONTROL	FL_META		///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
580 #endif // __APPLE__
581 
582 /*@}*/		// group: Event States
583 
584 /** \name Box Types
585     \brief FLTK standard box types
586 
587     This enum defines the standard box types included with FLTK.
588 
589     FL_NO_BOX means nothing is drawn at all, so whatever is already
590     on the screen remains. The FL_..._FRAME types only draw their edges,
591     leaving the interior unchanged. The blue color in Figure 1
592     is the area that is not drawn by the frame types.
593 
594     \image html boxtypes.png "Figure 1: FLTK standard box types"
595     \image latex boxtypes.png "FLTK standard box types" width=10cm
596     \todo	Description of boxtypes is incomplete.
597     		See below for the defined enum Fl_Boxtype.
598 		\see src/Fl_get_system_colors.cxx
599 */
600 /*@{*/
601 enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.cxx):
602 
603   FL_NO_BOX = 0,		///< nothing is drawn at all, this box is invisible
604   FL_FLAT_BOX,			///< a flat box
605   FL_UP_BOX,			///< see figure 1
606   FL_DOWN_BOX,			///< see figure 1
607   FL_UP_FRAME,			///< see figure 1
608   FL_DOWN_FRAME,		///< see figure 1
609   FL_THIN_UP_BOX,		///< see figure 1
610   FL_THIN_DOWN_BOX,		///< see figure 1
611   FL_THIN_UP_FRAME,		///< see figure 1
612   FL_THIN_DOWN_FRAME,		///< see figure 1
613   FL_ENGRAVED_BOX,		///< see figure 1
614   FL_EMBOSSED_BOX,		///< see figure 1
615   FL_ENGRAVED_FRAME,		///< see figure 1
616   FL_EMBOSSED_FRAME,		///< see figure 1
617   FL_BORDER_BOX,		///< see figure 1
618   _FL_SHADOW_BOX,		///< see figure 1
619   FL_BORDER_FRAME,		///< see figure 1
620   _FL_SHADOW_FRAME,		///< see figure 1
621   _FL_ROUNDED_BOX,		///< see figure 1
622   _FL_RSHADOW_BOX,		///< see figure 1
623   _FL_ROUNDED_FRAME,		///< see figure 1
624   _FL_RFLAT_BOX,		///< see figure 1
625   _FL_ROUND_UP_BOX,		///< see figure 1
626   _FL_ROUND_DOWN_BOX,		///< see figure 1
627   _FL_DIAMOND_UP_BOX,		///< see figure 1
628   _FL_DIAMOND_DOWN_BOX,		///< see figure 1
629   _FL_OVAL_BOX,			///< see figure 1
630   _FL_OSHADOW_BOX,		///< see figure 1
631   _FL_OVAL_FRAME,		///< see figure 1
632   _FL_OFLAT_BOX,		///< see figure 1
633   _FL_PLASTIC_UP_BOX,		///< plastic version of FL_UP_BOX
634   _FL_PLASTIC_DOWN_BOX,		///< plastic version of FL_DOWN_BOX
635   _FL_PLASTIC_UP_FRAME,		///< plastic version of FL_UP_FRAME
636   _FL_PLASTIC_DOWN_FRAME,	///< plastic version of FL_DOWN_FRAME
637   _FL_PLASTIC_THIN_UP_BOX,	///< plastic version of FL_THIN_UP_BOX
638   _FL_PLASTIC_THIN_DOWN_BOX,	///< plastic version of FL_THIN_DOWN_BOX
639   _FL_PLASTIC_ROUND_UP_BOX,	///< plastic version of FL_ROUND_UP_BOX
640   _FL_PLASTIC_ROUND_DOWN_BOX,	///< plastic version of FL_ROUND_DOWN_BOX
641   _FL_GTK_UP_BOX,		///< gtk+ version of FL_UP_BOX
642   _FL_GTK_DOWN_BOX,		///< gtk+ version of FL_DOWN_BOX
643   _FL_GTK_UP_FRAME,		///< gtk+ version of FL_UP_FRAME
644   _FL_GTK_DOWN_FRAME,		///< gtk+ version of FL_DOWN_FRAME
645   _FL_GTK_THIN_UP_BOX,		///< gtk+ version of FL_THIN_UP_BOX
646   _FL_GTK_THIN_DOWN_BOX,	///< gtk+ version of FL_THIN_DOWN_BOX
647   _FL_GTK_THIN_UP_FRAME,	///< gtk+ version of FL_THIN_UP_FRAME
648   _FL_GTK_THIN_DOWN_FRAME,	///< gtk+ version of FL_THIN_DOWN_FRAME
649   _FL_GTK_ROUND_UP_BOX,		///< gtk+ version of FL_ROUND_UP_BOX
650   _FL_GTK_ROUND_DOWN_BOX,	///< gtk+ version of FL_ROUND_DOWN_BOX
651   _FL_GLEAM_UP_BOX,		///< gleam version of FL_UP_BOX
652   _FL_GLEAM_DOWN_BOX,		///< gleam version of FL_DOWN_BOX
653   _FL_GLEAM_UP_FRAME,		///< gleam version of FL_UP_FRAME
654   _FL_GLEAM_DOWN_FRAME,		///< gleam version of FL_DOWN_FRAME
655   _FL_GLEAM_THIN_UP_BOX,	///< gleam version of FL_THIN_UP_BOX
656   _FL_GLEAM_THIN_DOWN_BOX,	///< gleam version of FL_THIN_DOWN_BOX
657   _FL_GLEAM_ROUND_UP_BOX,	///< gleam version of FL_ROUND_UP_BOX
658   _FL_GLEAM_ROUND_DOWN_BOX,	///< gleam version of FL_ROUND_DOWN_BOX
659   FL_FREE_BOXTYPE		///< the first free box type for creation of new box types
660 };
661 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
662 #define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX()
663 #define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1)
664 extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX();
665 #define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX()
666 #define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2)
667 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX();
668 #define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX()
669 #define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2)
670 extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX();
671 #define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX()
672 extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX();
673 #define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX()
674 extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX();
675 #define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX()
676 #define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1)
677 extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX();
678 #define FL_OVAL_BOX fl_define_FL_OVAL_BOX()
679 #define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1)
680 #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2)
681 #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3)
682 
683 extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX();
684 #define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX()
685 #define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1)
686 #define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2)
687 #define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3)
688 #define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4)
689 #define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5)
690 #define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6)
691 #define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7)
692 
693 extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
694 #define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX()
695 #define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1)
696 #define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2)
697 #define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3)
698 #define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4)
699 #define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5)
700 #define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6)
701 #define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7)
702 #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8)
703 #define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
704 
705 extern FL_EXPORT Fl_Boxtype fl_define_FL_GLEAM_UP_BOX();
706 #define FL_GLEAM_UP_BOX fl_define_FL_GLEAM_UP_BOX()
707 #define FL_GLEAM_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+1)
708 #define FL_GLEAM_UP_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+2)
709 #define FL_GLEAM_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+3)
710 #define FL_GLEAM_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+4)
711 #define FL_GLEAM_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+5)
712 #define FL_GLEAM_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+6)
713 #define FL_GLEAM_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+7)
714 
715 // conversions of box types to other boxtypes:
716 /**
717   Get the filled version of a frame.
718   If no filled version of a given frame exists, the behavior of this function
719   is undefined and some random box or frame is returned.
720  */
fl_box(Fl_Boxtype b)721 inline Fl_Boxtype fl_box(Fl_Boxtype b) {
722   return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2));
723 }
724 /**
725   Get the "pressed" or "down" version of a box.
726   If no "down" version of a given box exists, the behavior of this function
727   is undefined and some random box or frame is returned.
728  */
fl_down(Fl_Boxtype b)729 inline Fl_Boxtype fl_down(Fl_Boxtype b) {
730   return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1));
731 }
732 /**
733   Get the unfilled, frame only version of a box.
734   If no frame version of a given box exists, the behavior of this function
735   is undefined and some random box or frame is returned.
736  */
fl_frame(Fl_Boxtype b)737 inline Fl_Boxtype fl_frame(Fl_Boxtype b) {
738   return (Fl_Boxtype)((b%4<2)?b:(b+2));
739 }
740 
741 // back-compatibility box types:
742 #define FL_FRAME FL_ENGRAVED_FRAME
743 #define FL_FRAME_BOX FL_ENGRAVED_BOX
744 #define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX
745 #define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX
746 
747 /*@}*/	// group: Box Types
748 
749 /**
750    The labeltype() method sets the type of the label.
751 
752    The following standard label types are included:
753 
754    \todo	The doxygen comments are incomplete, and some labeltypes
755    	start with an underscore. Also, there are three
756 		external functions undocumented (yet):
757 		  - fl_define_FL_SHADOW_LABEL()
758 		  - fl_define_FL_ENGRAVED_LABEL()
759 		  - fl_define_FL_EMBOSSED_LABEL()
760 */
761 enum Fl_Labeltype {	// labeltypes:
762   FL_NORMAL_LABEL	= 0, ///< draws the text (0)
763   FL_NO_LABEL,         ///< does nothing
764   _FL_SHADOW_LABEL,    ///< draws a drop shadow under the text
765   _FL_ENGRAVED_LABEL,	 ///< draws edges as though the text is engraved
766   _FL_EMBOSSED_LABEL,  ///< draws edges as though the text is raised
767   _FL_MULTI_LABEL,     ///< draws a composite label \see Fl_Multi_Label
768   _FL_ICON_LABEL,      ///< draws the icon associated with the text
769   _FL_IMAGE_LABEL,     ///< the label displays an "icon" based on a Fl_Image
770 
771   FL_FREE_LABELTYPE    ///< first free labeltype to use for creating own labeltypes
772 };
773 
774 /**
775   Sets the current label type and return its corresponding Fl_Labeltype value.
776   @{
777 */
778 #define FL_SYMBOL_LABEL FL_NORMAL_LABEL
779 extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
780 #define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
781 extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
782 #define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
783 extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
784 #define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()
785 /** @} */
786 
787 /** \name Alignment Flags
788     Flags to control the label alignment.
789 
790     This controls how the label is displayed next to or inside the widget.
791     The default value is FL_ALIGN_CENTER (0) for most widgets, which centers
792     the label inside the widget.
793 
794     Flags can be or'd to achieve a combination of alignments, but there
795     are some "magic values" (e.g. combinations of TOP and BOTTOM and of
796     LEFT and RIGHT) that have special meanings (see below). For instance:<BR>
797     FL_ALIGN_TOP_LEFT == (FL_ALIGN_TOP|FL_ALIGN_LEFT) != FL_ALIGN_LEFT_TOP.
798 
799     \code
800     Outside alignments (FL_ALIGN_INSIDE is not set):
801 
802                TOP_LEFT        TOP       TOP_RIGHT
803                +---------------------------------+
804        LEFT_TOP|                                 |RIGHT_TOP
805                |                                 |
806            LEFT|             CENTER              |RIGHT
807                |                                 |
808     LEFT_BOTTOM|                                 |RIGHT_BOTTOM
809                +---------------------------------+
810                BOTTOM_LEFT   BOTTOM   BOTTOM_RIGHT
811 
812     Inside alignments (FL_ALIGN_INSIDE is set):
813 
814                +---------------------------------+
815                |TOP_LEFT       TOP      TOP_RIGHT|
816                |                                 |
817                |LEFT         CENTER         RIGHT|
818                |                                 |
819                |BOTTOM_LEFT  BOTTOM  BOTTOM_RIGHT|
820                +---------------------------------+
821     \endcode
822     \see #FL_ALIGN_CENTER, etc.
823  */
824 /*@{*/
825 /** FLTK type for alignment control */
826 typedef unsigned Fl_Align;
827   /** Align the label horizontally in the middle. */
828 const Fl_Align FL_ALIGN_CENTER		= (Fl_Align)0;
829   /** Align the label at the top of the widget. Inside labels appear below the top,
830       outside labels are drawn on top of the widget. */
831 const Fl_Align FL_ALIGN_TOP		= (Fl_Align)1;
832   /** Align the label at the bottom of the widget. */
833 const Fl_Align FL_ALIGN_BOTTOM		= (Fl_Align)2;
834   /** Align the label at the left of the widget. Inside labels appear left-justified
835       starting at the left side of the widget, outside labels are right-justified and
836       drawn to the left of the widget. */
837 const Fl_Align FL_ALIGN_LEFT		= (Fl_Align)4;
838   /** Align the label to the right of the widget. */
839 const Fl_Align FL_ALIGN_RIGHT		= (Fl_Align)8;
840   /** Draw the label inside of the widget. */
841 const Fl_Align FL_ALIGN_INSIDE		= (Fl_Align)16;
842   /** If the label contains an image, draw the text on top of the image. */
843 const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE	= (Fl_Align)0x0020;
844   /** If the label contains an image, draw the text below the image. */
845 const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT	= (Fl_Align)0x0000;
846   /** All parts of the label that are lager than the widget will not be drawn . */
847 const Fl_Align FL_ALIGN_CLIP		= (Fl_Align)64;
848   /** Wrap text that does not fit the width of the widget. */
849 const Fl_Align FL_ALIGN_WRAP		= (Fl_Align)128;
850   /** If the label contains an image, draw the text to the right of the image. */
851 const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100;
852   /** If the label contains an image, draw the text to the left of the image. */
853 const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0120;
854 /** If the label contains an image, draw the image or deimage in the background. */
855 const Fl_Align FL_ALIGN_IMAGE_BACKDROP  = (Fl_Align)0x0200;
856 const Fl_Align FL_ALIGN_TOP_LEFT	= FL_ALIGN_TOP | FL_ALIGN_LEFT;
857 const Fl_Align FL_ALIGN_TOP_RIGHT	= FL_ALIGN_TOP | FL_ALIGN_RIGHT;
858 const Fl_Align FL_ALIGN_BOTTOM_LEFT	= FL_ALIGN_BOTTOM | FL_ALIGN_LEFT;
859 const Fl_Align FL_ALIGN_BOTTOM_RIGHT	= FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT;
860 const Fl_Align FL_ALIGN_LEFT_TOP	= 0x0007; // magic value
861 const Fl_Align FL_ALIGN_RIGHT_TOP	= 0x000b; // magic value
862 const Fl_Align FL_ALIGN_LEFT_BOTTOM	= 0x000d; // magic value
863 const Fl_Align FL_ALIGN_RIGHT_BOTTOM	= 0x000e; // magic value
864 const Fl_Align FL_ALIGN_NOWRAP		= (Fl_Align)0; // for back compatibility
865 const Fl_Align FL_ALIGN_POSITION_MASK   = 0x000f; // left, right, top, bottom
866 const Fl_Align FL_ALIGN_IMAGE_MASK      = 0x0320; // l/r, t/b, backdrop
867 /*@}*/
868 
869 
870 /** \name Font Numbers
871     The following constants define the standard FLTK fonts:
872  */
873 /*@{*/
874 /** A font number is an index into the internal font table. */
875 typedef int Fl_Font;
876 
877 const Fl_Font FL_HELVETICA              = 0;	///< Helvetica (or Arial) normal (0)
878 const Fl_Font FL_HELVETICA_BOLD         = 1;	///< Helvetica (or Arial) bold
879 const Fl_Font FL_HELVETICA_ITALIC       = 2;	///< Helvetica (or Arial) oblique
880 const Fl_Font FL_HELVETICA_BOLD_ITALIC  = 3;	///< Helvetica (or Arial) bold-oblique
881 const Fl_Font FL_COURIER                = 4;	///< Courier normal
882 const Fl_Font FL_COURIER_BOLD           = 5;	///< Courier bold
883 const Fl_Font FL_COURIER_ITALIC         = 6;	///< Courier italic
884 const Fl_Font FL_COURIER_BOLD_ITALIC    = 7;	///< Courier bold-italic
885 const Fl_Font FL_TIMES                  = 8;	///< Times roman
886 const Fl_Font FL_TIMES_BOLD             = 9;	///< Times roman bold
887 const Fl_Font FL_TIMES_ITALIC           = 10;	///< Times roman italic
888 const Fl_Font FL_TIMES_BOLD_ITALIC      = 11;	///< Times roman bold-italic
889 const Fl_Font FL_SYMBOL                 = 12;	///< Standard symbol font
890 const Fl_Font FL_SCREEN                 = 13;	///< Default monospaced screen font
891 const Fl_Font FL_SCREEN_BOLD            = 14;	///< Default monospaced bold screen font
892 const Fl_Font FL_ZAPF_DINGBATS          = 15;	///< Zapf-dingbats font
893 
894 const Fl_Font FL_FREE_FONT              = 16;	///< first one to allocate
895 const Fl_Font FL_BOLD                   = 1;	///< add this to helvetica, courier, or times
896 const Fl_Font FL_ITALIC                 = 2;	///< add this to helvetica, courier, or times
897 const Fl_Font FL_BOLD_ITALIC            = 3;	///< add this to helvetica, courier, or times
898 
899 /*@}*/
900 
901 /** Size of a font in pixels.
902     This is the approximate height of a font in pixels.
903  */
904 typedef int Fl_Fontsize;
905 
906 extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE;	///< normal font size
907 
908 /** \name Colors
909     The Fl_Color type holds an FLTK color value.
910 
911     Colors are either 8-bit indexes into a <a href="fltk-colormap.png">virtual colormap</a>
912     or 24-bit RGB color values. (See \ref drawing_colors for the default FLTK colormap)
913 
914     Color indices occupy the lower 8 bits of the value, while
915     RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
916 
917 <pre>
918  Fl_Color => 0xrrggbbii
919                 | | | |
920                 | | | +--- \ref drawing_colors "index" between 0 and 255
921                 | | +----- blue color component (8 bit)
922                 | +------- green component (8 bit)
923                 +--------- red component (8 bit)
924  </pre>
925 
926     A color can have either an index or an rgb value. Colors with rgb set
927     and an index >0 are reserved for special use.
928 
929  */
930 /*@{*/
931 /** An FLTK color value; see also \ref drawing_colors  */
932 typedef unsigned int Fl_Color;
933 
934 // Standard colors. These are used as default colors in widgets and altered as necessary
935 const Fl_Color FL_FOREGROUND_COLOR  = 0;	///< the default foreground color (0) used for labels and text
936 const Fl_Color FL_BACKGROUND2_COLOR = 7;	///< the default background color for text, list, and valuator widgets
937 const Fl_Color FL_INACTIVE_COLOR    = 8;	///< the inactive foreground color
938 const Fl_Color FL_SELECTION_COLOR   = 15;	///< the default selection/highlight color
939 
940   // boxtypes generally limit themselves to these colors so
941   // the whole ramp is not allocated:
942 
943 const Fl_Color FL_GRAY0   = 32;			// 'A'
944 const Fl_Color FL_DARK3   = 39;			// 'H'
945 const Fl_Color FL_DARK2   = 45;			// 'N'
946 const Fl_Color FL_DARK1   = 47;			// 'P'
947 const Fl_Color FL_BACKGROUND_COLOR  = 49;	// 'R' default background color
948 const Fl_Color FL_LIGHT1  = 50;			// 'S'
949 const Fl_Color FL_LIGHT2  = 52;			// 'U'
950 const Fl_Color FL_LIGHT3  = 54;			// 'W'
951 
952   // FLTK provides a 5x8x5 color cube that is used with colormap visuals
953 
954 const Fl_Color FL_BLACK   = 56;
955 const Fl_Color FL_RED     = 88;
956 const Fl_Color FL_GREEN   = 63;
957 const Fl_Color FL_YELLOW  = 95;
958 const Fl_Color FL_BLUE    = 216;
959 const Fl_Color FL_MAGENTA = 248;
960 const Fl_Color FL_CYAN    = 223;
961 const Fl_Color FL_DARK_RED = 72;
962 
963 const Fl_Color FL_DARK_GREEN    = 60;
964 const Fl_Color FL_DARK_YELLOW   = 76;
965 const Fl_Color FL_DARK_BLUE     = 136;
966 const Fl_Color FL_DARK_MAGENTA  = 152;
967 const Fl_Color FL_DARK_CYAN     = 140;
968 
969 const Fl_Color FL_WHITE         = 255;
970 
971 
972 #define FL_FREE_COLOR     (Fl_Color)16
973 #define FL_NUM_FREE_COLOR 16
974 #define FL_GRAY_RAMP      (Fl_Color)32
975 #define FL_NUM_GRAY       24
976 #define FL_GRAY           FL_BACKGROUND_COLOR
977 #define FL_COLOR_CUBE     (Fl_Color)56
978 #define FL_NUM_RED        5
979 #define FL_NUM_GREEN      8
980 #define FL_NUM_BLUE       5
981 
982 FL_EXPORT Fl_Color fl_inactive(Fl_Color c);
983 
984 FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
985 
986 FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
987 
988 /** Returns a lighter version of the specified color. */
fl_lighter(Fl_Color c)989 inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
990 
991 /** Returns a darker version of the specified color. */
fl_darker(Fl_Color c)992 inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
993 
994 /** Returns the 24-bit color value closest to \p r, \p g, \p b. */
fl_rgb_color(uchar r,uchar g,uchar b)995 inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) {
996   if (!r && !g && !b) return FL_BLACK;
997   else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
998 }
999 
1000 /** Returns the 24-bit color value closest to \p g (grayscale). */
fl_rgb_color(uchar g)1001 inline Fl_Color fl_rgb_color(uchar g) {
1002   if (!g) return FL_BLACK;
1003   else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
1004 }
1005 
1006 /** Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1).
1007     FL_NUM_GRAY is defined to be 24 in the current FLTK release.
1008     To get the closest FLTK gray value to an 8-bit grayscale color 'I' use:
1009 
1010  \code
1011    fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255)
1012  \endcode
1013 */
fl_gray_ramp(int i)1014 inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
1015 
1016 /** Returns a color out of the color cube.
1017 
1018   \p r must be in the range 0 to FL_NUM_RED (5) minus 1,
1019   \p g must be in the range 0 to FL_NUM_GREEN (8) minus 1,
1020   \p b must be in the range 0 to FL_NUM_BLUE (5) minus 1.
1021 
1022   To get the closest color to a 8-bit set of R,G,B values use:
1023 
1024   \code
1025     fl_color_cube(R * (FL_NUM_RED - 1) / 255,
1026        G * (FL_NUM_GREEN - 1) / 255,
1027        B * (FL_NUM_BLUE - 1) / 255);
1028   \endcode
1029  */
fl_color_cube(int r,int g,int b)1030 inline Fl_Color fl_color_cube(int r, int g, int b) {
1031   return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
1032 
1033 /*@}*/		// group: Colors
1034 
1035 /** \name Cursors */
1036 /*@{*/
1037 
1038 /** The following constants define the mouse cursors that are available in FLTK.
1039 
1040     Cursors are provided by the system when available, or bitmaps built into
1041     FLTK as a fallback.
1042 
1043     \todo enum Fl_Cursor needs maybe an image.
1044 */
1045 /* FIXME: We should renumber these, but that will break the ABI */
1046 enum Fl_Cursor {
1047   FL_CURSOR_DEFAULT    =  0, /**< the default cursor, usually an arrow. */
1048   FL_CURSOR_ARROW      = 35, /**< an arrow pointer. */
1049   FL_CURSOR_CROSS      = 66, /**< crosshair. */
1050   FL_CURSOR_WAIT       = 76, /**< busy indicator (e.g. hourglass). */
1051   FL_CURSOR_INSERT     = 77, /**< I-beam. */
1052   FL_CURSOR_HAND       = 31, /**< pointing hand. */
1053   FL_CURSOR_HELP       = 47, /**< question mark pointer. */
1054   FL_CURSOR_MOVE       = 27, /**< 4-pointed arrow or hand. */
1055 
1056   /* Resize indicators */
1057   FL_CURSOR_NS         = 78, /**< up/down resize. */
1058   FL_CURSOR_WE         = 79, /**< left/right resize. */
1059   FL_CURSOR_NWSE       = 80, /**< diagonal resize. */
1060   FL_CURSOR_NESW       = 81, /**< diagonal resize. */
1061   FL_CURSOR_N          = 70, /**< upwards resize. */
1062   FL_CURSOR_NE         = 69, /**< upwards, right resize. */
1063   FL_CURSOR_E          = 49, /**< rightwards resize. */
1064   FL_CURSOR_SE         =  8, /**< downwards, right resize. */
1065   FL_CURSOR_S          =  9, /**< downwards resize. */
1066   FL_CURSOR_SW         =  7, /**< downwards, left resize. */
1067   FL_CURSOR_W          = 36, /**< leftwards resize. */
1068   FL_CURSOR_NW         = 68, /**< upwards, left resize. */
1069 
1070   FL_CURSOR_NONE       =255  /**< invisible. */
1071 };
1072 /*@}*/		// group: Cursors
1073 
1074 /** FD "when" conditions */
1075 enum { // values for "when" passed to Fl::add_fd()
1076   FL_READ   = 1, /**< Call the callback when there is data to be read. */
1077   FL_WRITE  = 4, /**< Call the callback when data can be written without blocking. */
1078   FL_EXCEPT = 8  /**< Call the callback if an exception occurs on the file. */
1079 };
1080 
1081 /** visual types and Fl_Gl_Window::mode() (values match Glut) */
1082 enum Fl_Mode {
1083   FL_RGB	= 0,
1084   FL_INDEX	= 1,
1085   FL_SINGLE	= 0,
1086   FL_DOUBLE	= 2,
1087   FL_ACCUM	= 4,
1088   FL_ALPHA	= 8,
1089   FL_DEPTH	= 16,
1090   FL_STENCIL	= 32,
1091   FL_RGB8	= 64,
1092   FL_MULTISAMPLE= 128,
1093   FL_STEREO     = 256,
1094   FL_FAKE_SINGLE = 512,	// Fake single buffered windows using double-buffer
1095   FL_OPENGL3    = 1024
1096 };
1097 
1098 // image alpha blending
1099 
1100 #define FL_IMAGE_WITH_ALPHA 0x40000000
1101 
1102 /** Damage masks */
1103 enum Fl_Damage {
1104   FL_DAMAGE_CHILD    = 0x01, /**< A child needs to be redrawn. */
1105   FL_DAMAGE_EXPOSE   = 0x02, /**< The window was exposed. */
1106   FL_DAMAGE_SCROLL   = 0x04, /**< The Fl_Scroll widget was scrolled. */
1107   FL_DAMAGE_OVERLAY  = 0x08, /**< The overlay planes need to be redrawn. */
1108   FL_DAMAGE_USER1    = 0x10, /**< First user-defined damage bit. */
1109   FL_DAMAGE_USER2    = 0x20, /**< Second user-defined damage bit. */
1110   FL_DAMAGE_ALL      = 0x80  /**< Everything needs to be redrawn. */
1111 };
1112 
1113 // FLTK 1.0.x compatibility definitions...
1114 #  ifdef FLTK_1_0_COMPAT
1115 #    define contrast	fl_contrast
1116 #    define down	fl_down
1117 #    define frame	fl_frame
1118 #    define inactive	fl_inactive
1119 #  endif // FLTK_1_0_COMPAT
1120 
1121 #endif
1122 
1123 //
1124 // End of "$Id$".
1125 //
1126