From cdb51045dda7076be33147cc8e9138035ad9b97e Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 27 Jan 2022 23:50:06 +0100 Subject: Background color attribute for Fl_Text_Display. (#378) * Background color attribute for Fl_Text_Display. * Adding attributes. * Avoid clipping horizontal * Fl_Text_Display underlining. * Better line positions * Typos, testing. * Documentation. --- FL/Fl_Text_Display.H | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Text_Display.H b/FL/Fl_Text_Display.H index 58d71ea94..375ee4eed 100644 --- a/FL/Fl_Text_Display.H +++ b/FL/Fl_Text_Display.H @@ -142,10 +142,25 @@ public: \see Fl_Text_Display::highlight_data() */ struct Style_Table_Entry { - Fl_Color color; ///< text color - Fl_Font font; ///< text font - Fl_Fontsize size; ///< text font size - unsigned attr; ///< currently unused (this may be changed in the future) + Fl_Color color; ///< text color + Fl_Font font; ///< text font + Fl_Fontsize size; ///< text font size + unsigned attr; ///< further attributes for the text style (see `ATTR_BGCOLOR`, etc.) + Fl_Color bgcolor; ///< text background color if `ATTR_BGCOLOR` or `ATTR_BGCOLOR_EXT` is set + }; + + /** + attribute flags in `Style_Table_Entry.attr` + */ + enum { + ATTR_BGCOLOR = 0x0001, ///< use the background color in the `bgcolor` field + ATTR_BGCOLOR_EXT_ = 0x0002, ///< (internal use) + ATTR_BGCOLOR_EXT = 0x0003, ///< extend background color to the end of the line + ATTR_UNDERLINE = 0x0004, ///< a single underline, underline types are mutually exclusive + ATTR_GRAMMAR = 0x0008, ///< grammar suggestion (blue dotted underline) + ATTR_SPELLING = 0x000C, ///< spelling suggestion (red dotted underline) + ATTR_STRIKE_THROUGH = 0x0010, ///< line through the middle of the text + ATTR_LINES_MASK = 0x001C, ///< the mask for all underline and strike through types }; Fl_Text_Display(int X, int Y, int W, int H, const char *l = 0); -- cgit v1.2.3