[glom] Details: Static Text items: Use background color from formatting.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom] Details: Static Text items: Use background color from formatting.
- Date: Sat, 23 Jan 2010 21:03:27 +0000 (UTC)
commit d324c92a680f4ba56951b389e08361fc983f60dd
Author: Murray Cumming <murrayc murrayc com>
Date: Sat Jan 23 21:15:59 2010 +0100
Details: Static Text items: Use background color from formatting.
* glom/utility_widgets/labelglom.cc: Do not call set_visible_window(false)
because we really need a visible child X window to be able to change the
background color.
ChangeLog | 8 ++++++++
glom/utility_widgets/labelglom.cc | 5 +++--
glom/utility_widgets/layoutwidgetbase.cc | 23 ++++++++++++++++-------
3 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 369e9aa..fff18bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2010-01-23 Murray Cumming <murrayc murrayc com>
+ Details: Static Text items: Use background color from formatting.
+
+ * glom/utility_widgets/labelglom.cc: Do not call set_visible_window(false)
+ because we really need a visible child X window to be able to change the
+ background color.
+
+2010-01-23 Murray Cumming <murrayc murrayc com>
+
Details: Static Text items and Buttons: Use foreground color from formatting.
* glom/utility_widgets/layoutwidgetbase.cc: apply_formatting(): Use the
diff --git a/glom/utility_widgets/labelglom.cc b/glom/utility_widgets/labelglom.cc
index d15caab..a4e53af 100644
--- a/glom/utility_widgets/labelglom.cc
+++ b/glom/utility_widgets/labelglom.cc
@@ -49,8 +49,9 @@ void LabelGlom::init()
{
add(m_label);
m_label.show();
- set_events (Gdk::ALL_EVENTS_MASK);
- set_visible_window (false);
+ set_events(Gdk::ALL_EVENTS_MASK);
+ //This would be more efficient if we were only using the (base) EventBox to get events,
+ //but we also want to allow changing of the background color, so we don't use it: set_visible_window(false);
}
App_Glom* LabelGlom::get_application()
diff --git a/glom/utility_widgets/layoutwidgetbase.cc b/glom/utility_widgets/layoutwidgetbase.cc
index 7c416f0..b030b88 100644
--- a/glom/utility_widgets/layoutwidgetbase.cc
+++ b/glom/utility_widgets/layoutwidgetbase.cc
@@ -101,7 +101,6 @@ void LayoutWidgetBase::apply_formatting(Gtk::Widget& widget, const sharedptr<con
widget_to_change = textview->get_textview();
else if(label)
widget_to_change = label->get_label();
- }
}
if(!layout_item)
@@ -137,18 +136,28 @@ void LayoutWidgetBase::apply_formatting(Gtk::Widget& widget, const sharedptr<con
widget_to_change->modify_fg(Gtk::STATE_NORMAL, Gdk::Color(fg));
}
- // "base" is the background color. "bg" seems to change the border:
+
const Glib::ustring bg = formatting.get_text_format_color_background();
if(!bg.empty())
{
- widget_to_change->modify_base(Gtk::STATE_NORMAL, Gdk::Color(bg));
-
- //TODO: This doesn't seem to work.
+ if(!label && !button)
+ {
+ // "base" is the background color for GtkEntry. "bg" seems to change the border:
+ widget_to_change->modify_base(Gtk::STATE_NORMAL, Gdk::Color(bg));
+ }
//According to the gtk_widget_modify_base() documentation,
//a GtkLabel can only have a background color by, for instance, placing it
//in a GtkEventBox. Luckily LabelGlom is actually derived from EventBox.
- if(label)
- label->modify_base(Gtk::STATE_NORMAL, Gdk::Color(bg));
+ else if(label)
+ {
+ //label->modify_base(Gtk::STATE_NORMAL, Gdk::Color("bg"));
+ label->modify_bg(Gtk::STATE_NORMAL, Gdk::Color(bg));
+ }
+ else if(button)
+ {
+ //button->modify_base(Gtk::STATE_NORMAL, Gdk::Color("bg"));
+ button->modify_bg(Gtk::STATE_NORMAL, Gdk::Color(bg));
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]