summaryrefslogtreecommitdiff
path: root/src/Fl_get_system_colors.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2003-08-02 13:49:17 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2003-08-02 13:49:17 +0000
commit2fc4d518cc1c82293147989f338f4a62ec66113a (patch)
treeaf31f4b3655060af0a4c4fd3c70129933dbaad1a /src/Fl_get_system_colors.cxx
parentafbeea5714673d1872bcf6949c0df714a3770478 (diff)
Fix Fl_Window::show(argc, argv) so that it calls Fl::get_system_colors(),
and Fl::get_system_colors() so that it doesn't override user/program colors (STR #119) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@3069 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_get_system_colors.cxx')
-rw-r--r--src/Fl_get_system_colors.cxx34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx
index ebc7d6dec..844d38c0c 100644
--- a/src/Fl_get_system_colors.cxx
+++ b/src/Fl_get_system_colors.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.22 2003/07/29 02:12:36 easysw Exp $"
+// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.23 2003/08/02 13:49:17 easysw Exp $"
//
// System color support for the Fast Light Tool Kit (FLTK).
//
@@ -39,7 +39,14 @@ extern "C" int putenv(const char*);
#endif // __APPLE__ && __MWERKS__
+static char fl_bg_set = 0;
+static char fl_bg2_set = 0;
+static char fl_fg_set = 0;
+
+
void Fl::background(uchar r, uchar g, uchar b) {
+ fl_bg_set = 1;
+
// replace the gray ramp so that FL_GRAY is this color
if (!r) r = 1; else if (r==255) r = 254;
double powr = log(r/255.0)/log((FL_GRAY-FL_GRAY_RAMP)/(FL_NUM_GRAY-1.0));
@@ -57,10 +64,15 @@ void Fl::background(uchar r, uchar g, uchar b) {
}
void Fl::foreground(uchar r, uchar g, uchar b) {
+ fl_fg_set = 1;
+
Fl::set_color(FL_FOREGROUND_COLOR,r,g,b);
}
void Fl::background2(uchar r, uchar g, uchar b) {
+ fl_fg_set = 1;
+ fl_bg2_set = 1;
+
Fl::set_color(FL_BACKGROUND2_COLOR,r,g,b);
Fl::set_color(FL_FOREGROUND_COLOR,
get_color(fl_contrast(FL_FOREGROUND_COLOR,FL_BACKGROUND2_COLOR)));
@@ -131,9 +143,9 @@ getsyscolor(int what, const char* arg, void (*func)(uchar,uchar,uchar))
}
void Fl::get_system_colors() {
- getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
- getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
- getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
+ if (!fl_bg2_set) getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
+ if (!fl_fg_set) getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
+ if (!fl_bg_set) getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color);
}
@@ -147,9 +159,9 @@ void Fl::get_system_colors()
{
fl_open_display();
- foreground(0, 0, 0);
- background(0xd8, 0xd8, 0xd8);
- background2(0xff, 0xff, 0xff);
+ if (!fl_bg2_set) background2(0xff, 0xff, 0xff);
+ if (!fl_fg_set) foreground(0, 0, 0);
+ if (!fl_bg_set) background(0xd8, 0xd8, 0xd8);
set_selection_color(0x00, 0x00, 0x80);
}
#else
@@ -183,9 +195,9 @@ void Fl::get_system_colors()
const char* key1 = 0;
if (Fl::first_window()) key1 = Fl::first_window()->xclass();
if (!key1) key1 = "fltk";
- getsyscolor(key1, "background", fl_bg, "#c0c0c0", Fl::background);
- getsyscolor(key1, "foreground", fl_fg, "#000000", Fl::foreground);
- getsyscolor("Text","background", fl_bg2, "#ffffff", Fl::background2);
+ if (!fl_bg2_set) getsyscolor("Text","background", fl_bg2, "#ffffff", Fl::background2);
+ if (!fl_fg_set) getsyscolor(key1, "foreground", fl_fg, "#000000", Fl::foreground);
+ if (!fl_bg_set) getsyscolor(key1, "background", fl_bg, "#c0c0c0", Fl::background);
getsyscolor(key1, "selectBackground",0, "#000080", set_selection_color);
}
@@ -321,5 +333,5 @@ int Fl::reload_scheme() {
//
-// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.22 2003/07/29 02:12:36 easysw Exp $".
+// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.23 2003/08/02 13:49:17 easysw Exp $".
//