diff options
author | Tim Janik <timj@gtk.org> | 2001-03-18 04:50:34 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 2001-03-18 04:50:34 +0000 |
commit | ac68581f9655392ab4b41ac5d6b0b76c0adf532f (patch) | |
tree | 3a8c1043c94817b941e70dfce7fefb309b0cf517 /gtk/gtkspinbutton.c | |
parent | 882bb853891b30c98c58d384d311fa24fbd1b326 (diff) | |
download | gtk+-ac68581f9655392ab4b41ac5d6b0b76c0adf532f.tar.gz |
added rc-style argument GtkSpinButton::shadow_type. removed
Sun Mar 18 01:15:30 2001 Tim Janik <timj@gtk.org>
* gtk/gtkspinbutton.[hc]: added rc-style argument
GtkSpinButton::shadow_type.
removed spin_button->shadow_type, gtk_spin_button_set_shadow_type()
and ARG_SHADOW_TYPE as it doesn' make much sense to try to override
rc-style settings.
* gtk/gtkfixed.c: removed gtk_fixed_paint() (was unused).
* gtk/gtkwidget.c: quark cleanups.
* gtk/gtkrc.[hc]: added gtk_rc_scanner_new() to create an rc-file
scanner with appropriate configuration, renamed GtkRcStyleClass.clone
to create_rc_style() (we don't do cloning in standard OO sense).
added per rc style properties.
* gtk/gtkstyle.[hc]: added code to retrive pspec conformant rc-style
property values and for caching those. some cleanups.
* gtk/Makefile.am: -DG_DISABLE_CONST_RETURNS.
* gtk/gtksettings.[hc]: new file for global rc-file properties
(at least currently, should get extended to support X properties
and other communication mechanisms).
* gtk/gtkwidget.[hc]: added style property support:
(gtk_widget_class_install_style_property_parser): install style
property pspec with parser function for rc-file values other
than LONG, DOUBLE or STRING.
(gtk_widget_class_install_style_property): same as above without
parser (parsers are going to be needed quite infrequently).
(gtk_widget_style_get_property): retrive style property value.
(gtk_widget_style_get_valist): same as above with varargs support,
has NOCOPY semantics.
(gtk_widget_style_get): wrapper around gtk_widget_style_get_valist().
Diffstat (limited to 'gtk/gtkspinbutton.c')
-rw-r--r-- | gtk/gtkspinbutton.c | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index f33a3d59e2..cc6a0acab6 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -36,6 +36,7 @@ #include "gtkspinbutton.h" #include "gtkmain.h" #include "gtksignal.h" +#include "gtksettings.h" #define MIN_SPIN_BUTTON_WIDTH 30 @@ -55,7 +56,6 @@ enum { ARG_NUMERIC, ARG_WRAP, ARG_UPDATE_POLICY, - ARG_SHADOW_TYPE, ARG_VALUE }; @@ -121,6 +121,7 @@ static void gtk_spin_button_real_spin (GtkSpinButton *spin_button, static gint gtk_spin_button_default_input (GtkSpinButton *spin_button, gfloat *new_val); static gint gtk_spin_button_default_output (GtkSpinButton *spin_button); +static gint spin_button_get_shadow_type (GtkSpinButton *spin_button); static GtkEntryClass *parent_class = NULL; @@ -221,15 +222,17 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class) GTK_TYPE_SPIN_BUTTON_UPDATE_POLICY, GTK_ARG_READWRITE, ARG_UPDATE_POLICY); - gtk_object_add_arg_type ("GtkSpinButton::shadow_type", - GTK_TYPE_SHADOW_TYPE, - GTK_ARG_READWRITE, - ARG_SHADOW_TYPE); gtk_object_add_arg_type ("GtkSpinButton::value", GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_VALUE); - + + gtk_widget_class_install_style_property_parser (widget_class, + g_param_spec_enum ("shadow_type", "Shadow Type", NULL, + GTK_TYPE_SHADOW_TYPE, + GTK_SHADOW_NONE, + G_PARAM_READABLE), + gtk_rc_property_parse_enum); spinbutton_signals[INPUT] = gtk_signal_new ("input", GTK_RUN_LAST, @@ -290,9 +293,6 @@ gtk_spin_button_set_arg (GtkObject *object, case ARG_UPDATE_POLICY: gtk_spin_button_set_update_policy (spin_button, GTK_VALUE_ENUM (*arg)); break; - case ARG_SHADOW_TYPE: - gtk_spin_button_set_shadow_type (spin_button, GTK_VALUE_ENUM (*arg)); - break; case ARG_VALUE: gtk_spin_button_set_value (spin_button, GTK_VALUE_FLOAT (*arg)); break; @@ -333,9 +333,6 @@ gtk_spin_button_get_arg (GtkObject *object, case ARG_UPDATE_POLICY: GTK_VALUE_ENUM (*arg) = spin_button->update_policy; break; - case ARG_SHADOW_TYPE: - GTK_VALUE_ENUM (*arg) = spin_button->shadow_type; - break; case ARG_VALUE: GTK_VALUE_FLOAT (*arg) = spin_button->adjustment->value; break; @@ -350,7 +347,6 @@ gtk_spin_button_init (GtkSpinButton *spin_button) { spin_button->adjustment = NULL; spin_button->panel = NULL; - spin_button->shadow_type = GTK_SHADOW_NONE; spin_button->timer = 0; spin_button->ev_time = 0; spin_button->climb_rate = 0.0; @@ -584,14 +580,17 @@ gtk_spin_button_expose (GtkWidget *widget, if (GTK_WIDGET_DRAWABLE (widget)) { + GtkShadowType shadow_type; + /* FIXME this seems like really broken code - * why aren't we looking at event->window * and acting accordingly? */ - - if (spin->shadow_type != GTK_SHADOW_NONE) + + shadow_type = spin_button_get_shadow_type (spin); + if (shadow_type != GTK_SHADOW_NONE) gtk_paint_box (widget->style, spin->panel, - GTK_STATE_NORMAL, spin->shadow_type, + GTK_STATE_NORMAL, shadow_type, &event->area, widget, "spinbutton", 0, 0, ARROW_SIZE + 2 * widget->style->xthickness, @@ -616,6 +615,7 @@ static void gtk_spin_button_draw_arrow (GtkSpinButton *spin_button, guint arrow) { + GtkShadowType spin_shadow_type; GtkStateType state_type; GtkShadowType shadow_type; GtkWidget *widget; @@ -626,6 +626,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button, g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); widget = GTK_WIDGET (spin_button); + spin_shadow_type = spin_button_get_shadow_type (spin_button); if (GTK_WIDGET_DRAWABLE (spin_button)) { @@ -659,7 +660,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button, } if (arrow == GTK_ARROW_UP) { - if (spin_button->shadow_type != GTK_SHADOW_NONE) + if (spin_shadow_type != GTK_SHADOW_NONE) { x = widget->style->xthickness; y = widget->style->ythickness; @@ -678,7 +679,7 @@ gtk_spin_button_draw_arrow (GtkSpinButton *spin_button, } else { - if (spin_button->shadow_type != GTK_SHADOW_NONE) + if (spin_shadow_type != GTK_SHADOW_NONE) { x = widget->style->xthickness; y = widget->requisition.height / 2; @@ -1563,19 +1564,14 @@ gtk_spin_button_set_wrap (GtkSpinButton *spin_button, spin_button->wrap = (wrap != 0); } -void -gtk_spin_button_set_shadow_type (GtkSpinButton *spin_button, - GtkShadowType shadow_type) +static gint +spin_button_get_shadow_type (GtkSpinButton *spin_button) { - g_return_if_fail (spin_button != NULL); - g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button)); + GtkShadowType rc_shadow_type; - if (shadow_type != spin_button->shadow_type) - { - spin_button->shadow_type = shadow_type; - if (GTK_WIDGET_DRAWABLE (spin_button)) - gtk_widget_queue_draw (GTK_WIDGET (spin_button)); - } + gtk_widget_style_get (GTK_WIDGET (spin_button), "shadow_type", &rc_shadow_type, NULL); + + return rc_shadow_type; } void |