FLTK 1.3.0
Enumerations.H
Go to the documentation of this file.
1 //
2 // "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $"
3 //
4 // Enumerations for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2011 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 on the following page:
24 //
25 // http://www.fltk.org/str.php
26 //
27 
32 #ifndef Fl_Enumerations_H
33 #define Fl_Enumerations_H
34 
35 # include "Fl_Export.H"
36 # include "fl_types.h"
37 
46 
51 #define FL_MAJOR_VERSION 1
52 
58 #define FL_MINOR_VERSION 3
59 
65 #define FL_PATCH_VERSION 0
66 
78 #define FL_VERSION ((double)FL_MAJOR_VERSION + \
79  (double)FL_MINOR_VERSION * 0.01 + \
80  (double)FL_PATCH_VERSION * 0.0001)
81  // group: Version Numbers
83 
99 enum Fl_Event { // events
102 
114  FL_PUSH = 1,
115 
123 
131  FL_ENTER = 3,
132 
137  FL_LEAVE = 4,
138 
146  FL_DRAG = 5,
147 
161  FL_FOCUS = 6,
162 
167 
189 
194 
198  FL_KEYUP = 9,
199 
205  FL_CLOSE = 10,
206 
213  FL_MOVE = 11,
214 
228 
235 
240 
247  FL_HIDE = 15,
248 
255  FL_SHOW = 16,
256 
261  FL_PASTE = 17,
262 
269 
274 
280 
286 
290 
296 };
297 
305 enum Fl_When { // Fl_Widget::when():
314 };
315  // group: When Conditions
317 
330 
331 // FIXME: These codes collide with valid Unicode keys
332 
333 #define FL_Button 0xfee8
334 #define FL_BackSpace 0xff08
335 #define FL_Tab 0xff09
336 #define FL_Enter 0xff0d
337 #define FL_Pause 0xff13
338 #define FL_Scroll_Lock 0xff14
339 #define FL_Escape 0xff1b
340 #define FL_Home 0xff50
341 #define FL_Left 0xff51
342 #define FL_Up 0xff52
343 #define FL_Right 0xff53
344 #define FL_Down 0xff54
345 #define FL_Page_Up 0xff55
346 #define FL_Page_Down 0xff56
347 #define FL_End 0xff57
348 #define FL_Print 0xff61
349 #define FL_Insert 0xff63
350 #define FL_Menu 0xff67
351 #define FL_Help 0xff68
352 #define FL_Num_Lock 0xff7f
353 #define FL_KP 0xff80
354 #define FL_KP_Enter 0xff8d
355 #define FL_KP_Last 0xffbd
356 #define FL_F 0xffbd
357 #define FL_F_Last 0xffe0
358 #define FL_Shift_L 0xffe1
359 #define FL_Shift_R 0xffe2
360 #define FL_Control_L 0xffe3
361 #define FL_Control_R 0xffe4
362 #define FL_Caps_Lock 0xffe5
363 #define FL_Meta_L 0xffe7
364 #define FL_Meta_R 0xffe8
365 #define FL_Alt_L 0xffe9
366 #define FL_Alt_R 0xffea
367 #define FL_Delete 0xffff
368 
369 // These use the Private Use Area (PUA) of the Basic Multilingual Plane
370 // of Unicode. Guaranteed not to conflict with a proper Unicode character.
371 
372 // These primarily map to the XFree86 keysym range
373 #define FL_Volume_Down 0xEF11 /* Volume control down */
374 #define FL_Volume_Mute 0xEF12 /* Mute sound from the system */
375 #define FL_Volume_Up 0xEF13 /* Volume control up */
376 #define FL_Media_Play 0xEF14 /* Start playing of audio */
377 #define FL_Media_Stop 0xEF15 /* Stop playing audio */
378 #define FL_Media_Prev 0xEF16 /* Previous track */
379 #define FL_Media_Next 0xEF17 /* Next track */
380 #define FL_Home_Page 0xEF18 /* Display user's home page */
381 #define FL_Mail 0xEF19 /* Invoke user's mail program */
382 #define FL_Search 0xEF1B /* Search */
383 #define FL_Back 0xEF26 /* Like back on a browser */
384 #define FL_Forward 0xEF27 /* Like forward on a browser */
385 #define FL_Stop 0xEF28 /* Stop current operation */
386 #define FL_Refresh 0xEF29 /* Refresh the page */
387 #define FL_Sleep 0xEF2F /* Put system to sleep */
388 #define FL_Favorites 0xEF30 /* Show favorite locations */
389  // group: Mouse and Keyboard Events
391 
400 
401 #define FL_LEFT_MOUSE 1
402 #define FL_MIDDLE_MOUSE 2
403 #define FL_RIGHT_MOUSE 3
404 
405  // group: Mouse Buttons
406 
407 
413  // group: Event States
414 
415 // FIXME: it would be nice to have the modifiers in the upper 8 bit so that
416 // a unicode ke (24bit) can be sent as an unsigned with the modifiers.
417 
418 #define FL_SHIFT 0x00010000
419 #define FL_CAPS_LOCK 0x00020000
420 #define FL_CTRL 0x00040000
421 #define FL_ALT 0x00080000
422 #define FL_NUM_LOCK 0x00100000
423  // most X servers do this?
424 #define FL_META 0x00400000
425  // correct for XFree86
426 #define FL_SCROLL_LOCK 0x00800000
427  // correct for XFree86
428 #define FL_BUTTON1 0x01000000
429 #define FL_BUTTON2 0x02000000
430 #define FL_BUTTON3 0x04000000
431 #define FL_BUTTONS 0x7f000000
432 #define FL_BUTTON(n) (0x00800000<<(n))
433 
434 #define FL_KEY_MASK 0x0000ffff
435  // FIXME: Unicode needs 24 bits!
436 
437 #ifdef __APPLE__
438 # define FL_COMMAND FL_META
439 # define FL_CONTROL FL_CTRL
440 #else
441 # define FL_COMMAND FL_CTRL
442 # define FL_CONTROL FL_META
443 #endif // __APPLE__
444  // group: Event States
446 
464 enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
465 
466  FL_NO_BOX = 0,
515 };
516 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
517 #define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX()
518 #define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1)
519 extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX();
520 #define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX()
521 #define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2)
522 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX();
523 #define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX()
524 #define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2)
525 extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX();
526 #define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX()
527 extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX();
528 #define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX()
529 extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX();
530 #define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX()
531 #define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1)
532 extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX();
533 #define FL_OVAL_BOX fl_define_FL_OVAL_BOX()
534 #define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1)
535 #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2)
536 #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3)
537 
538 extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX();
539 #define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX()
540 #define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1)
541 #define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2)
542 #define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3)
543 #define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4)
544 #define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5)
545 #define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6)
546 #define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7)
547 
548 extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
549 #define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX()
550 #define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1)
551 #define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2)
552 #define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3)
553 #define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4)
554 #define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5)
555 #define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6)
556 #define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7)
557 #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8)
558 #define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
559 
560 // conversions of box types to other boxtypes:
567  return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2));
568 }
575  return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1));
576 }
583  return (Fl_Boxtype)((b%4<2)?b:(b+2));
584 }
585 
586 // back-compatibility box types:
587 #define FL_FRAME FL_ENGRAVED_FRAME
588 #define FL_FRAME_BOX FL_ENGRAVED_BOX
589 #define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX
590 #define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX
591  // group: Box Types
593 
606 enum Fl_Labeltype { // labeltypes:
615 
617 };
618 
623 #define FL_SYMBOL_LABEL FL_NORMAL_LABEL
624 extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
625 #define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
626 extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
627 #define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
628 extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
629 #define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()
630 
663 typedef unsigned Fl_Align;
693 const Fl_Align FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT;
694 const Fl_Align FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT;
695 const Fl_Align FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT;
696 const Fl_Align FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT;
697 const Fl_Align FL_ALIGN_LEFT_TOP = 0x0007; // magic value
698 const Fl_Align FL_ALIGN_RIGHT_TOP = 0x000b; // magic value
699 const Fl_Align FL_ALIGN_LEFT_BOTTOM = 0x000d; // magic value
700 const Fl_Align FL_ALIGN_RIGHT_BOTTOM = 0x000e; // magic value
701 const Fl_Align FL_ALIGN_NOWRAP = (Fl_Align)0; // for back compatibility
702 const Fl_Align FL_ALIGN_POSITION_MASK = 0x000f; // left, right, top, bottom
703 const Fl_Align FL_ALIGN_IMAGE_MASK = 0x0320; // l/r, t/b, backdrop
712 typedef int Fl_Font;
713 
718 const Fl_Font FL_COURIER = 4;
722 const Fl_Font FL_TIMES = 8;
726 const Fl_Font FL_SYMBOL = 12;
727 const Fl_Font FL_SCREEN = 13;
730 
731 const Fl_Font FL_FREE_FONT = 16;
732 const Fl_Font FL_BOLD = 1;
733 const Fl_Font FL_ITALIC = 2;
735 
741 typedef int Fl_Fontsize;
742 
743 extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE;
744 
769 typedef unsigned int Fl_Color;
770 
771 // Standard colors. These are used as default colors in widgets and altered as necessary
776 
777  // boxtypes generally limit themselves to these colors so
778  // the whole ramp is not allocated:
779 
780 const Fl_Color FL_GRAY0 = 32; // 'A'
781 const Fl_Color FL_DARK3 = 39; // 'H'
782 const Fl_Color FL_DARK2 = 45; // 'N'
783 const Fl_Color FL_DARK1 = 47; // 'P'
784 const Fl_Color FL_BACKGROUND_COLOR = 49; // 'R' default background color
785 const Fl_Color FL_LIGHT1 = 50; // 'S'
786 const Fl_Color FL_LIGHT2 = 52; // 'U'
787 const Fl_Color FL_LIGHT3 = 54; // 'W'
788 
789  // FLTK provides a 5x8x5 color cube that is used with colormap visuals
790 
791 const Fl_Color FL_BLACK = 56;
792 const Fl_Color FL_RED = 88;
793 const Fl_Color FL_GREEN = 63;
794 const Fl_Color FL_YELLOW = 95;
795 const Fl_Color FL_BLUE = 216;
796 const Fl_Color FL_MAGENTA = 248;
797 const Fl_Color FL_CYAN = 223;
798 const Fl_Color FL_DARK_RED = 72;
799 
800 const Fl_Color FL_DARK_GREEN = 60;
801 const Fl_Color FL_DARK_YELLOW = 76;
802 const Fl_Color FL_DARK_BLUE = 136;
803 const Fl_Color FL_DARK_MAGENTA = 152;
804 const Fl_Color FL_DARK_CYAN = 140;
805 
806 const Fl_Color FL_WHITE = 255;
807 
808 
809 #define FL_FREE_COLOR (Fl_Color)16
810 #define FL_NUM_FREE_COLOR 16
811 #define FL_GRAY_RAMP (Fl_Color)32
812 #define FL_NUM_GRAY 24
813 #define FL_GRAY FL_BACKGROUND_COLOR
814 #define FL_COLOR_CUBE (Fl_Color)56
815 #define FL_NUM_RED 5
816 #define FL_NUM_GREEN 8
817 #define FL_NUM_BLUE 5
818 
819 FL_EXPORT Fl_Color fl_inactive(Fl_Color c);
820 
821 FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
822 
823 FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
824 
826 inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
827 
829 inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
830 
833  if (!r && !g && !b) return FL_BLACK;
834  else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
835 }
836 
839  if (!g) return FL_BLACK;
840  else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
841 }
842 
851 inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
852 
867 inline Fl_Color fl_color_cube(int r, int g, int b) {
868  return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
869  // group: Colors
871 
874 
882 enum Fl_Cursor {
891  // fltk provides bitmaps for these:
897  // for back compatibility (non MSWindows ones):
898  FL_CURSOR_N = 70,
900  FL_CURSOR_E = 49,
904  FL_CURSOR_W = 36,
906 }; // group: Cursors
908 
910 enum { // values for "when" passed to Fl::add_fd()
911  FL_READ = 1,
912  FL_WRITE = 4,
914 };
915 
917 enum Fl_Mode {
918  FL_RGB = 0,
919  FL_INDEX = 1,
920  FL_SINGLE = 0,
921  FL_DOUBLE = 2,
922  FL_ACCUM = 4,
923  FL_ALPHA = 8,
924  FL_DEPTH = 16,
925  FL_STENCIL = 32,
926  FL_RGB8 = 64,
927  FL_MULTISAMPLE= 128,
928  FL_STEREO = 256,
929  FL_FAKE_SINGLE = 512 // Fake single buffered windows using double-buffer
930 };
931 
932 // image alpha blending
933 
934 #define FL_IMAGE_WITH_ALPHA 0x40000000
935 
937 enum Fl_Damage {
945 };
946 
947 // FLTK 1.0.x compatibility definitions...
948 # ifdef FLTK_1_0_COMPAT
949 # define contrast fl_contrast
950 # define down fl_down
951 # define frame fl_frame
952 # define inactive fl_inactive
953 # endif // FLTK_1_0_COMPAT
954 
955 #endif
956 
957 //
958 // End of "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $".
959 //