summaryrefslogtreecommitdiff
path: root/dw/fltkui.cc
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2011-01-29 20:14:06 +0000
committercorvid <corvid@lavabit.com>2011-01-29 20:14:06 +0000
commitb2d79d0baa75df45f7154f893905e95edc43a53d (patch)
tree129e5d270194c541b534f73d0fc9a4c0480cecfb /dw/fltkui.cc
parentb1a83aee9683d73f728fd9eea76c54636036acbc (diff)
improve widget colors
- The background for the radio/check button likes to be white, so I'm leaving selection_color() as black. - OptionMenu, I don't like what background color we tend to get for a selected item while the menu's up, but you can always tell what's current by the box, anyway. - ListMenu, that will wait until some Fl_Tree changes are made, which it sounds like will happen very shortly.
Diffstat (limited to 'dw/fltkui.cc')
-rw-r--r--dw/fltkui.cc49
1 files changed, 48 insertions, 1 deletions
diff --git a/dw/fltkui.cc b/dw/fltkui.cc
index fe65cbd7..01b71247 100644
--- a/dw/fltkui.cc
+++ b/dw/fltkui.cc
@@ -151,7 +151,6 @@ void FltkResource::setWidgetStyle (Fl_Widget *widget,
Fl_Color fg = fl_contrast(style_fg, normal_bg);
widget->labelcolor(fg);
- widget->selection_color(fg);
}
widget->color(normal_bg);
@@ -475,6 +474,23 @@ Fl_Widget *FltkEntryResource::createNewWidget (core::Allocation
return input;
}
+void FltkEntryResource::setWidgetStyle (Fl_Widget *widget,
+ core::style::Style *style)
+{
+ Fl_Input *in = (Fl_Input *)widget;
+
+ 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());
+}
+
void FltkEntryResource::setDisplayed(bool displayed)
{
FltkResource::setDisplayed(displayed);
@@ -579,6 +595,23 @@ Fl_Widget *FltkMultiLineTextResource::createNewWidget (core::Allocation
return text;
}
+void FltkMultiLineTextResource::setWidgetStyle (Fl_Widget *widget,
+ core::style::Style *style)
+{
+ Fl_Text_Editor *ed = (Fl_Text_Editor *)widget;
+
+ 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());
+}
+
void FltkMultiLineTextResource::sizeRequest (core::Requisition *requisition)
{
if (style) {
@@ -856,6 +889,20 @@ FltkOptionMenuResource::~FltkOptionMenuResource ()
delete menu;
}
+void FltkOptionMenuResource::setWidgetStyle (Fl_Widget *widget,
+ core::style::Style *style)
+{
+ Fl_Choice *ch = (Fl_Choice *)widget;
+
+ 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()));
+}
Fl_Widget *FltkOptionMenuResource::createNewWidget (core::Allocation
*allocation)