diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H index 6ba1405de..985eacc9b 100644 --- a/FL/Fl_Browser.H +++ b/FL/Fl_Browser.H @@ -1,7 +1,7 @@ // // Browser header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2023 by Bill Spitzak and others. +// Copyright 1998-2026 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 @@ -135,9 +135,12 @@ protected: void*& bline_data(FL_BLINE* b) const; const void* bline_data(const FL_BLINE* b) const; char& bline_flags(FL_BLINE* b) const; - const char bline_flags(const FL_BLINE* b) const; + char bline_flags(const FL_BLINE* b) const; char* bline_txt(FL_BLINE* b) const; const char* bline_txt(const FL_BLINE* b) const; + Fl_Image*& bline_icon(FL_BLINE* b) const; + const Fl_Image* bline_icon(const FL_BLINE* b) const; + short bline_length(const FL_BLINE* b) const; public: diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx index a3e43de32..ab905ff0a 100644 --- a/src/Fl_Browser.cxx +++ b/src/Fl_Browser.cxx @@ -40,18 +40,55 @@ struct FL_BLINE { // data is in a linked list of these FL_BLINE* next; void* data; Fl_Image* icon; - short length; // sizeof(txt)-1, may be longer than string + short length; // allocated size of txt[] (excl. null terminator); current string may be shorter char flags; // selected, displayed char txt[1]; // start of allocated array }; -/** FL_BLINE access without publishing struct FL_BLINE */ -void*& Fl_Browser::bline_data(FL_BLINE* b) const { return b->data; } -const void* Fl_Browser::bline_data(const FL_BLINE* b) const { return b->data; } -char& Fl_Browser::bline_flags(FL_BLINE* b) const { return b->flags; } -const char Fl_Browser::bline_flags(const FL_BLINE* b) const { return b->flags; } -char* Fl_Browser::bline_txt(FL_BLINE* b) const { return b->txt; } -const char* Fl_Browser::bline_txt(const FL_BLINE* b) const { return b->txt; } +/** Get writable reference to FL_BLINE data. */ +void*& Fl_Browser::bline_data(FL_BLINE* b) const { + return b->data; +} + +/** Get FL_BLINE data. */ +const void* Fl_Browser::bline_data(const FL_BLINE* b) const { + return b->data; +} + +/** Get writable reference to FL_BLINE flags. */ +char& Fl_Browser::bline_flags(FL_BLINE* b) const { + return b->flags; +} + +/** Get FL_BLINE flags. */ +char Fl_Browser::bline_flags(const FL_BLINE* b) const { + return b->flags; +} + +/** Get writable reference to FL_BLINE text. */ +char* Fl_Browser::bline_txt(FL_BLINE* b) const { + return b->txt; +} + +/** Get FL_BLINE text. */ +const char* Fl_Browser::bline_txt(const FL_BLINE* b) const { + return b->txt; +} + +/** Get writable reference to FL_BLINE icon. */ +Fl_Image*& Fl_Browser::bline_icon(FL_BLINE* b) const { + return b->icon; +} + +/** Get FL_BLINE icon. */ +const Fl_Image* Fl_Browser::bline_icon(const FL_BLINE* b) const { + return b->icon; +} + +/** Get FL_BLINE allocated text buffer size (excl. null terminator). */ +short Fl_Browser::bline_length(const FL_BLINE* b) const { + return b->length; +} /**