diff options
| author | Cyprinus Carpio <cregams@gmail.com> | 2024-06-30 18:08:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-30 09:08:00 -0700 |
| commit | a69c5c5c925bb1521d894ef72ca7d99fb2f8f3aa (patch) | |
| tree | 47f12a31f82b814d7ef175d3b94430a7ab1c1326 /src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | |
| parent | 1c6a0c1a8fb254945179276ecbd359cc1926fbb1 (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/drivers/Darwin/Fl_Darwin_System_Driver.cxx')
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | 49 |
1 files changed, 6 insertions, 43 deletions
diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index c44ba34c1..9b6a2a694 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -21,6 +21,7 @@ #include <FL/Fl_Tree_Prefs.H> #include <FL/Fl_Pixmap.H> #include <FL/platform.H> +#include <FL/fl_draw.H> #include "../../flstring.h" #include <string.h> #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 @@ -357,50 +358,12 @@ Fl_Sys_Menu_Bar_Driver *Fl_Darwin_System_Driver::sys_menu_bar_driver() return Fl_MacOS_Sys_Menu_Bar_Driver::driver(); } -const char * const Fl_Darwin_System_Driver::tree_open_xpm_darwin[] = { - "11 11 2 1", - ". c None", - "@ c #000000", - "...@.......", - "...@@......", - "...@@@.....", - "...@@@@....", - "...@@@@@...", - "...@@@@@@..", - "...@@@@@...", - "...@@@@....", - "...@@@.....", - "...@@......", - "...@......." -}; - -const char * const Fl_Darwin_System_Driver::tree_close_xpm_darwin[] = { - "11 11 2 1", - ". c None", - "@ c #000000", - "...........", - "...........", - "...........", - "@@@@@@@@@@@", - ".@@@@@@@@@.", - "..@@@@@@@..", - "...@@@@@...", - "....@@@....", - ".....@.....", - "...........", - "..........." -}; - -Fl_Pixmap *Fl_Darwin_System_Driver::tree_openpixmap() { - static Fl_Pixmap *pixmap = new Fl_Pixmap(tree_open_xpm_darwin); - return pixmap; +// Draw Mac-specific Fl_Tree open/close icons +void Fl_Darwin_System_Driver::tree_draw_expando_button(int x, int y, bool state, bool active) { + fl_color(active ? FL_FOREGROUND_COLOR : FL_INACTIVE_COLOR); + if(state) fl_polygon(x + 3, y, x + 3, y + 11, x + 8, y + 5); // right arrow: ▶ + else fl_polygon(x, y + 3, x + 11, y + 3, x + 5, y + 8); // down arrow: ▼ } - -Fl_Pixmap *Fl_Darwin_System_Driver::tree_closepixmap() { - static Fl_Pixmap *pixmap = new Fl_Pixmap(tree_close_xpm_darwin); - return pixmap; -} - int Fl_Darwin_System_Driver::tree_connector_style() { return FL_TREE_CONNECTOR_NONE; } |
