2 // "$Id: Enumerations.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
4 // Enumerations for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2002 by Bill Spitzak and others.
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.
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.
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
23 // Please report all bugs and problems to "fltk-bugs@fltk.org".
26 #ifndef Fl_Enumerations_H
27 #define Fl_Enumerations_H
29 # include "Fl_Export.H"
33 // The FLTK version number; this is changed slightly from the beta versions
34 // because the old "const double" definition would not allow for conditional
37 // FL_VERSION is a double that describes the major and minor version numbers.
38 // Version 1.1 is actually stored as 1.01 to allow for more than 9 minor
41 // The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
42 // give the integral values for the major, minor, and patch releases
46 #define FL_MAJOR_VERSION 1
47 #define FL_MINOR_VERSION 1
48 #define FL_PATCH_VERSION 2
49 #define FL_VERSION ((double)FL_MAJOR_VERSION + \
50 (double)FL_MINOR_VERSION * 0.01 + \
51 (double)FL_PATCH_VERSION * 0.0001)
53 typedef unsigned char uchar;
54 typedef unsigned long ulong;
56 enum Fl_Event { // events
75 FL_SELECTIONCLEAR = 18,
82 #define FL_KEYBOARD FL_KEYDOWN
84 enum Fl_When { // Fl_Widget::when():
88 FL_WHEN_RELEASE_ALWAYS= 6,
89 FL_WHEN_ENTER_KEY = 8,
90 FL_WHEN_ENTER_KEY_ALWAYS=10,
91 FL_WHEN_ENTER_KEY_CHANGED=11,
92 FL_WHEN_NOT_CHANGED = 2 // modifier bit to disable changed() test
95 // Fl::event_key() and Fl::get_key(n) (use ascii letters for all other keys):
96 #define FL_Button 0xfee8 // use Fl_Button+FL_*_MOUSE
97 #define FL_BackSpace 0xff08
99 #define FL_Enter 0xff0d
100 #define FL_Pause 0xff13
101 #define FL_Scroll_Lock 0xff14
102 #define FL_Escape 0xff1b
103 #define FL_Home 0xff50
104 #define FL_Left 0xff51
106 #define FL_Right 0xff53
107 #define FL_Down 0xff54
108 #define FL_Page_Up 0xff55
109 #define FL_Page_Down 0xff56
110 #define FL_End 0xff57
111 #define FL_Print 0xff61
112 #define FL_Insert 0xff63
113 #define FL_Menu 0xff67 // the "menu/apps" key on XFree86
114 #define FL_Help 0xff68 // the 'help' key on Mac keyboards
115 #define FL_Num_Lock 0xff7f
116 #define FL_KP 0xff80 // use FL_KP+'x' for 'x' on numeric keypad
117 #define FL_KP_Enter 0xff8d // same as Fl_KP+'\r'
118 #define FL_KP_Last 0xffbd // use to range-check keypad
119 #define FL_F 0xffbd // use FL_F+n for function key n
120 #define FL_F_Last 0xffe0 // use to range-check function keys
121 #define FL_Shift_L 0xffe1
122 #define FL_Shift_R 0xffe2
123 #define FL_Control_L 0xffe3
124 #define FL_Control_R 0xffe4
125 #define FL_Caps_Lock 0xffe5
126 #define FL_Meta_L 0xffe7 // the left MSWindows key on XFree86
127 #define FL_Meta_R 0xffe8 // the right MSWindows key on XFree86
128 #define FL_Alt_L 0xffe9
129 #define FL_Alt_R 0xffea
130 #define FL_Delete 0xffff
132 // Fl::event_button():
133 #define FL_LEFT_MOUSE 1
134 #define FL_MIDDLE_MOUSE 2
135 #define FL_RIGHT_MOUSE 3
137 // Fl::event_state():
138 #define FL_SHIFT 0x00010000
139 #define FL_CAPS_LOCK 0x00020000
140 #define FL_CTRL 0x00040000
141 #define FL_ALT 0x00080000
142 #define FL_NUM_LOCK 0x00100000 // most X servers do this?
143 #define FL_META 0x00400000 // correct for XFree86
144 #define FL_SCROLL_LOCK 0x00800000 // correct for XFree86
145 #define FL_BUTTON1 0x01000000
146 #define FL_BUTTON2 0x02000000
147 #define FL_BUTTON3 0x04000000
148 #define FL_BUTTONS 0x7f000000 // All possible buttons
149 #define FL_BUTTON(n) (0x00800000<<(n))
152 # define FL_COMMAND FL_META
154 # define FL_COMMAND FL_CTRL
157 enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
158 FL_NO_BOX = 0, FL_FLAT_BOX,
160 FL_UP_BOX, FL_DOWN_BOX,
161 FL_UP_FRAME, FL_DOWN_FRAME,
162 FL_THIN_UP_BOX, FL_THIN_DOWN_BOX,
163 FL_THIN_UP_FRAME, FL_THIN_DOWN_FRAME,
164 FL_ENGRAVED_BOX, FL_EMBOSSED_BOX,
165 FL_ENGRAVED_FRAME, FL_EMBOSSED_FRAME,
166 FL_BORDER_BOX, _FL_SHADOW_BOX,
167 FL_BORDER_FRAME, _FL_SHADOW_FRAME,
168 _FL_ROUNDED_BOX, _FL_RSHADOW_BOX,
169 _FL_ROUNDED_FRAME, _FL_RFLAT_BOX,
170 _FL_ROUND_UP_BOX, _FL_ROUND_DOWN_BOX,
171 _FL_DIAMOND_UP_BOX, _FL_DIAMOND_DOWN_BOX,
172 _FL_OVAL_BOX, _FL_OSHADOW_BOX,
173 _FL_OVAL_FRAME, _FL_OFLAT_BOX,
174 _FL_PLASTIC_UP_BOX, _FL_PLASTIC_DOWN_BOX,
175 _FL_PLASTIC_UP_FRAME, _FL_PLASTIC_DOWN_FRAME,
178 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
179 #define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX()
180 #define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1)
181 extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX();
182 #define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX()
183 #define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2)
184 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX();
185 #define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX()
186 #define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2)
187 extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX();
188 #define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX()
189 extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX();
190 #define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX()
191 extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX();
192 #define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX()
193 #define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1)
194 extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX();
195 #define FL_OVAL_BOX fl_define_FL_OVAL_BOX()
196 #define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1)
197 #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2)
198 #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3)
200 extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX();
201 #define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX()
202 #define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1)
203 #define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2)
204 #define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3)
206 // conversions of box types to other boxtypes:
207 inline Fl_Boxtype fl_down(Fl_Boxtype b) {return (Fl_Boxtype)(b|1);}
208 inline Fl_Boxtype fl_frame(Fl_Boxtype b) {return (Fl_Boxtype)(b|2);}
210 // back-compatability box types:
211 #define FL_FRAME FL_ENGRAVED_FRAME
212 #define FL_FRAME_BOX FL_ENGRAVED_BOX
213 #define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX
214 #define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX
216 enum Fl_Labeltype { // labeltypes:
228 #define FL_SYMBOL_LABEL FL_NORMAL_LABEL
229 extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
230 #define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
231 extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
232 #define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
233 extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
234 #define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()
236 enum Fl_Align { // align() values
242 FL_ALIGN_INSIDE = 16,
243 FL_ALIGN_TEXT_OVER_IMAGE = 32,
244 FL_ALIGN_IMAGE_OVER_TEXT = 0,
247 FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT,
248 FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT,
249 FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT,
250 FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT,
251 FL_ALIGN_LEFT_TOP = FL_ALIGN_TOP_LEFT,
252 FL_ALIGN_RIGHT_TOP = FL_ALIGN_TOP_RIGHT,
253 FL_ALIGN_LEFT_BOTTOM = FL_ALIGN_BOTTOM_LEFT,
254 FL_ALIGN_RIGHT_BOTTOM = FL_ALIGN_BOTTOM_RIGHT,
255 FL_ALIGN_NOWRAP = 0 // for back compatability
258 enum Fl_Font { // standard fonts
262 FL_HELVETICA_BOLD_ITALIC,
266 FL_COURIER_BOLD_ITALIC,
270 FL_TIMES_BOLD_ITALIC,
276 FL_FREE_FONT = 16, // first one to allocate
277 FL_BOLD = 1, // add this to helvetica, courier, or times
278 FL_ITALIC = 2 // add this to helvetica, courier, or times
281 extern FL_EXPORT int FL_NORMAL_SIZE;
283 enum Fl_Color { // standard colors
284 // These are used as default colors in widgets and altered as necessary
285 FL_FOREGROUND_COLOR = 0,
286 FL_BACKGROUND2_COLOR = 7,
287 FL_INACTIVE_COLOR = 8,
288 FL_SELECTION_COLOR = 15,
290 // boxtypes generally limit themselves to these colors so
291 // the whole ramp is not allocated:
292 FL_GRAY0 = 32, // 'A'
293 FL_DARK3 = 39, // 'H'
294 FL_DARK2 = 45, // 'N'
295 FL_DARK1 = 47, // 'P'
296 FL_BACKGROUND_COLOR = 49, // 'R' default background color
297 FL_LIGHT1 = 50, // 'S'
298 FL_LIGHT2 = 52, // 'U'
299 FL_LIGHT3 = 54, // 'W'
301 // FLTK provides a 5x8x5 color cube that is used with colormap visuals
314 FL_DARK_MAGENTA = 152,
320 #define FL_FREE_COLOR (Fl_Color)16
321 #define FL_NUM_FREE_COLOR 16
322 #define FL_GRAY_RAMP (Fl_Color)32
323 #define FL_NUM_GRAY 24
324 #define FL_GRAY FL_BACKGROUND_COLOR
325 #define FL_COLOR_CUBE (Fl_Color)56
327 #define FL_NUM_GREEN 8
328 #define FL_NUM_BLUE 5
330 FL_EXPORT Fl_Color fl_inactive(Fl_Color c);
331 FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
332 FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
333 inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
334 inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
335 inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) {
336 if (!r && !g && !b) return FL_BLACK;
337 else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
339 inline Fl_Color fl_rgb_color(uchar g) {
340 if (!g) return FL_BLACK;
341 else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
343 inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
344 inline Fl_Color fl_color_cube(int r, int g, int b) {
345 return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
347 enum Fl_Cursor { // standard cursors
348 FL_CURSOR_DEFAULT = 0,
349 FL_CURSOR_ARROW = 35,
350 FL_CURSOR_CROSS = 66,
352 FL_CURSOR_INSERT = 77,
356 // fltk provides bitmaps for these:
361 FL_CURSOR_NONE = 255,
362 // for back compatability (non MSWindows ones):
375 enum { // values for "when" passed to Fl::add_fd()
381 enum Fl_Mode { // visual types and Fl_Gl_Window::mode() (values match Glut)
393 FL_FAKE_SINGLE = 512 // Fake single buffered windows using double-buffer
399 FL_DAMAGE_CHILD = 0x01,
400 FL_DAMAGE_EXPOSE = 0x02,
401 FL_DAMAGE_SCROLL = 0x04,
402 FL_DAMAGE_OVERLAY = 0x08,
406 // FLTK 1.0.x compatibility definitions...
407 # ifdef FLTK_1_0_COMPAT
408 # define contrast fl_contrast
409 # define down fl_down
410 # define frame fl_frame
411 # define inactive fl_inactive
412 # endif // FLTK_1_0_COMPAT
417 // End of "$Id: Enumerations.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".