Enumerations.H 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. //
  2. // "$Id: Enumerations.H 7903 2010-11-28 21:06:39Z matt $"
  3. //
  4. // Enumerations for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 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. /** \file
  28. * This file contains type definitions and general enumerations.
  29. */
  30. #ifndef Fl_Enumerations_H
  31. #define Fl_Enumerations_H
  32. # include "Fl_Export.H"
  33. # include "fl_types.h"
  34. /** \name Version Numbers
  35. FLTK defines some constants to help the programmer to
  36. find out, for which FLTK version a program is compiled.
  37. The following constants are defined:
  38. */
  39. /*@{*/
  40. /**
  41. * The major release version of this FLTK library.
  42. \sa FL_VERSION
  43. */
  44. #define FL_MAJOR_VERSION 1
  45. /**
  46. * The minor release version for this library.
  47. *
  48. * FLTK remains mostly source-code compatible between minor version changes.
  49. */
  50. #define FL_MINOR_VERSION 3
  51. /**
  52. * The patch version for this library.
  53. *
  54. * FLTK remains binary compatible between patches.
  55. */
  56. #define FL_PATCH_VERSION 0
  57. /**
  58. * The FLTK version number as a \em double.
  59. *
  60. * This is changed slightly from the beta versions
  61. * because the old "const double" definition would not allow for conditional
  62. * compilation...
  63. *
  64. * FL_VERSION is a double that describes the major and minor version numbers.
  65. * Version 1.1 is actually stored as 1.01 to allow for more than 9 minor
  66. * releases.
  67. *
  68. * The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
  69. * give the integral values for the major, minor, and patch releases
  70. * respectively.
  71. */
  72. #define FL_VERSION ((double)FL_MAJOR_VERSION + \
  73. (double)FL_MINOR_VERSION * 0.01 + \
  74. (double)FL_PATCH_VERSION * 0.0001)
  75. /*@}*/ // group: Version Numbers
  76. /**
  77. * Every time a user moves the mouse pointer, clicks a button,
  78. * or presses a key, an event is generated and sent to your
  79. * application. Events can also come from other programs like the
  80. * window manager.
  81. *
  82. * Events are identified by the integer argument passed to the
  83. * Fl_Widget::handle() virtual method. Other information about the
  84. * most recent event is stored in static locations and acquired by
  85. * calling the Fl::event_*() methods. This static information remains
  86. * valid until the next event is read from the window system, so it
  87. * is ok to look at it outside of the handle() method.
  88. *
  89. * \sa Fl::event_text(), Fl::event_key(), class Fl::
  90. */
  91. enum Fl_Event { // events
  92. /** No event. */
  93. FL_NO_EVENT = 0,
  94. /** A mouse button has gone down with the mouse pointing at this
  95. * widget. You can find out what button by calling Fl::event_button().
  96. * You find out the mouse position by calling Fl::event_x() and
  97. * Fl::event_y().
  98. *
  99. * A widget indicates that it "wants" the mouse click by returning non-zero
  100. * from its Fl_Widget::handle() method. It will then become the
  101. * Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events.
  102. * If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH
  103. * to another widget.
  104. */
  105. FL_PUSH = 1,
  106. /** A mouse button has been released. You can find out what button by
  107. * calling Fl::event_button().
  108. *
  109. * In order to receive the FL_RELEASE event, the widget must return
  110. * non-zero when handling FL_PUSH.
  111. */
  112. FL_RELEASE = 2,
  113. /** The mouse has been moved to point at this widget. This can
  114. * be used for highlighting feedback. If a widget wants to
  115. * highlight or otherwise track the mouse, it indicates this by
  116. * returning non-zero from its handle() method. It then
  117. * becomes the Fl::belowmouse() widget and will receive
  118. * FL_MOVE and FL_LEAVE events.
  119. */
  120. FL_ENTER = 3,
  121. /** The mouse has moved out of the widget.
  122. * In order to receive the FL_LEAVE event, the widget must
  123. * return non-zero when handling FL_ENTER.
  124. */
  125. FL_LEAVE = 4,
  126. /** The mouse has moved with a button held down. The current button state
  127. * is in Fl::event_state(). The mouse position is in Fl::event_x() and
  128. * Fl::event_y().
  129. *
  130. * In order to receive FL_DRAG events, the widget must return non-zero
  131. * when handling FL_PUSH.
  132. */
  133. FL_DRAG = 5,
  134. /** This indicates an <I>attempt</I> to give a widget the keyboard focus.
  135. *
  136. * If a widget wants the focus, it should change itself to display the
  137. * fact that it has the focus, and return non-zero from its handle() method.
  138. * It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP,
  139. * and FL_UNFOCUS events.
  140. *
  141. * The focus will change either because the window manager changed which
  142. * window gets the focus, or because the user tried to navigate using tab,
  143. * arrows, or other keys. You can check Fl::event_key() to figure out why
  144. * it moved. For navigation it will be the key pressed and interaction
  145. * with the window manager it will be zero.
  146. */
  147. FL_FOCUS = 6,
  148. /** This event is sent to the previous Fl::focus() widget when another
  149. * widget gets the focus or the window loses focus.
  150. */
  151. FL_UNFOCUS = 7,
  152. /** A key was pressed or released. The key can be found in Fl::event_key().
  153. * The text that the key should insert can be found with Fl::event_text()
  154. * and its length is in Fl::event_length(). If you use the key handle()
  155. * should return 1. If you return zero then FLTK assumes you ignored the
  156. * key and will then attempt to send it to a parent widget. If none of
  157. * them want it, it will change the event into a FL_SHORTCUT event.
  158. *
  159. * To receive FL_KEYBOARD events you must also respond to the FL_FOCUS
  160. * and FL_UNFOCUS events.
  161. *
  162. * If you are writing a text-editing widget you may also want to call
  163. * the Fl::compose() function to translate individual keystrokes into
  164. * foreign characters.
  165. *
  166. * FL_KEYUP events are sent to the widget that currently has focus. This
  167. * is not necessarily the same widget that received the corresponding
  168. * FL_KEYDOWN event because focus may have changed between events.
  169. */
  170. FL_KEYDOWN = 8,
  171. /** Equvalent to FL_KEYDOWN.
  172. * \see FL_KEYDOWN
  173. */
  174. FL_KEYBOARD = 8,
  175. /** Key release event.
  176. * \see FL_KEYDOWN
  177. */
  178. FL_KEYUP = 9,
  179. /** The user clicked the close button of a window.
  180. * This event is used internally only to trigger the callback of
  181. * Fl_Window derived classed. The default callback closes the
  182. * window calling Fl_Window::hide().
  183. */
  184. FL_CLOSE = 10,
  185. /** The mouse has moved without any mouse buttons held down.
  186. * This event is sent to the Fl::belowmouse() widget.
  187. *
  188. * In order to receive FL_MOVE events, the widget must return
  189. * non-zero when handling FL_ENTER.
  190. */
  191. FL_MOVE = 11,
  192. /** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD
  193. * event then FLTK tries sending this event to every widget it
  194. * can, until one of them returns non-zero. FL_SHORTCUT is first
  195. * sent to the Fl::belowmouse() widget, then its parents and siblings,
  196. * and eventually to every widget in the window, trying to find an
  197. * object that returns non-zero. FLTK tries really hard to not to ignore
  198. * any keystrokes!
  199. *
  200. * You can also make "global" shortcuts by using Fl::add_handler(). A
  201. * global shortcut will work no matter what windows are displayed or
  202. * which one has the focus.
  203. */
  204. FL_SHORTCUT = 12,
  205. /** This widget is no longer active, due to Fl_Widget::deactivate()
  206. * being called on it or one of its parents. Fl_Widget::active() may
  207. * still be true after this, the widget is only active if Fl_Widget::active()
  208. * is true on it and all its parents (use Fl_Widget::active_r() to check this).
  209. */
  210. FL_DEACTIVATE = 13,
  211. /** This widget is now active, due to Fl_Widget::activate() being
  212. * called on it or one of its parents.
  213. */
  214. FL_ACTIVATE = 14,
  215. /** This widget is no longer visible, due to Fl_Widget::hide() being
  216. * called on it or one of its parents, or due to a parent window being
  217. * minimized. Fl_Widget::visible() may still be true after this, but the
  218. * widget is visible only if visible() is true for it and all its
  219. * parents (use Fl_Widget::visible_r() to check this).
  220. */
  221. FL_HIDE = 15,
  222. /** This widget is visible again, due to Fl_Widget::show() being called on
  223. * it or one of its parents, or due to a parent window being restored.
  224. * Child Fl_Windows respond to this by actually creating the window if not
  225. * done already, so if you subclass a window, be sure to pass FL_SHOW
  226. * to the base class Fl_Widget::handle() method!
  227. */
  228. FL_SHOW = 16,
  229. /** You should get this event some time after you call Fl::paste().
  230. * The contents of Fl::event_text() is the text to insert and the number
  231. * of characters is in Fl::event_length().
  232. */
  233. FL_PASTE = 17,
  234. /** The Fl::selection_owner() will get this event before the selection is
  235. * moved to another widget. This indicates that some other widget or program
  236. * has claimed the selection. Motif programs used this to clear the selection
  237. * indication. Most modern programs ignore this.
  238. */
  239. FL_SELECTIONCLEAR = 18,
  240. /** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy()
  241. * methods can be used to find the amount to scroll horizontally and vertically.
  242. */
  243. FL_MOUSEWHEEL = 19,
  244. /** The mouse has been moved to point at this widget. A widget that is
  245. * interested in receiving drag'n'drop data must return 1 to receive
  246. * FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.
  247. */
  248. FL_DND_ENTER = 20,
  249. /** The mouse has been moved inside a widget while dragging data. A
  250. * widget that is interested in receiving drag'n'drop data should
  251. * indicate the possible drop position.
  252. */
  253. FL_DND_DRAG = 21,
  254. /** The mouse has moved out of the widget.
  255. */
  256. FL_DND_LEAVE = 22,
  257. /** The user has released the mouse button dropping data into the widget.
  258. * If the widget returns 1, it will receive the data in the immediately
  259. * following FL_PASTE event.
  260. */
  261. FL_DND_RELEASE = 23
  262. };
  263. /** \name When Conditions */
  264. /*@{*/
  265. /** These constants determine when a callback is performed.
  266. *
  267. * \sa Fl_Widget::when();
  268. * \todo doxygen comments for values are incomplete and maybe wrong or unclear
  269. */
  270. enum Fl_When { // Fl_Widget::when():
  271. FL_WHEN_NEVER = 0, ///< Never call the callback
  272. FL_WHEN_CHANGED = 1, ///< Do the callback only when the widget value changes
  273. FL_WHEN_NOT_CHANGED = 2, ///< Do the callback whenever the user interacts with the widget
  274. FL_WHEN_RELEASE = 4, ///< Do the callback when the button or key is released and the value changes
  275. FL_WHEN_RELEASE_ALWAYS= 6, ///< Do the callback when the button or key is released, even if the value doesn't change
  276. FL_WHEN_ENTER_KEY = 8, ///< Do the callback when the user presses the ENTER key and the value changes
  277. FL_WHEN_ENTER_KEY_ALWAYS=10, ///< Do the callback when the user presses the ENTER key, even if the value doesn't change
  278. FL_WHEN_ENTER_KEY_CHANGED=11 ///< ?
  279. };
  280. /*@}*/ // group: When Conditions
  281. /** \name Mouse and Keyboard Events
  282. This and the following constants define the non-ASCII keys on the
  283. keyboard for FL_KEYBOARD and FL_SHORTCUT events.
  284. \todo FL_Button and FL_key... constants could be structured better
  285. (use an enum or some doxygen grouping ?)
  286. \sa Fl::event_key() and Fl::get_key(int) (use ascii letters for all other keys):
  287. */
  288. /*@{*/
  289. // FIXME: These codes collide with valid Unicode keys
  290. #define FL_Button 0xfee8 ///< A mouse button; use Fl_Button + n for mouse button n.
  291. #define FL_BackSpace 0xff08 ///< The backspace key.
  292. #define FL_Tab 0xff09 ///< The tab key.
  293. #define FL_Enter 0xff0d ///< The enter key.
  294. #define FL_Pause 0xff13 ///< The pause key.
  295. #define FL_Scroll_Lock 0xff14 ///< The scroll lock key.
  296. #define FL_Escape 0xff1b ///< The escape key.
  297. #define FL_Home 0xff50 ///< The home key.
  298. #define FL_Left 0xff51 ///< The left arrow key.
  299. #define FL_Up 0xff52 ///< The up arrow key.
  300. #define FL_Right 0xff53 ///< The right arrow key.
  301. #define FL_Down 0xff54 ///< The down arrow key.
  302. #define FL_Page_Up 0xff55 ///< The page-up key.
  303. #define FL_Page_Down 0xff56 ///< The page-down key.
  304. #define FL_End 0xff57 ///< The end key.
  305. #define FL_Print 0xff61 ///< The print (or print-screen) key.
  306. #define FL_Insert 0xff63 ///< The insert key.
  307. #define FL_Menu 0xff67 ///< The menu key.
  308. #define FL_Help 0xff68 ///< The 'help' key on Mac keyboards
  309. #define FL_Num_Lock 0xff7f ///< The num lock key.
  310. #define FL_KP 0xff80 ///< One of the keypad numbers; use FL_KP + n for number n.
  311. #define FL_KP_Enter 0xff8d ///< The enter key on the keypad, same as Fl_KP+'\\r'.
  312. #define FL_KP_Last 0xffbd ///< The last keypad key; use to range-check keypad.
  313. #define FL_F 0xffbd ///< One of the function keys; use FL_F + n for function key n.
  314. #define FL_F_Last 0xffe0 ///< The last function key; use to range-check function keys.
  315. #define FL_Shift_L 0xffe1 ///< The lefthand shift key.
  316. #define FL_Shift_R 0xffe2 ///< The righthand shift key.
  317. #define FL_Control_L 0xffe3 ///< The lefthand control key.
  318. #define FL_Control_R 0xffe4 ///< The righthand control key.
  319. #define FL_Caps_Lock 0xffe5 ///< The caps lock key.
  320. #define FL_Meta_L 0xffe7 ///< The left meta/Windows key.
  321. #define FL_Meta_R 0xffe8 ///< The right meta/Windows key.
  322. #define FL_Alt_L 0xffe9 ///< The left alt key.
  323. #define FL_Alt_R 0xffea ///< The right alt key.
  324. #define FL_Delete 0xffff ///< The delete key.
  325. /*@}*/ // group: Mouse and Keyboard Events
  326. /** \name Mouse Buttons
  327. These constants define the button numbers for FL_PUSH and FL_RELEASE events.
  328. \sa Fl::event_button()
  329. */
  330. /*@{*/
  331. #define FL_LEFT_MOUSE 1 ///< The left mouse button
  332. #define FL_MIDDLE_MOUSE 2 ///< The middle mouse button
  333. #define FL_RIGHT_MOUSE 3 ///< The right mouse button
  334. /*@}*/ // group: Mouse Buttons
  335. /** \name Event States
  336. The following constants define bits in the Fl::event_state() value.
  337. */
  338. /*@{*/ // group: Event States
  339. // FIXME: it would be nice to have the modifiers in the upper 8 bit so that
  340. // a unicode ke (24bit) can be sent as an unsigned with the modifiers.
  341. #define FL_SHIFT 0x00010000 ///< One of the shift keys is down
  342. #define FL_CAPS_LOCK 0x00020000 ///< The caps lock is on
  343. #define FL_CTRL 0x00040000 ///< One of the ctrl keys is down
  344. #define FL_ALT 0x00080000 ///< One of the alt keys is down
  345. #define FL_NUM_LOCK 0x00100000 ///< The num lock is on
  346. // most X servers do this?
  347. #define FL_META 0x00400000 ///< One of the meta/Windows keys is down
  348. // correct for XFree86
  349. #define FL_SCROLL_LOCK 0x00800000 ///< The scroll lock is on
  350. // correct for XFree86
  351. #define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed
  352. #define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed
  353. #define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed
  354. #define FL_BUTTONS 0x7f000000 ///< Any mouse button is pushed
  355. #define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed
  356. #define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now
  357. // FIXME: Unicode needs 24 bits!
  358. #ifdef __APPLE__
  359. # define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
  360. # define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_META on MacOS X
  361. #else
  362. # define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
  363. # define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_META on MacOS X
  364. #endif // __APPLE__
  365. /*@}*/ // group: Event States
  366. /** \name Box Types
  367. \brief FLTK standard box types
  368. This enum defines the standard box types included with FLTK.
  369. FL_NO_BOX means nothing is drawn at all, so whatever is already
  370. on the screen remains. The FL_..._FRAME types only draw their edges,
  371. leaving the interior unchanged. The blue color in Figure 1
  372. is the area that is not drawn by the frame types.
  373. \image html boxtypes.gif "Figure 1: FLTK standard box types"
  374. \image latex boxtypes.eps "FLTK standard box types" width=10cm
  375. \todo Description of boxtypes is incomplete.
  376. See below for the defined enum Fl_Boxtype.
  377. \see src/Fl_get_system_colors.cxx
  378. */
  379. /*@{*/
  380. enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
  381. FL_NO_BOX = 0, ///< nothing is drawn at all, this box is invisible
  382. FL_FLAT_BOX, ///< a flat box
  383. FL_UP_BOX, ///< see figure 1
  384. FL_DOWN_BOX, ///< see figure 1
  385. FL_UP_FRAME, ///< see figure 1
  386. FL_DOWN_FRAME, ///< see figure 1
  387. FL_THIN_UP_BOX, ///< see figure 1
  388. FL_THIN_DOWN_BOX, ///< see figure 1
  389. FL_THIN_UP_FRAME, ///< see figure 1
  390. FL_THIN_DOWN_FRAME, ///< see figure 1
  391. FL_ENGRAVED_BOX, ///< see figure 1
  392. FL_EMBOSSED_BOX, ///< see figure 1
  393. FL_ENGRAVED_FRAME, ///< see figure 1
  394. FL_EMBOSSED_FRAME, ///< see figure 1
  395. FL_BORDER_BOX, ///< see figure 1
  396. _FL_SHADOW_BOX, ///< see figure 1
  397. FL_BORDER_FRAME, ///< see figure 1
  398. _FL_SHADOW_FRAME, ///< see figure 1
  399. _FL_ROUNDED_BOX, ///< see figure 1
  400. _FL_RSHADOW_BOX, ///< see figure 1
  401. _FL_ROUNDED_FRAME, ///< see figure 1
  402. _FL_RFLAT_BOX, ///< see figure 1
  403. _FL_ROUND_UP_BOX, ///< see figure 1
  404. _FL_ROUND_DOWN_BOX, ///< see figure 1
  405. _FL_DIAMOND_UP_BOX, ///< see figure 1
  406. _FL_DIAMOND_DOWN_BOX, ///< see figure 1
  407. _FL_OVAL_BOX, ///< see figure 1
  408. _FL_OSHADOW_BOX, ///< see figure 1
  409. _FL_OVAL_FRAME, ///< see figure 1
  410. _FL_OFLAT_BOX, ///< see figure 1
  411. _FL_PLASTIC_UP_BOX, ///< plastic version of FL_UP_BOX
  412. _FL_PLASTIC_DOWN_BOX, ///< plastic version of FL_DOWN_BOX
  413. _FL_PLASTIC_UP_FRAME, ///< plastic version of FL_UP_FRAME
  414. _FL_PLASTIC_DOWN_FRAME, ///< plastic version of FL_DOWN_FRAME
  415. _FL_PLASTIC_THIN_UP_BOX, ///< plastic version of FL_THIN_UP_BOX
  416. _FL_PLASTIC_THIN_DOWN_BOX, ///< plastic version of FL_THIN_DOWN_BOX
  417. _FL_PLASTIC_ROUND_UP_BOX, ///< plastic version of FL_ROUND_UP_BOX
  418. _FL_PLASTIC_ROUND_DOWN_BOX, ///< plastic version of FL_ROUND_DOWN_BOX
  419. _FL_GTK_UP_BOX, ///< gtk+ version of FL_UP_BOX
  420. _FL_GTK_DOWN_BOX, ///< gtk+ version of FL_DOWN_BOX
  421. _FL_GTK_UP_FRAME, ///< gtk+ version of FL_UP_FRAME
  422. _FL_GTK_DOWN_FRAME, ///< gtk+ version of FL_DOWN_RAME
  423. _FL_GTK_THIN_UP_BOX, ///< gtk+ version of FL_THIN_UP_BOX
  424. _FL_GTK_THIN_DOWN_BOX, ///< gtk+ version of FL_THIN_DOWN_BOX
  425. _FL_GTK_THIN_UP_FRAME, ///< gtk+ version of FL_UP_FRAME
  426. _FL_GTK_THIN_DOWN_FRAME, ///< gtk+ version of FL_THIN_DOWN_FRAME
  427. _FL_GTK_ROUND_UP_BOX, ///< gtk+ version of FL_ROUND_UP_BOX
  428. _FL_GTK_ROUND_DOWN_BOX, ///< gtk+ version of FL_ROUND_DOWN_BOX
  429. FL_FREE_BOXTYPE ///< the first free box type for creation of new box types
  430. };
  431. extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
  432. #define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX()
  433. #define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1)
  434. extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX();
  435. #define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX()
  436. #define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2)
  437. extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX();
  438. #define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX()
  439. #define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2)
  440. extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX();
  441. #define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX()
  442. extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX();
  443. #define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX()
  444. extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX();
  445. #define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX()
  446. #define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1)
  447. extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX();
  448. #define FL_OVAL_BOX fl_define_FL_OVAL_BOX()
  449. #define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1)
  450. #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2)
  451. #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3)
  452. extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX();
  453. #define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX()
  454. #define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1)
  455. #define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2)
  456. #define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3)
  457. #define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4)
  458. #define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5)
  459. #define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6)
  460. #define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7)
  461. extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
  462. #define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX()
  463. #define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1)
  464. #define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2)
  465. #define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3)
  466. #define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4)
  467. #define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5)
  468. #define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6)
  469. #define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7)
  470. #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8)
  471. #define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
  472. // conversions of box types to other boxtypes:
  473. /**
  474. Get the filled version of a frame.
  475. If no filled version of a given frame exists, the behavior of this function
  476. is undefined and some random box or frame is returned,
  477. */
  478. inline Fl_Boxtype fl_box(Fl_Boxtype b) {
  479. return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2));
  480. }
  481. /**
  482. Get the "pressed" or "down" version of a box.
  483. If no "down" version of a given box exists, the behavior of this function
  484. is undefined and some random box or frame is returned,
  485. */
  486. inline Fl_Boxtype fl_down(Fl_Boxtype b) {
  487. return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1));
  488. }
  489. /**
  490. Get the unfilled, frame only version of a box.
  491. If no frame version of a given box exists, the behavior of this function
  492. is undefined and some random box or frame is returned,
  493. */
  494. inline Fl_Boxtype fl_frame(Fl_Boxtype b) {
  495. return (Fl_Boxtype)((b%4<2)?b:(b+2));
  496. }
  497. // back-compatibility box types:
  498. #define FL_FRAME FL_ENGRAVED_FRAME
  499. #define FL_FRAME_BOX FL_ENGRAVED_BOX
  500. #define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX
  501. #define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX
  502. /*@}*/ // group: Box Types
  503. /**
  504. The labeltype() method sets the type of the label.
  505. The following standard label types are included:
  506. \todo The doxygen comments are incomplete, and some labeltypes
  507. are starting with an underscore. Also, there are three
  508. external functions undocumented (yet):
  509. - fl_define_FL_SHADOW_LABEL()
  510. - fl_define_FL_ENGRAVED_LABEL()
  511. - fl_define_FL_EMBOSSED_LABEL()
  512. */
  513. enum Fl_Labeltype { // labeltypes:
  514. FL_NORMAL_LABEL = 0, ///< draws the text (0)
  515. FL_NO_LABEL, ///< does nothing
  516. _FL_SHADOW_LABEL, ///< draws a drop shadow under the text
  517. _FL_ENGRAVED_LABEL, ///< draws edges as though the text is engraved
  518. _FL_EMBOSSED_LABEL, ///< draws edges as thought the text is raised
  519. _FL_MULTI_LABEL, ///< ?
  520. _FL_ICON_LABEL, ///< draws the icon associated with the text
  521. _FL_IMAGE_LABEL, ///< ?
  522. FL_FREE_LABELTYPE ///< first free labeltype to use for creating own labeltypes
  523. };
  524. /**
  525. Sets the current label type end return its corresponding Fl_Labeltype value.
  526. @{
  527. */
  528. #define FL_SYMBOL_LABEL FL_NORMAL_LABEL
  529. extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
  530. #define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
  531. extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
  532. #define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
  533. extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
  534. #define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()
  535. /** @} */
  536. /** \name Alignment Flags */
  537. /*@{*/
  538. /** Flags to control the label alignment.
  539. * This controls how the label is displayed next to or inside the widget.
  540. * The default value is FL_ALIGN_CENTER for most widgets, which centers the label
  541. * inside the widget.
  542. *
  543. * Flags can be or'd to achieve a combination of alignments.
  544. *
  545. * Outside alignments:
  546. * \code
  547. * TOP_LEFT TOP TOP_RIGHT
  548. * LEFT_TOP+---------------------------------+RIGHT_TOP
  549. * | |
  550. * LEFT| |RIGHT
  551. * | |
  552. * LEFT_BOTTOM+---------------------------------+RIGHT_BOTTOM
  553. * BOTTOM_RIGHT BOTTOM BOTTOM_LEFT
  554. *
  555. * Inside alignments:
  556. * \code
  557. * +---------------------------------+
  558. * |TOP_LEFT TOP TOP_RIGHT|
  559. * | |
  560. * |LEFT RIGHT|
  561. * | |
  562. * |BOTTOM_RIGHT BOTTOM BOTTOM_LEFT|
  563. * +---------------------------------+
  564. * \endcode
  565. * \see #FL_ALIGN_CENTER, etc.
  566. */
  567. typedef unsigned Fl_Align;
  568. /** Align the label horizontally in the middle. */
  569. const Fl_Align FL_ALIGN_CENTER = (Fl_Align)0;
  570. /** Align the label at the top of the widget. Inside labels appear below the top,
  571. * outside labels are drawn on top of the widget. */
  572. const Fl_Align FL_ALIGN_TOP = (Fl_Align)1;
  573. /** Align the label at the bottom of the widget. */
  574. const Fl_Align FL_ALIGN_BOTTOM = (Fl_Align)2;
  575. /** Align the label at the left of the widget. Inside labels appear left-justified
  576. * starting at the left side of the widget, outside labels are right-justified and
  577. * drawn to the left of the widget. */
  578. const Fl_Align FL_ALIGN_LEFT = (Fl_Align)4;
  579. /** Align the label to the right of the widget. */
  580. const Fl_Align FL_ALIGN_RIGHT = (Fl_Align)8;
  581. /** Draw the label inside of the widget. */
  582. const Fl_Align FL_ALIGN_INSIDE = (Fl_Align)16;
  583. /** If the label contains an image, draw the text on top of the image. */
  584. const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = (Fl_Align)0x0020;
  585. /** If the label contains an image, draw the text below the image. */
  586. const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = (Fl_Align)0x0000;
  587. /** All parts of the label that are lager than the widget will not be drawn . */
  588. const Fl_Align FL_ALIGN_CLIP = (Fl_Align)64;
  589. /** Wrap text that does not fit the width of the widget. */
  590. const Fl_Align FL_ALIGN_WRAP = (Fl_Align)128;
  591. /** If the label contains an image, draw the text to the right of the image. */
  592. const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = (Fl_Align)0x0100;
  593. /** If the label contains an image, draw the text to the left of the image. */
  594. const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = (Fl_Align)0x0120;
  595. /** If the label contains an image, draw the image or deimage in the backgroup. */
  596. const Fl_Align FL_ALIGN_IMAGE_BACKDROP = (Fl_Align)0x0200;
  597. const Fl_Align FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT;
  598. const Fl_Align FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT;
  599. const Fl_Align FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT;
  600. const Fl_Align FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT;
  601. const Fl_Align FL_ALIGN_LEFT_TOP = 0x0007; // magic value
  602. const Fl_Align FL_ALIGN_RIGHT_TOP = 0x000b; // magic value
  603. const Fl_Align FL_ALIGN_LEFT_BOTTOM = 0x000d; // magic value
  604. const Fl_Align FL_ALIGN_RIGHT_BOTTOM = 0x000e; // magic value
  605. const Fl_Align FL_ALIGN_NOWRAP = (Fl_Align)0; // for back compatability
  606. const Fl_Align FL_ALIGN_POSITION_MASK = 0x000f; // left, right, top, bottom
  607. const Fl_Align FL_ALIGN_IMAGE_MASK = 0x0320; // l/r, t/b, backdrop
  608. /*@}*/
  609. /** \name Font Numbers */
  610. /*@{*/
  611. /** A font number is an index into the internal font table.
  612. The following constants define the standard FLTK fonts:
  613. */
  614. typedef int Fl_Font;
  615. // standard fonts
  616. const Fl_Font FL_HELVETICA = 0; ///< Helvetica (or Arial) normal (0)
  617. const Fl_Font FL_HELVETICA_BOLD = 1; ///< Helvetica (or Arial) bold
  618. const Fl_Font FL_HELVETICA_ITALIC = 2; ///< Helvetica (or Arial) oblique
  619. const Fl_Font FL_HELVETICA_BOLD_ITALIC = 3; ///< Helvetica (or Arial) bold-oblique
  620. const Fl_Font FL_COURIER = 4; ///< Courier normal
  621. const Fl_Font FL_COURIER_BOLD = 5; ///< Courier bold
  622. const Fl_Font FL_COURIER_ITALIC = 6; ///< Courier italic
  623. const Fl_Font FL_COURIER_BOLD_ITALIC = 7; ///< Courier bold-italic
  624. const Fl_Font FL_TIMES = 8; ///< Times roman
  625. const Fl_Font FL_TIMES_BOLD = 9; ///< Times roman bold
  626. const Fl_Font FL_TIMES_ITALIC = 10; ///< Times roman italic
  627. const Fl_Font FL_TIMES_BOLD_ITALIC = 11; ///< Times roman bold-italic
  628. const Fl_Font FL_SYMBOL = 12; ///< Standard symbol font
  629. const Fl_Font FL_SCREEN = 13; ///< Default monospaced screen font
  630. const Fl_Font FL_SCREEN_BOLD = 14; ///< Default monospaced bold screen font
  631. const Fl_Font FL_ZAPF_DINGBATS = 15; ///< Zapf-dingbats font
  632. const Fl_Font FL_FREE_FONT = 16; ///< first one to allocate
  633. const Fl_Font FL_BOLD = 1; ///< add this to helvetica, courier, or times
  634. const Fl_Font FL_ITALIC = 2; ///< add this to helvetica, courier, or times
  635. const Fl_Font FL_BOLD_ITALIC = 3; ///< add this to helvetica, courier, or times
  636. /*@}*/
  637. /** Size of a font in pixels.
  638. * This is the approximate height of a font in pixels.
  639. */
  640. typedef int Fl_Fontsize;
  641. extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE; ///< normal font size
  642. /** \name Colors */
  643. /*@{*/
  644. /** The Fl_Color type holds an FLTK color value.
  645. Colors are either 8-bit indexes into a virtual colormap
  646. or 24-bit RGB color values.
  647. Color indices occupy the lower 8 bits of the value, while
  648. RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
  649. <pre>
  650. Fl_Color => 0xrrggbbii
  651. | | | |
  652. | | | +--- index between 0 and 255
  653. | | +----- blue color component (8 bit)
  654. | +------- green component (8 bit)
  655. +--------- red component (8 bit)
  656. </pre>
  657. A color can have either an index or an rgb value. Colors with rgb set
  658. and an index >0 are reserved for special use.
  659. */
  660. typedef unsigned int Fl_Color;
  661. // Standard colors. These are used as default colors in widgets and altered as necessary
  662. const Fl_Color FL_FOREGROUND_COLOR = 0; ///< the default foreground color (0) used for labels and text
  663. const Fl_Color FL_BACKGROUND2_COLOR = 7; ///< the default background color for text, list, and valuator widgets
  664. const Fl_Color FL_INACTIVE_COLOR = 8; ///< the inactive foreground color
  665. const Fl_Color FL_SELECTION_COLOR = 15; ///< the default selection/highlight color
  666. // boxtypes generally limit themselves to these colors so
  667. // the whole ramp is not allocated:
  668. const Fl_Color FL_GRAY0 = 32; // 'A'
  669. const Fl_Color FL_DARK3 = 39; // 'H'
  670. const Fl_Color FL_DARK2 = 45; // 'N'
  671. const Fl_Color FL_DARK1 = 47; // 'P'
  672. const Fl_Color FL_BACKGROUND_COLOR = 49; // 'R' default background color
  673. const Fl_Color FL_LIGHT1 = 50; // 'S'
  674. const Fl_Color FL_LIGHT2 = 52; // 'U'
  675. const Fl_Color FL_LIGHT3 = 54; // 'W'
  676. // FLTK provides a 5x8x5 color cube that is used with colormap visuals
  677. const Fl_Color FL_BLACK = 56;
  678. const Fl_Color FL_RED = 88;
  679. const Fl_Color FL_GREEN = 63;
  680. const Fl_Color FL_YELLOW = 95;
  681. const Fl_Color FL_BLUE = 216;
  682. const Fl_Color FL_MAGENTA = 248;
  683. const Fl_Color FL_CYAN = 223;
  684. const Fl_Color FL_DARK_RED = 72;
  685. const Fl_Color FL_DARK_GREEN = 60;
  686. const Fl_Color FL_DARK_YELLOW = 76;
  687. const Fl_Color FL_DARK_BLUE = 136;
  688. const Fl_Color FL_DARK_MAGENTA = 152;
  689. const Fl_Color FL_DARK_CYAN = 140;
  690. const Fl_Color FL_WHITE = 255;
  691. #define FL_FREE_COLOR (Fl_Color)16
  692. #define FL_NUM_FREE_COLOR 16
  693. #define FL_GRAY_RAMP (Fl_Color)32
  694. #define FL_NUM_GRAY 24
  695. #define FL_GRAY FL_BACKGROUND_COLOR
  696. #define FL_COLOR_CUBE (Fl_Color)56
  697. #define FL_NUM_RED 5
  698. #define FL_NUM_GREEN 8
  699. #define FL_NUM_BLUE 5
  700. FL_EXPORT Fl_Color fl_inactive(Fl_Color c);
  701. FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
  702. FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
  703. inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
  704. inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
  705. /** return 24-bit color value closest to \p r, \p g, \p b. */
  706. inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) {
  707. if (!r && !g && !b) return FL_BLACK;
  708. else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
  709. }
  710. /** return 24-bit color value closest to \p grayscale */
  711. inline Fl_Color fl_rgb_color(uchar g) {
  712. if (!g) return FL_BLACK;
  713. else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
  714. }
  715. inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
  716. inline Fl_Color fl_color_cube(int r, int g, int b) {
  717. return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
  718. //*@}*/ // group: Colors
  719. /** \name Cursors
  720. The following constants define the mouse cursors that are available in FLTK.
  721. The double-headed arrows are bitmaps provided by FLTK on X, the others
  722. are provided by system-defined cursors.
  723. \todo enum Fl_Cursor needs some more comments for values
  724. (and maybe an image), see Fl/Enumerations.H
  725. */
  726. enum Fl_Cursor { // standard cursors
  727. FL_CURSOR_DEFAULT = 0,
  728. FL_CURSOR_ARROW = 35,
  729. FL_CURSOR_CROSS = 66,
  730. FL_CURSOR_WAIT = 76,
  731. FL_CURSOR_INSERT = 77,
  732. FL_CURSOR_HAND = 31,
  733. FL_CURSOR_HELP = 47,
  734. FL_CURSOR_MOVE = 27,
  735. // fltk provides bitmaps for these:
  736. FL_CURSOR_NS = 78,
  737. FL_CURSOR_WE = 79,
  738. FL_CURSOR_NWSE = 80,
  739. FL_CURSOR_NESW = 81,
  740. FL_CURSOR_NONE = 255,
  741. // for back compatability (non MSWindows ones):
  742. FL_CURSOR_N = 70,
  743. FL_CURSOR_NE = 69,
  744. FL_CURSOR_E = 49,
  745. FL_CURSOR_SE = 8,
  746. FL_CURSOR_S = 9,
  747. FL_CURSOR_SW = 7,
  748. FL_CURSOR_W = 36,
  749. FL_CURSOR_NW = 68
  750. //FL_CURSOR_NS = 22,
  751. //FL_CURSOR_WE = 55,
  752. };
  753. enum { // values for "when" passed to Fl::add_fd()
  754. FL_READ = 1,
  755. FL_WRITE = 4,
  756. FL_EXCEPT = 8
  757. };
  758. enum Fl_Mode { // visual types and Fl_Gl_Window::mode() (values match Glut)
  759. FL_RGB = 0,
  760. FL_INDEX = 1,
  761. FL_SINGLE = 0,
  762. FL_DOUBLE = 2,
  763. FL_ACCUM = 4,
  764. FL_ALPHA = 8,
  765. FL_DEPTH = 16,
  766. FL_STENCIL = 32,
  767. FL_RGB8 = 64,
  768. FL_MULTISAMPLE= 128,
  769. FL_STEREO = 256,
  770. FL_FAKE_SINGLE = 512 // Fake single buffered windows using double-buffer
  771. };
  772. // image alpha blending
  773. #define FL_IMAGE_WITH_ALPHA 0x40000000
  774. // damage masks
  775. enum Fl_Damage {
  776. FL_DAMAGE_CHILD = 0x01,
  777. FL_DAMAGE_EXPOSE = 0x02,
  778. FL_DAMAGE_SCROLL = 0x04,
  779. FL_DAMAGE_OVERLAY = 0x08,
  780. FL_DAMAGE_USER1 = 0x10,
  781. FL_DAMAGE_USER2 = 0x20,
  782. FL_DAMAGE_ALL = 0x80
  783. };
  784. // FLTK 1.0.x compatibility definitions...
  785. # ifdef FLTK_1_0_COMPAT
  786. # define contrast fl_contrast
  787. # define down fl_down
  788. # define frame fl_frame
  789. # define inactive fl_inactive
  790. # endif // FLTK_1_0_COMPAT
  791. #endif
  792. //
  793. // End of "$Id: Enumerations.H 7903 2010-11-28 21:06:39Z matt $".
  794. //