From b65d3a249d4db1ada6d0bc96031e55459e0d6381 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 1 Sep 2020 12:33:11 +0200 Subject: Customize corner radius for rounded box/frame (#130) Make maximum box corner radius and shadow width configurable. See Fl::box_border_radius_max() and Fl::box_shadow_width(). Documentation: update image of box types. Fixes #130 --- FL/Fl.H | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'FL') diff --git a/FL/Fl.H b/FL/Fl.H index 4221d9588..fae394012 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -133,6 +133,8 @@ private: static int use_high_res_GL_; static int draw_GL_text_with_textures_; + static int box_shadow_width_; + static int box_border_radius_max_; public: @@ -141,6 +143,34 @@ public: static void reset_marked_text(); // resets marked text static void insertion_point_location(int x, int y, int height); // sets window coordinates & height of insertion point + /** Get the box shadow width of all "shadow" boxtypes in pixels. + \since 1.4.0 + */ + static int box_shadow_width() { return box_shadow_width_; } + /** Set the box shadow width of all "shadow" boxtypes in pixels. + Must be at least 1, default = 3. There is no upper limit. + \since 1.4.0 + */ + static void box_shadow_width(int W) { box_shadow_width_ = W < 1 ? 1 : W; } + + /** Get the maximum border radius of all "rounded" boxtypes in pixels. + \since 1.4.0 + */ + static int box_border_radius_max() { return box_border_radius_max_; } + /** Set the maximum border radius of all "rounded" boxtypes in pixels. + Must be at least 5, default = 15. + + \note This does \b not apply to the "round" boxtypes which have really round sides + (i.e. composed of half circles) as opposed to "rounded" boxtypes that have only + rounded corners with a straight border between corners. + + The box border radius of "rounded" boxtypes is typically calculated as about 2/5 of + the box height or width, whichever is smaller. The upper limit can be set by this + method for all "rounded" boxtypes. + \since 1.4.0 + */ + static void box_border_radius_max(int R) { box_border_radius_max_ = R < 5 ? 5 : R; } + public: // run time information about compile time configuration /** \defgroup cfg_gfx runtime graphics driver configuration */ /** @{ */ -- cgit v1.2.3