summaryrefslogtreecommitdiff
path: root/src/Fl_File_Browser.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-11-25 18:20:02 +0100
committerMatthias Melcher <github@matthiasm.com>2023-11-25 18:20:08 +0100
commit34ed30fe1a710f6294e23003aa385bd6da6cb326 (patch)
tree4fb8628a64a3c2943b23a9f7646206cb38bba69a /src/Fl_File_Browser.cxx
parent00808500926af83a531fc1fdc0b2df9716743e8b (diff)
Adds `linespacing()` to `Fl_Browser_` and all derived widgets
Diffstat (limited to 'src/Fl_File_Browser.cxx')
-rw-r--r--src/Fl_File_Browser.cxx28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/Fl_File_Browser.cxx b/src/Fl_File_Browser.cxx
index e3a70aa3b..c37ea8aa3 100644
--- a/src/Fl_File_Browser.cxx
+++ b/src/Fl_File_Browser.cxx
@@ -76,7 +76,7 @@ Fl_File_Browser::full_height() const
for (i = 0, th = 0; i < size(); i ++)
- th += item_height(find_line(i));
+ th += item_height(find_line(i)) + linespacing();
return (th);
}
@@ -234,7 +234,7 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
int X, // I - Upper-lefthand X coordinate
int Y, // I - Upper-lefthand Y coordinate
int W, // I - Width of item
- int) const // I - Height of item
+ int H) const// I - Height of item
{
int i; // Looping var
FL_BLINE *line; // Pointer to line
@@ -271,25 +271,23 @@ Fl_File_Browser::item_draw(void *p, // I - List item data
{
// Draw the icon if it is set...
if (line->data)
- ((Fl_File_Icon *)line->data)->draw(X, Y, iconsize_, iconsize_,
- (line->flags & SELECTED) ? FL_YELLOW :
+ ((Fl_File_Icon *)line->data)->draw(X, Y + (H - iconsize_) / 2,
+ iconsize_, iconsize_,
+ (line->flags & SELECTED) ? FL_YELLOW :
FL_LIGHT2,
- active_r());
+ active_r());
// Draw the text offset to the right...
X += iconsize_ + 9;
W -= iconsize_ - 10;
-
- // Center the text vertically...
- height = fl_height();
-
- for (t = line->txt; *t != '\0'; t ++)
- if (*t == '\n')
- height += fl_height();
-
- if (height < iconsize_)
- Y += (iconsize_ - height) / 2;
}
+ // Center the text vertically...
+ height = fl_height();
+
+ for (t = line->txt; *t != '\0'; t ++)
+ if (*t == '\n')
+ height += fl_height();
+ Y += (H - height) / 2;
// Draw the text...
line = (FL_BLINE *)p;