You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

949 lines
36KB

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