Accept NULL for color to mean "unmodify"

Sat Apr 20 12:07:14 2002  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwidget.c (gtk_widget_modify_color_component): Accept
	NULL for color to mean "unmodify"

	* gtk/gtkwidget.c (gtk_widget_modify_font): Accept NULL for
	font_desc to mean "unmodify".
This commit is contained in:
Owen Taylor 2002-04-20 16:16:52 +00:00 committed by Owen Taylor
parent 492aeef41c
commit b8ea6590f1
7 changed files with 95 additions and 24 deletions

View File

@ -1,3 +1,11 @@
Sat Apr 20 12:07:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_color_component): Accept
NULL for color to mean "unmodify"
* gtk/gtkwidget.c (gtk_widget_modify_font): Accept NULL for
font_desc to mean "unmodify".
Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org> Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW
@ -111,6 +119,7 @@ Tue Apr 16 07:53:49 2002 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the * gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the
accel path is from a locked accel group. accel path is from a locked accel group.
>>>>>>> 1.3353
Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com> Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcontainer.c (gtk_container_focus): include internal * gtk/gtkcontainer.c (gtk_container_focus): include internal

View File

@ -1,3 +1,11 @@
Sat Apr 20 12:07:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_color_component): Accept
NULL for color to mean "unmodify"
* gtk/gtkwidget.c (gtk_widget_modify_font): Accept NULL for
font_desc to mean "unmodify".
Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org> Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW
@ -111,6 +119,7 @@ Tue Apr 16 07:53:49 2002 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the * gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the
accel path is from a locked accel group. accel path is from a locked accel group.
>>>>>>> 1.3353
Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com> Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcontainer.c (gtk_container_focus): include internal * gtk/gtkcontainer.c (gtk_container_focus): include internal

View File

@ -1,3 +1,11 @@
Sat Apr 20 12:07:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_color_component): Accept
NULL for color to mean "unmodify"
* gtk/gtkwidget.c (gtk_widget_modify_font): Accept NULL for
font_desc to mean "unmodify".
Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org> Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW
@ -111,6 +119,7 @@ Tue Apr 16 07:53:49 2002 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the * gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the
accel path is from a locked accel group. accel path is from a locked accel group.
>>>>>>> 1.3353
Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com> Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcontainer.c (gtk_container_focus): include internal * gtk/gtkcontainer.c (gtk_container_focus): include internal

View File

@ -1,3 +1,11 @@
Sat Apr 20 12:07:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_color_component): Accept
NULL for color to mean "unmodify"
* gtk/gtkwidget.c (gtk_widget_modify_font): Accept NULL for
font_desc to mean "unmodify".
Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org> Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW
@ -111,6 +119,7 @@ Tue Apr 16 07:53:49 2002 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the * gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the
accel path is from a locked accel group. accel path is from a locked accel group.
>>>>>>> 1.3353
Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com> Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcontainer.c (gtk_container_focus): include internal * gtk/gtkcontainer.c (gtk_container_focus): include internal

View File

@ -1,3 +1,11 @@
Sat Apr 20 12:07:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_color_component): Accept
NULL for color to mean "unmodify"
* gtk/gtkwidget.c (gtk_widget_modify_font): Accept NULL for
font_desc to mean "unmodify".
Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org> Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW
@ -111,6 +119,7 @@ Tue Apr 16 07:53:49 2002 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the * gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the
accel path is from a locked accel group. accel path is from a locked accel group.
>>>>>>> 1.3353
Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com> Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcontainer.c (gtk_container_focus): include internal * gtk/gtkcontainer.c (gtk_container_focus): include internal

View File

@ -1,3 +1,11 @@
Sat Apr 20 12:07:14 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_color_component): Accept
NULL for color to mean "unmodify"
* gtk/gtkwidget.c (gtk_widget_modify_font): Accept NULL for
font_desc to mean "unmodify".
Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org> Sat Apr 20 16:49:26 2002 Kristian Rietveld <kris@gtk.org>
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_new): replace GDK_IS_WINDOW
@ -111,6 +119,7 @@ Tue Apr 16 07:53:49 2002 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the * gtk/gtkwidget.c (_gtk_widget_get_accel_path): export whether the
accel path is from a locked accel group. accel path is from a locked accel group.
>>>>>>> 1.3353
Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com> Mon Apr 15 15:41:56 2002 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkcontainer.c (gtk_container_focus): include internal * gtk/gtkcontainer.c (gtk_container_focus): include internal

View File

@ -4017,25 +4017,30 @@ gtk_widget_modify_color_component (GtkWidget *widget,
{ {
GtkRcStyle *rc_style = gtk_widget_get_modifier_style (widget); GtkRcStyle *rc_style = gtk_widget_get_modifier_style (widget);
switch (component) if (color)
{ {
case GTK_RC_FG: switch (component)
rc_style->fg[state] = *color; {
break; case GTK_RC_FG:
case GTK_RC_BG: rc_style->fg[state] = *color;
rc_style->bg[state] = *color; break;
break; case GTK_RC_BG:
case GTK_RC_TEXT: rc_style->bg[state] = *color;
rc_style->text[state] = *color; break;
break; case GTK_RC_TEXT:
case GTK_RC_BASE: rc_style->text[state] = *color;
rc_style->base[state] = *color; break;
break; case GTK_RC_BASE:
default: rc_style->base[state] = *color;
g_assert_not_reached(); break;
default:
g_assert_not_reached();
}
rc_style->color_flags[state] |= component;
} }
else
rc_style->color_flags[state] |= component; rc_style->color_flags[state] &= ~component;
gtk_widget_modify_style (widget, rc_style); gtk_widget_modify_style (widget, rc_style);
} }
@ -4044,7 +4049,9 @@ gtk_widget_modify_color_component (GtkWidget *widget,
* gtk_widget_modify_fg: * gtk_widget_modify_fg:
* @widget: a #GtkWidget. * @widget: a #GtkWidget.
* @state: the state for which to set the foreground color. * @state: the state for which to set the foreground color.
* @color: the color to assign (does not need to be allocated). * @color: the color to assign (does not need to be allocated),
* or %NULL to undo the effect of previous calls to
* of gtk_widget_modify_fg().
* *
* Sets the foreground color for a widget in a particular state. All * Sets the foreground color for a widget in a particular state. All
* other style values are left untouched. See also * other style values are left untouched. See also
@ -4066,7 +4073,9 @@ gtk_widget_modify_fg (GtkWidget *widget,
* gtk_widget_modify_bg: * gtk_widget_modify_bg:
* @widget: a #GtkWidget. * @widget: a #GtkWidget.
* @state: the state for which to set the background color. * @state: the state for which to set the background color.
* @color: the color to assign (does not need to be allocated). * @color: the color to assign (does not need to be allocated),
* or %NULL to undo the effect of previous calls to
* of gtk_widget_modify_bg().
* *
* Sets the background color for a widget in a particular state. All * Sets the background color for a widget in a particular state. All
* other style values are left untouched. See also * other style values are left untouched. See also
@ -4088,7 +4097,9 @@ gtk_widget_modify_bg (GtkWidget *widget,
* gtk_widget_modify_text: * gtk_widget_modify_text:
* @widget: a #GtkWidget. * @widget: a #GtkWidget.
* @state: the state for which to set the text color. * @state: the state for which to set the text color.
* @color: the color to assign (does not need to be allocated). * @color: the color to assign (does not need to be allocated),
* or %NULL to undo the effect of previous calls to
* of gtk_widget_modify_text().
* *
* Sets the text color for a widget in a particular state. All other * Sets the text color for a widget in a particular state. All other
* style values are left untouched. The text color is the foreground * style values are left untouched. The text color is the foreground
@ -4112,7 +4123,9 @@ gtk_widget_modify_text (GtkWidget *widget,
* gtk_widget_modify_base: * gtk_widget_modify_base:
* @widget: a #GtkWidget. * @widget: a #GtkWidget.
* @state: the state for which to set the base color. * @state: the state for which to set the base color.
* @color: the color to assign (does not need to be allocated). * @color: the color to assign (does not need to be allocated),
* or %NULL to undo the effect of previous calls to
* of gtk_widget_modify_base().
* *
* Sets the base color for a widget in a particular state. * Sets the base color for a widget in a particular state.
* All other style values are left untouched. The base color * All other style values are left untouched. The base color
@ -4135,7 +4148,8 @@ gtk_widget_modify_base (GtkWidget *widget,
/** /**
* gtk_widget_modify_font: * gtk_widget_modify_font:
* @widget: a #GtkWidget * @widget: a #GtkWidget
* @font_desc: the font description to use * @font_desc: the font description to use, or %NULL to undo
* the effect of previous calls to gtk_widget_modify_font().
* *
* Sets the font to use for a widget. All other style values are left * Sets the font to use for a widget. All other style values are left
* untouched. See also gtk_widget_modify_style(). * untouched. See also gtk_widget_modify_style().
@ -4153,9 +4167,12 @@ gtk_widget_modify_font (GtkWidget *widget,
if (rc_style->font_desc) if (rc_style->font_desc)
pango_font_description_free (rc_style->font_desc); pango_font_description_free (rc_style->font_desc);
rc_style->font_desc = pango_font_description_copy (font_desc);
if (font_desc)
rc_style->font_desc = pango_font_description_copy (font_desc);
else
rc_style->font_desc = NULL;
gtk_widget_modify_style (widget, rc_style); gtk_widget_modify_style (widget, rc_style);
} }