changeset 1899:492fc2c5ecda

widget coloring
author corvid <corvid@lavabit.com>
date Fri, 04 Feb 2011 17:03:18 +0000
parents b8fbd3c92e2e
children 10bca1660013
files dw/fltkui.cc dw/fltkui.hh
diffstat 2 files changed, 15 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/dw/fltkui.cc	Thu Feb 03 08:16:56 2011 +0000
+++ b/dw/fltkui.cc	Fri Feb 04 17:03:18 2011 +0000
@@ -151,6 +151,7 @@
          Fl_Color fg = fl_contrast(style_fg, normal_bg);
 
          widget->labelcolor(fg);
+         widget->selection_color(fg);
       }
 
       widget->color(normal_bg);
@@ -481,13 +482,7 @@
 
    FltkResource::setWidgetStyle(widget, style);
 
-   /* labelcolor has our foreground color. Borrow it for textcolor and
-    * find something that contrasts with the background for selection_color.
-    */
    in->textcolor(widget->labelcolor());
-   widget->selection_color(
-      fl_contrast(in->textcolor(), widget->color()));
-
    in->cursor_color(in->textcolor());
    in->textsize(in->labelsize());
    in->textfont(in->labelfont());
@@ -604,13 +599,7 @@
 
    FltkResource::setWidgetStyle(widget, style);
 
-   /* labelcolor has our foreground color. Borrow it for textcolor and
-    * find something that contrasts with the background for selection_color.
-    */
    ed->textcolor(widget->labelcolor());
-   widget->selection_color(
-      fl_contrast(ed->textcolor(), widget->color()));
-
    ed->cursor_color(ed->textcolor());
    ed->textsize(ed->labelsize());
    ed->textfont(ed->labelfont());
@@ -682,6 +671,15 @@
    return button;
 }
 
+template <class I>
+void FltkToggleButtonResource<I>::setWidgetStyle (Fl_Widget *widget,
+                                                  core::style::Style *style)
+{
+   FltkResource::setWidgetStyle(widget, style);
+
+   widget->selection_color(FL_BLACK);
+}
+
 
 template <class I>
 void FltkToggleButtonResource<I>::sizeRequest (core::Requisition *requisition)
@@ -900,13 +898,7 @@
 
    FltkResource::setWidgetStyle(widget, style);
 
-   /* labelcolor has our foreground color. Borrow it for textcolor and
-    * find something suitably contrasting for selection_color.
-    */
    ch->textcolor(widget->labelcolor());
-   widget->selection_color(
-      fl_contrast(ch->color(), ch->textcolor()));
-
    ch->textfont(ch->labelfont());
    ch->textsize(ch->labelsize());
 }
@@ -1084,11 +1076,10 @@
 
    FltkResource::setWidgetStyle(widget, style);
 
-   /* WORKAROUND The need for this label*-setting may be removed before
-    * FLTK-1.3.0 is released. But for the moment...
-    */
-   t->labelfont(t->Fl_Widget::labelfont());
-   t->labelsize(t->Fl_Widget::labelsize());
+   t->item_labelfont(widget->labelfont());
+   t->item_labelsize(widget->labelsize());
+   t->item_labelfgcolor(widget->labelcolor());
+   t->item_labelbgcolor(widget->color());
 }
 
 void FltkListResource::widgetCallback (Fl_Widget *widget, void *data)
--- a/dw/fltkui.hh	Thu Feb 03 08:16:56 2011 +0000
+++ b/dw/fltkui.hh	Fri Feb 04 17:03:18 2011 +0000
@@ -343,6 +343,7 @@
 protected:
    virtual Fl_Button *createNewButton (core::Allocation *allocation) = 0;
    Fl_Widget *createNewWidget (core::Allocation *allocation);
+   void setWidgetStyle (Fl_Widget *widget, core::style::Style *style);
 
 public:
    FltkToggleButtonResource (FltkPlatform *platform,