diff options
| author | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 21:32:25 +0500 |
|---|---|---|
| committer | maxim nikonov <maxim.nikonov@hqo.co> | 2026-02-05 21:32:25 +0500 |
| commit | dc39575fb3ef90e5a2689babe7fb335cd88f6727 (patch) | |
| tree | 24f6cef8f2b558ae6f1f812c75be0c09a53fe417 /FL | |
| parent | 7d3793ce1d8cb26e7608bf859beca21359cec6e9 (diff) | |
wip
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Enumerations.H | 3 | ||||
| -rw-r--r-- | FL/Fl.H | 3 | ||||
| -rw-r--r-- | FL/Fl_Color_Chooser.H | 3 | ||||
| -rw-r--r-- | FL/Fl_Help_View.H | 7 | ||||
| -rw-r--r-- | FL/Fl_Plugin.H | 4 | ||||
| -rw-r--r-- | FL/Fl_Preferences.H | 4 | ||||
| -rw-r--r-- | FL/Fl_Table_Row.H | 2 | ||||
| -rw-r--r-- | FL/Fl_Text_Buffer.H | 7 | ||||
| -rw-r--r-- | FL/Fl_Valuator.H | 3 | ||||
| -rw-r--r-- | FL/core/pen_events.H | 284 | ||||
| -rw-r--r-- | FL/filename.H | 17 | ||||
| -rw-r--r-- | FL/fl_ask.H | 20 | ||||
| -rw-r--r-- | FL/names.h | 118 |
13 files changed, 163 insertions, 312 deletions
diff --git a/FL/Enumerations.H b/FL/Enumerations.H index 0557e6a75..e426d90c4 100644 --- a/FL/Enumerations.H +++ b/FL/Enumerations.H @@ -107,8 +107,7 @@ is ok to look at it outside of the handle() method. Event numbers can be converted to their actual names using the - fl_eventnames[] array (std::map since FLTK 1.5) defined - in \#include <FL/names.h> + fl_eventnames[] array defined in \#include <FL/names.h> \see Fl::event_text(), Fl::event_key(), class Fl:: */ @@ -50,7 +50,6 @@ #endif #include <string.h> // FIXME: Fl::is_scheme(): strcmp needs string.h -#include <vector> class Fl_Widget; class Fl_Window; @@ -238,8 +237,6 @@ FL_EXPORT extern void repeat_timeout(double t, Fl_Timeout_Handler cb, void *data FL_EXPORT extern int has_timeout(Fl_Timeout_Handler cb, void *data = 0); FL_EXPORT extern void remove_timeout(Fl_Timeout_Handler cb, void *data = 0); FL_EXPORT extern int remove_next_timeout(Fl_Timeout_Handler cb, void *data = 0, void **data_return = 0); -typedef struct { double t; Fl_Timeout_Handler cb; void *data; } TimeoutData; -FL_EXPORT extern std::vector<TimeoutData> timeout_list(); FL_EXPORT extern void add_check(Fl_Timeout_Handler, void* = 0); FL_EXPORT extern int has_check(Fl_Timeout_Handler, void* = 0); diff --git a/FL/Fl_Color_Chooser.H b/FL/Fl_Color_Chooser.H index 5be4c2c71..2160a4fd4 100644 --- a/FL/Fl_Color_Chooser.H +++ b/FL/Fl_Color_Chooser.H @@ -30,8 +30,6 @@ #include <FL/Fl_Choice.H> #include <FL/Fl_Value_Input.H> -#include <string> - #ifndef FL_DOXYGEN /** For internal use only */ @@ -62,7 +60,6 @@ public: class FL_EXPORT Flcc_Value_Input : public Fl_Value_Input { public: int format(char*); - std::string format_str(); Flcc_Value_Input(int X, int Y, int W, int H) : Fl_Value_Input(X,Y,W,H) {} }; diff --git a/FL/Fl_Help_View.H b/FL/Fl_Help_View.H index 079b6ef83..f636d0598 100644 --- a/FL/Fl_Help_View.H +++ b/FL/Fl_Help_View.H @@ -27,11 +27,6 @@ #include "Fl_Group.H" #include "Fl_Scrollbar.H" -// -// System and C++ header files -// - -#include <memory> // std::unique_ptr<> // // Forward declarations and typedefs @@ -119,7 +114,7 @@ class FL_EXPORT Fl_Help_View : public Fl_Group { private: class Impl; - std::unique_ptr<Impl> impl_; ///< Pointer to the implementation details + Impl *impl_; ///< Pointer to the implementation details Fl_Scrollbar scrollbar_; ///< Vertical scrollbar for document Fl_Scrollbar hscrollbar_; ///< Horizontal scrollbar diff --git a/FL/Fl_Plugin.H b/FL/Fl_Plugin.H index d2b1dd1bd..09daf6f97 100644 --- a/FL/Fl_Plugin.H +++ b/FL/Fl_Plugin.H @@ -22,9 +22,6 @@ #include "Fl_Preferences.H" -#include <string> -#include <vector> - /** \brief Fl_Plugin allows link-time and run-time integration of binary modules. @@ -86,7 +83,6 @@ public: static void removePlugin(Fl_Preferences::ID id); static int load(const char *filename); static int loadAll(const char *dirpath, const char *pattern=0); - static std::vector<std::string> klass_list(); }; diff --git a/FL/Fl_Preferences.H b/FL/Fl_Preferences.H index 92cc966b3..d8fab7fc5 100644 --- a/FL/Fl_Preferences.H +++ b/FL/Fl_Preferences.H @@ -24,8 +24,6 @@ # include "Fl_Export.H" # include "fl_attr.h" -#include <string> - /** \brief Fl_Preferences store user settings between application starts. @@ -242,7 +240,6 @@ public: char set( const char *entry, double value, int precision ); char set( const char *entry, const char *value ); char set( const char *entry, const void *value, int size ); - char set( const char *entry, const std::string &value ); char get( const char *entry, int &value, int defaultValue ); char get( const char *entry, float &value, float defaultValue ); @@ -252,7 +249,6 @@ public: char get( const char *entry, void *&value, const void *defaultValue, int defaultSize ); char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize ); char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int *size ); - char get( const char *entry, std::string &value, const std::string &defaultValue ); int size( const char *entry ); diff --git a/FL/Fl_Table_Row.H b/FL/Fl_Table_Row.H index ec5cd4512..6e17d356f 100644 --- a/FL/Fl_Table_Row.H +++ b/FL/Fl_Table_Row.H @@ -23,7 +23,7 @@ #include <FL/Fl_Table.H> -#include <stdint.h> +#include <stdlib.h> /** A table with row selection capabilities. diff --git a/FL/Fl_Text_Buffer.H b/FL/Fl_Text_Buffer.H index a9365d5c0..e27214a6c 100644 --- a/FL/Fl_Text_Buffer.H +++ b/FL/Fl_Text_Buffer.H @@ -23,7 +23,6 @@ #define FL_TEXT_BUFFER_H #include <stdarg.h> /* va_list */ -#include <string> #include "fl_attr.h" /* Doxygen can't find <FL/fl_attr.h> */ #undef ASSERT_UTF8 @@ -232,12 +231,6 @@ public: char* text() const; /** - \brief Get a copy of the entire contents of the text buffer. - \return text as a UTF-8 string - */ - std::string text_str() const; - - /** Replaces the entire contents of the text buffer. \param text Text must be valid UTF-8. If null, an empty string is substituted. */ diff --git a/FL/Fl_Valuator.H b/FL/Fl_Valuator.H index 5855971fb..cca0495df 100644 --- a/FL/Fl_Valuator.H +++ b/FL/Fl_Valuator.H @@ -24,8 +24,6 @@ #include "Fl_Widget.H" #endif -#include <string> - // shared type() values for classes that work in both directions: #define FL_VERTICAL 0 ///< The valuator can work vertically #define FL_HORIZONTAL 1 ///< The valuator can work horizontally @@ -128,7 +126,6 @@ public: int value(double); virtual int format(char*); - virtual std::string format_str(); double round(double); // round to nearest multiple of step double clamp(double); // keep in range double increment(double, int); // add n*step to value diff --git a/FL/core/pen_events.H b/FL/core/pen_events.H index 48ce47034..39310e4cb 100644 --- a/FL/core/pen_events.H +++ b/FL/core/pen_events.H @@ -26,31 +26,26 @@ #include <FL/Fl_Export.H> // for FL_EXPORT #include <FL/core/function_types.H> // widget callbacks and services -#include <cstdint> +#include <stdint.h> class Fl_Widget; -namespace Fl { - -/** FLTK Pen/Stylus/Tablet input driver API. */ -namespace Pen { - /** \defgroup fl_pen_events Pen and tablet event handling \ingroup fl_events - \brief This chapter documents the Fl::Pen namespace API, declared in <FL/core/pen_events.H> + \brief This chapter documents the Fl_Pen API, declared in <FL/core/pen_events.H> - The FL::Pen namespace contains everything needed to work with a pen type input + The Fl_Pen prefix contains everything needed to work with a pen type input device, either in connection with an external tablet, or as a stylus for drawing directly onto a screen. - To receive pen input, call Fl::Pen::subscribe() for one or more widgets. The - widget will receive a Fl::Pen::ENTER event when the stylus enters the widget - area. By returning 1 to Fl::Pen::ENTER, all further pen events are sent to - this widget, and no mouse events are generated until Fl::Pen::LEAVE. + To receive pen input, call Fl_Pen_subscribe() for one or more widgets. The + widget will receive a FL_PEN_ENTER event when the stylus enters the widget + area. By returning 1 to FL_PEN_ENTER, all further pen events are sent to + this widget, and no mouse events are generated until FL_PEN_LEAVE. - Returning 0 Fl::Pen::ENTER tells FLTK to suppress further pen events until - Fl::Pen::LEAVE, and convert them into mouse events instead. + Returning 0 to FL_PEN_ENTER tells FLTK to suppress further pen events until + FL_PEN_LEAVE, and convert them into mouse events instead. Pen events also set Fl::event_x(), Fl::event_y(), Fl::event_x_root(), Fl::event_y_root(), Fl::event_is_click(), and Fl::event_clicks(). @@ -60,137 +55,77 @@ namespace Pen { /** \brief Bitfield of traits. - This is used in Fl::Pen::driver_traits() and Fl::Pen::pen_traits(). + This is used in Fl_Pen_driver_traits() and Fl_Pen_pen_traits(). */ -enum class Trait : uint32_t { +typedef uint32_t Fl_Pen_Trait; +enum { /// No bits set - NONE = 0x0000, + FL_PEN_TRAIT_NONE = 0x0000, /// Set if FLTK supports tablets and pens on this platform - DRIVER_AVAILABLE = 0x0001, + FL_PEN_TRAIT_DRIVER_AVAILABLE = 0x0001, /// Set after the system detected a pen, stylus, or tablet. This bit may not be /// set until a pen is brought into proximity of the tablet. - DETECTED = 0x0002, + FL_PEN_TRAIT_DETECTED = 0x0002, /// If set, this is a digitizer for a display; if clear, this is a standalone tablet - DISPLAY = 0x0004, + FL_PEN_TRAIT_DISPLAY = 0x0004, /// Driver provides different device IDs for different pens - PEN_ID = 0x0008, + FL_PEN_TRAIT_PEN_ID = 0x0008, /// Pen may have an eraser tip - ERASER = 0x0010, + FL_PEN_TRAIT_ERASER = 0x0010, /// Pen returns a pressure value - PRESSURE = 0x0020, + FL_PEN_TRAIT_PRESSURE = 0x0020, /// Pen returns a barrel pressure value (tangential pressure) - BARREL_PRESSURE = 0x0040, + FL_PEN_TRAIT_BARREL_PRESSURE = 0x0040, /// Pen returns tilt in X direction - TILT_X = 0x0080, + FL_PEN_TRAIT_TILT_X = 0x0080, /// Pen returns tilt in Y direction - TILT_Y = 0x0100, + FL_PEN_TRAIT_TILT_Y = 0x0100, /// Pen returns a twist value - TWIST = 0x0200, + FL_PEN_TRAIT_TWIST = 0x0200, /// Pen returns a proximity value - PROXIMITY = 0x0400, + FL_PEN_TRAIT_PROXIMITY = 0x0400 }; -/** - \brief Bitwise OR operator for Trait enum. - \param lhs Left-hand side trait flags - \param rhs Right-hand side trait flags - \return Combined trait flags - */ -inline constexpr Trait operator|(Trait lhs, Trait rhs) { - return static_cast<Trait>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs)); -} - -/** - \brief Bitwise AND operator for Trait enum. - \param lhs Left-hand side trait flags - \param rhs Right-hand side trait flags - \return Intersection of trait flags - */ -inline constexpr Trait operator&(Trait lhs, Trait rhs) { - return static_cast<Trait>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs)); -} - -/** - \brief Bitwise OR assignment operator for Trait enum. - \param lhs Left-hand side trait flags (modified in place) - \param rhs Right-hand side trait flags - \return Reference to modified lhs - */ -inline Trait& operator|=(Trait& lhs, Trait rhs) { - lhs = lhs | rhs; - return lhs; -} - /** \brief Bitfield of pen state flags. - \see event_state(), event_trigger() + \see Fl_Pen_event_state(), Fl_Pen_event_trigger() */ -enum class State : uint32_t { +typedef uint32_t Fl_Pen_State; +enum { /// No button pressed - NONE = 0x0000, + FL_PEN_STATE_NONE = 0x0000, /// The tip hovers over the surface but does not touch it - TIP_HOVERS = 0x0001, + FL_PEN_STATE_TIP_HOVERS = 0x0001, /// The tip touches the surface - TIP_DOWN = 0x0002, + FL_PEN_STATE_TIP_DOWN = 0x0002, /// The eraser hovers over the surface but does not touch it - ERASER_HOVERS = 0x0004, + FL_PEN_STATE_ERASER_HOVERS = 0x0004, /// The eraser touches the surface - ERASER_DOWN = 0x0008, + FL_PEN_STATE_ERASER_DOWN = 0x0008, /// Barrel button 0, usually the lower button on a pen, is pressed - BUTTON0 = 0x0100, + FL_PEN_STATE_BUTTON0 = 0x0100, /// Barrel button 1, usually the upper button on a pen, is pressed - BUTTON1 = 0x0200, + FL_PEN_STATE_BUTTON1 = 0x0200, /// Barrel button 2 is pressed - BUTTON2 = 0x0400, + FL_PEN_STATE_BUTTON2 = 0x0400, /// Barrel button 3 is pressed - BUTTON3 = 0x0800, + FL_PEN_STATE_BUTTON3 = 0x0800, /// Mask for all buttons, tip, and eraser down - ANY_DOWN = BUTTON0 | BUTTON1 | BUTTON2 | BUTTON3 | TIP_DOWN | ERASER_DOWN, + FL_PEN_STATE_ANY_DOWN = 0x0100 | 0x0200 | 0x0400 | 0x0800 | 0x0002 | 0x0008 }; -/** - \brief Bitwise OR operator for State enum. - \param lhs Left-hand side state flags - \param rhs Right-hand side state flags - \return Combined state flags - */ -inline constexpr State operator|(State lhs, State rhs) { - return static_cast<State>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs)); -} - -/** - \brief Bitwise AND operator for State enum. - \param lhs Left-hand side state flags - \param rhs Right-hand side state flags - \return Intersection of state flags - */ -inline constexpr State operator&(State lhs, State rhs) { - return static_cast<State>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs)); -} - -/** - \brief Bitwise OR assignment operator for State enum. - \param lhs Left-hand side state flags (modified in place) - \param rhs Right-hand side state flags - \return Reference to modified lhs - */ -inline State& operator|=(State& lhs, State rhs) { - lhs = lhs | rhs; - return lhs; -} - /** \brief List of pen events. These events extend the standard Fl_Event enumeration. \see enum Fl_Event */ -enum Event { +enum { /** Pen entered the proximity of the tablet with a new pen. */ - DETECTED = 0x1000, + FL_PEN_DETECTED = 0x1000, /** Pen entered the proximity of the tablet with a known, but changed pen. @@ -198,63 +133,63 @@ enum Event { was disconnected (event_id() == -1). Pen IDs, if supported, are assigned by the tablet manufacturer. */ - CHANGED, + FL_PEN_CHANGED, /** Pen entered the proximity of the tablet with a known pen. */ - IN_RANGE, + FL_PEN_IN_RANGE, /** Pen left the proximity of the tablet. */ - OUT_OF_RANGE, + FL_PEN_OUT_OF_RANGE, /** Pen entered the widget area, either by moving in x/y, or by a proximity change (pen gets closer to the surface). - event_trigger() returns 0, TIP_HOVERS, or ERASER_HOVERS. + Fl_Pen_event_trigger() returns 0, FL_PEN_STATE_TIP_HOVERS, or FL_PEN_STATE_ERASER_HOVERS. */ - ENTER, + FL_PEN_ENTER, /** If no button is pressed, indicates that the pen left the widget area. While any pen button is held down, or the pen touches the surface, Fl::pushed() is set, and the pushed widgets receives DRAG events, even if the pen leaves the widget area. If all buttons are released outside the - widget area, a LEAVE event is sent as well as LIFT or BUTTON_RELEASE. + widget area, a LEAVE event is sent as well as FL_PEN_LIFT or FL_PEN_BUTTON_RELEASE. */ - LEAVE, + FL_PEN_LEAVE, /** Pen went from hovering to touching the surface. - event_trigger() returns TIP_DOWN or ERASER_DOWN. + Fl_Pen_event_trigger() returns FL_PEN_STATE_TIP_DOWN or FL_PEN_STATE_ERASER_DOWN. */ - TOUCH, + FL_PEN_TOUCH, /** Pen went from touching to hovering over the surface. - event_trigger() returns TIP_HOVERS or ERASER_HOVERS. + Fl_Pen_event_trigger() returns FL_PEN_STATE_TIP_HOVERS or FL_PEN_STATE_ERASER_HOVERS. */ - LIFT, + FL_PEN_LIFT, /** Pen moved without touching the surface and no button is pressed. */ - HOVER, + FL_PEN_HOVER, /** Pen moved while touching the surface, or any button is pressed. */ - DRAW, + FL_PEN_DRAW, /** A pen button was pushed. - event_trigger() returns BUTTON0, BUTTON1, BUTTON2, or BUTTON3. + Fl_Pen_event_trigger() returns FL_PEN_STATE_BUTTON0, FL_PEN_STATE_BUTTON1, FL_PEN_STATE_BUTTON2, or FL_PEN_STATE_BUTTON3. */ - BUTTON_PUSH, + FL_PEN_BUTTON_PUSH, /** A pen button was released. - event_trigger() returns BUTTON0, BUTTON1, BUTTON2, or BUTTON3. + Fl_Pen_event_trigger() returns FL_PEN_STATE_BUTTON0, FL_PEN_STATE_BUTTON1, FL_PEN_STATE_BUTTON2, or FL_PEN_STATE_BUTTON3. */ - BUTTON_RELEASE + FL_PEN_BUTTON_RELEASE }; @@ -264,67 +199,67 @@ enum Event { This function returns a bitfield of traits that are supported by the FLTK driver for this platform. If a trait is not supported, the corresponding event value will not return a useful value. Note that even if the FLTK driver support a - trait, the underlying pen device or driver may not. Fl::Pen will return a - known default for those event values. + trait, the underlying pen device or driver may not. The Fl_Pen API will return + a known default for those event values. The bitfield returned is static. \return a bitfield of supported traits - \see pen_traits() + \see Fl_Pen_pen_traits() */ -FL_EXPORT extern Trait driver_traits(); +FL_EXPORT Fl_Pen_Trait Fl_Pen_driver_traits(void); /** - \brief Return true if the corresponding bit is set in the driver traits. + \brief Return non-zero if the corresponding bit is set in the driver traits. \param[in] bits check for one or more trait bits - \return true if any bit is set + \return non-zero if any bit is set */ -inline bool driver_traits(Trait bits) { - return ((driver_traits() & bits) != Trait::NONE); +inline int Fl_Pen_driver_traits_check(Fl_Pen_Trait bits) { + return ((Fl_Pen_driver_traits() & bits) != FL_PEN_TRAIT_NONE); } /** \brief Query traits of the current pen or stylus. The value returned by this function may change when pens change or when more information becomes known about the currently used pen. - \param[in] pen_id a know pen ID as returned from event_pen_id(), + \param[in] pen_id a know pen ID as returned from Fl_Pen_event_pen_id(), or 0 for the current pen \return a bitfield of supported traits */ -FL_EXPORT extern Trait pen_traits(int pen_id = 0); +FL_EXPORT Fl_Pen_Trait Fl_Pen_pen_traits(int pen_id); /** - \brief Return true if the corresponding bit is set in the pen traits. + \brief Return non-zero if the corresponding bit is set in the pen traits. \param[in] bits check for one or more trait bits - \param[in] pen_id a know pen ID as returned from event_pen_id(), + \param[in] pen_id a know pen ID as returned from Fl_Pen_event_pen_id(), or 0 for the current pen - \return true if any bit is set + \return non-zero if any bit is set */ -inline bool pen_traits(Trait bits, int pen_id = 0) { - return ((pen_traits() & bits) != Trait::NONE); +inline int Fl_Pen_pen_traits_check(Fl_Pen_Trait bits, int pen_id) { + return ((Fl_Pen_pen_traits(pen_id) & bits) != FL_PEN_TRAIT_NONE); } /** - \brief Receives a Pen::ENTER event when the pen enters this widget. + \brief Receives a FL_PEN_ENTER event when the pen enters this widget. Multiple widgets may subscribe to pen events. Additional subscription requests for the same widget are ignored. \param widget The widget subscribing to pen events. */ -FL_EXPORT extern void subscribe(Fl_Widget* widget); +FL_EXPORT void Fl_Pen_subscribe(Fl_Widget* widget); /** - \brief Stop receiving Pen::ENTER for this widget. + \brief Stop receiving FL_PEN_ENTER for this widget. Deleting a widget will automatically unsubscribe it. \param widget Widget to unsubscribe from pen events */ -FL_EXPORT extern void unsubscribe(Fl_Widget* widget); +FL_EXPORT void Fl_Pen_unsubscribe(Fl_Widget* widget); /** Clear the "pushed" state and forward pen events as mouse events. Call this if another window is popped up during pen event handling, so mouse event handling can resume normal. */ -FL_EXPORT extern void release(); +FL_EXPORT void Fl_Pen_release(void); /// \name Query values during event handling /// @{ @@ -337,9 +272,9 @@ FL_EXPORT extern void release(); \return Pen position as floating-point coordinate, defaults to 0.0 \see Fl::event_x(), Fl::event_y() */ -FL_EXPORT extern double event_x(); -/** \brief Returns pen Y coordinate in widget space, see event_x(). */ -FL_EXPORT extern double event_y(); +FL_EXPORT double Fl_Pen_event_x(void); +/** \brief Returns pen Y coordinate in widget space, see Fl_Pen_event_x(). */ +FL_EXPORT double Fl_Pen_event_y(void); /** \brief Returns the pen x and y position in global coordinates as doubles. @@ -347,31 +282,31 @@ FL_EXPORT extern double event_y(); \return Pen position as floating-point coordinate in screen space, defaults to 0.0 \see Fl::event_x_root(), Fl::event_y_root() */ -FL_EXPORT extern double event_x_root(); -/** \brief Returns pen Y coordinate in screen space, see event_x_root(). */ -FL_EXPORT extern double event_y_root(); +FL_EXPORT double Fl_Pen_event_x_root(void); +/** \brief Returns pen Y coordinate in screen space, see Fl_Pen_event_x_root(). */ +FL_EXPORT double Fl_Pen_event_y_root(void); /** \brief Returns the ID of the pen used in the last event. \return Unique pen identifier, or -1 if pen was removed, defaults to 0 - \see Trait::PEN_ID + \see FL_PEN_TRAIT_PEN_ID */ -FL_EXPORT extern int event_pen_id(); +FL_EXPORT int Fl_Pen_event_pen_id(void); /** \brief Returns the pressure between the tip or eraser and the surface. \return pressure value from 0.0 (no pressure) to 1.0 (maximum pressure), defaults to 1.0. - \see Trait::PRESSURE + \see FL_PEN_TRAIT_PRESSURE */ -FL_EXPORT extern double event_pressure(); +FL_EXPORT double Fl_Pen_event_pressure(void); /** \brief Returns barrel pressure or tangential pressure. \return Pressure value from -1.0 to 1.0 , defaults to 0.0 . - \see Trait::BARREL_PRESSURE + \see FL_PEN_TRAIT_BARREL_PRESSURE */ -FL_EXPORT extern double event_barrel_pressure(); +FL_EXPORT double Fl_Pen_event_barrel_pressure(void); /** \brief Returns the tilt of the pen in the x and y directions between -1 and 1. @@ -384,61 +319,56 @@ FL_EXPORT extern double event_barrel_pressure(); it tilts toward the user. \return Tilt value from -1.0 to 1.0, defaults to 0.0 - \see Trait::TILT_X, Trait::TILT_Y + \see FL_PEN_TRAIT_TILT_X, FL_PEN_TRAIT_TILT_Y */ -FL_EXPORT extern double event_tilt_x(); -/** \brief Returns pen Y-axis tilt, see event_tilt_x() */ -FL_EXPORT extern double event_tilt_y(); +FL_EXPORT double Fl_Pen_event_tilt_x(void); +/** \brief Returns pen Y-axis tilt, see Fl_Pen_event_tilt_x() */ +FL_EXPORT double Fl_Pen_event_tilt_y(void); /** \brief Returns the pen's axial rotation in degrees. The twist angle is reported in degrees, with: - - 0° : pen’s “top” (the button side) facing upward - - +180° : twisted halfway clockwise, looking at the end of the pen toward the tip - - –180° → twisted half way counter clockwise - So the full range is usually –180° to +180°. + - 0 deg : pen's "top" (the button side) facing upward + - +180 deg : twisted halfway clockwise, looking at the end of the pen toward the tip + - -180 deg : twisted half way counter clockwise + So the full range is usually -180 to +180. \return Twist angle in degrees, defaults to 0.0. - \see Trait::TWIST + \see FL_PEN_TRAIT_TWIST */ -FL_EXPORT extern double event_twist(); +FL_EXPORT double Fl_Pen_event_twist(void); /** \brief Returns the proximity of the pen to the surface between 0 and 1. A proximity of 0 is closest to the surface, 1 is farthest away. \return Proximity value from 0.0 (touching) to 1.0 (far away), defaults to 0.0 . - \see Trait::PROXIMITY + \see FL_PEN_TRAIT_PROXIMITY */ -FL_EXPORT extern double event_proximity(); +FL_EXPORT double Fl_Pen_event_proximity(void); /** \brief Returns the state of the various buttons and tips. - \return Current state flags (combination of State values) + \return Current state flags (combination of Fl_Pen_State values) */ -FL_EXPORT extern State event_state(); +FL_EXPORT Fl_Pen_State Fl_Pen_event_state(void); /** - \brief Return true if any of the bits are set in the event state. + \brief Return non-zero if any of the bits are set in the event state. \param[in] bits check for one or more event state bits - \return true if any bit is set + \return non-zero if any bit is set */ -inline bool event_state(State bits) { - return ((event_state() & bits) != State::NONE); +inline int Fl_Pen_event_state_check(Fl_Pen_State bits) { + return ((Fl_Pen_event_state() & bits) != FL_PEN_STATE_NONE); } /** \brief Returns the state change that triggered the event. \return a state with one bit set for the action that triggered this event */ -FL_EXPORT extern State event_trigger(); +FL_EXPORT Fl_Pen_State Fl_Pen_event_trigger(void); /** @} */ // group fl_pen_events -} // namespace Pen - -} // namespace Fl - - /* Resources: diff --git a/FL/filename.H b/FL/filename.H index 74ef1c91c..4aae10275 100644 --- a/FL/filename.H +++ b/FL/filename.H @@ -31,11 +31,6 @@ #include <FL/platform_types.h> #ifdef __cplusplus - -// The following include is not (yet) used in FLTK 1.4 -// In FLTK 1.5 or 4.0 using std::string would be default. -// #include <string> - #endif /* __cplusplus */ /** \addtogroup filenames File names and URI utility functions @@ -72,18 +67,6 @@ FL_EXPORT int fl_filename_isdir(const char *name); FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from, const char *cwd); FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd); -#include <string> - -FL_EXPORT std::string fl_filename_name_str(const std::string &filename); -FL_EXPORT std::string fl_filename_path_str(const std::string &filename); -FL_EXPORT std::string fl_filename_ext_str(const std::string &filename); -FL_EXPORT std::string fl_filename_setext_str(const std::string &filename, const std::string &new_extension); -FL_EXPORT std::string fl_filename_expand_str(const std::string &from); -FL_EXPORT std::string fl_filename_absolute_str(const std::string &from); -FL_EXPORT std::string fl_filename_absolute_str(const std::string &from, const std::string &base); -FL_EXPORT std::string fl_filename_relative_str(const std::string &from); -FL_EXPORT std::string fl_filename_relative_str(const std::string &from, const std::string &base); -FL_EXPORT std::string fl_getcwd_str(); # endif /* defined(__cplusplus) */ diff --git a/FL/fl_ask.H b/FL/fl_ask.H index d596e9347..9ff169521 100644 --- a/FL/fl_ask.H +++ b/FL/fl_ask.H @@ -24,8 +24,6 @@ #include <FL/Enumerations.H> #include <FL/fl_attr.h> -#include <string> - // Note to FLTK developers: fl_ask() had been deprecated since FLTK 1.1.7 // (released Jan 17, 2006 !) but was still available in FLTK 1.4.x. // FLTK 1.5 disables it by using an *undocumented* preprocessor macro. @@ -95,24 +93,6 @@ FL_EXPORT const char *fl_input(int maxchar, const char *label, const char *deflt FL_EXPORT const char *fl_password(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 2, 4))); -// since FLTK 1.4.0 -- optional -// since FLTK 1.5.0 -- always - -// - fl_input_str() with limited input size, returns std::string -// - fl_password_str() with limited input size, returns std::string - -FL_EXPORT std::string fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...) - __fl_attr((__format__(__printf__, 2, 4))); - -FL_EXPORT std::string fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) - __fl_attr((__format__(__printf__, 3, 5))); - -FL_EXPORT std::string fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...) - __fl_attr((__format__(__printf__, 2, 4))); - -FL_EXPORT std::string fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) - __fl_attr((__format__(__printf__, 3, 5))); - FL_EXPORT Fl_Widget *fl_message_icon(); extern FL_EXPORT Fl_Font fl_message_font_; extern FL_EXPORT Fl_Fontsize fl_message_size_; diff --git a/FL/names.h b/FL/names.h index 33bc6caa4..0cdc9edea 100644 --- a/FL/names.h +++ b/FL/names.h @@ -25,8 +25,6 @@ #define FL_NAMES_H #include <FL/Fl.H> // for event constants -#include <string> -#include <map> /** \defgroup fl_events Events handling functions @{ @@ -47,63 +45,53 @@ } \endcode */ -static std::map<int, const char*> fl_eventnames = { - { FL_NO_EVENT, "FL_NO_EVENT" }, - { FL_PUSH, "FL_PUSH" }, - { FL_RELEASE, "FL_RELEASE" }, - { FL_ENTER, "FL_ENTER" }, - { FL_LEAVE, "FL_LEAVE" }, - { FL_DRAG, "FL_DRAG" }, - { FL_FOCUS, "FL_FOCUS" }, - { FL_UNFOCUS, "FL_UNFOCUS" }, - { FL_KEYDOWN, "FL_KEYDOWN" }, - { FL_KEYUP, "FL_KEYUP" }, - { FL_CLOSE, "FL_CLOSE" }, - { FL_MOVE, "FL_MOVE" }, - { FL_SHORTCUT, "FL_SHORTCUT" }, - { FL_DEACTIVATE, "FL_DEACTIVATE" }, - { FL_ACTIVATE, "FL_ACTIVATE" }, - { FL_HIDE, "FL_HIDE" }, - { FL_SHOW, "FL_SHOW" }, - { FL_PASTE, "FL_PASTE" }, - { FL_SELECTIONCLEAR, "FL_SELECTIONCLEAR" }, - { FL_MOUSEWHEEL, "FL_MOUSEWHEEL" }, - { FL_DND_ENTER, "FL_DND_ENTER" }, - { FL_DND_DRAG, "FL_DND_DRAG" }, - { FL_DND_LEAVE, "FL_DND_LEAVE" }, - { FL_DND_RELEASE, "FL_DND_RELEASE" }, - { FL_SCREEN_CONFIGURATION_CHANGED, "FL_SCREEN_CONFIGURATION_CHANGED" }, - { FL_FULLSCREEN, "FL_FULLSCREEN" }, - { FL_ZOOM_GESTURE, "FL_ZOOM_GESTURE" }, - { FL_ZOOM_EVENT, "FL_ZOOM_EVENT" }, - { FL_BEFORE_TOOLTIP, "FL_BEFORE_TOOLTIP" }, - { FL_BEFORE_MENU, "FL_BEFORE_MENU" }, - { FL_APP_ACTIVATE, "FL_APP_ACTIVATE" }, - { FL_APP_DEACTIVATE, "FL_APP_DEACTIVATE" }, - { Fl::Pen::DETECTED, "Fl::Pen::DETECTED" }, - { Fl::Pen::CHANGED, "Fl::Pen::CHANGED" }, - { Fl::Pen::ENTER, "Fl::Pen::ENTER" }, - { Fl::Pen::LEAVE, "Fl::Pen::LEAVE" }, - { Fl::Pen::TOUCH, "Fl::Pen::TOUCH" }, - { Fl::Pen::LIFT, "Fl::Pen::LIFT" }, - { Fl::Pen::HOVER, "Fl::Pen::HOVER" }, - { Fl::Pen::DRAW, "Fl::Pen::DRAW" }, - { Fl::Pen::BUTTON_PUSH, "Fl::Pen::BUTTON_PUSH" }, - { Fl::Pen::BUTTON_RELEASE, "Fl::Pen::BUTTON_RELEASE" } +static const char * const fl_eventnames[] = { + "FL_NO_EVENT", + "FL_PUSH", + "FL_RELEASE", + "FL_ENTER", + "FL_LEAVE", + "FL_DRAG", + "FL_FOCUS", + "FL_UNFOCUS", + "FL_KEYDOWN", + "FL_KEYUP", + "FL_CLOSE", + "FL_MOVE", + "FL_SHORTCUT", + "FL_DEACTIVATE", + "FL_ACTIVATE", + "FL_HIDE", + "FL_SHOW", + "FL_PASTE", + "FL_SELECTIONCLEAR", + "FL_MOUSEWHEEL", + "FL_DND_ENTER", + "FL_DND_DRAG", + "FL_DND_LEAVE", + "FL_DND_RELEASE", + "FL_SCREEN_CONFIGURATION_CHANGED", + "FL_FULLSCREEN", + "FL_ZOOM_GESTURE", + "FL_ZOOM_EVENT", + "FL_BEFORE_TOOLTIP", + "FL_BEFORE_MENU", + "FL_APP_ACTIVATE", + "FL_APP_DEACTIVATE" }; +#define FL_EVENTNAMES_MAX 32 + /** Return the C++ symbol of an Fl_Event as a string. \param[in] event index as an integer - \return C++ symbol of event index as a string + \return C++ symbol of event index as a string, or 0 if out of range */ -inline std::string fl_eventname_str(int event) { - auto it = fl_eventnames.find(event); - if (it == fl_eventnames.end()) { - return "FL_EVENT_" + std::to_string(event); - } else { - return it->second; +inline const char *fl_eventname(int event) { + if (event >= 0 && event < FL_EVENTNAMES_MAX) { + return fl_eventnames[event]; } + return 0; } @@ -147,14 +135,13 @@ const char * const fl_fontnames[] = /** Return the C++ symbol of an Fl_Font as a string. \param[in] font index as an integer - \return C++ symbol of font index as a string + \return C++ symbol of font index as a string, or 0 if out of range */ -inline std::string fl_fontname_str(int font) { - if ((font < 0) || (font >= FL_ZAPF_DINGBATS)) { - return "FL_FONT_" + std::to_string(font); - } else { +inline const char *fl_fontname(int font) { + if (font >= 0 && font <= FL_ZAPF_DINGBATS) { return fl_fontnames[font]; } + return 0; } @@ -178,23 +165,24 @@ const char * const fl_callback_reason_names[] = "FL_REASON_LOST_FOCUS", "FL_REASON_RELEASED", "FL_REASON_ENTER_KEY", - NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, "FL_REASON_USER", "FL_REASON_USER+1", "FL_REASON_USER+2", "FL_REASON_USER+3", }; +#define FL_REASON_NAMES_MAX 36 + /** Return the C++ symbol of an Fl_Callback_Reason as a string. \param[in] reason as an integer - \return C++ symbol of reason as a string + \return C++ symbol of reason as a string, or 0 if out of range or invalid */ -inline std::string fl_callback_reason_str(int reason) { - if ((reason < 0) || (reason >= FL_REASON_USER+3) || (fl_callback_reason_names[reason] == 0)) { - return "FL_REASON_" + std::to_string(reason); - } else { +inline const char *fl_callback_reason_name(int reason) { + if (reason >= 0 && reason < FL_REASON_NAMES_MAX) { return fl_callback_reason_names[reason]; } + return 0; } /** @} */ |
