summaryrefslogtreecommitdiff
path: root/src/drivers/WinAPI
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/WinAPI')
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx34
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h1
2 files changed, 34 insertions, 1 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
index f30bee01c..9c3b450cd 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx
@@ -241,7 +241,7 @@ void Fl_WinAPI_Screen_Driver::flush()
// simulation of XParseColor:
-int Fl_WinAPI_Screen_Driverparse_color(const char* p, uchar& r, uchar& g, uchar& b)
+int Fl_WinAPI_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b)
{
if (*p == '#') p++;
size_t n = strlen(p);
@@ -265,6 +265,38 @@ int Fl_WinAPI_Screen_Driverparse_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);
+}
+
+
+static void getsyscolor(int what, const char* arg, void (*func)(uchar,uchar,uchar))
+{
+ if (arg) {
+ uchar r,g,b;
+ if (!fl_parse_color(arg, r,g,b))
+ Fl::error("Unknown color: %s", arg);
+ else
+ func(r,g,b);
+ } else {
+ DWORD x = GetSysColor(what);
+ func(uchar(x&255), uchar(x>>8), uchar(x>>16));
+ }
+}
+
+
+void Fl_WinAPI_Screen_Driver::get_system_colors()
+{
+ if (!bg2_set) getsyscolor(COLOR_WINDOW, fl_bg2,Fl::background2);
+ if (!fg_set) getsyscolor(COLOR_WINDOWTEXT, fl_fg, Fl::foreground);
+ if (!bg_set) getsyscolor(COLOR_BTNFACE, fl_bg, Fl::background);
+ getsyscolor(COLOR_HIGHLIGHT, 0, set_selection_color);
+}
+
+
+
+
//
// End of "$Id$".
// \ No newline at end of file
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h
index ac9849246..b44b70ebb 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h
+++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h
@@ -55,6 +55,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();
};