summaryrefslogtreecommitdiff
path: root/src/Fl_Tree_Item.cxx
diff options
context:
space:
mode:
authorCyprinus Carpio <cregams@gmail.com>2024-06-30 18:08:00 +0200
committerGitHub <noreply@github.com>2024-06-30 09:08:00 -0700
commita69c5c5c925bb1521d894ef72ca7d99fb2f8f3aa (patch)
tree47f12a31f82b814d7ef175d3b94430a7ab1c1326 /src/Fl_Tree_Item.cxx
parent1c6a0c1a8fb254945179276ecbd359cc1926fbb1 (diff)
Fl_Tree +/- buttons are no longer drawn using bitmaps, different default line color (#995)
Fl_Tree changed to support system color themes (PR #995) merging CyprinusCarpio's mods carried over from from issue #972. * Fl_Tree: use named (colormap) colors to support system color themes (see issue #972). changed connectorcolor() default from gray ramp color to FL_INACTIVE_COLOR (Fl_Color(8)), and similar named colormap colors for icon drawing. * Fl_Tree ⊞ / ⊟ icons (and on macs, ▶ / ▼icons) are now drawn w/fl_draw() functions instead of with xpm bitmaps for colormap control --------- Co-authored-by: Greg Ercolano <erco@seriss.com>
Diffstat (limited to 'src/Fl_Tree_Item.cxx')
-rw-r--r--src/Fl_Tree_Item.cxx29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/Fl_Tree_Item.cxx b/src/Fl_Tree_Item.cxx
index 544170a32..a9e192692 100644
--- a/src/Fl_Tree_Item.cxx
+++ b/src/Fl_Tree_Item.cxx
@@ -9,6 +9,7 @@
#include <FL/Fl_Tree_Prefs.H>
#include <FL/Fl_Tree.H>
#include <FL/fl_string_functions.h>
+#include "Fl_System_Driver.H"
//////////////////////
// Fl_Tree_Item.cxx
@@ -804,7 +805,7 @@ Fl_Tree_Item *Fl_Tree_Item::find_clicked(const Fl_Tree_Prefs &prefs, int yonly)
/// - visibility (if !is_visible(), returns 0)
/// - labelfont() height: if label() != NULL
/// - widget() height: if widget() != NULL
-/// - openicon() height (if not NULL)
+/// - openicon() height (if has children)
/// - usericon() height (if not NULL)
/// Does NOT include Fl_Tree::linespacing();
/// \returns maximum pixel height
@@ -821,8 +822,8 @@ int Fl_Tree_Item::calc_item_height(const Fl_Tree_Prefs &prefs) const {
H < widget()->h()) {
H = widget()->h();
}
- if ( has_children() && prefs.openicon() && H<prefs.openicon()->h() )
- H = prefs.openicon()->h();
+ if ( has_children() && H < prefs.openicon_h() )
+ H = prefs.openicon_h();
if ( usericon() && H<usericon()->h() )
H = usericon()->h();
return(H);
@@ -990,13 +991,13 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
// We don't care about items clipped off the viewport; they won't get mouse events.
//
int item_y_center = Y+(H/2);
- _collapse_xywh[2] = prefs.openicon()->w();
+ _collapse_xywh[2] = prefs.openicon_w();
int &icon_w = _collapse_xywh[2];
_collapse_xywh[0] = X + (icon_w + prefs.connectorwidth())/2 - 3;
int &icon_x = _collapse_xywh[0];
- _collapse_xywh[1] = item_y_center - (prefs.openicon()->h()/2);
+ _collapse_xywh[1] = item_y_center - prefs.openicon_h()/2;
int &icon_y = _collapse_xywh[1];
- _collapse_xywh[3] = prefs.openicon()->h();
+ _collapse_xywh[3] = prefs.openicon_h();
// Horizontal connector values
// Must calculate these even if(clipped) because 'draw children' code (below)
@@ -1080,11 +1081,19 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus,
if ( render && has_children() && prefs.showcollapse() ) {
// Draw icon image
if ( is_open() ) {
- if ( active ) prefs.closeicon()->draw(icon_x,icon_y);
- else prefs.closedeicon()->draw(icon_x,icon_y);
+ if ( prefs.closeicon() ) {
+ if ( active ) prefs.closeicon()->draw(icon_x, icon_y);
+ else prefs.closedeicon()->draw(icon_x, icon_y);
+ } else {
+ Fl::system_driver()->tree_draw_expando_button(icon_x, icon_y, false, active);
+ }
} else {
- if ( active ) prefs.openicon()->draw(icon_x,icon_y);
- else prefs.opendeicon()->draw(icon_x,icon_y);
+ if ( prefs.openicon() ) {
+ if ( active ) prefs.openicon()->draw(icon_x, icon_y);
+ else prefs.opendeicon()->draw(icon_x, icon_y);
+ } else {
+ Fl::system_driver()->tree_draw_expando_button(icon_x, icon_y, true, active);
+ }
}
}
// Draw user icon (if any)