diff options
Diffstat (limited to 'src/drivers/Cocoa')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx | 38 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx index 9c6ff5dfa..e34f8b998 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx @@ -19,6 +19,7 @@ #include "../../config_lib.h" #include "Fl_Cocoa_Screen_Driver.h" +#include <FL/Fl.H> #include <FL/fl_ask.h> #include <stdio.h> @@ -145,6 +146,43 @@ int Fl_Cocoa_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar } +static void set_selection_color(uchar r, uchar g, uchar b) +{ + Fl::set_color(FL_SELECTION_COLOR,r,g,b); +} + + +// MacOS X currently supports two color schemes - Blue and Graphite. +// Since we aren't emulating the Aqua interface (even if Apple would +// let us), we use some defaults that are similar to both. The +// Fl::scheme("plastic") color/box scheme provides a usable Aqua-like +// look-n-feel... +void Fl_Cocoa_Screen_Driver::get_system_colors() +{ + fl_open_display(); + + if (!bg2_set) Fl::background2(0xff, 0xff, 0xff); + if (!fg_set) Fl::foreground(0, 0, 0); + if (!bg_set) Fl::background(0xd8, 0xd8, 0xd8); + +#if 0 + // this would be the correct code, but it does not run on all versions + // of OS X. Also, setting a bright selection color would require + // some updates in Fl_Adjuster and Fl_Help_Browser + OSStatus err; + RGBColor c; + err = GetThemeBrushAsColor(kThemeBrushPrimaryHighlightColor, 24, true, &c); + if (err) + set_selection_color(0x00, 0x00, 0x80); + else + set_selection_color(c.red, c.green, c.blue); +#else + set_selection_color(0x00, 0x00, 0x80); +#endif +} + + + // // End of "$Id$". // diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h index 02852c514..b06192205 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h @@ -61,6 +61,7 @@ public: virtual void flush(); // --- global colors virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b); + virtual void get_system_colors(); }; |
