diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-11-22 19:19:19 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2022-11-22 19:32:54 +0100 |
| commit | ecc47d0cc3e1784e17ac94829202f2bdbd38a682 (patch) | |
| tree | 2519c9b11a598ed4ad1faf9d07c205da5c4903c7 /FL/Enumerations.H | |
| parent | 4daec2a9408c674f8d62f8770ec8c035c25f2294 (diff) | |
Refactor and simplify "arrow drawing" in widgets
"Arrows" in widgets are those GUI elements mostly represented by
triangles pointing in a particular direction as in scrollbars,
choice widgets, some menus, valuators and Fl_Counter widgets.
The code has been simplified and standardized such that all these
GUI elements are drawn identically per FLTK scheme.
Widget authors no longer need to write code to calculate arrow sizes
and draw polygons etc.
Different schemes can and do implement different drawing functions.
Todo: see comments "FIXME_ARROW" in src/Fl_Menu_Button.cxx and
src/Fl_Menu.cxx
Diffstat (limited to 'FL/Enumerations.H')
| -rw-r--r-- | FL/Enumerations.H | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H index 365f3fa3f..11a75947a 100644 --- a/FL/Enumerations.H +++ b/FL/Enumerations.H @@ -1,7 +1,7 @@ // // Enumerations for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2020 by Bill Spitzak and others. +// Copyright 1998-2022 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -1223,4 +1223,57 @@ enum Fl_Damage { // FLTK 1.0.x compatibility definitions (FLTK_1_0_COMPAT) dropped in 1.4.0 +/** Arrow types define the type of arrow drawing function. + + FLTK schemes can draw several graphical elements in their particular way. + One of these elements is an arrow type that can be in different GUI + elements like scrollbars, choice buttons, and FLTK's Fl_Return_Button. + + \note This enum is not yet stable (as of FLTK 1.4.0) and may be changed + without notice as necessary. + + \since 1.4.0 +*/ + +enum Fl_Arrow_Type { + FL_ARROW_SINGLE = 0x01, ///< Single arrow, e.g. in Fl_Scrollbar + FL_ARROW_DOUBLE = 0x02, ///< Double arrow, e.g. in Fl_Counter + FL_ARROW_CHOICE = 0x03, ///< Dropdown box, e.g. in Fl_Choice + FL_ARROW_RETURN = 0x04 ///< Return arrow, e.g. in Fl_Return_Button +}; + +/** Fl_Orientation describes the orientation of a GUI element. + + FLTK schemes can draw several graphical elements, for instance arrows, + pointing at different directions. This enum defines the direction + to use for drawing a particular GUI element. + + The definition of this enum was chosen such that the enum value can + be multiplied by 45 to get a rotation angle in degrees starting + at the horizontal axis (0 = right, 1 = NE, 2 = up, ...) that can be + used with fl_rotate(). Note: angle is counter-clockwise in degrees. + + The 'unspecified' value \b FL_ORIENT_NONE shall be used for elements + that would usually not be rotated, like the return arrow of the + Fl_Return_Button. It can still be used as an angle though since it is + the same value as \p FL_ORIENT_RIGHT (0 degrees). + + \note This enum is not yet stable (as of FLTK 1.4.0) and may be changed + without notice as necessary. + + \since 1.4.0 +*/ + +enum Fl_Orientation { + FL_ORIENT_NONE = 0x00, ///< GUI element direction is unspecified + FL_ORIENT_RIGHT = 0x00, ///< GUI element pointing right ( 0°) + FL_ORIENT_NE = 0x01, ///< GUI element pointing NE ( 45°) + FL_ORIENT_UP = 0x02, ///< GUI element pointing up ( 90°) + FL_ORIENT_NW = 0x03, ///< GUI element pointing NW (135°) + FL_ORIENT_LEFT = 0x04, ///< GUI element pointing left (180°) + FL_ORIENT_SW = 0x05, ///< GUI element pointing SW (225°) + FL_ORIENT_DOWN = 0x06, ///< GUI element pointing down (270°) + FL_ORIENT_SE = 0x07 ///< GUI element pointing SE (315°) +}; + #endif |
