DRC | 2ff39b8 | 2011-07-28 08:38:59 +0000 | [diff] [blame^] | 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 | |
| 28 | /** \file |
| 29 | This file contains type definitions and general enumerations. |
| 30 | */ |
| 31 | |
| 32 | #ifndef Fl_Enumerations_H |
| 33 | #define Fl_Enumerations_H |
| 34 | |
| 35 | # include "Fl_Export.H" |
| 36 | # include "fl_types.h" |
| 37 | |
| 38 | /** \name Version Numbers |
| 39 | |
| 40 | FLTK defines some constants to help the programmer to |
| 41 | find out, for which FLTK version a program is compiled. |
| 42 | |
| 43 | The following constants are defined: |
| 44 | */ |
| 45 | /*@{*/ |
| 46 | |
| 47 | /** |
| 48 | The major release version of this FLTK library. |
| 49 | \sa FL_VERSION |
| 50 | */ |
| 51 | #define FL_MAJOR_VERSION 1 |
| 52 | |
| 53 | /** |
| 54 | The minor release version for this library. |
| 55 | |
| 56 | FLTK remains mostly source-code compatible between minor version changes. |
| 57 | */ |
| 58 | #define FL_MINOR_VERSION 3 |
| 59 | |
| 60 | /** |
| 61 | The patch version for this library. |
| 62 | |
| 63 | FLTK remains binary compatible between patches. |
| 64 | */ |
| 65 | #define FL_PATCH_VERSION 0 |
| 66 | |
| 67 | /** |
| 68 | The FLTK version number as a \em double. |
| 69 | |
| 70 | FL_VERSION is a double that describes the major and minor version numbers. |
| 71 | Version 1.1 is actually stored as 1.01 to allow for more than 9 minor |
| 72 | releases. |
| 73 | |
| 74 | The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants |
| 75 | give the integral values for the major, minor, and patch releases |
| 76 | respectively. |
| 77 | */ |
| 78 | #define FL_VERSION ((double)FL_MAJOR_VERSION + \ |
| 79 | (double)FL_MINOR_VERSION * 0.01 + \ |
| 80 | (double)FL_PATCH_VERSION * 0.0001) |
| 81 | |
| 82 | /*@}*/ // group: Version Numbers |
| 83 | |
| 84 | /** |
| 85 | Every time a user moves the mouse pointer, clicks a button, |
| 86 | or presses a key, an event is generated and sent to your |
| 87 | application. Events can also come from other programs like the |
| 88 | window manager. |
| 89 | |
| 90 | Events are identified by the integer argument passed to the |
| 91 | Fl_Widget::handle() virtual method. Other information about the |
| 92 | most recent event is stored in static locations and acquired by |
| 93 | calling the Fl::event_*() methods. This static information remains |
| 94 | valid until the next event is read from the window system, so it |
| 95 | is ok to look at it outside of the handle() method. |
| 96 | |
| 97 | \sa Fl::event_text(), Fl::event_key(), class Fl:: |
| 98 | */ |
| 99 | enum Fl_Event { // events |
| 100 | /** No event. */ |
| 101 | FL_NO_EVENT = 0, |
| 102 | |
| 103 | /** A mouse button has gone down with the mouse pointing at this |
| 104 | widget. You can find out what button by calling Fl::event_button(). |
| 105 | You find out the mouse position by calling Fl::event_x() and |
| 106 | Fl::event_y(). |
| 107 | |
| 108 | A widget indicates that it "wants" the mouse click by returning non-zero |
| 109 | from its Fl_Widget::handle() method. It will then become the |
| 110 | Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events. |
| 111 | If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH |
| 112 | to another widget. |
| 113 | */ |
| 114 | FL_PUSH = 1, |
| 115 | |
| 116 | /** A mouse button has been released. You can find out what button by |
| 117 | calling Fl::event_button(). |
| 118 | |
| 119 | In order to receive the FL_RELEASE event, the widget must return |
| 120 | non-zero when handling FL_PUSH. |
| 121 | */ |
| 122 | FL_RELEASE = 2, |
| 123 | |
| 124 | /** The mouse has been moved to point at this widget. This can |
| 125 | be used for highlighting feedback. If a widget wants to |
| 126 | highlight or otherwise track the mouse, it indicates this by |
| 127 | returning non-zero from its handle() method. It then |
| 128 | becomes the Fl::belowmouse() widget and will receive |
| 129 | FL_MOVE and FL_LEAVE events. |
| 130 | */ |
| 131 | FL_ENTER = 3, |
| 132 | |
| 133 | /** The mouse has moved out of the widget. |
| 134 | In order to receive the FL_LEAVE event, the widget must |
| 135 | return non-zero when handling FL_ENTER. |
| 136 | */ |
| 137 | FL_LEAVE = 4, |
| 138 | |
| 139 | /** The mouse has moved with a button held down. The current button state |
| 140 | is in Fl::event_state(). The mouse position is in Fl::event_x() and |
| 141 | Fl::event_y(). |
| 142 | |
| 143 | In order to receive FL_DRAG events, the widget must return non-zero |
| 144 | when handling FL_PUSH. |
| 145 | */ |
| 146 | FL_DRAG = 5, |
| 147 | |
| 148 | /** This indicates an <I>attempt</I> to give a widget the keyboard focus. |
| 149 | |
| 150 | If a widget wants the focus, it should change itself to display the |
| 151 | fact that it has the focus, and return non-zero from its handle() method. |
| 152 | It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP, |
| 153 | and FL_UNFOCUS events. |
| 154 | |
| 155 | The focus will change either because the window manager changed which |
| 156 | window gets the focus, or because the user tried to navigate using tab, |
| 157 | arrows, or other keys. You can check Fl::event_key() to figure out why |
| 158 | it moved. For navigation it will be the key pressed and for interaction |
| 159 | with the window manager it will be zero. |
| 160 | */ |
| 161 | FL_FOCUS = 6, |
| 162 | |
| 163 | /** This event is sent to the previous Fl::focus() widget when another |
| 164 | widget gets the focus or the window loses focus. |
| 165 | */ |
| 166 | FL_UNFOCUS = 7, |
| 167 | |
| 168 | /** A key was pressed (FL_KEYDOWN) or released (FL_KEYUP). |
| 169 | Fl_KEYBOARD is a synonym for FL_KEYDOWN. |
| 170 | The key can be found in Fl::event_key(). |
| 171 | The text that the key should insert can be found with Fl::event_text() |
| 172 | and its length is in Fl::event_length(). If you use the key handle() |
| 173 | should return 1. If you return zero then FLTK assumes you ignored the |
| 174 | key and will then attempt to send it to a parent widget. If none of |
| 175 | them want it, it will change the event into a FL_SHORTCUT event. |
| 176 | |
| 177 | To receive FL_KEYBOARD events you must also respond to the FL_FOCUS |
| 178 | and FL_UNFOCUS events. |
| 179 | |
| 180 | If you are writing a text-editing widget you may also want to call |
| 181 | the Fl::compose() function to translate individual keystrokes into |
| 182 | non-ASCII characters. |
| 183 | |
| 184 | FL_KEYUP events are sent to the widget that currently has focus. This |
| 185 | is not necessarily the same widget that received the corresponding |
| 186 | FL_KEYDOWN event because focus may have changed between events. |
| 187 | */ |
| 188 | FL_KEYDOWN = 8, |
| 189 | |
| 190 | /** Equivalent to FL_KEYDOWN. |
| 191 | \see FL_KEYDOWN |
| 192 | */ |
| 193 | FL_KEYBOARD = 8, |
| 194 | |
| 195 | /** Key release event. |
| 196 | \see FL_KEYDOWN |
| 197 | */ |
| 198 | FL_KEYUP = 9, |
| 199 | |
| 200 | /** The user clicked the close button of a window. |
| 201 | This event is used internally only to trigger the callback of |
| 202 | Fl_Window derived classed. The default callback closes the |
| 203 | window calling Fl_Window::hide(). |
| 204 | */ |
| 205 | FL_CLOSE = 10, |
| 206 | |
| 207 | /** The mouse has moved without any mouse buttons held down. |
| 208 | This event is sent to the Fl::belowmouse() widget. |
| 209 | |
| 210 | In order to receive FL_MOVE events, the widget must return |
| 211 | non-zero when handling FL_ENTER. |
| 212 | */ |
| 213 | FL_MOVE = 11, |
| 214 | |
| 215 | /** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD |
| 216 | event then FLTK tries sending this event to every widget it |
| 217 | can, until one of them returns non-zero. FL_SHORTCUT is first |
| 218 | sent to the Fl::belowmouse() widget, then its parents and siblings, |
| 219 | and eventually to every widget in the window, trying to find an |
| 220 | object that returns non-zero. FLTK tries really hard to not to ignore |
| 221 | any keystrokes! |
| 222 | |
| 223 | You can also make "global" shortcuts by using Fl::add_handler(). A |
| 224 | global shortcut will work no matter what windows are displayed or |
| 225 | which one has the focus. |
| 226 | */ |
| 227 | FL_SHORTCUT = 12, |
| 228 | |
| 229 | /** This widget is no longer active, due to Fl_Widget::deactivate() |
| 230 | being called on it or one of its parents. Fl_Widget::active() may |
| 231 | still be true after this, the widget is only active if Fl_Widget::active() |
| 232 | is true on it and all its parents (use Fl_Widget::active_r() to check this). |
| 233 | */ |
| 234 | FL_DEACTIVATE = 13, |
| 235 | |
| 236 | /** This widget is now active, due to Fl_Widget::activate() being |
| 237 | called on it or one of its parents. |
| 238 | */ |
| 239 | FL_ACTIVATE = 14, |
| 240 | |
| 241 | /** This widget is no longer visible, due to Fl_Widget::hide() being |
| 242 | called on it or one of its parents, or due to a parent window being |
| 243 | minimized. Fl_Widget::visible() may still be true after this, but the |
| 244 | widget is visible only if visible() is true for it and all its |
| 245 | parents (use Fl_Widget::visible_r() to check this). |
| 246 | */ |
| 247 | FL_HIDE = 15, |
| 248 | |
| 249 | /** This widget is visible again, due to Fl_Widget::show() being called on |
| 250 | it or one of its parents, or due to a parent window being restored. |
| 251 | Child Fl_Windows respond to this by actually creating the window if not |
| 252 | done already, so if you subclass a window, be sure to pass FL_SHOW |
| 253 | to the base class Fl_Widget::handle() method! |
| 254 | */ |
| 255 | FL_SHOW = 16, |
| 256 | |
| 257 | /** You should get this event some time after you call Fl::paste(). |
| 258 | The contents of Fl::event_text() is the text to insert and the number |
| 259 | of characters is in Fl::event_length(). |
| 260 | */ |
| 261 | FL_PASTE = 17, |
| 262 | |
| 263 | /** The Fl::selection_owner() will get this event before the selection is |
| 264 | moved to another widget. This indicates that some other widget or program |
| 265 | has claimed the selection. Motif programs used this to clear the selection |
| 266 | indication. Most modern programs ignore this. |
| 267 | */ |
| 268 | FL_SELECTIONCLEAR = 18, |
| 269 | |
| 270 | /** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy() |
| 271 | methods can be used to find the amount to scroll horizontally and vertically. |
| 272 | */ |
| 273 | FL_MOUSEWHEEL = 19, |
| 274 | |
| 275 | /** The mouse has been moved to point at this widget. A widget that is |
| 276 | interested in receiving drag'n'drop data must return 1 to receive |
| 277 | FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events. |
| 278 | */ |
| 279 | FL_DND_ENTER = 20, |
| 280 | |
| 281 | /** The mouse has been moved inside a widget while dragging data. A |
| 282 | widget that is interested in receiving drag'n'drop data should |
| 283 | indicate the possible drop position. |
| 284 | */ |
| 285 | FL_DND_DRAG = 21, |
| 286 | |
| 287 | /** The mouse has moved out of the widget. |
| 288 | */ |
| 289 | FL_DND_LEAVE = 22, |
| 290 | |
| 291 | /** The user has released the mouse button dropping data into the widget. |
| 292 | If the widget returns 1, it will receive the data in the immediately |
| 293 | following FL_PASTE event. |
| 294 | */ |
| 295 | FL_DND_RELEASE = 23 |
| 296 | }; |
| 297 | |
| 298 | /** \name When Conditions */ |
| 299 | /*@{*/ |
| 300 | /** These constants determine when a callback is performed. |
| 301 | |
| 302 | \sa Fl_Widget::when(); |
| 303 | \todo doxygen comments for values are incomplete and maybe wrong or unclear |
| 304 | */ |
| 305 | enum Fl_When { // Fl_Widget::when(): |
| 306 | FL_WHEN_NEVER = 0, ///< Never call the callback |
| 307 | FL_WHEN_CHANGED = 1, ///< Do the callback only when the widget value changes |
| 308 | FL_WHEN_NOT_CHANGED = 2, ///< Do the callback whenever the user interacts with the widget |
| 309 | FL_WHEN_RELEASE = 4, ///< Do the callback when the button or key is released and the value changes |
| 310 | FL_WHEN_RELEASE_ALWAYS= 6, ///< Do the callback when the button or key is released, even if the value doesn't change |
| 311 | FL_WHEN_ENTER_KEY = 8, ///< Do the callback when the user presses the ENTER key and the value changes |
| 312 | FL_WHEN_ENTER_KEY_ALWAYS=10, ///< Do the callback when the user presses the ENTER key, even if the value doesn't change |
| 313 | FL_WHEN_ENTER_KEY_CHANGED=11 ///< ? |
| 314 | }; |
| 315 | |
| 316 | /*@}*/ // group: When Conditions |
| 317 | |
| 318 | /** \name Mouse and Keyboard Events |
| 319 | |
| 320 | This and the following constants define the non-ASCII keys on the |
| 321 | keyboard for FL_KEYBOARD and FL_SHORTCUT events. |
| 322 | |
| 323 | \todo FL_Button and FL_key... constants could be structured better |
| 324 | (use an enum or some doxygen grouping ?) |
| 325 | |
| 326 | \sa Fl::event_key() and Fl::get_key(int) (use ascii letters for all other keys): |
| 327 | */ |
| 328 | |
| 329 | /*@{*/ |
| 330 | |
| 331 | // FIXME: These codes collide with valid Unicode keys |
| 332 | |
| 333 | #define FL_Button 0xfee8 ///< A mouse button; use Fl_Button + n for mouse button n. |
| 334 | #define FL_BackSpace 0xff08 ///< The backspace key. |
| 335 | #define FL_Tab 0xff09 ///< The tab key. |
| 336 | #define FL_Enter 0xff0d ///< The enter key. |
| 337 | #define FL_Pause 0xff13 ///< The pause key. |
| 338 | #define FL_Scroll_Lock 0xff14 ///< The scroll lock key. |
| 339 | #define FL_Escape 0xff1b ///< The escape key. |
| 340 | #define FL_Home 0xff50 ///< The home key. |
| 341 | #define FL_Left 0xff51 ///< The left arrow key. |
| 342 | #define FL_Up 0xff52 ///< The up arrow key. |
| 343 | #define FL_Right 0xff53 ///< The right arrow key. |
| 344 | #define FL_Down 0xff54 ///< The down arrow key. |
| 345 | #define FL_Page_Up 0xff55 ///< The page-up key. |
| 346 | #define FL_Page_Down 0xff56 ///< The page-down key. |
| 347 | #define FL_End 0xff57 ///< The end key. |
| 348 | #define FL_Print 0xff61 ///< The print (or print-screen) key. |
| 349 | #define FL_Insert 0xff63 ///< The insert key. |
| 350 | #define FL_Menu 0xff67 ///< The menu key. |
| 351 | #define FL_Help 0xff68 ///< The 'help' key on Mac keyboards |
| 352 | #define FL_Num_Lock 0xff7f ///< The num lock key. |
| 353 | #define FL_KP 0xff80 ///< One of the keypad numbers; use FL_KP + n for number n. |
| 354 | #define FL_KP_Enter 0xff8d ///< The enter key on the keypad, same as Fl_KP+'\\r'. |
| 355 | #define FL_KP_Last 0xffbd ///< The last keypad key; use to range-check keypad. |
| 356 | #define FL_F 0xffbd ///< One of the function keys; use FL_F + n for function key n. |
| 357 | #define FL_F_Last 0xffe0 ///< The last function key; use to range-check function keys. |
| 358 | #define FL_Shift_L 0xffe1 ///< The lefthand shift key. |
| 359 | #define FL_Shift_R 0xffe2 ///< The righthand shift key. |
| 360 | #define FL_Control_L 0xffe3 ///< The lefthand control key. |
| 361 | #define FL_Control_R 0xffe4 ///< The righthand control key. |
| 362 | #define FL_Caps_Lock 0xffe5 ///< The caps lock key. |
| 363 | #define FL_Meta_L 0xffe7 ///< The left meta/Windows key. |
| 364 | #define FL_Meta_R 0xffe8 ///< The right meta/Windows key. |
| 365 | #define FL_Alt_L 0xffe9 ///< The left alt key. |
| 366 | #define FL_Alt_R 0xffea ///< The right alt key. |
| 367 | #define FL_Delete 0xffff ///< The delete key. |
| 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 | |
| 390 | /*@}*/ // group: Mouse and Keyboard Events |
| 391 | |
| 392 | /** \name Mouse Buttons |
| 393 | |
| 394 | These constants define the button numbers for FL_PUSH and FL_RELEASE events. |
| 395 | |
| 396 | \sa Fl::event_button() |
| 397 | */ |
| 398 | |
| 399 | /*@{*/ |
| 400 | |
| 401 | #define FL_LEFT_MOUSE 1 ///< The left mouse button |
| 402 | #define FL_MIDDLE_MOUSE 2 ///< The middle mouse button |
| 403 | #define FL_RIGHT_MOUSE 3 ///< The right mouse button |
| 404 | |
| 405 | /*@}*/ // group: Mouse Buttons |
| 406 | |
| 407 | |
| 408 | /** \name Event States |
| 409 | |
| 410 | The following constants define bits in the Fl::event_state() value. |
| 411 | */ |
| 412 | |
| 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 ///< One of the shift keys is down |
| 419 | #define FL_CAPS_LOCK 0x00020000 ///< The caps lock is on |
| 420 | #define FL_CTRL 0x00040000 ///< One of the ctrl keys is down |
| 421 | #define FL_ALT 0x00080000 ///< One of the alt keys is down |
| 422 | #define FL_NUM_LOCK 0x00100000 ///< The num lock is on |
| 423 | // most X servers do this? |
| 424 | #define FL_META 0x00400000 ///< One of the meta/Windows keys is down |
| 425 | // correct for XFree86 |
| 426 | #define FL_SCROLL_LOCK 0x00800000 ///< The scroll lock is on |
| 427 | // correct for XFree86 |
| 428 | #define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed |
| 429 | #define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed |
| 430 | #define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed |
| 431 | #define FL_BUTTONS 0x7f000000 ///< Any mouse button is pushed |
| 432 | #define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed |
| 433 | |
| 434 | #define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now |
| 435 | // FIXME: Unicode needs 24 bits! |
| 436 | |
| 437 | #ifdef __APPLE__ |
| 438 | # define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X |
| 439 | # define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X |
| 440 | #else |
| 441 | # define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X |
| 442 | # define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X |
| 443 | #endif // __APPLE__ |
| 444 | |
| 445 | /*@}*/ // group: Event States |
| 446 | |
| 447 | /** \name Box Types |
| 448 | \brief FLTK standard box types |
| 449 | |
| 450 | This enum defines the standard box types included with FLTK. |
| 451 | |
| 452 | FL_NO_BOX means nothing is drawn at all, so whatever is already |
| 453 | on the screen remains. The FL_..._FRAME types only draw their edges, |
| 454 | leaving the interior unchanged. The blue color in Figure 1 |
| 455 | is the area that is not drawn by the frame types. |
| 456 | |
| 457 | \image html boxtypes.png "Figure 1: FLTK standard box types" |
| 458 | \image latex boxtypes.png "FLTK standard box types" width=10cm |
| 459 | \todo Description of boxtypes is incomplete. |
| 460 | See below for the defined enum Fl_Boxtype. |
| 461 | \see src/Fl_get_system_colors.cxx |
| 462 | */ |
| 463 | /*@{*/ |
| 464 | enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C): |
| 465 | |
| 466 | FL_NO_BOX = 0, ///< nothing is drawn at all, this box is invisible |
| 467 | FL_FLAT_BOX, ///< a flat box |
| 468 | FL_UP_BOX, ///< see figure 1 |
| 469 | FL_DOWN_BOX, ///< see figure 1 |
| 470 | FL_UP_FRAME, ///< see figure 1 |
| 471 | FL_DOWN_FRAME, ///< see figure 1 |
| 472 | FL_THIN_UP_BOX, ///< see figure 1 |
| 473 | FL_THIN_DOWN_BOX, ///< see figure 1 |
| 474 | FL_THIN_UP_FRAME, ///< see figure 1 |
| 475 | FL_THIN_DOWN_FRAME, ///< see figure 1 |
| 476 | FL_ENGRAVED_BOX, ///< see figure 1 |
| 477 | FL_EMBOSSED_BOX, ///< see figure 1 |
| 478 | FL_ENGRAVED_FRAME, ///< see figure 1 |
| 479 | FL_EMBOSSED_FRAME, ///< see figure 1 |
| 480 | FL_BORDER_BOX, ///< see figure 1 |
| 481 | _FL_SHADOW_BOX, ///< see figure 1 |
| 482 | FL_BORDER_FRAME, ///< see figure 1 |
| 483 | _FL_SHADOW_FRAME, ///< see figure 1 |
| 484 | _FL_ROUNDED_BOX, ///< see figure 1 |
| 485 | _FL_RSHADOW_BOX, ///< see figure 1 |
| 486 | _FL_ROUNDED_FRAME, ///< see figure 1 |
| 487 | _FL_RFLAT_BOX, ///< see figure 1 |
| 488 | _FL_ROUND_UP_BOX, ///< see figure 1 |
| 489 | _FL_ROUND_DOWN_BOX, ///< see figure 1 |
| 490 | _FL_DIAMOND_UP_BOX, ///< see figure 1 |
| 491 | _FL_DIAMOND_DOWN_BOX, ///< see figure 1 |
| 492 | _FL_OVAL_BOX, ///< see figure 1 |
| 493 | _FL_OSHADOW_BOX, ///< see figure 1 |
| 494 | _FL_OVAL_FRAME, ///< see figure 1 |
| 495 | _FL_OFLAT_BOX, ///< see figure 1 |
| 496 | _FL_PLASTIC_UP_BOX, ///< plastic version of FL_UP_BOX |
| 497 | _FL_PLASTIC_DOWN_BOX, ///< plastic version of FL_DOWN_BOX |
| 498 | _FL_PLASTIC_UP_FRAME, ///< plastic version of FL_UP_FRAME |
| 499 | _FL_PLASTIC_DOWN_FRAME, ///< plastic version of FL_DOWN_FRAME |
| 500 | _FL_PLASTIC_THIN_UP_BOX, ///< plastic version of FL_THIN_UP_BOX |
| 501 | _FL_PLASTIC_THIN_DOWN_BOX, ///< plastic version of FL_THIN_DOWN_BOX |
| 502 | _FL_PLASTIC_ROUND_UP_BOX, ///< plastic version of FL_ROUND_UP_BOX |
| 503 | _FL_PLASTIC_ROUND_DOWN_BOX, ///< plastic version of FL_ROUND_DOWN_BOX |
| 504 | _FL_GTK_UP_BOX, ///< gtk+ version of FL_UP_BOX |
| 505 | _FL_GTK_DOWN_BOX, ///< gtk+ version of FL_DOWN_BOX |
| 506 | _FL_GTK_UP_FRAME, ///< gtk+ version of FL_UP_FRAME |
| 507 | _FL_GTK_DOWN_FRAME, ///< gtk+ version of FL_DOWN_RAME |
| 508 | _FL_GTK_THIN_UP_BOX, ///< gtk+ version of FL_THIN_UP_BOX |
| 509 | _FL_GTK_THIN_DOWN_BOX, ///< gtk+ version of FL_THIN_DOWN_BOX |
| 510 | _FL_GTK_THIN_UP_FRAME, ///< gtk+ version of FL_UP_FRAME |
| 511 | _FL_GTK_THIN_DOWN_FRAME, ///< gtk+ version of FL_THIN_DOWN_FRAME |
| 512 | _FL_GTK_ROUND_UP_BOX, ///< gtk+ version of FL_ROUND_UP_BOX |
| 513 | _FL_GTK_ROUND_DOWN_BOX, ///< gtk+ version of FL_ROUND_DOWN_BOX |
| 514 | FL_FREE_BOXTYPE ///< the first free box type for creation of new box types |
| 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: |
| 561 | /** |
| 562 | Get the filled version of a frame. |
| 563 | If no filled version of a given frame exists, the behavior of this function |
| 564 | is undefined and some random box or frame is returned. |
| 565 | */ |
| 566 | inline Fl_Boxtype fl_box(Fl_Boxtype b) { |
| 567 | return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2)); |
| 568 | } |
| 569 | /** |
| 570 | Get the "pressed" or "down" version of a box. |
| 571 | If no "down" version of a given box exists, the behavior of this function |
| 572 | is undefined and some random box or frame is returned. |
| 573 | */ |
| 574 | inline Fl_Boxtype fl_down(Fl_Boxtype b) { |
| 575 | return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1)); |
| 576 | } |
| 577 | /** |
| 578 | Get the unfilled, frame only version of a box. |
| 579 | If no frame version of a given box exists, the behavior of this function |
| 580 | is undefined and some random box or frame is returned. |
| 581 | */ |
| 582 | inline Fl_Boxtype fl_frame(Fl_Boxtype b) { |
| 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 | |
| 592 | /*@}*/ // group: Box Types |
| 593 | |
| 594 | /** |
| 595 | The labeltype() method sets the type of the label. |
| 596 | |
| 597 | The following standard label types are included: |
| 598 | |
| 599 | \todo The doxygen comments are incomplete, and some labeltypes |
| 600 | are starting with an underscore. Also, there are three |
| 601 | external functions undocumented (yet): |
| 602 | - fl_define_FL_SHADOW_LABEL() |
| 603 | - fl_define_FL_ENGRAVED_LABEL() |
| 604 | - fl_define_FL_EMBOSSED_LABEL() |
| 605 | */ |
| 606 | enum Fl_Labeltype { // labeltypes: |
| 607 | FL_NORMAL_LABEL = 0, ///< draws the text (0) |
| 608 | FL_NO_LABEL, ///< does nothing |
| 609 | _FL_SHADOW_LABEL, ///< draws a drop shadow under the text |
| 610 | _FL_ENGRAVED_LABEL, ///< draws edges as though the text is engraved |
| 611 | _FL_EMBOSSED_LABEL, ///< draws edges as though the text is raised |
| 612 | _FL_MULTI_LABEL, ///< ? |
| 613 | _FL_ICON_LABEL, ///< draws the icon associated with the text |
| 614 | _FL_IMAGE_LABEL, ///< ? |
| 615 | |
| 616 | FL_FREE_LABELTYPE ///< first free labeltype to use for creating own labeltypes |
| 617 | }; |
| 618 | |
| 619 | /** |
| 620 | Sets the current label type and return its corresponding Fl_Labeltype value. |
| 621 | @{ |
| 622 | */ |
| 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 | /** @} */ |
| 631 | |
| 632 | /** \name Alignment Flags |
| 633 | Flags to control the label alignment. |
| 634 | This controls how the label is displayed next to or inside the widget. |
| 635 | The default value is FL_ALIGN_CENTER for most widgets, which centers the label |
| 636 | inside the widget. |
| 637 | |
| 638 | Flags can be or'd to achieve a combination of alignments. |
| 639 | |
| 640 | \code |
| 641 | Outside alignments: |
| 642 | TOP_LEFT TOP TOP_RIGHT |
| 643 | LEFT_TOP+---------------------------------+RIGHT_TOP |
| 644 | | | |
| 645 | LEFT| |RIGHT |
| 646 | | | |
| 647 | LEFT_BOTTOM+---------------------------------+RIGHT_BOTTOM |
| 648 | BOTTOM_RIGHT BOTTOM BOTTOM_LEFT |
| 649 | |
| 650 | Inside alignments: |
| 651 | +---------------------------------+ |
| 652 | |TOP_LEFT TOP TOP_RIGHT| |
| 653 | | | |
| 654 | |LEFT RIGHT| |
| 655 | | | |
| 656 | |BOTTOM_RIGHT BOTTOM BOTTOM_LEFT| |
| 657 | +---------------------------------+ |
| 658 | \endcode |
| 659 | \see #FL_ALIGN_CENTER, etc. |
| 660 | */ |
| 661 | /*@{*/ |
| 662 | /** FLTK type for alignment control */ |
| 663 | typedef unsigned Fl_Align; |
| 664 | /** Align the label horizontally in the middle. */ |
| 665 | const Fl_Align FL_ALIGN_CENTER = (Fl_Align)0; |
| 666 | /** Align the label at the top of the widget. Inside labels appear below the top, |
| 667 | outside labels are drawn on top of the widget. */ |
| 668 | const Fl_Align FL_ALIGN_TOP = (Fl_Align)1; |
| 669 | /** Align the label at the bottom of the widget. */ |
| 670 | const Fl_Align FL_ALIGN_BOTTOM = (Fl_Align)2; |
| 671 | /** Align the label at the left of the widget. Inside labels appear left-justified |
| 672 | starting at the left side of the widget, outside labels are right-justified and |
| 673 | drawn to the left of the widget. */ |
| 674 | const Fl_Align FL_ALIGN_LEFT = (Fl_Align)4; |
| 675 | /** Align the label to the right of the widget. */ |
| 676 | const Fl_Align FL_ALIGN_RIGHT = (Fl_Align)8; |
| 677 | /** Draw the label inside of the widget. */ |
| 678 | const Fl_Align FL_ALIGN_INSIDE = (Fl_Align)16; |
| 679 | /** If the label contains an image, draw the text on top of the image. */ |
| 680 | const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)0x0020; |
| 681 | /** If the label contains an image, draw the text below the image. */ |
| 682 | const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0x0000; |
| 683 | /** All parts of the label that are lager than the widget will not be drawn . */ |
| 684 | const Fl_Align FL_ALIGN_CLIP = (Fl_Align)64; |
| 685 | /** Wrap text that does not fit the width of the widget. */ |
| 686 | const Fl_Align FL_ALIGN_WRAP = (Fl_Align)128; |
| 687 | /** If the label contains an image, draw the text to the right of the image. */ |
| 688 | const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100; |
| 689 | /** If the label contains an image, draw the text to the left of the image. */ |
| 690 | const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0120; |
| 691 | /** If the label contains an image, draw the image or deimage in the background. */ |
| 692 | const Fl_Align FL_ALIGN_IMAGE_BACKDROP = (Fl_Align)0x0200; |
| 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 |
| 704 | /*@}*/ |
| 705 | |
| 706 | |
| 707 | /** \name Font Numbers |
| 708 | The following constants define the standard FLTK fonts: |
| 709 | */ |
| 710 | /*@{*/ |
| 711 | /** A font number is an index into the internal font table. */ |
| 712 | typedef int Fl_Font; |
| 713 | |
| 714 | const Fl_Font FL_HELVETICA = 0; ///< Helvetica (or Arial) normal (0) |
| 715 | const Fl_Font FL_HELVETICA_BOLD = 1; ///< Helvetica (or Arial) bold |
| 716 | const Fl_Font FL_HELVETICA_ITALIC = 2; ///< Helvetica (or Arial) oblique |
| 717 | const Fl_Font FL_HELVETICA_BOLD_ITALIC = 3; ///< Helvetica (or Arial) bold-oblique |
| 718 | const Fl_Font FL_COURIER = 4; ///< Courier normal |
| 719 | const Fl_Font FL_COURIER_BOLD = 5; ///< Courier bold |
| 720 | const Fl_Font FL_COURIER_ITALIC = 6; ///< Courier italic |
| 721 | const Fl_Font FL_COURIER_BOLD_ITALIC = 7; ///< Courier bold-italic |
| 722 | const Fl_Font FL_TIMES = 8; ///< Times roman |
| 723 | const Fl_Font FL_TIMES_BOLD = 9; ///< Times roman bold |
| 724 | const Fl_Font FL_TIMES_ITALIC = 10; ///< Times roman italic |
| 725 | const Fl_Font FL_TIMES_BOLD_ITALIC = 11; ///< Times roman bold-italic |
| 726 | const Fl_Font FL_SYMBOL = 12; ///< Standard symbol font |
| 727 | const Fl_Font FL_SCREEN = 13; ///< Default monospaced screen font |
| 728 | const Fl_Font FL_SCREEN_BOLD = 14; ///< Default monospaced bold screen font |
| 729 | const Fl_Font FL_ZAPF_DINGBATS = 15; ///< Zapf-dingbats font |
| 730 | |
| 731 | const Fl_Font FL_FREE_FONT = 16; ///< first one to allocate |
| 732 | const Fl_Font FL_BOLD = 1; ///< add this to helvetica, courier, or times |
| 733 | const Fl_Font FL_ITALIC = 2; ///< add this to helvetica, courier, or times |
| 734 | const Fl_Font FL_BOLD_ITALIC = 3; ///< add this to helvetica, courier, or times |
| 735 | |
| 736 | /*@}*/ |
| 737 | |
| 738 | /** Size of a font in pixels. |
| 739 | This is the approximate height of a font in pixels. |
| 740 | */ |
| 741 | typedef int Fl_Fontsize; |
| 742 | |
| 743 | extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE; ///< normal font size |
| 744 | |
| 745 | /** \name Colors |
| 746 | The Fl_Color type holds an FLTK color value. |
| 747 | |
| 748 | Colors are either 8-bit indexes into a virtual colormap |
| 749 | or 24-bit RGB color values. |
| 750 | |
| 751 | Color indices occupy the lower 8 bits of the value, while |
| 752 | RGB colors occupy the upper 24 bits, for a byte organization of RGBI. |
| 753 | |
| 754 | <pre> |
| 755 | Fl_Color => 0xrrggbbii |
| 756 | | | | | |
| 757 | | | | +--- index between 0 and 255 |
| 758 | | | +----- blue color component (8 bit) |
| 759 | | +------- green component (8 bit) |
| 760 | +--------- red component (8 bit) |
| 761 | </pre> |
| 762 | |
| 763 | A color can have either an index or an rgb value. Colors with rgb set |
| 764 | and an index >0 are reserved for special use. |
| 765 | |
| 766 | */ |
| 767 | /*@{*/ |
| 768 | /** an FLTK color value */ |
| 769 | typedef unsigned int Fl_Color; |
| 770 | |
| 771 | // Standard colors. These are used as default colors in widgets and altered as necessary |
| 772 | const Fl_Color FL_FOREGROUND_COLOR = 0; ///< the default foreground color (0) used for labels and text |
| 773 | const Fl_Color FL_BACKGROUND2_COLOR = 7; ///< the default background color for text, list, and valuator widgets |
| 774 | const Fl_Color FL_INACTIVE_COLOR = 8; ///< the inactive foreground color |
| 775 | const Fl_Color FL_SELECTION_COLOR = 15; ///< the default selection/highlight color |
| 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 | |
| 825 | /** Returns a lighter version of the specified color. */ |
| 826 | inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); } |
| 827 | |
| 828 | /** Returns a darker version of the specified color. */ |
| 829 | inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); } |
| 830 | |
| 831 | /** Returns the 24-bit color value closest to \p r, \p g, \p b. */ |
| 832 | inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) { |
| 833 | if (!r && !g && !b) return FL_BLACK; |
| 834 | else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8); |
| 835 | } |
| 836 | |
| 837 | /** Returns the 24-bit color value closest to \p g (grayscale). */ |
| 838 | inline Fl_Color fl_rgb_color(uchar g) { |
| 839 | if (!g) return FL_BLACK; |
| 840 | else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8); |
| 841 | } |
| 842 | |
| 843 | /** Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1). |
| 844 | FL_NUM_GRAY is defined to be 24 in the current FLTK release. |
| 845 | To get the closest FLTK gray value to an 8-bit grayscale color 'I' use: |
| 846 | |
| 847 | \code |
| 848 | fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255) |
| 849 | \endcode |
| 850 | */ |
| 851 | inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);} |
| 852 | |
| 853 | /** Returns a color out of the color cube. |
| 854 | |
| 855 | \p r must be in the range 0 to FL_NUM_RED (5) minus 1, |
| 856 | \p g must be in the range 0 to FL_NUM_GREEN (8) minus 1, |
| 857 | \p b must be in the range 0 to FL_NUM_BLUE (5) minus 1. |
| 858 | |
| 859 | To get the closest color to a 8-bit set of R,G,B values use: |
| 860 | |
| 861 | \code |
| 862 | fl_color_cube(R * (FL_NUM_RED - 1) / 255, |
| 863 | G * (FL_NUM_GREEN - 1) / 255, |
| 864 | B * (FL_NUM_BLUE - 1) / 255); |
| 865 | \endcode |
| 866 | */ |
| 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 | |
| 870 | /*@}*/ // group: Colors |
| 871 | |
| 872 | /** \name Cursors */ |
| 873 | /*@{*/ |
| 874 | |
| 875 | /** The following constants define the mouse cursors that are available in FLTK. |
| 876 | |
| 877 | The double-headed arrows are bitmaps provided by FLTK on X, the others |
| 878 | are provided by system-defined cursors. |
| 879 | |
| 880 | \todo enum Fl_Cursor needs maybe an image. |
| 881 | */ |
| 882 | enum Fl_Cursor { |
| 883 | FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */ |
| 884 | FL_CURSOR_ARROW = 35, /**< an arrow pointer. */ |
| 885 | FL_CURSOR_CROSS = 66, /**< crosshair. */ |
| 886 | FL_CURSOR_WAIT = 76, /**< watch or hourglass. */ |
| 887 | FL_CURSOR_INSERT = 77, /**< I-beam. */ |
| 888 | FL_CURSOR_HAND = 31, /**< hand (uparrow on MSWindows). */ |
| 889 | FL_CURSOR_HELP = 47, /**< question mark. */ |
| 890 | FL_CURSOR_MOVE = 27, /**< 4-pointed arrow. */ |
| 891 | // fltk provides bitmaps for these: |
| 892 | FL_CURSOR_NS = 78, /**< up/down arrow. */ |
| 893 | FL_CURSOR_WE = 79, /**< left/right arrow. */ |
| 894 | FL_CURSOR_NWSE = 80, /**< diagonal arrow. */ |
| 895 | FL_CURSOR_NESW = 81, /**< diagonal arrow. */ |
| 896 | FL_CURSOR_NONE =255, /**< invisible. */ |
| 897 | // for back compatibility (non MSWindows ones): |
| 898 | FL_CURSOR_N = 70, /**< for back compatibility. */ |
| 899 | FL_CURSOR_NE = 69, /**< for back compatibility. */ |
| 900 | FL_CURSOR_E = 49, /**< for back compatibility. */ |
| 901 | FL_CURSOR_SE = 8, /**< for back compatibility. */ |
| 902 | FL_CURSOR_S = 9, /**< for back compatibility. */ |
| 903 | FL_CURSOR_SW = 7, /**< for back compatibility. */ |
| 904 | FL_CURSOR_W = 36, /**< for back compatibility. */ |
| 905 | FL_CURSOR_NW = 68 /**< for back compatibility. */ |
| 906 | }; |
| 907 | /*@}*/ // group: Cursors |
| 908 | |
| 909 | /** FD "when" conditions */ |
| 910 | enum { // values for "when" passed to Fl::add_fd() |
| 911 | FL_READ = 1, /**< Call the callback when there is data to be read. */ |
| 912 | FL_WRITE = 4, /**< Call the callback when data can be written without blocking. */ |
| 913 | FL_EXCEPT = 8 /**< Call the callback if an exception occurs on the file. */ |
| 914 | }; |
| 915 | |
| 916 | /** visual types and Fl_Gl_Window::mode() (values match Glut) */ |
| 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 | |
| 936 | /** Damage masks */ |
| 937 | enum Fl_Damage { |
| 938 | FL_DAMAGE_CHILD = 0x01, /**< A child needs to be redrawn. */ |
| 939 | FL_DAMAGE_EXPOSE = 0x02, /**< The window was exposed. */ |
| 940 | FL_DAMAGE_SCROLL = 0x04, /**< The Fl_Scroll widget was scrolled. */ |
| 941 | FL_DAMAGE_OVERLAY = 0x08, /**< The overlay planes need to be redrawn. */ |
| 942 | FL_DAMAGE_USER1 = 0x10, /**< First user-defined damage bit. */ |
| 943 | FL_DAMAGE_USER2 = 0x20, /**< Second user-defined damage bit. */ |
| 944 | FL_DAMAGE_ALL = 0x80 /**< Everything needs to be redrawn. */ |
| 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 | // |