From a94e7291e8e9c3e33eae2bfaaaa653fac912b5ab Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 4 May 2004 20:05:10 +0000 Subject: [PATCH] added a style property to control boldening of the frame title. 2004-05-04 Sven Neumann * libgimpwidgets/gimpframe.c: added a style property to control boldening of the frame title. * themes/Default/gtkrc * themes/Small/gtkrc: suppress the bold title for GimpFrames in GimpDockables, --- ChangeLog | 9 +++++++++ libgimpwidgets/gimpframe.c | 21 ++++++++++++++++++--- themes/Default/gtkrc | 1 + themes/Small/gtkrc | 1 + 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c34c4a411b..23f0cfc499 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-05-04 Sven Neumann + + * libgimpwidgets/gimpframe.c: added a style property to control + boldening of the frame title. + + * themes/Default/gtkrc + * themes/Small/gtkrc: suppress the bold title for GimpFrames in + GimpDockables, + 2004-05-04 Sven Neumann * libgimpwidgets/gimpframe.c (gimp_frame_size_allocate): allocate diff --git a/libgimpwidgets/gimpframe.c b/libgimpwidgets/gimpframe.c index 7740055957..0731a728ee 100644 --- a/libgimpwidgets/gimpframe.c +++ b/libgimpwidgets/gimpframe.c @@ -32,6 +32,8 @@ #define DEFAULT_LABEL_SPACING 6 +#define DEFAULT_LABEL_BOLD TRUE + #define GIMP_FRAME_INDENT_KEY "gimp-frame-indent" #define GIMP_FRAME_IN_EXPANDER_KEY "gimp-frame-in-expander" @@ -103,6 +105,11 @@ gimp_frame_class_init (GimpFrameClass *klass) frame_class->compute_child_allocation = gimp_frame_child_allocate; + gtk_widget_class_install_style_property (widget_class, + g_param_spec_boolean ("label_bold", + NULL, NULL, + DEFAULT_LABEL_BOLD, + G_PARAM_READABLE)); gtk_widget_class_install_style_property (widget_class, g_param_spec_int ("label_spacing", NULL, NULL, @@ -230,7 +237,12 @@ static void gimp_frame_style_set (GtkWidget *widget, GtkStyle *previous) { + /* for "label_spacing" */ g_object_set_data (G_OBJECT (widget), GIMP_FRAME_INDENT_KEY, NULL); + gtk_widget_queue_resize (widget); + + /* for "label_bold" */ + gimp_frame_label_widget_notify (GTK_FRAME (widget)); } static gboolean @@ -271,12 +283,15 @@ gimp_frame_label_widget_notify (GtkFrame *frame) if (label) { - PangoAttrList *attrs; + PangoAttrList *attrs = pango_attr_list_new (); PangoAttribute *attr; + gboolean bold; - attrs = pango_attr_list_new (); + gtk_widget_style_get (GTK_WIDGET (frame), "label_bold", &bold, NULL); - attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD); + attr = pango_attr_weight_new (bold ? + PANGO_WEIGHT_BOLD : + PANGO_WEIGHT_NORMAL); attr->start_index = 0; attr->end_index = -1; pango_attr_list_insert (attrs, attr); diff --git a/themes/Default/gtkrc b/themes/Default/gtkrc index 773ea045e4..30c1278009 100644 --- a/themes/Default/gtkrc +++ b/themes/Default/gtkrc @@ -77,6 +77,7 @@ widget "*GimpContainerGridView*GtkViewport*" style "gimp-grid-view-style" style "gimp-dockable-style" = "gimp-default-style" { + GimpFrame::label_bold = 0 GimpFrame::label_spacing = 2 GtkButton::focus_line_width = 0 GtkButton::focus_line_padding = 0 diff --git a/themes/Small/gtkrc b/themes/Small/gtkrc index 6d0bad8dba..2459cb17ea 100644 --- a/themes/Small/gtkrc +++ b/themes/Small/gtkrc @@ -75,6 +75,7 @@ widget "*GimpContainerGridView*GtkViewport*" style "gimp-grid-view-style" style "gimp-dockable-style" = "gimp-default-style" { + GimpFrame::label_bold = 0 GimpFrame::label_spacing = 1 GtkButton::focus_line_width = 0 GtkButton::focus_line_padding = 0