Completing access to FL_BLINE in Fl_Browser.
Build and Test / build-linux (push) Has been cancelled
Build and Test / build-wayland (push) Has been cancelled
Build and Test / build-macos (push) Has been cancelled
Build and Test / build-windows (push) Has been cancelled

May be used by derived classes like Fl_File_Browser
for fast access.
This commit is contained in:
Matthias Melcher
2026-04-27 01:02:47 +02:00
parent f1b81f8a55
commit 4f9d7794f8
2 changed files with 50 additions and 10 deletions
+5 -2
View File
@@ -1,7 +1,7 @@
// //
// Browser header file for the Fast Light Tool Kit (FLTK). // 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 // 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 // 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; void*& bline_data(FL_BLINE* b) const;
const void* bline_data(const FL_BLINE* b) const; const void* bline_data(const FL_BLINE* b) const;
char& bline_flags(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; char* bline_txt(FL_BLINE* b) const;
const char* bline_txt(const 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: public:
+45 -8
View File
@@ -40,18 +40,55 @@ struct FL_BLINE { // data is in a linked list of these
FL_BLINE* next; FL_BLINE* next;
void* data; void* data;
Fl_Image* icon; 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 flags; // selected, displayed
char txt[1]; // start of allocated array char txt[1]; // start of allocated array
}; };
/** FL_BLINE access without publishing struct FL_BLINE */ /** Get writable reference to FL_BLINE data. */
void*& Fl_Browser::bline_data(FL_BLINE* b) const { return b->data; } void*& Fl_Browser::bline_data(FL_BLINE* b) const {
const void* Fl_Browser::bline_data(const FL_BLINE* b) const { return b->data; } 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; } /** Get FL_BLINE data. */
const char* Fl_Browser::bline_txt(const FL_BLINE* b) const { return b->txt; } 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;
}
/** /**