Commit 9b4d9046 authored by Tim Janik's avatar Tim Janik Committed by Tim Janik

handle GTK_RELIEF_HALF, which was introduced to keep either

Wed Jul  8 15:31:28 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
        keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
        to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
        (GTK_RELIEF_HALF).
        (gtk_button_paint): set the background for prelighted buttons with
        GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
        (gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
        the shadow type (otherwise we get strange shadows for coloured buttons).
        (gtk_button_set_relief): queue a redraw after changing
        the relief.
        (gtk_button_class_init):
        (gtk_button_set_arg):
        (gtk_button_get_arg): added object argument "GtkButton::relief".

        * gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
parent 88fba9f8
Wed Jul 8 15:31:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
(GTK_RELIEF_HALF).
(gtk_button_paint): set the background for prelighted buttons with
GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
(gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
the shadow type (otherwise we get strange shadows for coloured buttons).
(gtk_button_set_relief): queue a redraw after changing
the relief.
(gtk_button_class_init):
(gtk_button_set_arg):
(gtk_button_get_arg): added object argument "GtkButton::relief".
* gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.h:
......
Wed Jul 8 15:31:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
(GTK_RELIEF_HALF).
(gtk_button_paint): set the background for prelighted buttons with
GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
(gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
the shadow type (otherwise we get strange shadows for coloured buttons).
(gtk_button_set_relief): queue a redraw after changing
the relief.
(gtk_button_class_init):
(gtk_button_set_arg):
(gtk_button_get_arg): added object argument "GtkButton::relief".
* gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.h:
......
Wed Jul 8 15:31:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
(GTK_RELIEF_HALF).
(gtk_button_paint): set the background for prelighted buttons with
GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
(gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
the shadow type (otherwise we get strange shadows for coloured buttons).
(gtk_button_set_relief): queue a redraw after changing
the relief.
(gtk_button_class_init):
(gtk_button_set_arg):
(gtk_button_get_arg): added object argument "GtkButton::relief".
* gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.h:
......
Wed Jul 8 15:31:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
(GTK_RELIEF_HALF).
(gtk_button_paint): set the background for prelighted buttons with
GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
(gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
the shadow type (otherwise we get strange shadows for coloured buttons).
(gtk_button_set_relief): queue a redraw after changing
the relief.
(gtk_button_class_init):
(gtk_button_set_arg):
(gtk_button_get_arg): added object argument "GtkButton::relief".
* gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.h:
......
Wed Jul 8 15:31:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
(GTK_RELIEF_HALF).
(gtk_button_paint): set the background for prelighted buttons with
GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
(gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
the shadow type (otherwise we get strange shadows for coloured buttons).
(gtk_button_set_relief): queue a redraw after changing
the relief.
(gtk_button_class_init):
(gtk_button_set_arg):
(gtk_button_get_arg): added object argument "GtkButton::relief".
* gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.h:
......
Wed Jul 8 15:31:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
(GTK_RELIEF_HALF).
(gtk_button_paint): set the background for prelighted buttons with
GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
(gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
the shadow type (otherwise we get strange shadows for coloured buttons).
(gtk_button_set_relief): queue a redraw after changing
the relief.
(gtk_button_class_init):
(gtk_button_set_arg):
(gtk_button_get_arg): added object argument "GtkButton::relief".
* gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.h:
......
Wed Jul 8 15:31:28 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.c: handle GTK_RELIEF_HALF, which was introduced to
keep either GTK_STATE_NORMAL for relief buttons (GTK_RELIEF_NONE) or
to still honour GTK_WIDGET_STATE(), e.g. for coloured buttons
(GTK_RELIEF_HALF).
(gtk_button_paint): set the background for prelighted buttons with
GTK_STATE_NORMAL only if GTK_RELIEF_NONE.
(gtk_button_draw_focus): if GTK_RELIEF_NONE, use GTK_STATE_NORMAL for
the shadow type (otherwise we get strange shadows for coloured buttons).
(gtk_button_set_relief): queue a redraw after changing
the relief.
(gtk_button_class_init):
(gtk_button_set_arg):
(gtk_button_get_arg): added object argument "GtkButton::relief".
* gtk/gtkenums.h (enum): added GTK_RELIEF_HALF.
Mon Jul 6 18:30:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtkbutton.h:
......
......@@ -130,6 +130,7 @@
(define-enum GtkReliefStyle
(normal GTK_RELIEF_NORMAL)
(half GTK_RELIEF_HALF)
(none GTK_RELIEF_NONE))
(define-enum GtkResizeMode
......
......@@ -39,7 +39,8 @@ enum {
};
enum {
ARG_0,
ARG_LABEL
ARG_LABEL,
ARG_RELIEF
};
......@@ -132,6 +133,7 @@ gtk_button_class_init (GtkButtonClass *klass)
parent_class = gtk_type_class (GTK_TYPE_BIN);
gtk_object_add_arg_type ("GtkButton::label", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_LABEL);
gtk_object_add_arg_type ("GtkButton::relief", GTK_TYPE_RELIEF_STYLE, GTK_ARG_READWRITE, ARG_RELIEF);
button_signals[PRESSED] =
gtk_signal_new ("pressed",
......@@ -243,6 +245,9 @@ gtk_button_set_arg (GtkObject *object,
gtk_container_add (GTK_CONTAINER (button), label);
break;
case ARG_RELIEF:
gtk_button_set_relief (button, GTK_VALUE_ENUM (*arg));
break;
default:
break;
}
......@@ -265,6 +270,9 @@ gtk_button_get_arg (GtkObject *object,
else
GTK_VALUE_STRING (*arg) = NULL;
break;
case ARG_RELIEF:
GTK_VALUE_ENUM (*arg) = gtk_button_get_relief (button);
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
......@@ -331,10 +339,11 @@ gtk_button_set_relief (GtkButton *button,
g_return_if_fail (GTK_IS_BUTTON (button));
button->relief = newrelief;
gtk_widget_queue_draw (GTK_WIDGET (button));
}
GtkReliefStyle
gtk_button_get_relief(GtkButton *button)
gtk_button_get_relief (GtkButton *button)
{
g_return_val_if_fail (button != NULL, GTK_RELIEF_NORMAL);
g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL);
......@@ -531,8 +540,9 @@ gtk_button_paint (GtkWidget *widget,
if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
{
if ((GTK_WIDGET_STATE (widget) == GTK_STATE_PRELIGHT) &&
(GTK_BUTTON (widget)->relief == GTK_RELIEF_NONE))
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
(GTK_BUTTON (widget)->relief != GTK_RELIEF_NORMAL))
gtk_style_set_background (widget->style, widget->window,
GTK_BUTTON (widget)->relief == GTK_RELIEF_NONE ? GTK_STATE_NORMAL : GTK_WIDGET_STATE (widget));
else
gtk_style_set_background (widget->style, widget->window, GTK_WIDGET_STATE (widget));
gdk_window_clear_area (widget->window,
......@@ -678,7 +688,8 @@ gtk_button_draw_focus (GtkWidget *widget)
(GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE)))
{
gtk_draw_shadow (widget->style, widget->window,
GTK_WIDGET_STATE (widget), shadow_type,
button->relief == GTK_RELIEF_NONE ? GTK_STATE_NORMAL : GTK_WIDGET_STATE (widget),
shadow_type,
x, y, width, height);
}
......@@ -712,7 +723,8 @@ gtk_button_draw_default (GtkWidget *widget)
width = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
height = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
if (GTK_WIDGET_HAS_DEFAULT (widget) && gtk_button_get_relief (GTK_BUTTON (widget)) == GTK_RELIEF_NORMAL)
if (GTK_WIDGET_HAS_DEFAULT (widget) &&
GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
{
gtk_draw_shadow (widget->style, widget->window,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
......
......@@ -179,6 +179,7 @@ typedef enum
typedef enum
{
GTK_RELIEF_NORMAL,
GTK_RELIEF_HALF,
GTK_RELIEF_NONE
} GtkReliefStyle;
......
......@@ -142,6 +142,7 @@ static GtkEnumValue _gtk_preview_type_values[] = {
};
static GtkEnumValue _gtk_relief_style_values[] = {
{ GTK_RELIEF_NORMAL, "GTK_RELIEF_NORMAL", "normal" },
{ GTK_RELIEF_HALF, "GTK_RELIEF_HALF", "half" },
{ GTK_RELIEF_NONE, "GTK_RELIEF_NONE", "none" },
{ 0, NULL, NULL }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment