Enumerations.H 49 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250
  1. //
  2. // "$Id: Enumerations.H 12450 2017-09-12 15:26:36Z AlbrechtS $"
  3. //
  4. // Enumerations for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2017 by Bill Spitzak and others.
  7. //
  8. // This library is free software. Distribution and use rights are outlined in
  9. // the file "COPYING" which should have been included with this file. If this
  10. // file is missing or damaged, see the license at:
  11. //
  12. // http://www.fltk.org/COPYING.php
  13. //
  14. // Please report all bugs and problems on the following page:
  15. //
  16. // http://www.fltk.org/str.php
  17. //
  18. /** \file
  19. This file contains type definitions and general enumerations.
  20. */
  21. #ifndef Fl_Enumerations_H
  22. #define Fl_Enumerations_H
  23. /*
  24. ******************************************************************************
  25. * FL_ABI_VERSION is defined by configure or CMake since FLTK 1.3.4.
  26. * It is written to FL/abi-version.h and #included here.
  27. ******************************************************************************
  28. * For more informations on FL_ABI_VERSION see README.abi-version.txt.
  29. ******************************************************************************
  30. */
  31. #include <FL/abi-version.h>
  32. # include "Fl_Export.H"
  33. # include "fl_types.h"
  34. # include <FL/platform_types.h> // for FL_COMMAND and FL_CONTROL
  35. /** \name Version Numbers
  36. FLTK defines some constants to help the programmer to
  37. find out, for which FLTK version a program is compiled.
  38. The following constants are defined:
  39. */
  40. /*@{*/
  41. /**
  42. The major release version of this FLTK library.
  43. \see FL_VERSION
  44. */
  45. #define FL_MAJOR_VERSION 1
  46. /**
  47. The minor release version for this library.
  48. FLTK remains mostly source-code compatible between minor version changes.
  49. */
  50. #define FL_MINOR_VERSION 4
  51. /**
  52. The patch version for this library.
  53. FLTK remains binary compatible between patches.
  54. */
  55. #define FL_PATCH_VERSION 0
  56. /**
  57. The FLTK version number as a \em double.
  58. FL_VERSION is a \em double that describes the major, minor, and patch
  59. version numbers.
  60. Version 1.2.3 is actually stored as 1.0203 to allow for more than 9
  61. minor and patch releases.
  62. \deprecated This \p double version number is retained for compatibility
  63. with existing program code. New code should use \em int FL_API_VERSION
  64. instead. FL_VERSION is deprecated because comparisons of floating point
  65. values may fail due to rounding errors. However, there are currently no
  66. plans to remove this deprecated constant.
  67. FL_VERSION is equivalent to <em>(double)FL_API_VERSION / 10000</em>.
  68. \see Fl::version() (deprecated as well)
  69. \see FL_API_VERSION
  70. \see Fl::api_version()
  71. */
  72. #define FL_VERSION ( (double)FL_MAJOR_VERSION + \
  73. (double)FL_MINOR_VERSION * 0.01 + \
  74. (double)FL_PATCH_VERSION * 0.0001 )
  75. /**
  76. The FLTK API version number as an \em int.
  77. FL_API_VERSION is an \em int that describes the major, minor, and patch
  78. version numbers.
  79. Version 1.2.3 is actually stored as 10203 to allow for more than 9
  80. minor and patch releases.
  81. The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
  82. give the integral values for the major, minor, and patch releases
  83. respectively.
  84. \note FL_API_VERSION is intended to replace the deprecated
  85. \em double FL_VERSION.
  86. \see Fl::api_version()
  87. */
  88. #define FL_API_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100 + FL_PATCH_VERSION)
  89. /**
  90. The FLTK ABI (Application Binary Interface) version number as an \em int.
  91. FL_ABI_VERSION is an \em int that describes the major, minor, and patch
  92. ABI version numbers in the same format as FL_API_VERSION.
  93. The ABI version number \p FL_ABI_VERSION is usually the same as the
  94. API version \p FL_API_VERSION with the last two digits set to '00'.
  95. FLTK retains the ABI (Application Binary Interface) during patch
  96. releases of the same major and minor versions. Examples:
  97. \verbatim
  98. FLTK Version FL_API_VERSION FL_ABI_VERSION FL_VERSION (deprecated)
  99. 1.3.0 10300 10300 1.0300
  100. 1.3.4 10304 10300 1.0304
  101. \endverbatim
  102. Version 1.2.3 is actually stored as 10203 to allow for more than 9
  103. minor and patch releases.
  104. The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
  105. give the integral values for the major, minor, and patch releases
  106. respectively.
  107. To enable new ABI-breaking features in patch releases you can configure
  108. FLTK to use a higher FL_ABI_VERSION.
  109. \see README.abi-version.txt
  110. */
  111. #ifndef FL_ABI_VERSION
  112. #define FL_ABI_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100)
  113. #endif
  114. /*
  115. Check if FL_ABI_VERSION is out of allowed range; redefine if necessary.
  116. This is done to prevent users from defining an illegal ABI version.
  117. Rule: FL_MAJOR_VERSION * 10000 + FL_MINOR_VERSION * 100
  118. <= FL_ABI_VERSION <= FL_API_VERSION.
  119. Example (FLTK 1.3.4):
  120. 10300 <= FL_ABI_VERSION <= 10304
  121. Note: configure + CMake can be used to define FL_ABI_VERSION, but they
  122. do not check validity. This is done here.
  123. */
  124. #if FL_ABI_VERSION < FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100
  125. # undef FL_ABI_VERSION
  126. # define FL_ABI_VERSION (FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100)
  127. #elif FL_ABI_VERSION > FL_API_VERSION
  128. # undef FL_ABI_VERSION
  129. # define FL_ABI_VERSION FL_API_VERSION
  130. #endif
  131. /*@}*/ // group: Version Numbers
  132. /**
  133. Every time a user moves the mouse pointer, clicks a button,
  134. or presses a key, an event is generated and sent to your
  135. application. Events can also come from other programs like the
  136. window manager.
  137. Events are identified by the integer argument passed to the
  138. Fl_Widget::handle() virtual method. Other information about the
  139. most recent event is stored in static locations and acquired by
  140. calling the Fl::event_*() methods. This static information remains
  141. valid until the next event is read from the window system, so it
  142. is ok to look at it outside of the handle() method.
  143. Event numbers can be converted to their actual names using the
  144. \ref fl_eventnames[] array defined in \#include &lt;FL/names.h&gt;
  145. \see Fl::event_text(), Fl::event_key(), class Fl::
  146. */
  147. // DEV NOTE: Keep this list in sync with FL/names.h
  148. enum Fl_Event { // events
  149. /** No event. */
  150. FL_NO_EVENT = 0,
  151. /** A mouse button has gone down with the mouse pointing at this
  152. widget. You can find out what button by calling Fl::event_button().
  153. You find out the mouse position by calling Fl::event_x() and
  154. Fl::event_y().
  155. A widget indicates that it "wants" the mouse click by returning non-zero
  156. from its Fl_Widget::handle() method. It will then become the
  157. Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events.
  158. If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH
  159. to another widget.
  160. */
  161. FL_PUSH = 1,
  162. /** A mouse button has been released. You can find out what button by
  163. calling Fl::event_button().
  164. In order to receive the FL_RELEASE event, the widget must return
  165. non-zero when handling FL_PUSH.
  166. */
  167. FL_RELEASE = 2,
  168. /** The mouse has been moved to point at this widget. This can
  169. be used for highlighting feedback. If a widget wants to
  170. highlight or otherwise track the mouse, it indicates this by
  171. returning non-zero from its handle() method. It then
  172. becomes the Fl::belowmouse() widget and will receive
  173. FL_MOVE and FL_LEAVE events.
  174. */
  175. FL_ENTER = 3,
  176. /** The mouse has moved out of the widget.
  177. In order to receive the FL_LEAVE event, the widget must
  178. return non-zero when handling FL_ENTER.
  179. */
  180. FL_LEAVE = 4,
  181. /** The mouse has moved with a button held down. The current button state
  182. is in Fl::event_state(). The mouse position is in Fl::event_x() and
  183. Fl::event_y().
  184. In order to receive FL_DRAG events, the widget must return non-zero
  185. when handling FL_PUSH.
  186. */
  187. FL_DRAG = 5,
  188. /** This indicates an <I>attempt</I> to give a widget the keyboard focus.
  189. If a widget wants the focus, it should change itself to display the
  190. fact that it has the focus, and return non-zero from its handle() method.
  191. It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP,
  192. and FL_UNFOCUS events.
  193. The focus will change either because the window manager changed which
  194. window gets the focus, or because the user tried to navigate using tab,
  195. arrows, or other keys. You can check Fl::event_key() to figure out why
  196. it moved. For navigation it will be the key pressed and for interaction
  197. with the window manager it will be zero.
  198. */
  199. FL_FOCUS = 6,
  200. /** This event is sent to the previous Fl::focus() widget when another
  201. widget gets the focus or the window loses focus.
  202. */
  203. FL_UNFOCUS = 7,
  204. /** A key was pressed (FL_KEYDOWN) or released (FL_KEYUP).
  205. Fl_KEYBOARD is a synonym for FL_KEYDOWN.
  206. The key can be found in Fl::event_key().
  207. The text that the key should insert can be found with Fl::event_text()
  208. and its length is in Fl::event_length(). If you use the key handle()
  209. should return 1. If you return zero then FLTK assumes you ignored the
  210. key and will then attempt to send it to a parent widget. If none of
  211. them want it, it will change the event into a FL_SHORTCUT event.
  212. To receive FL_KEYBOARD events you must also respond to the FL_FOCUS
  213. and FL_UNFOCUS events.
  214. If you are writing a text-editing widget you may also want to call
  215. the Fl::compose() function to translate individual keystrokes into
  216. non-ASCII characters.
  217. FL_KEYUP events are sent to the widget that currently has focus. This
  218. is not necessarily the same widget that received the corresponding
  219. FL_KEYDOWN event because focus may have changed between events.
  220. */
  221. FL_KEYDOWN = 8,
  222. /** Equivalent to FL_KEYDOWN.
  223. \see FL_KEYDOWN
  224. */
  225. FL_KEYBOARD = 8,
  226. /** Key release event.
  227. \see FL_KEYDOWN
  228. */
  229. FL_KEYUP = 9,
  230. /** The user clicked the close button of a window.
  231. This event is used internally only to trigger the callback of
  232. Fl_Window derived classed. The default callback closes the
  233. window calling Fl_Window::hide().
  234. */
  235. FL_CLOSE = 10,
  236. /** The mouse has moved without any mouse buttons held down.
  237. This event is sent to the Fl::belowmouse() widget.
  238. In order to receive FL_MOVE events, the widget must return
  239. non-zero when handling FL_ENTER.
  240. */
  241. FL_MOVE = 11,
  242. /** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD
  243. event then FLTK tries sending this event to every widget it
  244. can, until one of them returns non-zero. FL_SHORTCUT is first
  245. sent to the Fl::belowmouse() widget, then its parents and siblings,
  246. and eventually to every widget in the window, trying to find an
  247. object that returns non-zero. FLTK tries really hard to not to ignore
  248. any keystrokes!
  249. You can also make "global" shortcuts by using Fl::add_handler(). A
  250. global shortcut will work no matter what windows are displayed or
  251. which one has the focus.
  252. */
  253. FL_SHORTCUT = 12,
  254. /** This widget is no longer active, due to Fl_Widget::deactivate()
  255. being called on it or one of its parents. Fl_Widget::active() may
  256. still be true after this, the widget is only active if Fl_Widget::active()
  257. is true on it and all its parents (use Fl_Widget::active_r() to check this).
  258. */
  259. FL_DEACTIVATE = 13,
  260. /** This widget is now active, due to Fl_Widget::activate() being
  261. called on it or one of its parents.
  262. */
  263. FL_ACTIVATE = 14,
  264. /** This widget is no longer visible, due to Fl_Widget::hide() being
  265. called on it or one of its parents, or due to a parent window being
  266. minimized. Fl_Widget::visible() may still be true after this, but the
  267. widget is visible only if visible() is true for it and all its
  268. parents (use Fl_Widget::visible_r() to check this).
  269. */
  270. FL_HIDE = 15,
  271. /** This widget is visible again, due to Fl_Widget::show() being called on
  272. it or one of its parents, or due to a parent window being restored.
  273. Child Fl_Windows respond to this by actually creating the window if not
  274. done already, so if you subclass a window, be sure to pass FL_SHOW
  275. to the base class Fl_Widget::handle() method!
  276. */
  277. FL_SHOW = 16,
  278. /** You should get this event some time after you call Fl::paste().
  279. The contents of Fl::event_text() is the text to insert and the number
  280. of characters is in Fl::event_length().
  281. */
  282. FL_PASTE = 17,
  283. /** The Fl::selection_owner() will get this event before the selection is
  284. moved to another widget. This indicates that some other widget or program
  285. has claimed the selection. Motif programs used this to clear the selection
  286. indication. Most modern programs ignore this.
  287. */
  288. FL_SELECTIONCLEAR = 18,
  289. /** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy()
  290. methods can be used to find the amount to scroll horizontally and vertically.
  291. */
  292. FL_MOUSEWHEEL = 19,
  293. /** The mouse has been moved to point at this widget. A widget that is
  294. interested in receiving drag'n'drop data must return 1 to receive
  295. FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.
  296. */
  297. FL_DND_ENTER = 20,
  298. /** The mouse has been moved inside a widget while dragging data. A
  299. widget that is interested in receiving drag'n'drop data should
  300. indicate the possible drop position.
  301. */
  302. FL_DND_DRAG = 21,
  303. /** The mouse has moved out of the widget.
  304. */
  305. FL_DND_LEAVE = 22,
  306. /** The user has released the mouse button dropping data into the widget.
  307. If the widget returns 1, it will receive the data in the immediately
  308. following FL_PASTE event.
  309. */
  310. FL_DND_RELEASE = 23,
  311. /** The screen configuration (number, positions) was changed.
  312. Use Fl::add_handler() to be notified of this event.
  313. */
  314. FL_SCREEN_CONFIGURATION_CHANGED = 24,
  315. /** The fullscreen state of the window has changed
  316. */
  317. FL_FULLSCREEN = 25,
  318. /** The user has made a zoom/pinch/magnification gesture.
  319. The Fl::event_dy() method can be used to find magnification amount,
  320. Fl::event_x() and Fl::event_y() are set as well.
  321. */
  322. FL_ZOOM_GESTURE = 26
  323. // DEV NOTE: Keep this list in sync with FL/names.h
  324. };
  325. /** \name When Conditions */
  326. /*@{*/
  327. /** These constants determine when a callback is performed.
  328. \see Fl_Widget::when();
  329. \todo doxygen comments for values are incomplete and maybe wrong or unclear
  330. */
  331. enum Fl_When { // Fl_Widget::when():
  332. FL_WHEN_NEVER = 0, ///< Never call the callback
  333. FL_WHEN_CHANGED = 1, ///< Do the callback only when the widget value changes
  334. FL_WHEN_NOT_CHANGED = 2, ///< Do the callback whenever the user interacts with the widget
  335. FL_WHEN_RELEASE = 4, ///< Do the callback when the button or key is released and the value changes
  336. FL_WHEN_RELEASE_ALWAYS= 6, ///< Do the callback when the button or key is released, even if the value doesn't change
  337. FL_WHEN_ENTER_KEY = 8, ///< Do the callback when the user presses the ENTER key and the value changes
  338. FL_WHEN_ENTER_KEY_ALWAYS=10, ///< Do the callback when the user presses the ENTER key, even if the value doesn't change
  339. FL_WHEN_ENTER_KEY_CHANGED=11 ///< ?
  340. };
  341. /*@}*/ // group: When Conditions
  342. /** \name Mouse and Keyboard Events
  343. This and the following constants define the non-ASCII keys on the
  344. keyboard for FL_KEYBOARD and FL_SHORTCUT events.
  345. \see Fl::event_key() and Fl::get_key(int) (use ASCII letters for all other keys):
  346. \todo FL_Button and FL_key... constants could be structured better
  347. (use an enum or some doxygen grouping ?)
  348. */
  349. /*@{*/
  350. // FIXME: These codes collide with valid Unicode keys
  351. #define FL_Button 0xfee8 ///< A mouse button; use Fl_Button + n for mouse button n.
  352. #define FL_BackSpace 0xff08 ///< The backspace key.
  353. #define FL_Tab 0xff09 ///< The tab key.
  354. #define FL_Iso_Key 0xff0c ///< The additional key of ISO keyboards.
  355. #define FL_Enter 0xff0d ///< The enter key.
  356. #define FL_Pause 0xff13 ///< The pause key.
  357. #define FL_Scroll_Lock 0xff14 ///< The scroll lock key.
  358. #define FL_Escape 0xff1b ///< The escape key.
  359. #define FL_Kana 0xff2e ///< The Kana key of JIS keyboards.
  360. #define FL_Eisu 0xff2f ///< The Eisu key of JIS keyboards.
  361. #define FL_Yen 0xff30 ///< The Yen key of JIS keyboards.
  362. #define FL_JIS_Underscore 0xff31 ///< The underscore key of JIS keyboards.
  363. #define FL_Home 0xff50 ///< The home key.
  364. #define FL_Left 0xff51 ///< The left arrow key.
  365. #define FL_Up 0xff52 ///< The up arrow key.
  366. #define FL_Right 0xff53 ///< The right arrow key.
  367. #define FL_Down 0xff54 ///< The down arrow key.
  368. #define FL_Page_Up 0xff55 ///< The page-up key.
  369. #define FL_Page_Down 0xff56 ///< The page-down key.
  370. #define FL_End 0xff57 ///< The end key.
  371. #define FL_Print 0xff61 ///< The print (or print-screen) key.
  372. #define FL_Insert 0xff63 ///< The insert key.
  373. #define FL_Menu 0xff67 ///< The menu key.
  374. #define FL_Help 0xff68 ///< The 'help' key on Mac keyboards
  375. #define FL_Num_Lock 0xff7f ///< The num lock key.
  376. #define FL_KP 0xff80 ///< One of the keypad numbers; use FL_KP + 'n' for digit n.
  377. #define FL_KP_Enter 0xff8d ///< The enter key on the keypad, same as Fl_KP+'\\r'.
  378. #define FL_KP_Last 0xffbd ///< The last keypad key; use to range-check keypad.
  379. #define FL_F 0xffbd ///< One of the function keys; use FL_F + n for function key n.
  380. #define FL_F_Last 0xffe0 ///< The last function key; use to range-check function keys.
  381. #define FL_Shift_L 0xffe1 ///< The lefthand shift key.
  382. #define FL_Shift_R 0xffe2 ///< The righthand shift key.
  383. #define FL_Control_L 0xffe3 ///< The lefthand control key.
  384. #define FL_Control_R 0xffe4 ///< The righthand control key.
  385. #define FL_Caps_Lock 0xffe5 ///< The caps lock key.
  386. #define FL_Meta_L 0xffe7 ///< The left meta/Windows key.
  387. #define FL_Meta_R 0xffe8 ///< The right meta/Windows key.
  388. #define FL_Alt_L 0xffe9 ///< The left alt key.
  389. #define FL_Alt_R 0xffea ///< The right alt key.
  390. #define FL_Delete 0xffff ///< The delete key.
  391. // These use the Private Use Area (PUA) of the Basic Multilingual Plane
  392. // of Unicode. Guaranteed not to conflict with a proper Unicode character.
  393. // These primarily map to the XFree86 keysym range
  394. #define FL_Volume_Down 0xEF11 /* Volume control down */
  395. #define FL_Volume_Mute 0xEF12 /* Mute sound from the system */
  396. #define FL_Volume_Up 0xEF13 /* Volume control up */
  397. #define FL_Media_Play 0xEF14 /* Start playing of audio */
  398. #define FL_Media_Stop 0xEF15 /* Stop playing audio */
  399. #define FL_Media_Prev 0xEF16 /* Previous track */
  400. #define FL_Media_Next 0xEF17 /* Next track */
  401. #define FL_Home_Page 0xEF18 /* Display user's home page */
  402. #define FL_Mail 0xEF19 /* Invoke user's mail program */
  403. #define FL_Search 0xEF1B /* Search */
  404. #define FL_Back 0xEF26 /* Like back on a browser */
  405. #define FL_Forward 0xEF27 /* Like forward on a browser */
  406. #define FL_Stop 0xEF28 /* Stop current operation */
  407. #define FL_Refresh 0xEF29 /* Refresh the page */
  408. #define FL_Sleep 0xEF2F /* Put system to sleep */
  409. #define FL_Favorites 0xEF30 /* Show favorite locations */
  410. /*@}*/ // group: Mouse and Keyboard Events
  411. /** \name Mouse Buttons
  412. These constants define the button numbers for FL_PUSH and FL_RELEASE events.
  413. \see Fl::event_button()
  414. */
  415. /*@{*/
  416. #define FL_LEFT_MOUSE 1 ///< The left mouse button
  417. #define FL_MIDDLE_MOUSE 2 ///< The middle mouse button
  418. #define FL_RIGHT_MOUSE 3 ///< The right mouse button
  419. /*@}*/ // group: Mouse Buttons
  420. /** \name Event States
  421. The following constants define bits in the Fl::event_state() value.
  422. */
  423. /*@{*/ // group: Event States
  424. // FIXME: it would be nice to have the modifiers in the upper 8 bit so that
  425. // a unicode key (24bit) can be sent as an unsigned with the modifiers.
  426. #define FL_SHIFT 0x00010000 ///< One of the shift keys is down
  427. #define FL_CAPS_LOCK 0x00020000 ///< The caps lock is on
  428. #define FL_CTRL 0x00040000 ///< One of the ctrl keys is down
  429. #define FL_ALT 0x00080000 ///< One of the alt keys is down
  430. #define FL_NUM_LOCK 0x00100000 ///< The num lock is on
  431. // most X servers do this?
  432. #define FL_META 0x00400000 ///< One of the meta/Windows keys is down
  433. // correct for XFree86
  434. #define FL_SCROLL_LOCK 0x00800000 ///< The scroll lock is on
  435. // correct for XFree86
  436. #define FL_BUTTON1 0x01000000 ///< Mouse button 1 is pushed
  437. #define FL_BUTTON2 0x02000000 ///< Mouse button 2 is pushed
  438. #define FL_BUTTON3 0x04000000 ///< Mouse button 3 is pushed
  439. #define FL_BUTTONS 0x7f000000 ///< Any mouse button is pushed
  440. #define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed
  441. #define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now
  442. // FIXME: Unicode needs 24 bits!
  443. /*@}*/ // group: Event States
  444. /** \name Box Types
  445. \brief FLTK standard box types
  446. This enum defines the standard box types included with FLTK.
  447. \note The documented \p enum \p Fl_Boxtype contains some values (names)
  448. with leading underscores, e.g. \p \b _FL_SHADOW_BOX. This is due to
  449. technical reasons - please use the same values (names) without the
  450. leading underscore in your code! Enum values with leading underscores
  451. are reserved for internal use and subject to change without notice!
  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. \image html boxtypes.png "Figure 1: FLTK standard box types"
  457. \image latex boxtypes.png "FLTK standard box types" width=10cm
  458. \todo Description of boxtypes is incomplete.
  459. See below for the defined enum Fl_Boxtype.
  460. \see src/Fl_get_system_colors.cxx
  461. */
  462. /*@{*/
  463. enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.cxx):
  464. FL_NO_BOX = 0, ///< nothing is drawn at all, this box is invisible
  465. FL_FLAT_BOX, ///< a flat box
  466. FL_UP_BOX, ///< see figure 1
  467. FL_DOWN_BOX, ///< see figure 1
  468. FL_UP_FRAME, ///< see figure 1
  469. FL_DOWN_FRAME, ///< see figure 1
  470. FL_THIN_UP_BOX, ///< see figure 1
  471. FL_THIN_DOWN_BOX, ///< see figure 1
  472. FL_THIN_UP_FRAME, ///< see figure 1
  473. FL_THIN_DOWN_FRAME, ///< see figure 1
  474. FL_ENGRAVED_BOX, ///< see figure 1
  475. FL_EMBOSSED_BOX, ///< see figure 1
  476. FL_ENGRAVED_FRAME, ///< see figure 1
  477. FL_EMBOSSED_FRAME, ///< see figure 1
  478. FL_BORDER_BOX, ///< see figure 1
  479. _FL_SHADOW_BOX, ///< see figure 1
  480. FL_BORDER_FRAME, ///< see figure 1
  481. _FL_SHADOW_FRAME, ///< see figure 1
  482. _FL_ROUNDED_BOX, ///< see figure 1
  483. _FL_RSHADOW_BOX, ///< see figure 1
  484. _FL_ROUNDED_FRAME, ///< see figure 1
  485. _FL_RFLAT_BOX, ///< see figure 1
  486. _FL_ROUND_UP_BOX, ///< see figure 1
  487. _FL_ROUND_DOWN_BOX, ///< see figure 1
  488. _FL_DIAMOND_UP_BOX, ///< see figure 1
  489. _FL_DIAMOND_DOWN_BOX, ///< see figure 1
  490. _FL_OVAL_BOX, ///< see figure 1
  491. _FL_OSHADOW_BOX, ///< see figure 1
  492. _FL_OVAL_FRAME, ///< see figure 1
  493. _FL_OFLAT_BOX, ///< see figure 1
  494. _FL_PLASTIC_UP_BOX, ///< plastic version of FL_UP_BOX
  495. _FL_PLASTIC_DOWN_BOX, ///< plastic version of FL_DOWN_BOX
  496. _FL_PLASTIC_UP_FRAME, ///< plastic version of FL_UP_FRAME
  497. _FL_PLASTIC_DOWN_FRAME, ///< plastic version of FL_DOWN_FRAME
  498. _FL_PLASTIC_THIN_UP_BOX, ///< plastic version of FL_THIN_UP_BOX
  499. _FL_PLASTIC_THIN_DOWN_BOX, ///< plastic version of FL_THIN_DOWN_BOX
  500. _FL_PLASTIC_ROUND_UP_BOX, ///< plastic version of FL_ROUND_UP_BOX
  501. _FL_PLASTIC_ROUND_DOWN_BOX, ///< plastic version of FL_ROUND_DOWN_BOX
  502. _FL_GTK_UP_BOX, ///< gtk+ version of FL_UP_BOX
  503. _FL_GTK_DOWN_BOX, ///< gtk+ version of FL_DOWN_BOX
  504. _FL_GTK_UP_FRAME, ///< gtk+ version of FL_UP_FRAME
  505. _FL_GTK_DOWN_FRAME, ///< gtk+ version of FL_DOWN_FRAME
  506. _FL_GTK_THIN_UP_BOX, ///< gtk+ version of FL_THIN_UP_BOX
  507. _FL_GTK_THIN_DOWN_BOX, ///< gtk+ version of FL_THIN_DOWN_BOX
  508. _FL_GTK_THIN_UP_FRAME, ///< gtk+ version of FL_THIN_UP_FRAME
  509. _FL_GTK_THIN_DOWN_FRAME, ///< gtk+ version of FL_THIN_DOWN_FRAME
  510. _FL_GTK_ROUND_UP_BOX, ///< gtk+ version of FL_ROUND_UP_BOX
  511. _FL_GTK_ROUND_DOWN_BOX, ///< gtk+ version of FL_ROUND_DOWN_BOX
  512. _FL_GLEAM_UP_BOX, ///< gleam version of FL_UP_BOX
  513. _FL_GLEAM_DOWN_BOX, ///< gleam version of FL_DOWN_BOX
  514. _FL_GLEAM_UP_FRAME, ///< gleam version of FL_UP_FRAME
  515. _FL_GLEAM_DOWN_FRAME, ///< gleam version of FL_DOWN_FRAME
  516. _FL_GLEAM_THIN_UP_BOX, ///< gleam version of FL_THIN_UP_BOX
  517. _FL_GLEAM_THIN_DOWN_BOX, ///< gleam version of FL_THIN_DOWN_BOX
  518. _FL_GLEAM_ROUND_UP_BOX, ///< gleam version of FL_ROUND_UP_BOX
  519. _FL_GLEAM_ROUND_DOWN_BOX, ///< gleam version of FL_ROUND_DOWN_BOX
  520. FL_FREE_BOXTYPE ///< the first free box type for creation of new box types
  521. };
  522. extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
  523. #define FL_ROUND_UP_BOX fl_define_FL_ROUND_UP_BOX()
  524. #define FL_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_ROUND_UP_BOX()+1)
  525. extern FL_EXPORT Fl_Boxtype fl_define_FL_SHADOW_BOX();
  526. #define FL_SHADOW_BOX fl_define_FL_SHADOW_BOX()
  527. #define FL_SHADOW_FRAME (Fl_Boxtype)(fl_define_FL_SHADOW_BOX()+2)
  528. extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUNDED_BOX();
  529. #define FL_ROUNDED_BOX fl_define_FL_ROUNDED_BOX()
  530. #define FL_ROUNDED_FRAME (Fl_Boxtype)(fl_define_FL_ROUNDED_BOX()+2)
  531. extern FL_EXPORT Fl_Boxtype fl_define_FL_RFLAT_BOX();
  532. #define FL_RFLAT_BOX fl_define_FL_RFLAT_BOX()
  533. extern FL_EXPORT Fl_Boxtype fl_define_FL_RSHADOW_BOX();
  534. #define FL_RSHADOW_BOX fl_define_FL_RSHADOW_BOX()
  535. extern FL_EXPORT Fl_Boxtype fl_define_FL_DIAMOND_BOX();
  536. #define FL_DIAMOND_UP_BOX fl_define_FL_DIAMOND_BOX()
  537. #define FL_DIAMOND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_DIAMOND_BOX()+1)
  538. extern FL_EXPORT Fl_Boxtype fl_define_FL_OVAL_BOX();
  539. #define FL_OVAL_BOX fl_define_FL_OVAL_BOX()
  540. #define FL_OSHADOW_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+1)
  541. #define FL_OVAL_FRAME (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+2)
  542. #define FL_OFLAT_BOX (Fl_Boxtype)(fl_define_FL_OVAL_BOX()+3)
  543. extern FL_EXPORT Fl_Boxtype fl_define_FL_PLASTIC_UP_BOX();
  544. #define FL_PLASTIC_UP_BOX fl_define_FL_PLASTIC_UP_BOX()
  545. #define FL_PLASTIC_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+1)
  546. #define FL_PLASTIC_UP_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+2)
  547. #define FL_PLASTIC_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+3)
  548. #define FL_PLASTIC_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+4)
  549. #define FL_PLASTIC_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+5)
  550. #define FL_PLASTIC_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+6)
  551. #define FL_PLASTIC_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_PLASTIC_UP_BOX()+7)
  552. extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
  553. #define FL_GTK_UP_BOX fl_define_FL_GTK_UP_BOX()
  554. #define FL_GTK_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+1)
  555. #define FL_GTK_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+2)
  556. #define FL_GTK_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+3)
  557. #define FL_GTK_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+4)
  558. #define FL_GTK_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+5)
  559. #define FL_GTK_THIN_UP_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+6)
  560. #define FL_GTK_THIN_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+7)
  561. #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8)
  562. #define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
  563. extern FL_EXPORT Fl_Boxtype fl_define_FL_GLEAM_UP_BOX();
  564. #define FL_GLEAM_UP_BOX fl_define_FL_GLEAM_UP_BOX()
  565. #define FL_GLEAM_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+1)
  566. #define FL_GLEAM_UP_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+2)
  567. #define FL_GLEAM_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+3)
  568. #define FL_GLEAM_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+4)
  569. #define FL_GLEAM_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+5)
  570. #define FL_GLEAM_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+6)
  571. #define FL_GLEAM_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+7)
  572. // conversions of box types to other boxtypes:
  573. /**
  574. Get the filled version of a frame.
  575. If no filled version of a given frame exists, the behavior of this function
  576. is undefined and some random box or frame is returned.
  577. */
  578. inline Fl_Boxtype fl_box(Fl_Boxtype b) {
  579. return (Fl_Boxtype)((b<FL_UP_BOX||b%4>1)?b:(b-2));
  580. }
  581. /**
  582. Get the "pressed" or "down" version of a box.
  583. If no "down" version of a given box exists, the behavior of this function
  584. is undefined and some random box or frame is returned.
  585. */
  586. inline Fl_Boxtype fl_down(Fl_Boxtype b) {
  587. return (Fl_Boxtype)((b<FL_UP_BOX)?b:(b|1));
  588. }
  589. /**
  590. Get the unfilled, frame only version of a box.
  591. If no frame version of a given box exists, the behavior of this function
  592. is undefined and some random box or frame is returned.
  593. */
  594. inline Fl_Boxtype fl_frame(Fl_Boxtype b) {
  595. return (Fl_Boxtype)((b%4<2)?b:(b+2));
  596. }
  597. // back-compatibility box types:
  598. #define FL_FRAME FL_ENGRAVED_FRAME
  599. #define FL_FRAME_BOX FL_ENGRAVED_BOX
  600. #define FL_CIRCLE_BOX FL_ROUND_DOWN_BOX
  601. #define FL_DIAMOND_BOX FL_DIAMOND_DOWN_BOX
  602. /*@}*/ // group: Box Types
  603. /**
  604. The labeltype() method sets the type of the label.
  605. \note The documented \p enum \p Fl_Labeltype contains some values (names)
  606. with leading underscores, e.g. \p \b _FL_IMAGE_LABEL. This is due to
  607. technical reasons - please use the same values (names) without the
  608. leading underscore in your code! Enum values with leading underscores
  609. are reserved for internal use and subject to change without notice!
  610. The following standard label types are included:
  611. */
  612. enum Fl_Labeltype { // labeltypes:
  613. FL_NORMAL_LABEL = 0, ///< draws the text (0)
  614. FL_NO_LABEL, ///< does nothing
  615. _FL_SHADOW_LABEL, ///< draws a drop shadow under the text
  616. _FL_ENGRAVED_LABEL, ///< draws edges as though the text is engraved
  617. _FL_EMBOSSED_LABEL, ///< draws edges as though the text is raised
  618. _FL_MULTI_LABEL, ///< draws a composite label \see Fl_Multi_Label
  619. _FL_ICON_LABEL, ///< draws the icon associated with the text
  620. _FL_IMAGE_LABEL, ///< the label displays an "icon" based on a Fl_Image
  621. FL_FREE_LABELTYPE ///< first free labeltype to use for creating own labeltypes
  622. };
  623. /**
  624. Sets the current label type and returns its corresponding Fl_Labeltype value.
  625. @{
  626. */
  627. /** FL_SYMBOL_LABEL is an alias for FL_NORMAL_LABEL.
  628. '@' symbols can be drawn with normal labels as well.\n
  629. This definition is for historical reasons only (forms compatibility).
  630. You should use FL_NORMAL_LABEL instead.
  631. */
  632. #define FL_SYMBOL_LABEL FL_NORMAL_LABEL
  633. /**
  634. Initializes the internal table entry for FL_SHADOW_LABEL and returns
  635. its internal value. Internal use only.
  636. */
  637. extern Fl_Labeltype FL_EXPORT fl_define_FL_SHADOW_LABEL();
  638. /**
  639. Draws a label with shadows behind the text.
  640. */
  641. #define FL_SHADOW_LABEL fl_define_FL_SHADOW_LABEL()
  642. /**
  643. Initializes the internal table entry for FL_ENGRAVED_LABEL and returns
  644. its internal value. Internal use only.
  645. */
  646. extern Fl_Labeltype FL_EXPORT fl_define_FL_ENGRAVED_LABEL();
  647. /**
  648. Draws a label with engraved text.
  649. */
  650. #define FL_ENGRAVED_LABEL fl_define_FL_ENGRAVED_LABEL()
  651. /**
  652. Initializes the internal table entry for FL_EMBOSSED_LABEL and returns
  653. its internal value. Internal use only.
  654. */
  655. extern Fl_Labeltype FL_EXPORT fl_define_FL_EMBOSSED_LABEL();
  656. /**
  657. Draws a label with embossed text.
  658. */
  659. #define FL_EMBOSSED_LABEL fl_define_FL_EMBOSSED_LABEL()
  660. /**
  661. Initializes the internal table entry for FL_MULTI_LABEL and returns
  662. its internal value. Internal use only.
  663. */
  664. extern Fl_Labeltype FL_EXPORT fl_define_FL_MULTI_LABEL();
  665. /**
  666. Draws a label that can comprise several parts like text and images.
  667. \see Fl_Multi_Label
  668. */
  669. #define FL_MULTI_LABEL fl_define_FL_MULTI_LABEL()
  670. /**
  671. Initializes the internal table entry for FL_ICON_LABEL and returns
  672. its internal value. Internal use only.
  673. */
  674. extern Fl_Labeltype FL_EXPORT fl_define_FL_ICON_LABEL();
  675. /**
  676. Draws an icon as the label.
  677. */
  678. #define FL_ICON_LABEL fl_define_FL_ICON_LABEL()
  679. /**
  680. Initializes the internal table entry for FL_IMAGE_LABEL and returns
  681. its internal value. Internal use only.
  682. */
  683. extern Fl_Labeltype FL_EXPORT fl_define_FL_IMAGE_LABEL();
  684. /**
  685. Draws an image (Fl_Image) as the label.
  686. This is useful for one particular part of an Fl_Multi_Label.
  687. Use Fl_Widget::image() and/or Fl_Widget::deimage() for normal widgets
  688. with images as labels.
  689. */
  690. #define FL_IMAGE_LABEL fl_define_FL_IMAGE_LABEL()
  691. /** @} */
  692. /** \name Alignment Flags
  693. Flags to control the label alignment.
  694. This controls how the label is displayed next to or inside the widget.
  695. The default value is FL_ALIGN_CENTER (0) for most widgets, which centers
  696. the label inside the widget.
  697. All alignment flags use the common prefix "FL_ALIGN_". In the following
  698. descriptions this prefix is sometimes omitted for brevity.
  699. Flags can be or'd to achieve a combination of alignments, but there
  700. are some \e "magic values" (e.g. combinations of TOP and BOTTOM and of
  701. LEFT and RIGHT) that have special meanings (see below). For instance:\n
  702. FL_ALIGN_TOP_LEFT == (FL_ALIGN_TOP | FL_ALIGN_LEFT) != FL_ALIGN_LEFT_TOP.
  703. \code
  704. Outside alignments (FL_ALIGN_INSIDE is not set):
  705. TOP_LEFT TOP TOP_RIGHT
  706. +---------------------------------+
  707. LEFT_TOP| |RIGHT_TOP
  708. | |
  709. LEFT| CENTER |RIGHT
  710. | |
  711. LEFT_BOTTOM| |RIGHT_BOTTOM
  712. +---------------------------------+
  713. BOTTOM_LEFT BOTTOM BOTTOM_RIGHT
  714. Inside alignments (FL_ALIGN_INSIDE is set):
  715. +---------------------------------+
  716. |TOP_LEFT TOP TOP_RIGHT|
  717. | |
  718. |LEFT CENTER RIGHT|
  719. | |
  720. |BOTTOM_LEFT BOTTOM BOTTOM_RIGHT|
  721. +---------------------------------+
  722. \endcode
  723. \see Fl_Align, #FL_ALIGN_CENTER, etc.
  724. \note
  725. -# Bit positions not defined in the following constants of type
  726. \p Fl_Align are reserved for future extensions. Do not use.
  727. -# The \e "magic values" (FL_ALIGN_)LEFT_TOP, RIGHT_TOP, LEFT_BOTTOM,
  728. and RIGHT_BOTTOM must not be used together with FL_ALIGN_INSIDE.
  729. Use TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, or BOTTOM_RIGHT instead.
  730. -# Although bits can be or'd together there are some unused/illegal
  731. combinations, for instance:
  732. - setting both FL_ALIGN_TOP and FL_ALIGN_BOTTOM in combinations other
  733. than those given in the \p Fl_Align constants below (magic values)
  734. - setting both FL_ALIGN_LEFT and FL_ALIGN_RIGHT in combinations other
  735. than those given in the \p Fl_Align constants below (magic values)
  736. - using one of the "magic values" (2) together with FL_ALIGN_INSIDE
  737. \note
  738. Using illegal bit combinations or undefined bits may yield unexpected
  739. behavior, and this behavior may be changed without notice in future
  740. FLTK versions.
  741. */
  742. /*@{*/
  743. /** FLTK type for alignment control. */
  744. typedef unsigned Fl_Align;
  745. /** Align the label horizontally in the middle. */
  746. const Fl_Align FL_ALIGN_CENTER = 0x0000;
  747. /** Align the label at the top of the widget. Inside labels appear below the top,
  748. outside labels are drawn on top of the widget. */
  749. const Fl_Align FL_ALIGN_TOP = 0x0001;
  750. /** Align the label at the bottom of the widget. */
  751. const Fl_Align FL_ALIGN_BOTTOM = 0x0002;
  752. /** Align the label at the left of the widget. Inside labels appear left-justified
  753. starting at the left side of the widget, outside labels are right-justified and
  754. drawn to the left of the widget. */
  755. const Fl_Align FL_ALIGN_LEFT = 0x0004;
  756. /** Align the label to the right of the widget. */
  757. const Fl_Align FL_ALIGN_RIGHT = 0x0008;
  758. /** Draw the label inside of the widget. */
  759. const Fl_Align FL_ALIGN_INSIDE = 0x0010;
  760. /** If the label contains an image, draw the text on top of the image. */
  761. const Fl_Align FL_ALIGN_TEXT_OVER_IMAGE = 0x0020;
  762. /** If the label contains an image, draw the text below the image. */
  763. const Fl_Align FL_ALIGN_IMAGE_OVER_TEXT = 0x0000;
  764. /** All parts of the label that are larger than the widget will not be drawn. */
  765. const Fl_Align FL_ALIGN_CLIP = 0x0040;
  766. /** Wrap text that does not fit the width of the widget. */
  767. const Fl_Align FL_ALIGN_WRAP = 0x0080;
  768. /** If the label contains an image, draw the text to the right of the image. */
  769. const Fl_Align FL_ALIGN_IMAGE_NEXT_TO_TEXT = 0x0100;
  770. /** If the label contains an image, draw the text to the left of the image. */
  771. const Fl_Align FL_ALIGN_TEXT_NEXT_TO_IMAGE = 0x0120;
  772. /** If the label contains an image, draw the image or deimage in the background. */
  773. const Fl_Align FL_ALIGN_IMAGE_BACKDROP = 0x0200;
  774. const Fl_Align FL_ALIGN_TOP_LEFT = FL_ALIGN_TOP | FL_ALIGN_LEFT;
  775. const Fl_Align FL_ALIGN_TOP_RIGHT = FL_ALIGN_TOP | FL_ALIGN_RIGHT;
  776. const Fl_Align FL_ALIGN_BOTTOM_LEFT = FL_ALIGN_BOTTOM | FL_ALIGN_LEFT;
  777. const Fl_Align FL_ALIGN_BOTTOM_RIGHT = FL_ALIGN_BOTTOM | FL_ALIGN_RIGHT;
  778. /** Outside only, left of widget, top position, magic value: TOP | BOTTOM | LEFT. */
  779. const Fl_Align FL_ALIGN_LEFT_TOP = 0x0007;
  780. /** Outside only, right of widget, top position, magic value: TOP | BOTTOM | RIGHT. */
  781. const Fl_Align FL_ALIGN_RIGHT_TOP = 0x000b;
  782. /** Outside only, left of widget, bottom position, magic value: TOP | LEFT | RIGHT. */
  783. const Fl_Align FL_ALIGN_LEFT_BOTTOM = 0x000d;
  784. /** Outside only, right of widget, bottom position, magic value: BOTTOM | LEFT | RIGHT. */
  785. const Fl_Align FL_ALIGN_RIGHT_BOTTOM = 0x000e;
  786. /** Nothing, same as FL_ALIGN_CENTER, for back compatibility. */
  787. const Fl_Align FL_ALIGN_NOWRAP = 0x0000;
  788. /** Mask value to test for TOP, BOTTOM, LEFT, and RIGHT flags. */
  789. const Fl_Align FL_ALIGN_POSITION_MASK = 0x000f;
  790. /** Mask value to test for image alignment flags. */
  791. const Fl_Align FL_ALIGN_IMAGE_MASK = 0x0320;
  792. /*@}*/
  793. /** \name Font Numbers
  794. The following constants define the standard FLTK fonts:
  795. */
  796. /*@{*/
  797. /** A font number is an index into the internal font table. */
  798. typedef int Fl_Font;
  799. const Fl_Font FL_HELVETICA = 0; ///< Helvetica (or Arial) normal (0)
  800. const Fl_Font FL_HELVETICA_BOLD = 1; ///< Helvetica (or Arial) bold
  801. const Fl_Font FL_HELVETICA_ITALIC = 2; ///< Helvetica (or Arial) oblique
  802. const Fl_Font FL_HELVETICA_BOLD_ITALIC = 3; ///< Helvetica (or Arial) bold-oblique
  803. const Fl_Font FL_COURIER = 4; ///< Courier normal
  804. const Fl_Font FL_COURIER_BOLD = 5; ///< Courier bold
  805. const Fl_Font FL_COURIER_ITALIC = 6; ///< Courier italic
  806. const Fl_Font FL_COURIER_BOLD_ITALIC = 7; ///< Courier bold-italic
  807. const Fl_Font FL_TIMES = 8; ///< Times roman
  808. const Fl_Font FL_TIMES_BOLD = 9; ///< Times roman bold
  809. const Fl_Font FL_TIMES_ITALIC = 10; ///< Times roman italic
  810. const Fl_Font FL_TIMES_BOLD_ITALIC = 11; ///< Times roman bold-italic
  811. const Fl_Font FL_SYMBOL = 12; ///< Standard symbol font
  812. const Fl_Font FL_SCREEN = 13; ///< Default monospaced screen font
  813. const Fl_Font FL_SCREEN_BOLD = 14; ///< Default monospaced bold screen font
  814. const Fl_Font FL_ZAPF_DINGBATS = 15; ///< Zapf-dingbats font
  815. const Fl_Font FL_FREE_FONT = 16; ///< first one to allocate
  816. const Fl_Font FL_BOLD = 1; ///< add this to helvetica, courier, or times
  817. const Fl_Font FL_ITALIC = 2; ///< add this to helvetica, courier, or times
  818. const Fl_Font FL_BOLD_ITALIC = 3; ///< add this to helvetica, courier, or times
  819. /*@}*/
  820. /** Size of a font in pixels.
  821. This is the approximate height of a font in pixels.
  822. */
  823. typedef int Fl_Fontsize;
  824. extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE; ///< normal font size
  825. /** \name Colors
  826. The Fl_Color type holds an FLTK color value.
  827. Colors are either 8-bit indexes into a <a href="fltk-colormap.png">virtual colormap</a>
  828. or 24-bit RGB color values. (See \ref drawing_colors for the default FLTK colormap)
  829. Color indices occupy the lower 8 bits of the value, while
  830. RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
  831. <pre>
  832. Fl_Color => 0xrrggbbii
  833. | | | |
  834. | | | +--- \ref drawing_colors "index" between 0 and 255
  835. | | +----- blue color component (8 bit)
  836. | +------- green component (8 bit)
  837. +--------- red component (8 bit)
  838. </pre>
  839. A color can have either an index or an rgb value. Colors with rgb set
  840. and an index >0 are reserved for special use.
  841. */
  842. /*@{*/
  843. /** An FLTK color value; see also \ref drawing_colors */
  844. typedef unsigned int Fl_Color;
  845. // Standard colors. These are used as default colors in widgets and altered as necessary
  846. const Fl_Color FL_FOREGROUND_COLOR = 0; ///< the default foreground color (0) used for labels and text
  847. const Fl_Color FL_BACKGROUND2_COLOR = 7; ///< the default background color for text, list, and valuator widgets
  848. const Fl_Color FL_INACTIVE_COLOR = 8; ///< the inactive foreground color
  849. const Fl_Color FL_SELECTION_COLOR = 15; ///< the default selection/highlight color
  850. // boxtypes generally limit themselves to these colors so
  851. // the whole ramp is not allocated:
  852. const Fl_Color FL_GRAY0 = 32; // 'A'
  853. const Fl_Color FL_DARK3 = 39; // 'H'
  854. const Fl_Color FL_DARK2 = 45; // 'N'
  855. const Fl_Color FL_DARK1 = 47; // 'P'
  856. const Fl_Color FL_BACKGROUND_COLOR = 49; // 'R' default background color
  857. const Fl_Color FL_LIGHT1 = 50; // 'S'
  858. const Fl_Color FL_LIGHT2 = 52; // 'U'
  859. const Fl_Color FL_LIGHT3 = 54; // 'W'
  860. // FLTK provides a 5x8x5 color cube that is used with colormap visuals
  861. const Fl_Color FL_BLACK = 56;
  862. const Fl_Color FL_RED = 88;
  863. const Fl_Color FL_GREEN = 63;
  864. const Fl_Color FL_YELLOW = 95;
  865. const Fl_Color FL_BLUE = 216;
  866. const Fl_Color FL_MAGENTA = 248;
  867. const Fl_Color FL_CYAN = 223;
  868. const Fl_Color FL_DARK_RED = 72;
  869. const Fl_Color FL_DARK_GREEN = 60;
  870. const Fl_Color FL_DARK_YELLOW = 76;
  871. const Fl_Color FL_DARK_BLUE = 136;
  872. const Fl_Color FL_DARK_MAGENTA = 152;
  873. const Fl_Color FL_DARK_CYAN = 140;
  874. const Fl_Color FL_WHITE = 255;
  875. #define FL_FREE_COLOR (Fl_Color)16
  876. #define FL_NUM_FREE_COLOR 16
  877. #define FL_GRAY_RAMP (Fl_Color)32
  878. #define FL_NUM_GRAY 24
  879. #define FL_GRAY FL_BACKGROUND_COLOR
  880. #define FL_COLOR_CUBE (Fl_Color)56
  881. #define FL_NUM_RED 5
  882. #define FL_NUM_GREEN 8
  883. #define FL_NUM_BLUE 5
  884. FL_EXPORT Fl_Color fl_inactive(Fl_Color c);
  885. FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
  886. FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
  887. /** Returns a lighter version of the specified color. */
  888. inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
  889. /** Returns a darker version of the specified color. */
  890. inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
  891. /** Returns the 24-bit color value closest to \p r, \p g, \p b. */
  892. inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) {
  893. if (!r && !g && !b) return FL_BLACK;
  894. else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
  895. }
  896. /** Returns the 24-bit color value closest to \p g (grayscale). */
  897. inline Fl_Color fl_rgb_color(uchar g) {
  898. if (!g) return FL_BLACK;
  899. else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
  900. }
  901. /** Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1).
  902. FL_NUM_GRAY is defined to be 24 in the current FLTK release.
  903. To get the closest FLTK gray value to an 8-bit grayscale color 'I' use:
  904. \code
  905. fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255)
  906. \endcode
  907. */
  908. inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
  909. /** Returns a color out of the color cube.
  910. \p r must be in the range 0 to FL_NUM_RED (5) minus 1,
  911. \p g must be in the range 0 to FL_NUM_GREEN (8) minus 1,
  912. \p b must be in the range 0 to FL_NUM_BLUE (5) minus 1.
  913. To get the closest color to a 8-bit set of R,G,B values use:
  914. \code
  915. fl_color_cube(R * (FL_NUM_RED - 1) / 255,
  916. G * (FL_NUM_GREEN - 1) / 255,
  917. B * (FL_NUM_BLUE - 1) / 255);
  918. \endcode
  919. */
  920. inline Fl_Color fl_color_cube(int r, int g, int b) {
  921. return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
  922. /*@}*/ // group: Colors
  923. /** \name Cursors */
  924. /*@{*/
  925. /** The following constants define the mouse cursors that are available in FLTK.
  926. Cursors are provided by the system when available, or bitmaps built into
  927. FLTK as a fallback.
  928. \todo enum Fl_Cursor needs maybe an image.
  929. */
  930. /* FIXME: We should renumber these, but that will break the ABI */
  931. enum Fl_Cursor {
  932. FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */
  933. FL_CURSOR_ARROW = 35, /**< an arrow pointer. */
  934. FL_CURSOR_CROSS = 66, /**< crosshair. */
  935. FL_CURSOR_WAIT = 76, /**< busy indicator (e.g. hourglass). */
  936. FL_CURSOR_INSERT = 77, /**< I-beam. */
  937. FL_CURSOR_HAND = 31, /**< pointing hand. */
  938. FL_CURSOR_HELP = 47, /**< question mark pointer. */
  939. FL_CURSOR_MOVE = 27, /**< 4-pointed arrow or hand. */
  940. /* Resize indicators */
  941. FL_CURSOR_NS = 78, /**< up/down resize. */
  942. FL_CURSOR_WE = 79, /**< left/right resize. */
  943. FL_CURSOR_NWSE = 80, /**< diagonal resize. */
  944. FL_CURSOR_NESW = 81, /**< diagonal resize. */
  945. FL_CURSOR_N = 70, /**< upwards resize. */
  946. FL_CURSOR_NE = 69, /**< upwards, right resize. */
  947. FL_CURSOR_E = 49, /**< rightwards resize. */
  948. FL_CURSOR_SE = 8, /**< downwards, right resize. */
  949. FL_CURSOR_S = 9, /**< downwards resize. */
  950. FL_CURSOR_SW = 7, /**< downwards, left resize. */
  951. FL_CURSOR_W = 36, /**< leftwards resize. */
  952. FL_CURSOR_NW = 68, /**< upwards, left resize. */
  953. FL_CURSOR_NONE =255 /**< invisible. */
  954. };
  955. /*@}*/ // group: Cursors
  956. /** FD "when" conditions */
  957. enum { // values for "when" passed to Fl::add_fd()
  958. FL_READ = 1, /**< Call the callback when there is data to be read. */
  959. FL_WRITE = 4, /**< Call the callback when data can be written without blocking. */
  960. FL_EXCEPT = 8 /**< Call the callback if an exception occurs on the file. */
  961. };
  962. /** visual types and Fl_Gl_Window::mode() (values match Glut) */
  963. enum Fl_Mode {
  964. FL_RGB = 0,
  965. FL_INDEX = 1,
  966. FL_SINGLE = 0,
  967. FL_DOUBLE = 2,
  968. FL_ACCUM = 4,
  969. FL_ALPHA = 8,
  970. FL_DEPTH = 16,
  971. FL_STENCIL = 32,
  972. FL_RGB8 = 64,
  973. FL_MULTISAMPLE= 128,
  974. FL_STEREO = 256,
  975. FL_FAKE_SINGLE = 512, // Fake single buffered windows using double-buffer
  976. FL_OPENGL3 = 1024
  977. };
  978. // image alpha blending
  979. #define FL_IMAGE_WITH_ALPHA 0x40000000
  980. /** Damage masks */
  981. enum Fl_Damage {
  982. FL_DAMAGE_CHILD = 0x01, /**< A child needs to be redrawn. */
  983. FL_DAMAGE_EXPOSE = 0x02, /**< The window was exposed. */
  984. FL_DAMAGE_SCROLL = 0x04, /**< The Fl_Scroll widget was scrolled. */
  985. FL_DAMAGE_OVERLAY = 0x08, /**< The overlay planes need to be redrawn. */
  986. FL_DAMAGE_USER1 = 0x10, /**< First user-defined damage bit. */
  987. FL_DAMAGE_USER2 = 0x20, /**< Second user-defined damage bit. */
  988. FL_DAMAGE_ALL = 0x80 /**< Everything needs to be redrawn. */
  989. };
  990. // FLTK 1.0.x compatibility definitions...
  991. # ifdef FLTK_1_0_COMPAT
  992. # define contrast fl_contrast
  993. # define down fl_down
  994. # define frame fl_frame
  995. # define inactive fl_inactive
  996. # endif // FLTK_1_0_COMPAT
  997. /*!
  998. Values of the bits stored in Fl_Widget::layout_damage().
  999. When a widget resized or moved (or when it is initially created),
  1000. flags are set in Fl_Widget::layout_damage() to indicate the layout is
  1001. damaged. This will cause the virtual function Fl_Widget::layout() to be
  1002. called just before fltk attempts to draw the windows on the screen.
  1003. This is useful because often calculating the new layout is quite
  1004. expensive, this expense is now deferred until the user will actually
  1005. see the new size.
  1006. Some Group widgets such as Fl_Pack will also use the
  1007. virtual Fl_Widget::layout() function to find out how big a widget
  1008. should be. A Fl_Widget is allowed to change it's own dimensions in
  1009. layout() (except it is not allowed to change it if called a second
  1010. time with no changes other than it's x/y position). This allows
  1011. widgets to resize to fit their contents.
  1012. The layout bits are turned on by calling Fl_Widget::relayout().
  1013. */
  1014. enum Fl_Layout {
  1015. FL_LAYOUT_X = 0x01, /*!< Fl_Widget::x() changed by resize() */
  1016. FL_LAYOUT_Y = 0x02, /*!< Fl_Widget::y() changed by resize() */
  1017. FL_LAYOUT_XY = 0x03, /*!< Same as FL_LAYOUT_X|FL_LAYOUT_Y */
  1018. FL_LAYOUT_W = 0x04, /*!< Fl_Widget::w() changed by resize() */
  1019. FL_LAYOUT_H = 0x08, /*!< Fl_Widget::h() changed by resize() */
  1020. FL_LAYOUT_WH = 0x0C, /*!< Same as FL_LAYOUT_W|FL_LAYOUT_H */
  1021. FL_LAYOUT_XYWH = 0x0F, /*!< Same as FL_LAYOUT_XY|FL_LAYOUT_WH */
  1022. FL_LAYOUT_CHILD = 0x10, /*!< Fl_Widget::layout() needs to be called on a child of this group widget. */
  1023. FL_LAYOUT_USER = 0x20, /*!< The moving/resizing is being caused by the user and not internal code. */
  1024. FL_LAYOUT_DAMAGE = 0x80 /*!< Fl_Widget::relayout() was called. */
  1025. };
  1026. #endif
  1027. //
  1028. // End of "$Id: Enumerations.H 12450 2017-09-12 15:26:36Z AlbrechtS $".
  1029. //