summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1999-01-11 18:49:54 +0000
committerTim Janik <timj@src.gnome.org>1999-01-11 18:49:54 +0000
commitd2e69a89d4b8a0f9ceedbe87362cf9609e5b7c52 (patch)
tree9552de529756e2ce086f0965601290dad6d31c52
parent0b84fc27424dfe1a3dbd7cb35b80a95eadd8aa17 (diff)
downloadgtk+-d2e69a89d4b8a0f9ceedbe87362cf9609e5b7c52.tar.gz
eliminated some queue_draws when invoking gtk_widget_set_state, since that
Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org> * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking gtk_widget_set_state, since that cares about redrawing already. some code cleanups. * gtk/gtktogglebutton.[hc]: * gtk/gtkfontsel.c: * gtkgamma.c: s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since set_state is already taken by gtkwidget.h. * gtk/gtkcompat.h: #define gtk_toggle_button_set_state gtk_toggle_button_set_active. * gtk/gtkstyle.c: some indentation cleanups.
-rw-r--r--ChangeLog22
-rw-r--r--ChangeLog.pre-2-022
-rw-r--r--ChangeLog.pre-2-1022
-rw-r--r--ChangeLog.pre-2-222
-rw-r--r--ChangeLog.pre-2-422
-rw-r--r--ChangeLog.pre-2-622
-rw-r--r--ChangeLog.pre-2-822
-rw-r--r--gtk/gtkcheckbutton.c186
-rw-r--r--gtk/gtkcompat.h1
-rw-r--r--gtk/gtkfontsel.c36
-rw-r--r--gtk/gtkgamma.c4
-rw-r--r--gtk/gtkrc.c6
-rw-r--r--gtk/gtkstyle.c2014
-rw-r--r--gtk/gtktogglebutton.c105
-rw-r--r--gtk/gtktogglebutton.h6
-rw-r--r--gtk/testgtk.c32
-rw-r--r--gtk/testgtkrc8
-rw-r--r--gtk/testselection.c4
-rw-r--r--tests/testgtk.c32
-rw-r--r--tests/testgtkrc8
-rw-r--r--tests/testselection.c4
21 files changed, 1384 insertions, 1216 deletions
diff --git a/ChangeLog b/ChangeLog
index 8d4cadb9ab..ff0e502b9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking
+ gtk_widget_set_state, since that cares about redrawing already.
+ some code cleanups.
+
+ * gtk/gtktogglebutton.[hc]:
+ * gtk/gtkfontsel.c:
+ * gtkgamma.c:
+ s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since
+ set_state is already taken by gtkwidget.h.
+
+ * gtk/gtkcompat.h: #define gtk_toggle_button_set_state
+ gtk_toggle_button_set_active.
+
+ * gtk/gtkstyle.c: some indentation cleanups.
+
+Mon Jan 11 15:12:33 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_set_mode): take previous
+ visibility state into account when unrealizing.
+
Mon Jan 11 10:45:28 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Only remove handlers for motion/button_release
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 8d4cadb9ab..ff0e502b9f 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,25 @@
+Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking
+ gtk_widget_set_state, since that cares about redrawing already.
+ some code cleanups.
+
+ * gtk/gtktogglebutton.[hc]:
+ * gtk/gtkfontsel.c:
+ * gtkgamma.c:
+ s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since
+ set_state is already taken by gtkwidget.h.
+
+ * gtk/gtkcompat.h: #define gtk_toggle_button_set_state
+ gtk_toggle_button_set_active.
+
+ * gtk/gtkstyle.c: some indentation cleanups.
+
+Mon Jan 11 15:12:33 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_set_mode): take previous
+ visibility state into account when unrealizing.
+
Mon Jan 11 10:45:28 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Only remove handlers for motion/button_release
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 8d4cadb9ab..ff0e502b9f 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,25 @@
+Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking
+ gtk_widget_set_state, since that cares about redrawing already.
+ some code cleanups.
+
+ * gtk/gtktogglebutton.[hc]:
+ * gtk/gtkfontsel.c:
+ * gtkgamma.c:
+ s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since
+ set_state is already taken by gtkwidget.h.
+
+ * gtk/gtkcompat.h: #define gtk_toggle_button_set_state
+ gtk_toggle_button_set_active.
+
+ * gtk/gtkstyle.c: some indentation cleanups.
+
+Mon Jan 11 15:12:33 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_set_mode): take previous
+ visibility state into account when unrealizing.
+
Mon Jan 11 10:45:28 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Only remove handlers for motion/button_release
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 8d4cadb9ab..ff0e502b9f 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,25 @@
+Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking
+ gtk_widget_set_state, since that cares about redrawing already.
+ some code cleanups.
+
+ * gtk/gtktogglebutton.[hc]:
+ * gtk/gtkfontsel.c:
+ * gtkgamma.c:
+ s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since
+ set_state is already taken by gtkwidget.h.
+
+ * gtk/gtkcompat.h: #define gtk_toggle_button_set_state
+ gtk_toggle_button_set_active.
+
+ * gtk/gtkstyle.c: some indentation cleanups.
+
+Mon Jan 11 15:12:33 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_set_mode): take previous
+ visibility state into account when unrealizing.
+
Mon Jan 11 10:45:28 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Only remove handlers for motion/button_release
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 8d4cadb9ab..ff0e502b9f 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,25 @@
+Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking
+ gtk_widget_set_state, since that cares about redrawing already.
+ some code cleanups.
+
+ * gtk/gtktogglebutton.[hc]:
+ * gtk/gtkfontsel.c:
+ * gtkgamma.c:
+ s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since
+ set_state is already taken by gtkwidget.h.
+
+ * gtk/gtkcompat.h: #define gtk_toggle_button_set_state
+ gtk_toggle_button_set_active.
+
+ * gtk/gtkstyle.c: some indentation cleanups.
+
+Mon Jan 11 15:12:33 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_set_mode): take previous
+ visibility state into account when unrealizing.
+
Mon Jan 11 10:45:28 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Only remove handlers for motion/button_release
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 8d4cadb9ab..ff0e502b9f 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,25 @@
+Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking
+ gtk_widget_set_state, since that cares about redrawing already.
+ some code cleanups.
+
+ * gtk/gtktogglebutton.[hc]:
+ * gtk/gtkfontsel.c:
+ * gtkgamma.c:
+ s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since
+ set_state is already taken by gtkwidget.h.
+
+ * gtk/gtkcompat.h: #define gtk_toggle_button_set_state
+ gtk_toggle_button_set_active.
+
+ * gtk/gtkstyle.c: some indentation cleanups.
+
+Mon Jan 11 15:12:33 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_set_mode): take previous
+ visibility state into account when unrealizing.
+
Mon Jan 11 10:45:28 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Only remove handlers for motion/button_release
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 8d4cadb9ab..ff0e502b9f 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,25 @@
+Mon Jan 11 15:23:32 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c: eliminated some queue_draws when invoking
+ gtk_widget_set_state, since that cares about redrawing already.
+ some code cleanups.
+
+ * gtk/gtktogglebutton.[hc]:
+ * gtk/gtkfontsel.c:
+ * gtkgamma.c:
+ s/gtk_toggle_button_set_state/gtk_toggle_button_set_active/ since
+ set_state is already taken by gtkwidget.h.
+
+ * gtk/gtkcompat.h: #define gtk_toggle_button_set_state
+ gtk_toggle_button_set_active.
+
+ * gtk/gtkstyle.c: some indentation cleanups.
+
+Mon Jan 11 15:12:33 1999 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktogglebutton.c (gtk_toggle_button_set_mode): take previous
+ visibility state into account when unrealizing.
+
Mon Jan 11 10:45:28 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Only remove handlers for motion/button_release
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index c064cf0a92..2fd81aa799 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -49,7 +49,7 @@ GtkType
gtk_check_button_get_type (void)
{
static GtkType check_button_type = 0;
-
+
if (!check_button_type)
{
static const GtkTypeInfo check_button_info =
@@ -63,10 +63,10 @@ gtk_check_button_get_type (void)
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
- check_button_type = gtk_type_unique (gtk_toggle_button_get_type (), &check_button_info);
+
+ check_button_type = gtk_type_unique (GTK_TYPE_TOGGLE_BUTTON, &check_button_info);
}
-
+
return check_button_type;
}
@@ -74,16 +74,16 @@ static void
gtk_check_button_class_init (GtkCheckButtonClass *class)
{
GtkWidgetClass *widget_class;
-
+
widget_class = (GtkWidgetClass*) class;
parent_class = gtk_type_class (gtk_toggle_button_get_type ());
-
+
widget_class->draw = gtk_check_button_draw;
widget_class->draw_focus = gtk_check_button_draw_focus;
widget_class->size_request = gtk_check_button_size_request;
widget_class->size_allocate = gtk_check_button_size_allocate;
widget_class->expose_event = gtk_check_button_expose;
-
+
class->indicator_size = INDICATOR_SIZE;
class->indicator_spacing = INDICATOR_SPACING;
class->draw_indicator = gtk_real_check_button_draw_indicator;
@@ -93,13 +93,13 @@ static void
gtk_check_button_init (GtkCheckButton *check_button)
{
GTK_WIDGET_SET_FLAGS (check_button, GTK_NO_WINDOW);
- check_button->toggle_button.draw_indicator = TRUE;
+ GTK_TOGGLE_BUTTON (check_button)->draw_indicator = TRUE;
}
GtkWidget*
gtk_check_button_new (void)
{
- return GTK_WIDGET (gtk_type_new (gtk_check_button_get_type ()));
+ return gtk_widget_new (GTK_TYPE_CHECK_BUTTON, NULL);
}
@@ -108,14 +108,14 @@ gtk_check_button_new_with_label (const gchar *label)
{
GtkWidget *check_button;
GtkWidget *label_widget;
-
+
check_button = gtk_check_button_new ();
label_widget = gtk_label_new (label);
gtk_misc_set_alignment (GTK_MISC (label_widget), 0.0, 0.5);
-
+
gtk_container_add (GTK_CONTAINER (check_button), label_widget);
gtk_widget_show (label_widget);
-
+
return check_button;
}
@@ -123,25 +123,27 @@ static void
gtk_check_button_draw (GtkWidget *widget,
GdkRectangle *area)
{
- GtkButton *button;
GtkCheckButton *check_button;
+ GtkToggleButton *toggle_button;
+ GtkBin *bin;
GdkRectangle child_area;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
+
+ check_button = GTK_CHECK_BUTTON (widget);
+ toggle_button = GTK_TOGGLE_BUTTON (widget);
+ bin = GTK_BIN (widget);
+
+ if (GTK_WIDGET_DRAWABLE (widget))
{
- check_button = GTK_CHECK_BUTTON (widget);
-
- if (check_button->toggle_button.draw_indicator)
+ if (toggle_button->draw_indicator)
{
gint border_width;
- button = GTK_BUTTON (widget);
-
+
gtk_check_button_draw_indicator (check_button, area);
-
+
border_width = GTK_CONTAINER (widget)->border_width;
if (GTK_WIDGET_HAS_FOCUS (widget))
gtk_paint_focus (widget->style, widget->window,
@@ -151,9 +153,9 @@ gtk_check_button_draw (GtkWidget *widget,
widget->allocation.width - 2 * border_width - 1,
widget->allocation.height - 2 * border_width - 1);
- if (GTK_BIN (button)->child && GTK_WIDGET_NO_WINDOW (GTK_BIN (button)->child) &&
- gtk_widget_intersect (GTK_BIN (button)->child, area, &child_area))
- gtk_widget_draw (GTK_BIN (button)->child, &child_area);
+ if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) &&
+ gtk_widget_intersect (bin->child, area, &child_area))
+ gtk_widget_draw (bin->child, &child_area);
}
else
{
@@ -170,39 +172,36 @@ gtk_check_button_draw_focus (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
-
+
border_width = GTK_CONTAINER (widget)->border_width;
- gtk_widget_queue_clear_area(widget->parent,
- border_width + widget->allocation.x,
- border_width + widget->allocation.y,
- widget->allocation.width - 2 * border_width,
- widget->allocation.height - 2 * border_width);
+ gtk_widget_queue_clear_area (widget->parent,
+ border_width + widget->allocation.x,
+ border_width + widget->allocation.y,
+ widget->allocation.width - 2 * border_width,
+ widget->allocation.height - 2 * border_width);
}
static void
gtk_check_button_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
- GtkCheckButton *check_button;
- GtkButton *button;
+ GtkToggleButton *toggle_button;
gint temp;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
g_return_if_fail (requisition != NULL);
-
- check_button = GTK_CHECK_BUTTON (widget);
-
+
+ toggle_button = GTK_TOGGLE_BUTTON (widget);
+
if (GTK_WIDGET_CLASS (parent_class)->size_request)
(* GTK_WIDGET_CLASS (parent_class)->size_request) (widget, requisition);
-
- if (check_button->toggle_button.draw_indicator)
+
+ if (toggle_button->draw_indicator)
{
- button = GTK_BUTTON (widget);
-
requisition->width += (CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 2);
-
+
temp = (CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 2);
requisition->height = MAX (requisition->height, temp) + 2;
@@ -221,34 +220,35 @@ gtk_check_button_size_allocate (GtkWidget *widget,
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (widget));
g_return_if_fail (allocation != NULL);
-
+
check_button = GTK_CHECK_BUTTON (widget);
toggle_button = GTK_TOGGLE_BUTTON (widget);
- if (check_button->toggle_button.draw_indicator)
+
+ if (toggle_button->draw_indicator)
{
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (toggle_button->event_window,
allocation->x, allocation->y,
allocation->width, allocation->height);
-
+
button = GTK_BUTTON (widget);
-
+
if (GTK_BIN (button)->child && GTK_WIDGET_VISIBLE (GTK_BIN (button)->child))
{
child_allocation.x = (GTK_CONTAINER (widget)->border_width +
CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1 +
widget->allocation.x);
- child_allocation.y = GTK_CONTAINER (widget)->border_width + 1 +
- widget->allocation.y;
+ child_allocation.y = GTK_CONTAINER (widget)->border_width + 1 +
+ widget->allocation.y;
child_allocation.width = MAX (1, allocation->width -
(GTK_CONTAINER (widget)->border_width +
CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1) -
- GTK_CONTAINER (widget)->border_width - 1);
+ GTK_CONTAINER (widget)->border_width - 1);
child_allocation.height = MAX (1, allocation->height - (GTK_CONTAINER (widget)->border_width + 1) * 2);
-
+
gtk_widget_size_allocate (GTK_BIN (button)->child, &child_allocation);
}
}
@@ -263,29 +263,30 @@ static gint
gtk_check_button_expose (GtkWidget *widget,
GdkEventExpose *event)
{
- GtkButton *button;
GtkCheckButton *check_button;
+ GtkToggleButton *toggle_button;
+ GtkBin *bin;
GdkEventExpose child_event;
-
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CHECK_BUTTON (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget))
+
+ check_button = GTK_CHECK_BUTTON (widget);
+ toggle_button = GTK_TOGGLE_BUTTON (widget);
+ bin = GTK_BIN (widget);
+
+ if (GTK_WIDGET_DRAWABLE (widget))
{
- check_button = GTK_CHECK_BUTTON (widget);
-
- if (check_button->toggle_button.draw_indicator)
+ if (toggle_button->draw_indicator)
{
- button = GTK_BUTTON (widget);
-
gtk_check_button_draw_indicator (check_button, &event->area);
-
+
child_event = *event;
- if (GTK_BIN (button)->child && GTK_WIDGET_NO_WINDOW (GTK_BIN (button)->child) &&
- gtk_widget_intersect (GTK_BIN (button)->child, &event->area, &child_event.area))
- gtk_widget_event (GTK_BIN (button)->child, (GdkEvent*) &child_event);
-
+ if (bin->child && GTK_WIDGET_NO_WINDOW (bin->child) &&
+ gtk_widget_intersect (bin->child, &event->area, &child_event.area))
+ gtk_widget_event (bin->child, (GdkEvent*) &child_event);
+
gtk_widget_draw_focus (widget);
}
else
@@ -294,7 +295,7 @@ gtk_check_button_expose (GtkWidget *widget,
(* GTK_WIDGET_CLASS (parent_class)->expose_event) (widget, event);
}
}
-
+
return FALSE;
}
@@ -304,20 +305,19 @@ gtk_check_button_draw_indicator (GtkCheckButton *check_button,
GdkRectangle *area)
{
GtkCheckButtonClass *class;
-
+
g_return_if_fail (check_button != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
- g_return_if_fail (CHECK_BUTTON_CLASS (check_button) != NULL);
-
+
class = CHECK_BUTTON_CLASS (check_button);
-
+
if (class->draw_indicator)
(* class->draw_indicator) (check_button, area);
}
static void
gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
- GdkRectangle *area)
+ GdkRectangle *area)
{
GtkWidget *widget;
GtkToggleButton *toggle_button;
@@ -327,35 +327,32 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
GdkRectangle new_area;
gint width, height;
gint x, y;
- GdkWindow *window;
-
+ GdkWindow *window;
+
g_return_if_fail (check_button != NULL);
g_return_if_fail (GTK_IS_CHECK_BUTTON (check_button));
-
-
+
+ widget = GTK_WIDGET (check_button);
+ toggle_button = GTK_TOGGLE_BUTTON (check_button);
+
if (GTK_WIDGET_DRAWABLE (check_button))
{
- widget = GTK_WIDGET (check_button);
- toggle_button = GTK_TOGGLE_BUTTON (check_button);
-
- window = widget->window;
- if (!window)
- return;
-
- state_type = GTK_WIDGET_STATE (widget);
- if ((state_type != GTK_STATE_NORMAL) &&
- (state_type != GTK_STATE_PRELIGHT))
+ window = widget->window;
+
+ state_type = GTK_WIDGET_STATE (widget);
+ if (state_type != GTK_STATE_NORMAL &&
+ state_type != GTK_STATE_PRELIGHT)
state_type = GTK_STATE_NORMAL;
-
+
restrict_area.x = widget->allocation.x + GTK_CONTAINER (widget)->border_width;
restrict_area.y = widget->allocation.y + GTK_CONTAINER (widget)->border_width;
restrict_area.width = widget->allocation.width - ( 2 * GTK_CONTAINER (widget)->border_width);
restrict_area.height = widget->allocation.height - ( 2 * GTK_CONTAINER (widget)->border_width);
-
+
if (gdk_rectangle_intersect (area, &restrict_area, &new_area))
{
- if (state_type != GTK_STATE_NORMAL)
- gtk_paint_flat_box(widget->style, window, state_type,
+ if (state_type != GTK_STATE_NORMAL)
+ gtk_paint_flat_box (widget->style, window, state_type,
GTK_SHADOW_ETCHED_OUT,
area, widget, "checkbutton",
new_area.x, new_area.y,
@@ -366,16 +363,15 @@ gtk_real_check_button_draw_indicator (GtkCheckButton *check_button,
y = widget->allocation.y + (widget->allocation.height - CHECK_BUTTON_CLASS (widget)->indicator_size) / 2;
width = CHECK_BUTTON_CLASS (widget)->indicator_size;
height = CHECK_BUTTON_CLASS (widget)->indicator_size;
-
+
if (GTK_TOGGLE_BUTTON (widget)->active)
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
-
- gtk_paint_check (widget->style, window,
- GTK_WIDGET_STATE (widget), shadow_type,
- area, widget, "checkbutton",
- x + 1, y + 1, width, height);
+
+ gtk_paint_check (widget->style, window,
+ GTK_WIDGET_STATE (widget), shadow_type,
+ area, widget, "checkbutton",
+ x + 1, y + 1, width, height);
}
}
-
diff --git a/gtk/gtkcompat.h b/gtk/gtkcompat.h
index 3b4e90c3bf..63efea5c96 100644
--- a/gtk/gtkcompat.h
+++ b/gtk/gtkcompat.h
@@ -36,6 +36,7 @@ extern "C" {
#define gtk_paned_handle_size gtk_paned_set_handle_size
#define gtk_scale_value_width gtk_scale_get_value_width
#define gtk_window_position gtk_window_set_position
+#define gtk_toggle_button_set_state gtk_toggle_button_set_active
#ifdef __cplusplus
}
diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c
index baae35da73..e50b9490c3 100644
--- a/gtk/gtkfontsel.c
+++ b/gtk/gtkfontsel.c
@@ -658,14 +658,14 @@ gtk_font_selection_init(GtkFontSelection *fontsel)
gtk_widget_show (fontsel->points_button);
gtk_box_pack_start (GTK_BOX (hbox2), fontsel->points_button, FALSE, TRUE, 0);
if (INITIAL_METRIC == GTK_FONT_METRIC_POINTS)
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->points_button),
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fontsel->points_button),
TRUE);
fontsel->pixels_button = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(fontsel->points_button), _("Pixels"));
gtk_widget_show (fontsel->pixels_button);
gtk_box_pack_start (GTK_BOX (hbox2), fontsel->pixels_button, FALSE, TRUE, 0);
if (INITIAL_METRIC == GTK_FONT_METRIC_PIXELS)
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->pixels_button),
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fontsel->pixels_button),
TRUE);
gtk_signal_connect(GTK_OBJECT(fontsel->points_button), "toggled",
@@ -798,13 +798,13 @@ gtk_font_selection_init(GtkFontSelection *fontsel)
gtk_box_pack_start (GTK_BOX (hbox), hbox2, FALSE, TRUE, 0);
fontsel->type_bitmaps_button = gtk_check_button_new_with_label (_("Bitmap"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), TRUE);
gtk_widget_show (fontsel->type_bitmaps_button);
gtk_box_pack_start (GTK_BOX (hbox2), fontsel->type_bitmaps_button,
FALSE, TRUE, 0);
fontsel->type_scalable_button = gtk_check_button_new_with_label (_("Scalable"));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), TRUE);
gtk_widget_show (fontsel->type_scalable_button);
gtk_box_pack_start (GTK_BOX (hbox2), fontsel->type_scalable_button,
FALSE, TRUE, 0);
@@ -2326,11 +2326,11 @@ gtk_font_selection_reset_filter (GtkWidget *w,
base_font_type = fontsel->filters[GTK_FONT_FILTER_BASE].font_type;
if (base_font_type & GTK_FONT_BITMAP)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), TRUE);
if (base_font_type & GTK_FONT_SCALABLE)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), TRUE);
if (base_font_type & GTK_FONT_SCALABLE_BITMAP)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), FALSE);
for (prop = 0; prop < GTK_NUM_FONT_PROPERTIES; prop++)
gtk_clist_select_row(GTK_CLIST(fontsel->filter_clists[prop]), 0, 0);
@@ -2461,47 +2461,47 @@ gtk_font_selection_set_filter (GtkFontSelection *fontsel,
if (font_type & GTK_FONT_BITMAP)
{
gtk_widget_set_sensitive (fontsel->type_bitmaps_button, TRUE);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), user_font_type & GTK_FONT_BITMAP);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), user_font_type & GTK_FONT_BITMAP);
}
else
{
gtk_widget_set_sensitive (fontsel->type_bitmaps_button, FALSE);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), FALSE);
}
if (font_type & GTK_FONT_SCALABLE)
{
gtk_widget_set_sensitive (fontsel->type_scalable_button, TRUE);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), user_font_type & GTK_FONT_SCALABLE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), user_font_type & GTK_FONT_SCALABLE);
}
else
{
gtk_widget_set_sensitive (fontsel->type_scalable_button, FALSE);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), FALSE);
}
if (font_type & GTK_FONT_SCALABLE_BITMAP)
{
gtk_widget_set_sensitive (fontsel->type_scaled_bitmaps_button, TRUE);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), user_font_type & GTK_FONT_SCALABLE_BITMAP);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), user_font_type & GTK_FONT_SCALABLE_BITMAP);
}
else
{
gtk_widget_set_sensitive (fontsel->type_scaled_bitmaps_button, FALSE);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), FALSE);
}
}
else
{
base_font_type = fontsel->filters[GTK_FONT_FILTER_BASE].font_type;
if (base_font_type & GTK_FONT_BITMAP)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), font_type & GTK_FONT_BITMAP);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_bitmaps_button), font_type & GTK_FONT_BITMAP);
if (base_font_type & GTK_FONT_SCALABLE)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), font_type & GTK_FONT_SCALABLE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scalable_button), font_type & GTK_FONT_SCALABLE);
if (base_font_type & GTK_FONT_SCALABLE_BITMAP)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), font_type & GTK_FONT_SCALABLE_BITMAP);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fontsel->type_scaled_bitmaps_button), font_type & GTK_FONT_SCALABLE_BITMAP);
/* If the user filter is not the default, make the 'Reset Filter' button
sensitive. */
@@ -3163,7 +3163,7 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
size = 20;
fontsel->size = fontsel->selected_size = size;
fontsel->metric = GTK_FONT_METRIC_POINTS;
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->points_button),
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fontsel->points_button),
TRUE);
if (size % 10 == 0)
sprintf (buffer, "%i", size / 10);
@@ -3179,7 +3179,7 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel,
size = 2;
fontsel->size = fontsel->selected_size = size;
fontsel->metric = GTK_FONT_METRIC_PIXELS;
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->pixels_button),
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fontsel->pixels_button),
TRUE);
sprintf (buffer, "%i", size);
}
diff --git a/gtk/gtkgamma.c b/gtk/gtkgamma.c
index f395712e38..cd68139fe4 100644
--- a/gtk/gtkgamma.c
+++ b/gtk/gtkgamma.c
@@ -329,7 +329,7 @@ button_toggled_callback (GtkWidget *w, gpointer data)
break;
if (i < 3)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (c->button[i]), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->button[i]), FALSE);
switch (active)
{
@@ -444,7 +444,7 @@ curve_type_changed_callback (GtkWidget *w, gpointer data)
default: active = 2; break;
}
if (!GTK_TOGGLE_BUTTON (c->button[active])->active)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (c->button[active]), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c->button[active]), TRUE);
}
GtkWidget*
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 63fa67d33a..7aec7ac2ad 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -1466,10 +1466,10 @@ gtk_rc_parse_bg_pixmap (GScanner *scanner,
if (token != G_TOKEN_STRING)
return G_TOKEN_STRING;
- if (strcmp (scanner->value.v_string, "<parent>"))
- pixmap_file = gtk_rc_find_pixmap_in_path (scanner, scanner->value.v_string);
- else
+ if (strcmp (scanner->value.v_string, "<parent>") == 0)
pixmap_file = g_strdup (scanner->value.v_string);
+ else
+ pixmap_file = gtk_rc_find_pixmap_in_path (scanner, scanner->value.v_string);
if (pixmap_file)
{
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 8d737198a2..97df6898d2 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -288,29 +288,29 @@ static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s);
static const GtkStyleClass default_class =
{
- 2,
- 2,
- gtk_default_draw_hline,
- gtk_default_draw_vline,
- gtk_default_draw_shadow,
- gtk_default_draw_polygon,
- gtk_default_draw_arrow,
- gtk_default_draw_diamond,
- gtk_default_draw_oval,
- gtk_default_draw_string,
- gtk_default_draw_box,
- gtk_default_draw_flat_box,
- gtk_default_draw_check,
- gtk_default_draw_option,
- gtk_default_draw_cross,
- gtk_default_draw_ramp,
- gtk_default_draw_tab,
- gtk_default_draw_shadow_gap,
- gtk_default_draw_box_gap,
- gtk_default_draw_extension,
- gtk_default_draw_focus,
- gtk_default_draw_slider,
- gtk_default_draw_handle
+ 2,
+ 2,
+ gtk_default_draw_hline,
+ gtk_default_draw_vline,
+ gtk_default_draw_shadow,
+ gtk_default_draw_polygon,
+ gtk_default_draw_arrow,
+ gtk_default_draw_diamond,
+ gtk_default_draw_oval,
+ gtk_default_draw_string,
+ gtk_default_draw_box,
+ gtk_default_draw_flat_box,
+ gtk_default_draw_check,
+ gtk_default_draw_option,
+ gtk_default_draw_cross,
+ gtk_default_draw_ramp,
+ gtk_default_draw_tab,
+ gtk_default_draw_shadow_gap,
+ gtk_default_draw_box_gap,
+ gtk_default_draw_extension,
+ gtk_default_draw_focus,
+ gtk_default_draw_slider,
+ gtk_default_draw_handle
};
GdkFont *default_font = NULL;
@@ -331,24 +331,24 @@ gtk_style_copy (GtkStyle *style)
{
GtkStyle *new_style;
guint i;
-
+
g_return_val_if_fail (style != NULL, NULL);
-
+
new_style = gtk_style_new ();
-
+
for (i = 0; i < 5; i++)
{
new_style->fg[i] = style->fg[i];
new_style->bg[i] = style->bg[i];
new_style->text[i] = style->text[i];
new_style->base[i] = style->base[i];
-
+
new_style->bg_pixmap[i] = style->bg_pixmap[i];
}
-
+
new_style->font = style->font;
gdk_font_ref (new_style->font);
-
+
return new_style;
}
@@ -356,14 +356,14 @@ static GtkStyle*
gtk_style_duplicate (GtkStyle *style)
{
GtkStyle *new_style;
-
+
g_return_val_if_fail (style != NULL, NULL);
-
+
new_style = gtk_style_copy (style);
-
+
style->styles = g_slist_append (style->styles, new_style);
new_style->styles = style->styles;
-
+
if (style->rc_style)
{
new_style->rc_style = style->rc_style;
@@ -375,7 +375,7 @@ gtk_style_duplicate (GtkStyle *style)
new_style->engine = style->engine;
new_style->engine->duplicate_style (new_style, style);
}
-
+
return new_style;
}
@@ -384,62 +384,62 @@ gtk_style_new (void)
{
GtkStyle *style;
gint i;
-
+
style = g_new0 (GtkStyle, 1);
-
+
if (!default_font)
default_font =
gdk_font_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*");
-
+
style->font = default_font;
gdk_font_ref (style->font);
-
+
style->ref_count = 1;
style->attach_count = 0;
style->colormap = NULL;
style->depth = -1;
style->klass = &default_class;
-
+
style->black.red = 0;
style->black.green = 0;
style->black.blue = 0;
-
+
style->white.red = 65535;
style->white.green = 65535;
style->white.blue = 65535;
-
+
style->black_gc = NULL;
style->white_gc = NULL;
-
+
style->fg[GTK_STATE_NORMAL] = gtk_default_normal_fg;
style->fg[GTK_STATE_ACTIVE] = gtk_default_active_fg;
style->fg[GTK_STATE_PRELIGHT] = gtk_default_prelight_fg;
style->fg[GTK_STATE_SELECTED] = gtk_default_selected_fg;
style->fg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_fg;
-
+
style->bg[GTK_STATE_NORMAL] = gtk_default_normal_bg;
style->bg[GTK_STATE_ACTIVE] = gtk_default_active_bg;
style->bg[GTK_STATE_PRELIGHT] = gtk_default_prelight_bg;
style->bg[GTK_STATE_SELECTED] = gtk_default_selected_bg;
style->bg[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
-
+
for (i = 0; i < 4; i++)
{
style->text[i] = style->fg[i];
style->base[i] = style->white;
}
-
+
style->base[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
style->text[GTK_STATE_INSENSITIVE] = gtk_default_insensitive_bg;
-
+
for (i = 0; i < 5; i++)
style->bg_pixmap[i] = NULL;
-
+
style->engine = NULL;
style->engine_data = NULL;
-
+
style->rc_style = NULL;
-
+
for (i = 0; i < 5; i++)
{
style->fg_gc[i] = NULL;
@@ -450,7 +450,7 @@ gtk_style_new (void)
style->text_gc[i] = NULL;
style->base_gc[i] = NULL;
}
-
+
return style;
}
@@ -462,21 +462,21 @@ gtk_style_attach (GtkStyle *style,
GtkStyle *new_style = NULL;
GdkColormap *colormap;
gint depth;
-
+
g_return_val_if_fail (style != NULL, NULL);
g_return_val_if_fail (window != NULL, NULL);
-
+
colormap = gdk_window_get_colormap (window);
depth = gdk_window_get_visual (window)->depth;
-
+
if (!style->styles)
style->styles = g_slist_append (NULL, style);
-
+
styles = style->styles;
while (styles)
{
new_style = styles->data;
-
+
if (new_style->attach_count == 0)
{
gtk_style_init (new_style, colormap, depth);
@@ -485,24 +485,24 @@ gtk_style_attach (GtkStyle *style,
else if ((new_style->colormap == colormap) &&
(new_style->depth == depth))
break;
-
+
new_style = NULL;
styles = styles->next;
}
-
+
if (!new_style)
{
new_style = gtk_style_duplicate (style);
gtk_style_init (new_style, colormap, depth);
}
-
+
if (new_style->attach_count == 0)
gtk_style_ref (new_style);
-
-
+
+
new_style->attach_count++;
-
+
return new_style;
}
@@ -510,15 +510,15 @@ void
gtk_style_detach (GtkStyle *style)
{
gint i;
-
+
g_return_if_fail (style != NULL);
-
+
style->attach_count -= 1;
if (style->attach_count == 0)
{
if (style->engine)
style->engine->unrealize_style (style);
-
+
gtk_gc_release (style->black_gc);
gtk_gc_release (style->white_gc);
@@ -532,7 +532,7 @@ gtk_style_detach (GtkStyle *style)
gtk_gc_release (style->text_gc[i]);
gtk_gc_release (style->base_gc[i]);
}
-
+
gtk_style_unref (style);
}
}
@@ -541,7 +541,7 @@ GtkStyle*
gtk_style_ref (GtkStyle *style)
{
g_return_val_if_fail (style != NULL, NULL);
-
+
style->ref_count += 1;
return style;
}
@@ -550,7 +550,7 @@ void
gtk_style_unref (GtkStyle *style)
{
g_return_if_fail (style != NULL);
-
+
style->ref_count -= 1;
if (style->ref_count == 0)
gtk_style_destroy (style);
@@ -564,9 +564,9 @@ gtk_style_init (GtkStyle *style,
GdkGCValues gc_values;
GdkGCValuesMask gc_values_mask;
gint i;
-
+
g_return_if_fail (style != NULL);
-
+
style->colormap = colormap;
style->depth = depth;
@@ -645,7 +645,7 @@ gtk_style_init (GtkStyle *style,
gc_values.foreground = style->text[i];
style->text_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
-
+
gc_values.foreground = style->base[i];
style->base_gc[i] = gtk_gc_get (style->depth, style->colormap, &gc_values, gc_values_mask);
}
@@ -657,7 +657,7 @@ static void
gtk_style_destroy (GtkStyle *style)
{
g_return_if_fail (style->attach_count == 0);
-
+
if (style->styles)
{
if (style->styles->data != style)
@@ -673,17 +673,17 @@ gtk_style_destroy (GtkStyle *style)
g_slist_free_1 (style->styles);
}
}
-
+
if (style->engine)
{
style->engine->destroy_style (style);
gtk_theme_engine_unref (style->engine);
}
-
+
gdk_font_unref (style->font);
if (style->rc_style)
gtk_rc_style_unref (style->rc_style);
-
+
g_free (style);
}
@@ -694,16 +694,16 @@ gtk_style_set_background (GtkStyle *style,
{
GdkPixmap *pixmap;
gint parent_relative;
-
- if (style->engine && style->engine->set_background)
- {
- (*style->engine->set_background) (style, window, state_type);
- return;
- }
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
+
+ if (style->engine && style->engine->set_background)
+ {
+ (*style->engine->set_background) (style, window, state_type);
+ return;
+ }
+
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
if (style->bg_pixmap[state_type])
{
if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
@@ -716,7 +716,7 @@ gtk_style_set_background (GtkStyle *style,
pixmap = style->bg_pixmap[state_type];
parent_relative = FALSE;
}
-
+
gdk_window_set_back_pixmap (window, pixmap, parent_relative);
}
else
@@ -735,7 +735,7 @@ gtk_draw_hline (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_hline != NULL);
-
+
(*style->klass->draw_hline) (style, window, state_type, NULL, NULL, NULL, x1, x2, y);
}
@@ -751,7 +751,7 @@ gtk_draw_vline (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_vline != NULL);
-
+
(*style->klass->draw_vline) (style, window, state_type, NULL, NULL, NULL, y1, y2, x);
}
@@ -769,8 +769,8 @@ gtk_draw_shadow (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_shadow != NULL);
-
- (*style->klass->draw_shadow) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+
+ (*style->klass->draw_shadow) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -785,7 +785,7 @@ gtk_draw_polygon (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_shadow != NULL);
-
+
(*style->klass->draw_polygon) (style, window, state_type, shadow_type, NULL, NULL, NULL, points, npoints, fill);
}
@@ -804,7 +804,7 @@ gtk_draw_arrow (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_arrow != NULL);
-
+
(*style->klass->draw_arrow) (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, fill, x, y, width, height);
}
@@ -822,7 +822,7 @@ gtk_draw_diamond (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_diamond != NULL);
-
+
(*style->klass->draw_diamond) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
@@ -840,7 +840,7 @@ gtk_draw_oval (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_oval != NULL);
-
+
(*style->klass->draw_oval) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
@@ -855,25 +855,25 @@ gtk_draw_string (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_oval != NULL);
-
+
(*style->klass->draw_string) (style, window, state_type, NULL, NULL, NULL, x, y, string);
}
void
gtk_draw_box (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow_type,
- gint x,
- gint y,
- gint width,
- gint height)
+ GdkWindow *window,
+ GtkStateType state_type,
+ GtkShadowType shadow_type,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_box != NULL);
-
- (*style->klass->draw_box) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_box != NULL);
+
+ (*style->klass->draw_box) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -886,11 +886,11 @@ gtk_draw_flat_box (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_flat_box != NULL);
-
- (*style->klass->draw_flat_box) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_flat_box != NULL);
+
+ (*style->klass->draw_flat_box) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -903,11 +903,11 @@ gtk_draw_check (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_check != NULL);
-
- (*style->klass->draw_check) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_check != NULL);
+
+ (*style->klass->draw_check) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -920,11 +920,11 @@ gtk_draw_option (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_option != NULL);
-
- (*style->klass->draw_option) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_option != NULL);
+
+ (*style->klass->draw_option) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -937,11 +937,11 @@ gtk_draw_cross (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_cross != NULL);
-
- (*style->klass->draw_cross) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_cross != NULL);
+
+ (*style->klass->draw_cross) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -955,11 +955,11 @@ gtk_draw_ramp (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_ramp != NULL);
-
- (*style->klass->draw_ramp) (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_ramp != NULL);
+
+ (*style->klass->draw_ramp) (style, window, state_type, shadow_type, NULL, NULL, NULL, arrow_type, x, y, width, height);
}
void
@@ -972,11 +972,11 @@ gtk_draw_tab (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_tab != NULL);
-
- (*style->klass->draw_tab) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_tab != NULL);
+
+ (*style->klass->draw_tab) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -992,11 +992,11 @@ gtk_draw_shadow_gap (GtkStyle *style,
gint gap_x,
gint gap_width)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_shadow_gap != NULL);
-
- (*style->klass->draw_shadow_gap) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_shadow_gap != NULL);
+
+ (*style->klass->draw_shadow_gap) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
}
void
@@ -1012,11 +1012,11 @@ gtk_draw_box_gap (GtkStyle *style,
gint gap_x,
gint gap_width)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_box_gap != NULL);
-
- (*style->klass->draw_box_gap) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_box_gap != NULL);
+
+ (*style->klass->draw_box_gap) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side, gap_x, gap_width);
}
void
@@ -1030,11 +1030,11 @@ gtk_draw_extension (GtkStyle *style,
gint height,
GtkPositionType gap_side)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_extension != NULL);
-
- (*style->klass->draw_extension) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_extension != NULL);
+
+ (*style->klass->draw_extension) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, gap_side);
}
void
@@ -1045,11 +1045,11 @@ gtk_draw_focus (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_focus != NULL);
-
- (*style->klass->draw_focus) (style, window, NULL, NULL, NULL, x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_focus != NULL);
+
+ (*style->klass->draw_focus) (style, window, NULL, NULL, NULL, x, y, width, height);
}
void
@@ -1063,11 +1063,11 @@ gtk_draw_slider (GtkStyle *style,
gint height,
GtkOrientation orientation)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_slider != NULL);
-
- (*style->klass->draw_slider) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_slider != NULL);
+
+ (*style->klass->draw_slider) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
}
void
@@ -1081,32 +1081,32 @@ gtk_draw_handle (GtkStyle *style,
gint height,
GtkOrientation orientation)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (style->klass != NULL);
- g_return_if_fail (style->klass->draw_handle != NULL);
-
- (*style->klass->draw_handle) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (style->klass != NULL);
+ g_return_if_fail (style->klass->draw_handle != NULL);
+
+ (*style->klass->draw_handle) (style, window, state_type, shadow_type, NULL, NULL, NULL, x, y, width, height, orientation);
}
/* Default functions */
void
-gtk_style_apply_default_pixmap(GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- gint x,
- gint y,
- gint width,
- gint height)
+gtk_style_apply_default_pixmap (GtkStyle *style,
+ GdkWindow *window,
+ GtkStateType state_type,
+ GdkRectangle *area,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
GdkRectangle new_rect, old_rect;
GdkGC *gc;
-
- if ((!style->bg_pixmap[state_type]) ||
- (gdk_window_get_type(window) == GDK_WINDOW_PIXMAP))
+
+ if (!style->bg_pixmap[state_type] ||
+ gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
{
gc = style->bg_gc[state_type];
-
+
old_rect.x = x;
old_rect.y = y;
old_rect.width = width;
@@ -1114,30 +1114,30 @@ gtk_style_apply_default_pixmap(GtkStyle *style,
if (area)
{
- if (gdk_rectangle_intersect(area, &old_rect, &new_rect))
- gdk_draw_rectangle(window, gc, TRUE,
- new_rect.x, new_rect.y, new_rect.width, new_rect.height);
+ if (gdk_rectangle_intersect (area, &old_rect, &new_rect))
+ gdk_draw_rectangle (window, gc, TRUE,
+ new_rect.x, new_rect.y, new_rect.width, new_rect.height);
}
else
- gdk_draw_rectangle(window, gc, TRUE,
- x, y, width, height);
+ gdk_draw_rectangle (window, gc, TRUE,
+ x, y, width, height);
}
else
{
if (style->bg_pixmap[state_type] == (GdkPixmap*) GDK_PARENT_RELATIVE)
- gdk_window_set_back_pixmap(window, NULL, TRUE);
+ gdk_window_set_back_pixmap (window, NULL, TRUE);
else
- gdk_window_set_back_pixmap(window, style->bg_pixmap[state_type], FALSE);
+ gdk_window_set_back_pixmap (window, style->bg_pixmap[state_type], FALSE);
old_rect.x = x;
old_rect.y = y;
old_rect.width = width;
old_rect.height = height;
- if ((area) && (gdk_rectangle_intersect(area, &old_rect, &new_rect)))
- gdk_window_clear_area(window, new_rect.x, new_rect.y, new_rect.width, new_rect.height);
+ if (area && gdk_rectangle_intersect (area, &old_rect, &new_rect))
+ gdk_window_clear_area (window, new_rect.x, new_rect.y, new_rect.width, new_rect.height);
else
- gdk_window_clear_area(window, x, y, width, height);
+ gdk_window_clear_area (window, x, y, width, height);
}
}
@@ -1152,49 +1152,49 @@ gtk_default_draw_hline (GtkStyle *style,
gint x2,
gint y)
{
- gint thickness_light;
- gint thickness_dark;
- gint i;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- thickness_light = style->klass->ythickness / 2;
- thickness_dark = style->klass->ythickness - thickness_light;
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
- gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
- }
-
- if (detail && !strcmp (detail, "label"))
- {
- if (state_type == GTK_STATE_INSENSITIVE)
- gdk_draw_line (window, style->white_gc, x1 + 1, y + 1, x2 + 1, y + 1);
- gdk_draw_line (window, style->fg_gc[state_type], x1, y, x2, y);
- }
- else
- {
- for (i = 0; i < thickness_dark; i++)
- {
- gdk_draw_line (window, style->light_gc[state_type], x2 - i - 1, y + i, x2, y + i);
- gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x2 - i - 1, y + i);
- }
-
- y += thickness_dark;
- for (i = 0; i < thickness_light; i++)
- {
- gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x1 + thickness_light - i - 1, y + i);
- gdk_draw_line (window, style->light_gc[state_type], x1 + thickness_light - i - 1, y + i, x2, y + i);
- }
- }
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
- gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
- }
+ gint thickness_light;
+ gint thickness_dark;
+ gint i;
+
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ thickness_light = style->klass->ythickness / 2;
+ thickness_dark = style->klass->ythickness - thickness_light;
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
+ gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
+ }
+
+ if (detail && !strcmp (detail, "label"))
+ {
+ if (state_type == GTK_STATE_INSENSITIVE)
+ gdk_draw_line (window, style->white_gc, x1 + 1, y + 1, x2 + 1, y + 1);
+ gdk_draw_line (window, style->fg_gc[state_type], x1, y, x2, y);
+ }
+ else
+ {
+ for (i = 0; i < thickness_dark; i++)
+ {
+ gdk_draw_line (window, style->light_gc[state_type], x2 - i - 1, y + i, x2, y + i);
+ gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x2 - i - 1, y + i);
+ }
+
+ y += thickness_dark;
+ for (i = 0; i < thickness_light; i++)
+ {
+ gdk_draw_line (window, style->dark_gc[state_type], x1, y + i, x1 + thickness_light - i - 1, y + i);
+ gdk_draw_line (window, style->light_gc[state_type], x1 + thickness_light - i - 1, y + i, x2, y + i);
+ }
+ }
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
+ gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
+ }
}
@@ -1209,38 +1209,38 @@ gtk_default_draw_vline (GtkStyle *style,
gint y2,
gint x)
{
- gint thickness_light;
- gint thickness_dark;
- gint i;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- thickness_light = style->klass->xthickness / 2;
- thickness_dark = style->klass->xthickness - thickness_light;
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
- gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
- }
- for (i = 0; i < thickness_dark; i++)
- {
- gdk_draw_line (window, style->light_gc[state_type], x + i, y2 - i - 1, x + i, y2);
+ gint thickness_light;
+ gint thickness_dark;
+ gint i;
+
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ thickness_light = style->klass->xthickness / 2;
+ thickness_dark = style->klass->xthickness - thickness_light;
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
+ gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
+ }
+ for (i = 0; i < thickness_dark; i++)
+ {
+ gdk_draw_line (window, style->light_gc[state_type], x + i, y2 - i - 1, x + i, y2);
gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y2 - i - 1);
- }
-
- x += thickness_dark;
- for (i = 0; i < thickness_light; i++)
- {
- gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y1 + thickness_light - i);
- gdk_draw_line (window, style->light_gc[state_type], x + i, y1 + thickness_light - i, x + i, y2);
- }
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
- gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
- }
+ }
+
+ x += thickness_dark;
+ for (i = 0; i < thickness_light; i++)
+ {
+ gdk_draw_line (window, style->dark_gc[state_type], x + i, y1, x + i, y1 + thickness_light - i);
+ gdk_draw_line (window, style->light_gc[state_type], x + i, y1 + thickness_light - i, x + i, y2);
+ }
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
+ gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
+ }
}
@@ -1262,17 +1262,17 @@ gtk_default_draw_shadow (GtkStyle *style,
gint thickness_light;
gint thickness_dark;
gint i;
-
+
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
-
+
if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height);
else if (width == -1)
gdk_window_get_size (window, &width, NULL);
else if (height == -1)
gdk_window_get_size (window, NULL, &height);
-
+
switch (shadow_type)
{
case GTK_SHADOW_NONE:
@@ -1288,72 +1288,73 @@ gtk_default_draw_shadow (GtkStyle *style,
gc2 = style->light_gc[state_type];
break;
}
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (gc1, area);
- gdk_gc_set_clip_rectangle (gc2, area);
- if ((shadow_type == GTK_SHADOW_IN) ||
- (shadow_type == GTK_SHADOW_OUT))
- {
- gdk_gc_set_clip_rectangle (style->black_gc, area);
- gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
- }
- }
- switch (shadow_type)
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (gc1, area);
+ gdk_gc_set_clip_rectangle (gc2, area);
+ if (shadow_type == GTK_SHADOW_IN ||
+ shadow_type == GTK_SHADOW_OUT)
+ {
+ gdk_gc_set_clip_rectangle (style->black_gc, area);
+ gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
+ }
+ }
+
+ switch (shadow_type)
{
case GTK_SHADOW_NONE:
break;
-
+
case GTK_SHADOW_IN:
gdk_draw_line (window, gc1,
x, y + height - 1, x + width - 1, y + height - 1);
gdk_draw_line (window, gc1,
x + width - 1, y, x + width - 1, y + height - 1);
-
+
gdk_draw_line (window, style->bg_gc[state_type],
x + 1, y + height - 2, x + width - 2, y + height - 2);
gdk_draw_line (window, style->bg_gc[state_type],
x + width - 2, y + 1, x + width - 2, y + height - 2);
-
+
gdk_draw_line (window, style->black_gc,
x + 1, y + 1, x + width - 2, y + 1);
gdk_draw_line (window, style->black_gc,
x + 1, y + 1, x + 1, y + height - 2);
-
+
gdk_draw_line (window, gc2,
x, y, x + width - 1, y);
gdk_draw_line (window, gc2,
x, y, x, y + height - 1);
break;
-
+
case GTK_SHADOW_OUT:
gdk_draw_line (window, gc1,
x + 1, y + height - 2, x + width - 2, y + height - 2);
gdk_draw_line (window, gc1,
x + width - 2, y + 1, x + width - 2, y + height - 2);
-
+
gdk_draw_line (window, gc2,
x, y, x + width - 1, y);
gdk_draw_line (window, gc2,
x, y, x, y + height - 1);
-
+
gdk_draw_line (window, style->bg_gc[state_type],
x + 1, y + 1, x + width - 2, y + 1);
gdk_draw_line (window, style->bg_gc[state_type],
x + 1, y + 1, x + 1, y + height - 2);
-
+
gdk_draw_line (window, style->black_gc,
x, y + height - 1, x + width - 1, y + height - 1);
gdk_draw_line (window, style->black_gc,
x + width - 1, y, x + width - 1, y + height - 1);
break;
-
+
case GTK_SHADOW_ETCHED_IN:
case GTK_SHADOW_ETCHED_OUT:
thickness_light = 1;
thickness_dark = 1;
-
+
for (i = 0; i < thickness_dark; i++)
{
gdk_draw_line (window, gc1,
@@ -1366,7 +1367,7 @@ gtk_default_draw_shadow (GtkStyle *style,
y + i,
x + width - i - 1,
y + height - i - 1);
-
+
gdk_draw_line (window, gc2,
x + i,
y + i,
@@ -1378,7 +1379,7 @@ gtk_default_draw_shadow (GtkStyle *style,
x + i,
y + height - i - 2);
}
-
+
for (i = 0; i < thickness_light; i++)
{
gdk_draw_line (window, gc1,
@@ -1391,7 +1392,7 @@ gtk_default_draw_shadow (GtkStyle *style,
y + thickness_dark + i,
x + thickness_dark + i,
y + height - thickness_dark - i - 1);
-
+
gdk_draw_line (window, gc2,
x + thickness_dark + i,
y + height - thickness_light - i - 1,
@@ -1405,17 +1406,17 @@ gtk_default_draw_shadow (GtkStyle *style,
}
break;
}
- if (area)
- {
- gdk_gc_set_clip_rectangle (gc1, NULL);
- gdk_gc_set_clip_rectangle (gc2, NULL);
- if ((shadow_type == GTK_SHADOW_IN) ||
- (shadow_type == GTK_SHADOW_OUT))
- {
- gdk_gc_set_clip_rectangle (style->black_gc, NULL);
- gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
- }
- }
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (gc1, NULL);
+ gdk_gc_set_clip_rectangle (gc2, NULL);
+ if (shadow_type == GTK_SHADOW_IN ||
+ shadow_type == GTK_SHADOW_OUT)
+ {
+ gdk_gc_set_clip_rectangle (style->black_gc, NULL);
+ gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
+ }
+ }
}
@@ -1437,10 +1438,10 @@ gtk_default_draw_polygon (GtkStyle *style,
#ifndef M_PI_4
#define M_PI_4 0.78539816339744830962
#endif /* M_PI_4 */
-
+
static const gdouble pi_over_4 = M_PI_4;
static const gdouble pi_3_over_4 = M_PI_4 * 3;
-
+
GdkGC *gc1;
GdkGC *gc2;
GdkGC *gc3;
@@ -1449,11 +1450,11 @@ gtk_default_draw_polygon (GtkStyle *style,
gint xadjust;
gint yadjust;
gint i;
-
+
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
g_return_if_fail (points != NULL);
-
+
switch (shadow_type)
{
case GTK_SHADOW_IN:
@@ -1462,7 +1463,7 @@ gtk_default_draw_polygon (GtkStyle *style,
gc3 = style->light_gc[state_type];
gc4 = style->black_gc;
break;
- case GTK_SHADOW_ETCHED_IN:
+ case GTK_SHADOW_ETCHED_IN:
gc1 = style->light_gc[state_type];
gc2 = style->dark_gc[state_type];
gc3 = style->dark_gc[state_type];
@@ -1474,7 +1475,7 @@ gtk_default_draw_polygon (GtkStyle *style,
gc3 = style->black_gc;
gc4 = style->bg_gc[state_type];
break;
- case GTK_SHADOW_ETCHED_OUT:
+ case GTK_SHADOW_ETCHED_OUT:
gc1 = style->dark_gc[state_type];
gc2 = style->light_gc[state_type];
gc3 = style->light_gc[state_type];
@@ -1483,20 +1484,20 @@ gtk_default_draw_polygon (GtkStyle *style,
default:
return;
}
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (gc1, area);
- gdk_gc_set_clip_rectangle (gc2, area);
- gdk_gc_set_clip_rectangle (gc3, area);
- gdk_gc_set_clip_rectangle (gc4, area);
- }
-
- if (fill)
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (gc1, area);
+ gdk_gc_set_clip_rectangle (gc2, area);
+ gdk_gc_set_clip_rectangle (gc3, area);
+ gdk_gc_set_clip_rectangle (gc4, area);
+ }
+
+ if (fill)
gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, npoints);
-
+
npoints--;
-
+
for (i = 0; i < npoints; i++)
{
if ((points[i].x == points[i+1].x) &&
@@ -1509,7 +1510,7 @@ gtk_default_draw_polygon (GtkStyle *style,
angle = atan2 (points[i+1].y - points[i].y,
points[i+1].x - points[i].x);
}
-
+
if ((angle > -pi_3_over_4) && (angle < pi_over_4))
{
if (angle > -pi_over_4)
@@ -1522,7 +1523,7 @@ gtk_default_draw_polygon (GtkStyle *style,
xadjust = 1;
yadjust = 0;
}
-
+
gdk_draw_line (window, gc1,
points[i].x-xadjust, points[i].y-yadjust,
points[i+1].x-xadjust, points[i+1].y-yadjust);
@@ -1542,7 +1543,7 @@ gtk_default_draw_polygon (GtkStyle *style,
xadjust = 1;
yadjust = 0;
}
-
+
gdk_draw_line (window, gc4,
points[i].x+xadjust, points[i].y+yadjust,
points[i+1].x+xadjust, points[i+1].y+yadjust);
@@ -1551,13 +1552,13 @@ gtk_default_draw_polygon (GtkStyle *style,
points[i+1].x, points[i+1].y);
}
}
- if (area)
- {
- gdk_gc_set_clip_rectangle (gc1, NULL);
- gdk_gc_set_clip_rectangle (gc2, NULL);
- gdk_gc_set_clip_rectangle (gc3, NULL);
- gdk_gc_set_clip_rectangle (gc4, NULL);
- }
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (gc1, NULL);
+ gdk_gc_set_clip_rectangle (gc2, NULL);
+ gdk_gc_set_clip_rectangle (gc3, NULL);
+ gdk_gc_set_clip_rectangle (gc4, NULL);
+ }
}
static void
@@ -1575,341 +1576,341 @@ gtk_default_draw_arrow (GtkStyle *style,
gint width,
gint height)
{
- GdkGC *gc1;
- GdkGC *gc2;
- GdkGC *gc3;
- GdkGC *gc4;
- gint half_width;
- gint half_height;
- GdkPoint points[3];
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- gc1 = style->bg_gc[state_type];
- gc2 = style->dark_gc[state_type];
- gc3 = style->light_gc[state_type];
- gc4 = style->black_gc;
- break;
- case GTK_SHADOW_OUT:
- gc1 = style->dark_gc[state_type];
- gc2 = style->light_gc[state_type];
- gc3 = style->black_gc;
- gc4 = style->bg_gc[state_type];
- break;
- case GTK_SHADOW_ETCHED_IN:
- gc1 = style->light_gc[state_type];
- gc2 = style->dark_gc[state_type];
- gc3 = NULL;
- gc4 = NULL;
- break;
- case GTK_SHADOW_ETCHED_OUT:
- gc1 = style->dark_gc[state_type];
- gc2 = style->light_gc[state_type];
- gc3 = NULL;
- gc4 = NULL;
- break;
- default:
- return;
- }
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- half_width = width / 2;
- half_height = height / 2;
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (gc1, area);
- gdk_gc_set_clip_rectangle (gc2, area);
- if ((gc3) && (gc4))
- {
- gdk_gc_set_clip_rectangle (gc3, area);
- gdk_gc_set_clip_rectangle (gc4, area);
- }
- }
-
- switch (arrow_type)
- {
- case GTK_ARROW_UP:
- if (fill)
- {
- points[0].x = x + half_width;
- points[0].y = y;
- points[1].x = x;
- points[1].y = y + height - 1;
- points[2].x = x + width - 1;
- points[2].y = y + height - 1;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- case GTK_SHADOW_OUT:
-
- gdk_draw_line (window, gc1,
- x + 1, y + height - 2,
- x + width - 2, y + height - 2);
- gdk_draw_line (window, gc3,
- x + 0, y + height - 1,
- x + width - 1, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + width - 2, y + height - 1,
- x + half_width, y + 1);
- gdk_draw_line (window, gc3,
- x + width - 1, y + height - 1,
- x + half_width, y);
-
- gdk_draw_line (window, gc4,
- x + half_width, y + 1,
- x + 1, y + height - 1);
- gdk_draw_line (window, gc2,
- x + half_width, y,
- x, y + height - 1);
- break;
-
- case GTK_SHADOW_ETCHED_IN:
- case GTK_SHADOW_ETCHED_OUT:
- gdk_draw_line (window, gc1,
- x + half_width, y + 1,
- x + 1, y + height - 1);
- gdk_draw_line (window, gc1,
- x + 1, y + height - 1,
- x + width - 1, y + height - 1);
- gdk_draw_line (window, gc1,
- x + width - 1, y + height - 1,
- x + half_width + 1, y + 1);
-
- points[0].x = x + half_width;
- points[0].y = y;
- points[1].x = x;
- points[1].y = y + height - 2;
- points[2].x = x + width - 2;
- points[2].y = y + height - 2;
-
- gdk_draw_polygon (window, gc2, FALSE, points, 3);
- break;
-
- default:
- break;
- }
- break;
-
- case GTK_ARROW_DOWN:
- if (fill)
- {
- points[0].x = x + width - 1;
- points[0].y = y;
+ GdkGC *gc1;
+ GdkGC *gc2;
+ GdkGC *gc3;
+ GdkGC *gc4;
+ gint half_width;
+ gint half_height;
+ GdkPoint points[3];
+
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ switch (shadow_type)
+ {
+ case GTK_SHADOW_IN:
+ gc1 = style->bg_gc[state_type];
+ gc2 = style->dark_gc[state_type];
+ gc3 = style->light_gc[state_type];
+ gc4 = style->black_gc;
+ break;
+ case GTK_SHADOW_OUT:
+ gc1 = style->dark_gc[state_type];
+ gc2 = style->light_gc[state_type];
+ gc3 = style->black_gc;
+ gc4 = style->bg_gc[state_type];
+ break;
+ case GTK_SHADOW_ETCHED_IN:
+ gc1 = style->light_gc[state_type];
+ gc2 = style->dark_gc[state_type];
+ gc3 = NULL;
+ gc4 = NULL;
+ break;
+ case GTK_SHADOW_ETCHED_OUT:
+ gc1 = style->dark_gc[state_type];
+ gc2 = style->light_gc[state_type];
+ gc3 = NULL;
+ gc4 = NULL;
+ break;
+ default:
+ return;
+ }
+
+ if ((width == -1) && (height == -1))
+ gdk_window_get_size (window, &width, &height);
+ else if (width == -1)
+ gdk_window_get_size (window, &width, NULL);
+ else if (height == -1)
+ gdk_window_get_size (window, NULL, &height);
+
+ half_width = width / 2;
+ half_height = height / 2;
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (gc1, area);
+ gdk_gc_set_clip_rectangle (gc2, area);
+ if ((gc3) && (gc4))
+ {
+ gdk_gc_set_clip_rectangle (gc3, area);
+ gdk_gc_set_clip_rectangle (gc4, area);
+ }
+ }
+
+ switch (arrow_type)
+ {
+ case GTK_ARROW_UP:
+ if (fill)
+ {
+ points[0].x = x + half_width;
+ points[0].y = y;
+ points[1].x = x;
+ points[1].y = y + height - 1;
+ points[2].x = x + width - 1;
+ points[2].y = y + height - 1;
+
+ gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
+ }
+
+ switch (shadow_type)
+ {
+ case GTK_SHADOW_IN:
+ case GTK_SHADOW_OUT:
+
+ gdk_draw_line (window, gc1,
+ x + 1, y + height - 2,
+ x + width - 2, y + height - 2);
+ gdk_draw_line (window, gc3,
+ x + 0, y + height - 1,
+ x + width - 1, y + height - 1);
+
+ gdk_draw_line (window, gc1,
+ x + width - 2, y + height - 1,
+ x + half_width, y + 1);
+ gdk_draw_line (window, gc3,
+ x + width - 1, y + height - 1,
+ x + half_width, y);
+
+ gdk_draw_line (window, gc4,
+ x + half_width, y + 1,
+ x + 1, y + height - 1);
+ gdk_draw_line (window, gc2,
+ x + half_width, y,
+ x, y + height - 1);
+ break;
+
+ case GTK_SHADOW_ETCHED_IN:
+ case GTK_SHADOW_ETCHED_OUT:
+ gdk_draw_line (window, gc1,
+ x + half_width, y + 1,
+ x + 1, y + height - 1);
+ gdk_draw_line (window, gc1,
+ x + 1, y + height - 1,
+ x + width - 1, y + height - 1);
+ gdk_draw_line (window, gc1,
+ x + width - 1, y + height - 1,
+ x + half_width + 1, y + 1);
+
+ points[0].x = x + half_width;
+ points[0].y = y;
+ points[1].x = x;
+ points[1].y = y + height - 2;
+ points[2].x = x + width - 2;
+ points[2].y = y + height - 2;
+
+ gdk_draw_polygon (window, gc2, FALSE, points, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case GTK_ARROW_DOWN:
+ if (fill)
+ {
+ points[0].x = x + width - 1;
+ points[0].y = y;
points[1].x = x;
- points[1].y = y;
- points[2].x = x + half_width;
- points[2].y = y + height - 1;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- case GTK_SHADOW_OUT:
- gdk_draw_line (window, gc4,
- x + width - 2,
- y + 1, x + 1, y + 1);
- gdk_draw_line (window, gc2,
- x + width - 1, y,
- x, y);
-
- gdk_draw_line (window, gc4,
- x + 1, y,
- x + half_width, y + height - 2);
- gdk_draw_line (window, gc2,
- x, y,
- x + half_width, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + half_width, y + height - 2,
- x + width - 2, y);
- gdk_draw_line (window, gc3,
- x + half_width, y + height - 1,
- x + width - 1, y);
- break;
-
- case GTK_SHADOW_ETCHED_IN:
- case GTK_SHADOW_ETCHED_OUT:
- gdk_draw_line (window, gc1,
- x + width - 1, y + 1,
- x + 1, y + 1);
- gdk_draw_line (window, gc1,
- x + 1, y + 1,
- x + half_width + 1, y + height - 1);
- gdk_draw_line (window, gc1,
- x + half_width + 1, y + height - 2,
- x + width - 1, y);
-
- points[0].x = x + width - 2;
- points[0].y = y;
- points[1].x = x;
- points[1].y = y;
- points[2].x = x + half_width;
- points[2].y = y + height - 2;
-
- gdk_draw_polygon (window, gc2, FALSE, points, 3);
- break;
-
- default:
- break;
- }
- break;
- case GTK_ARROW_LEFT:
+ points[1].y = y;
+ points[2].x = x + half_width;
+ points[2].y = y + height - 1;
+
+ gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
+ }
+ switch (shadow_type)
+ {
+ case GTK_SHADOW_IN:
+ case GTK_SHADOW_OUT:
+ gdk_draw_line (window, gc4,
+ x + width - 2,
+ y + 1, x + 1, y + 1);
+ gdk_draw_line (window, gc2,
+ x + width - 1, y,
+ x, y);
+
+ gdk_draw_line (window, gc4,
+ x + 1, y,
+ x + half_width, y + height - 2);
+ gdk_draw_line (window, gc2,
+ x, y,
+ x + half_width, y + height - 1);
+
+ gdk_draw_line (window, gc1,
+ x + half_width, y + height - 2,
+ x + width - 2, y);
+ gdk_draw_line (window, gc3,
+ x + half_width, y + height - 1,
+ x + width - 1, y);
+ break;
+
+ case GTK_SHADOW_ETCHED_IN:
+ case GTK_SHADOW_ETCHED_OUT:
+ gdk_draw_line (window, gc1,
+ x + width - 1, y + 1,
+ x + 1, y + 1);
+ gdk_draw_line (window, gc1,
+ x + 1, y + 1,
+ x + half_width + 1, y + height - 1);
+ gdk_draw_line (window, gc1,
+ x + half_width + 1, y + height - 2,
+ x + width - 1, y);
+
+ points[0].x = x + width - 2;
+ points[0].y = y;
+ points[1].x = x;
+ points[1].y = y;
+ points[2].x = x + half_width;
+ points[2].y = y + height - 2;
+
+ gdk_draw_polygon (window, gc2, FALSE, points, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+ case GTK_ARROW_LEFT:
if (fill)
- {
- points[0].x = x;
- points[0].y = y + half_height;
- points[1].x = x + width - 1;
- points[1].y = y + height - 1;
- points[2].x = x + width - 1;
- points[2].y = y;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- case GTK_SHADOW_OUT:
- gdk_draw_line (window, gc1,
- x + 1, y + half_height,
- x + width - 1, y + height - 1);
- gdk_draw_line (window, gc3,
- x, y + half_height,
- x + width - 1, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + width - 2, y + height - 1,
- x + width - 2, y + 1);
- gdk_draw_line (window, gc3,
- x + width - 1, y + height - 1,
- x + width - 1, y);
-
- gdk_draw_line (window, gc4,
- x + width - 1, y + 1,
- x + 1, y + half_height);
- gdk_draw_line (window, gc2,
- x + width - 1, y,
- x, y + half_height);
- break;
-
- case GTK_SHADOW_ETCHED_IN:
- case GTK_SHADOW_ETCHED_OUT:
- gdk_draw_line (window, gc1,
- x + width - 1, y + 1,
- x + 1, y + half_height);
- gdk_draw_line (window, gc1,
- x + 1, y + half_height + 1,
- x + width - 1, y + height - 1);
- gdk_draw_line (window, gc1,
- x + width - 1, y + height - 1,
- x + width - 1, y + 1);
-
- points[0].x = x + width - 2;
- points[0].y = y;
- points[1].x = x;
- points[1].y = y + half_height;
- points[2].x = x + width - 2;
- points[2].y = y + height - 2;
-
- gdk_draw_polygon (window, gc2, FALSE, points, 3);
- break;
-
- default:
- break;
- }
- break;
- case GTK_ARROW_RIGHT:
- if (fill)
- {
- points[0].x = x + width - 1;
- points[0].y = y + half_height;
- points[1].x = x;
- points[1].y = y;
- points[2].x = x;
- points[2].y = y + height - 1;
-
- gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
- }
-
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- case GTK_SHADOW_OUT:
- gdk_draw_line (window, gc4,
- x + width - 1, y + half_height,
- x + 1, y + 1);
- gdk_draw_line (window, gc2,
- x + width - 1, y + half_height,
- x, y);
- gdk_draw_line (window, gc4,
- x + 1, y + 1,
- x + 1, y + height - 2);
- gdk_draw_line (window, gc2,
- x, y,
- x, y + height - 1);
-
- gdk_draw_line (window, gc1,
- x + 1, y + height - 2,
- x + width - 1, y + half_height);
- gdk_draw_line (window, gc3,
- x, y + height - 1,
- x + width - 1, y + half_height);
- break;
-
- case GTK_SHADOW_ETCHED_IN:
+ {
+ points[0].x = x;
+ points[0].y = y + half_height;
+ points[1].x = x + width - 1;
+ points[1].y = y + height - 1;
+ points[2].x = x + width - 1;
+ points[2].y = y;
+
+ gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
+ }
+
+ switch (shadow_type)
+ {
+ case GTK_SHADOW_IN:
+ case GTK_SHADOW_OUT:
+ gdk_draw_line (window, gc1,
+ x + 1, y + half_height,
+ x + width - 1, y + height - 1);
+ gdk_draw_line (window, gc3,
+ x, y + half_height,
+ x + width - 1, y + height - 1);
+
+ gdk_draw_line (window, gc1,
+ x + width - 2, y + height - 1,
+ x + width - 2, y + 1);
+ gdk_draw_line (window, gc3,
+ x + width - 1, y + height - 1,
+ x + width - 1, y);
+
+ gdk_draw_line (window, gc4,
+ x + width - 1, y + 1,
+ x + 1, y + half_height);
+ gdk_draw_line (window, gc2,
+ x + width - 1, y,
+ x, y + half_height);
+ break;
+
+ case GTK_SHADOW_ETCHED_IN:
case GTK_SHADOW_ETCHED_OUT:
- gdk_draw_line (window, gc1,
- x + width - 1, y + half_height + 1,
- x + 1, y + 1);
- gdk_draw_line (window, gc1,
- x + 1, y + 1,
- x + 1, y + height - 1);
- gdk_draw_line (window, gc1,
- x + 1, y + height - 1,
- x + width - 1, y + half_height + 1);
-
- points[0].x = x + width - 2;
- points[0].y = y + half_height;
- points[1].x = x;
- points[1].y = y;
- points[2].x = x;
- points[2].y = y + height - 1;
-
- gdk_draw_polygon (window, gc2, FALSE, points, 3);
- break;
-
- default:
- break;
- }
- break;
- }
- if (area)
- {
- gdk_gc_set_clip_rectangle (gc1, NULL);
- gdk_gc_set_clip_rectangle (gc2, NULL);
- if (gc3)
- {
- gdk_gc_set_clip_rectangle (gc3, NULL);
- gdk_gc_set_clip_rectangle (gc4, NULL);
- }
- }
+ gdk_draw_line (window, gc1,
+ x + width - 1, y + 1,
+ x + 1, y + half_height);
+ gdk_draw_line (window, gc1,
+ x + 1, y + half_height + 1,
+ x + width - 1, y + height - 1);
+ gdk_draw_line (window, gc1,
+ x + width - 1, y + height - 1,
+ x + width - 1, y + 1);
+
+ points[0].x = x + width - 2;
+ points[0].y = y;
+ points[1].x = x;
+ points[1].y = y + half_height;
+ points[2].x = x + width - 2;
+ points[2].y = y + height - 2;
+
+ gdk_draw_polygon (window, gc2, FALSE, points, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+ case GTK_ARROW_RIGHT:
+ if (fill)
+ {
+ points[0].x = x + width - 1;
+ points[0].y = y + half_height;
+ points[1].x = x;
+ points[1].y = y;
+ points[2].x = x;
+ points[2].y = y + height - 1;
+
+ gdk_draw_polygon (window, style->bg_gc[state_type], TRUE, points, 3);
+ }
+
+ switch (shadow_type)
+ {
+ case GTK_SHADOW_IN:
+ case GTK_SHADOW_OUT:
+ gdk_draw_line (window, gc4,
+ x + width - 1, y + half_height,
+ x + 1, y + 1);
+ gdk_draw_line (window, gc2,
+ x + width - 1, y + half_height,
+ x, y);
+ gdk_draw_line (window, gc4,
+ x + 1, y + 1,
+ x + 1, y + height - 2);
+ gdk_draw_line (window, gc2,
+ x, y,
+ x, y + height - 1);
+
+ gdk_draw_line (window, gc1,
+ x + 1, y + height - 2,
+ x + width - 1, y + half_height);
+ gdk_draw_line (window, gc3,
+ x, y + height - 1,
+ x + width - 1, y + half_height);
+ break;
+
+ case GTK_SHADOW_ETCHED_IN:
+ case GTK_SHADOW_ETCHED_OUT:
+ gdk_draw_line (window, gc1,
+ x + width - 1, y + half_height + 1,
+ x + 1, y + 1);
+ gdk_draw_line (window, gc1,
+ x + 1, y + 1,
+ x + 1, y + height - 1);
+ gdk_draw_line (window, gc1,
+ x + 1, y + height - 1,
+ x + width - 1, y + half_height + 1);
+
+ points[0].x = x + width - 2;
+ points[0].y = y + half_height;
+ points[1].x = x;
+ points[1].y = y;
+ points[2].x = x;
+ points[2].y = y + height - 1;
+
+ gdk_draw_polygon (window, gc2, FALSE, points, 3);
+ break;
+
+ default:
+ break;
+ }
+ break;
+ }
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (gc1, NULL);
+ gdk_gc_set_clip_rectangle (gc2, NULL);
+ if (gc3)
+ {
+ gdk_gc_set_clip_rectangle (gc3, NULL);
+ gdk_gc_set_clip_rectangle (gc4, NULL);
+ }
+ }
}
static void
@@ -1925,119 +1926,119 @@ gtk_default_draw_diamond (GtkStyle *style,
gint width,
gint height)
{
- gint half_width;
- gint half_height;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- half_width = width / 2;
- half_height = height / 2;
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
- gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
- gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
- gdk_gc_set_clip_rectangle (style->black_gc, area);
- }
- switch (shadow_type)
- {
- case GTK_SHADOW_IN:
- gdk_draw_line (window, style->bg_gc[state_type],
- x + 2, y + half_height,
- x + half_width, y + height - 2);
- gdk_draw_line (window, style->bg_gc[state_type],
- x + half_width, y + height - 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x + 1, y + half_height,
- x + half_width, y + height - 1);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y + height - 1,
- x + width - 1, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x, y + half_height,
- x + half_width, y + height);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y + height,
+ gint half_width;
+ gint half_height;
+
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ if ((width == -1) && (height == -1))
+ gdk_window_get_size (window, &width, &height);
+ else if (width == -1)
+ gdk_window_get_size (window, &width, NULL);
+ else if (height == -1)
+ gdk_window_get_size (window, NULL, &height);
+
+ half_width = width / 2;
+ half_height = height / 2;
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->light_gc[state_type], area);
+ gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
+ gdk_gc_set_clip_rectangle (style->dark_gc[state_type], area);
+ gdk_gc_set_clip_rectangle (style->black_gc, area);
+ }
+ switch (shadow_type)
+ {
+ case GTK_SHADOW_IN:
+ gdk_draw_line (window, style->bg_gc[state_type],
+ x + 2, y + half_height,
+ x + half_width, y + height - 2);
+ gdk_draw_line (window, style->bg_gc[state_type],
+ x + half_width, y + height - 2,
+ x + width - 2, y + half_height);
+ gdk_draw_line (window, style->light_gc[state_type],
+ x + 1, y + half_height,
+ x + half_width, y + height - 1);
+ gdk_draw_line (window, style->light_gc[state_type],
+ x + half_width, y + height - 1,
+ x + width - 1, y + half_height);
+ gdk_draw_line (window, style->light_gc[state_type],
+ x, y + half_height,
+ x + half_width, y + height);
+ gdk_draw_line (window, style->light_gc[state_type],
+ x + half_width, y + height,
x + width, y + half_height);
-
- gdk_draw_line (window, style->black_gc,
- x + 2, y + half_height,
- x + half_width, y + 2);
- gdk_draw_line (window, style->black_gc,
- x + half_width, y + 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + 1, y + half_height,
+
+ gdk_draw_line (window, style->black_gc,
+ x + 2, y + half_height,
+ x + half_width, y + 2);
+ gdk_draw_line (window, style->black_gc,
+ x + half_width, y + 2,
+ x + width - 2, y + half_height);
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x + 1, y + half_height,
x + half_width, y + 1);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y + 1,
- x + width - 1, y + half_height);
- gdk_draw_line (window, style->dark_gc[state_type],
- x, y + half_height,
- x + half_width, y);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y,
- x + width, y + half_height);
- break;
- case GTK_SHADOW_OUT:
- gdk_draw_line (window, style->dark_gc[state_type],
- x + 2, y + half_height,
- x + half_width, y + height - 2);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y + height - 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + 1, y + half_height,
- x + half_width, y + height - 1);
- gdk_draw_line (window, style->dark_gc[state_type],
- x + half_width, y + height - 1,
- x + width - 1, y + half_height);
- gdk_draw_line (window, style->black_gc,
- x, y + half_height,
- x + half_width, y + height);
- gdk_draw_line (window, style->black_gc,
- x + half_width, y + height,
- x + width, y + half_height);
-
- gdk_draw_line (window, style->bg_gc[state_type],
- x + 2, y + half_height,
- x + half_width, y + 2);
- gdk_draw_line (window, style->bg_gc[state_type],
- x + half_width, y + 2,
- x + width - 2, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x + 1, y + half_height,
- x + half_width, y + 1);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y + 1,
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x + half_width, y + 1,
+ x + width - 1, y + half_height);
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x, y + half_height,
+ x + half_width, y);
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x + half_width, y,
+ x + width, y + half_height);
+ break;
+ case GTK_SHADOW_OUT:
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x + 2, y + half_height,
+ x + half_width, y + height - 2);
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x + half_width, y + height - 2,
+ x + width - 2, y + half_height);
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x + 1, y + half_height,
+ x + half_width, y + height - 1);
+ gdk_draw_line (window, style->dark_gc[state_type],
+ x + half_width, y + height - 1,
+ x + width - 1, y + half_height);
+ gdk_draw_line (window, style->black_gc,
+ x, y + half_height,
+ x + half_width, y + height);
+ gdk_draw_line (window, style->black_gc,
+ x + half_width, y + height,
+ x + width, y + half_height);
+
+ gdk_draw_line (window, style->bg_gc[state_type],
+ x + 2, y + half_height,
+ x + half_width, y + 2);
+ gdk_draw_line (window, style->bg_gc[state_type],
+ x + half_width, y + 2,
+ x + width - 2, y + half_height);
+ gdk_draw_line (window, style->light_gc[state_type],
+ x + 1, y + half_height,
+ x + half_width, y + 1);
+ gdk_draw_line (window, style->light_gc[state_type],
+ x + half_width, y + 1,
x + width - 1, y + half_height);
- gdk_draw_line (window, style->light_gc[state_type],
- x, y + half_height,
- x + half_width, y);
- gdk_draw_line (window, style->light_gc[state_type],
- x + half_width, y,
- x + width, y + half_height);
- break;
- default:
- break;
- }
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
- gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
- gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
- gdk_gc_set_clip_rectangle (style->black_gc, NULL);
- }
+ gdk_draw_line (window, style->light_gc[state_type],
+ x, y + half_height,
+ x + half_width, y);
+ gdk_draw_line (window, style->light_gc[state_type],
+ x + half_width, y,
+ x + width, y + half_height);
+ break;
+ default:
+ break;
+ }
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->light_gc[state_type], NULL);
+ gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
+ gdk_gc_set_clip_rectangle (style->dark_gc[state_type], NULL);
+ gdk_gc_set_clip_rectangle (style->black_gc, NULL);
+ }
}
@@ -2071,20 +2072,20 @@ gtk_default_draw_string (GtkStyle *style,
{
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
-
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->white_gc, area);
- gdk_gc_set_clip_rectangle (style->fg_gc[state_type], area);
- }
- if (state_type == GTK_STATE_INSENSITIVE)
- gdk_draw_string (window, style->font, style->white_gc, x + 1, y + 1, string);
- gdk_draw_string (window, style->font, style->fg_gc[state_type], x, y, string);
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->white_gc, NULL);
- gdk_gc_set_clip_rectangle (style->fg_gc[state_type], NULL);
- }
+
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->white_gc, area);
+ gdk_gc_set_clip_rectangle (style->fg_gc[state_type], area);
+ }
+ if (state_type == GTK_STATE_INSENSITIVE)
+ gdk_draw_string (window, style->font, style->white_gc, x + 1, y + 1, string);
+ gdk_draw_string (window, style->font, style->fg_gc[state_type], x, y, string);
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->white_gc, NULL);
+ gdk_gc_set_clip_rectangle (style->fg_gc[state_type], NULL);
+ }
}
static void
@@ -2100,32 +2101,33 @@ gtk_default_draw_box (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- if ((!style->bg_pixmap[state_type]) ||
- (gdk_window_get_type(window) == GDK_WINDOW_PIXMAP))
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ if ((width == -1) && (height == -1))
+ gdk_window_get_size (window, &width, &height);
+ else if (width == -1)
+ gdk_window_get_size (window, &width, NULL);
+ else if (height == -1)
+ gdk_window_get_size (window, NULL, &height);
+
+ if (!style->bg_pixmap[state_type] ||
+ gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
{
if (area)
{
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area);
}
- gdk_draw_rectangle(window, style->bg_gc[state_type], TRUE,
- x, y, width, height);
+ gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE,
+ x, y, width, height);
if (area)
{
gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL);
}
}
else
- gtk_style_apply_default_pixmap(style, window, state_type, area, x, y, width, height);
+ gtk_style_apply_default_pixmap (style, window, state_type, area, x, y, width, height);
+
gtk_paint_shadow (style, window, state_type, shadow_type, area, widget, detail,
x, y, width, height);
}
@@ -2144,17 +2146,17 @@ gtk_default_draw_flat_box (GtkStyle *style,
gint height)
{
GdkGC *gc1;
-
+
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
-
+
if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height);
else if (width == -1)
gdk_window_get_size (window, &width, NULL);
else if (height == -1)
gdk_window_get_size (window, NULL, &height);
-
+
if ((detail) && (!strcmp("text",detail)) && (state_type == GTK_STATE_SELECTED))
gc1 = style->bg_gc[GTK_STATE_SELECTED];
else if ((detail) && (!strcmp("viewportbin",detail)))
@@ -2163,9 +2165,9 @@ gtk_default_draw_flat_box (GtkStyle *style,
gc1 = style->base_gc[state_type];
else
gc1 = style->bg_gc[state_type];
-
- if ((!style->bg_pixmap[state_type]) || (gc1 != style->bg_gc[state_type]) ||
- (gdk_window_get_type(window) == GDK_WINDOW_PIXMAP))
+
+ if (!style->bg_pixmap[state_type] || gc1 != style->bg_gc[state_type] ||
+ gdk_window_get_type (window) == GDK_WINDOW_PIXMAP)
{
if (area)
{
@@ -2198,8 +2200,8 @@ gtk_default_draw_check (GtkStyle *style,
gint width,
gint height)
{
- gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
- x, y, width, height);
+ gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
+ x, y, width, height);
}
static void
@@ -2215,7 +2217,7 @@ gtk_default_draw_option (GtkStyle *style,
gint width,
gint height)
{
- gtk_paint_diamond (style, window, state_type, shadow_type, area, widget,
+ gtk_paint_diamond (style, window, state_type, shadow_type, area, widget,
detail, x, y, width, height);
}
@@ -2232,8 +2234,8 @@ gtk_default_draw_cross (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
}
static void
@@ -2250,8 +2252,8 @@ gtk_default_draw_ramp (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
}
static void gtk_default_draw_tab (GtkStyle *style,
@@ -2266,11 +2268,11 @@ static void gtk_default_draw_tab (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
- x, y, width, height);
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ gtk_paint_box (style, window, state_type, shadow_type, area, widget, detail,
+ x, y, width, height);
}
static void
@@ -2293,40 +2295,40 @@ gtk_default_draw_shadow_gap (GtkStyle *style,
GdkGC *gc2 = NULL;
GdkGC *gc3 = NULL;
GdkGC *gc4 = NULL;
-
+
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
-
+
if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height);
else if (width == -1)
gdk_window_get_size (window, &width, NULL);
else if (height == -1)
gdk_window_get_size (window, NULL, &height);
-
+
switch (shadow_type)
{
- case GTK_SHADOW_NONE:
+ case GTK_SHADOW_NONE:
return;
- case GTK_SHADOW_IN:
+ case GTK_SHADOW_IN:
gc1 = style->dark_gc[state_type];
gc2 = style->black_gc;
gc3 = style->bg_gc[state_type];
gc4 = style->light_gc[state_type];
break;
- case GTK_SHADOW_ETCHED_IN:
+ case GTK_SHADOW_ETCHED_IN:
gc1 = style->dark_gc[state_type];
gc2 = style->light_gc[state_type];
gc3 = style->dark_gc[state_type];
gc4 = style->light_gc[state_type];
break;
- case GTK_SHADOW_OUT:
+ case GTK_SHADOW_OUT:
gc1 = style->light_gc[state_type];
gc2 = style->bg_gc[state_type];
gc3 = style->dark_gc[state_type];
gc4 = style->black_gc;
break;
- case GTK_SHADOW_ETCHED_OUT:
+ case GTK_SHADOW_ETCHED_OUT:
gc1 = style->light_gc[state_type];
gc2 = style->dark_gc[state_type];
gc3 = style->light_gc[state_type];
@@ -2340,7 +2342,7 @@ gtk_default_draw_shadow_gap (GtkStyle *style,
gdk_gc_set_clip_rectangle (gc3, area);
gdk_gc_set_clip_rectangle (gc4, area);
}
-
+
switch (shadow_type)
{
case GTK_SHADOW_NONE:
@@ -2392,7 +2394,7 @@ gtk_default_draw_shadow_gap (GtkStyle *style,
x + 1, y + 1, x + width - 2, y + 1);
gdk_draw_line (window, gc2,
x + 1, y + 1, x + 1, y + height - 1);
-
+
gdk_draw_line (window, gc3,
x + width - 2, y + 1, x + width - 2, y + height - 1);
gdk_draw_line (window, gc4,
@@ -2421,7 +2423,7 @@ gtk_default_draw_shadow_gap (GtkStyle *style,
x, y, x + width - 1, y);
gdk_draw_line (window, gc2,
x, y + 1, x + width - 2, y + 1);
-
+
gdk_draw_line (window, gc3,
x, y + height - 2, x + width - 2, y + height - 2);
gdk_draw_line (window, gc3,
@@ -2458,7 +2460,7 @@ gtk_default_draw_shadow_gap (GtkStyle *style,
x + 1, y + 1, x + width - 1, y + 1);
gdk_draw_line (window, gc2,
x + 1, y + 1, x + 1, y + height - 2);
-
+
gdk_draw_line (window, gc3,
x + 1, y + height - 2, x + width - 1, y + height - 2);
gdk_draw_line (window, gc4,
@@ -2513,43 +2515,43 @@ gtk_default_draw_box_gap (GtkStyle *style,
GdkGC *gc2 = NULL;
GdkGC *gc3 = NULL;
GdkGC *gc4 = NULL;
-
+
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
-
+
gtk_style_apply_default_pixmap(style, window, state_type, area,
x, y, width, height);
-
+
if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height);
else if (width == -1)
gdk_window_get_size (window, &width, NULL);
else if (height == -1)
gdk_window_get_size (window, NULL, &height);
-
+
switch (shadow_type)
{
- case GTK_SHADOW_NONE:
+ case GTK_SHADOW_NONE:
return;
- case GTK_SHADOW_IN:
+ case GTK_SHADOW_IN:
gc1 = style->dark_gc[state_type];
gc2 = style->black_gc;
gc3 = style->bg_gc[state_type];
gc4 = style->light_gc[state_type];
break;
- case GTK_SHADOW_ETCHED_IN:
+ case GTK_SHADOW_ETCHED_IN:
gc1 = style->dark_gc[state_type];
gc2 = style->light_gc[state_type];
gc3 = style->dark_gc[state_type];
gc4 = style->light_gc[state_type];
break;
- case GTK_SHADOW_OUT:
+ case GTK_SHADOW_OUT:
gc1 = style->light_gc[state_type];
gc2 = style->bg_gc[state_type];
gc3 = style->dark_gc[state_type];
gc4 = style->black_gc;
break;
- case GTK_SHADOW_ETCHED_OUT:
+ case GTK_SHADOW_ETCHED_OUT:
gc1 = style->light_gc[state_type];
gc2 = style->dark_gc[state_type];
gc3 = style->light_gc[state_type];
@@ -2563,7 +2565,7 @@ gtk_default_draw_box_gap (GtkStyle *style,
gdk_gc_set_clip_rectangle (gc3, area);
gdk_gc_set_clip_rectangle (gc4, area);
}
-
+
switch (shadow_type)
{
case GTK_SHADOW_NONE:
@@ -2578,7 +2580,7 @@ gtk_default_draw_box_gap (GtkStyle *style,
x, y, x, y + height - 1);
gdk_draw_line (window, gc2,
x + 1, y, x + 1, y + height - 2);
-
+
gdk_draw_line (window, gc3,
x + 1, y + height - 2, x + width - 2, y + height - 2);
gdk_draw_line (window, gc3,
@@ -2615,7 +2617,7 @@ gtk_default_draw_box_gap (GtkStyle *style,
x + 1, y + 1, x + width - 2, y + 1);
gdk_draw_line (window, gc2,
x + 1, y + 1, x + 1, y + height - 1);
-
+
gdk_draw_line (window, gc3,
x + width - 2, y + 1, x + width - 2, y + height - 1);
gdk_draw_line (window, gc4,
@@ -2644,7 +2646,7 @@ gtk_default_draw_box_gap (GtkStyle *style,
x, y, x + width - 1, y);
gdk_draw_line (window, gc2,
x, y + 1, x + width - 2, y + 1);
-
+
gdk_draw_line (window, gc3,
x, y + height - 2, x + width - 2, y + height - 2);
gdk_draw_line (window, gc3,
@@ -2681,7 +2683,7 @@ gtk_default_draw_box_gap (GtkStyle *style,
x + 1, y + 1, x + width - 1, y + 1);
gdk_draw_line (window, gc2,
x + 1, y + 1, x + 1, y + height - 2);
-
+
gdk_draw_line (window, gc3,
x + 1, y + height - 2, x + width - 1, y + height - 2);
gdk_draw_line (window, gc4,
@@ -2734,43 +2736,43 @@ gtk_default_draw_extension (GtkStyle *style,
GdkGC *gc2 = NULL;
GdkGC *gc3 = NULL;
GdkGC *gc4 = NULL;
-
+
g_return_if_fail (style != NULL);
g_return_if_fail (window != NULL);
-
+
gtk_style_apply_default_pixmap(style, window, GTK_STATE_NORMAL, area,
x, y, width, height);
-
+
if ((width == -1) && (height == -1))
gdk_window_get_size (window, &width, &height);
else if (width == -1)
gdk_window_get_size (window, &width, NULL);
else if (height == -1)
gdk_window_get_size (window, NULL, &height);
-
+
switch (shadow_type)
{
- case GTK_SHADOW_NONE:
+ case GTK_SHADOW_NONE:
return;
- case GTK_SHADOW_IN:
+ case GTK_SHADOW_IN:
gc1 = style->dark_gc[state_type];
gc2 = style->black_gc;
gc3 = style->bg_gc[state_type];
gc4 = style->light_gc[state_type];
break;
- case GTK_SHADOW_ETCHED_IN:
+ case GTK_SHADOW_ETCHED_IN:
gc1 = style->dark_gc[state_type];
gc2 = style->light_gc[state_type];
gc3 = style->dark_gc[state_type];
gc4 = style->light_gc[state_type];
break;
- case GTK_SHADOW_OUT:
+ case GTK_SHADOW_OUT:
gc1 = style->light_gc[state_type];
gc2 = style->bg_gc[state_type];
gc3 = style->dark_gc[state_type];
gc4 = style->black_gc;
break;
- case GTK_SHADOW_ETCHED_OUT:
+ case GTK_SHADOW_ETCHED_OUT:
gc1 = style->light_gc[state_type];
gc2 = style->dark_gc[state_type];
gc3 = style->light_gc[state_type];
@@ -2784,7 +2786,7 @@ gtk_default_draw_extension (GtkStyle *style,
gdk_gc_set_clip_rectangle (gc3, area);
gdk_gc_set_clip_rectangle (gc4, area);
}
- switch (shadow_type)
+ switch (shadow_type)
{
case GTK_SHADOW_NONE:
case GTK_SHADOW_IN:
@@ -2803,7 +2805,7 @@ gtk_default_draw_extension (GtkStyle *style,
x, y, x, y + height - 2);
gdk_draw_line (window, gc2,
x + 1, y, x + 1, y + height - 2);
-
+
gdk_draw_line (window, gc3,
x + 2, y + height - 2, x + width - 2, y + height - 2);
gdk_draw_line (window, gc3,
@@ -2827,7 +2829,7 @@ gtk_default_draw_extension (GtkStyle *style,
x + 1, y + 1, x + width - 2, y + 1);
gdk_draw_line (window, gc2,
x + 1, y + 1, x + 1, y + height - 1);
-
+
gdk_draw_line (window, gc3,
x + width - 2, y + 2, x + width - 2, y + height - 1);
gdk_draw_line (window, gc4,
@@ -2843,7 +2845,7 @@ gtk_default_draw_extension (GtkStyle *style,
x, y, x + width - 2, y);
gdk_draw_line (window, gc2,
x + 1, y + 1, x + width - 2, y + 1);
-
+
gdk_draw_line (window, gc3,
x, y + height - 2, x + width - 2, y + height - 2);
gdk_draw_line (window, gc3,
@@ -2867,7 +2869,7 @@ gtk_default_draw_extension (GtkStyle *style,
x + 1, y + 1, x + width - 1, y + 1);
gdk_draw_line (window, gc2,
x + 1, y + 1, x + 1, y + height - 2);
-
+
gdk_draw_line (window, gc3,
x + 2, y + height - 2, x + width - 1, y + height - 2);
gdk_draw_line (window, gc4,
@@ -2895,50 +2897,50 @@ gtk_default_draw_focus (GtkStyle *style,
gint width,
gint height)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if ((width == -1) && (height == -1))
- {
- gdk_window_get_size (window, &width, &height);
- width -= 1;
- height -= 1;
- }
- else if (width == -1)
- {
- gdk_window_get_size (window, &width, NULL);
- width -= 1;
- }
- else if (height == -1)
- {
- gdk_window_get_size (window, NULL, &height);
- height -= 1;
- }
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->black_gc, area);
- }
- if (detail && !strcmp (detail, "add-mode"))
- {
- gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_ON_OFF_DASH, 0, 0);
- gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2);
-
- gdk_draw_rectangle (window,
- style->black_gc, FALSE,
- x, y, width, height);
-
- gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
- }
- else
- {
- gdk_draw_rectangle (window,
- style->black_gc, FALSE,
- x, y, width, height);
- }
- if (area)
- {
- gdk_gc_set_clip_rectangle (style->black_gc, NULL);
- }
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ if ((width == -1) && (height == -1))
+ {
+ gdk_window_get_size (window, &width, &height);
+ width -= 1;
+ height -= 1;
+ }
+ else if (width == -1)
+ {
+ gdk_window_get_size (window, &width, NULL);
+ width -= 1;
+ }
+ else if (height == -1)
+ {
+ gdk_window_get_size (window, NULL, &height);
+ height -= 1;
+ }
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->black_gc, area);
+ }
+ if (detail && !strcmp (detail, "add-mode"))
+ {
+ gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_ON_OFF_DASH, 0, 0);
+ gdk_gc_set_dashes (style->black_gc, 0, "\4\4", 2);
+
+ gdk_draw_rectangle (window,
+ style->black_gc, FALSE,
+ x, y, width, height);
+
+ gdk_gc_set_line_attributes (style->black_gc, 1, GDK_LINE_SOLID, 0, 0);
+ }
+ else
+ {
+ gdk_draw_rectangle (window,
+ style->black_gc, FALSE,
+ x, y, width, height);
+ }
+ if (area)
+ {
+ gdk_gc_set_clip_rectangle (style->black_gc, NULL);
+ }
}
static void
@@ -2955,26 +2957,26 @@ gtk_default_draw_slider (GtkStyle *style,
gint height,
GtkOrientation orientation)
{
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- gtk_paint_box (style, window, state_type, shadow_type,
- area, widget, detail, x, y, width, height);
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- gtk_paint_vline (style, window, state_type, area, widget, detail,
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ if ((width == -1) && (height == -1))
+ gdk_window_get_size (window, &width, &height);
+ else if (width == -1)
+ gdk_window_get_size (window, &width, NULL);
+ else if (height == -1)
+ gdk_window_get_size (window, NULL, &height);
+
+ gtk_paint_box (style, window, state_type, shadow_type,
+ area, widget, detail, x, y, width, height);
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ gtk_paint_vline (style, window, state_type, area, widget, detail,
style->klass->ythickness,
height - style->klass->ythickness - 1, width / 2);
- else
- gtk_paint_hline (style, window, state_type, area, widget, detail,
- style->klass->xthickness,
- width - style->klass->xthickness - 1, height / 2);
+ else
+ gtk_paint_hline (style, window, state_type, area, widget, detail,
+ style->klass->xthickness,
+ width - style->klass->xthickness - 1, height / 2);
}
static void
@@ -2991,49 +2993,49 @@ gtk_default_draw_handle (GtkStyle *style,
gint height,
GtkOrientation orientation)
{
- gint xx, yy;
- gint xthick, ythick;
- GdkGC *light_gc, *dark_gc;
- GdkRectangle dest;
-
- g_return_if_fail (style != NULL);
- g_return_if_fail (window != NULL);
-
- if ((width == -1) && (height == -1))
- gdk_window_get_size (window, &width, &height);
- else if (width == -1)
- gdk_window_get_size (window, &width, NULL);
- else if (height == -1)
- gdk_window_get_size (window, NULL, &height);
-
- gtk_paint_box (style, window, state_type, shadow_type, area, widget,
- detail, x, y, width, height);
-
- light_gc = style->light_gc[state_type];
- dark_gc = style->dark_gc[state_type];
-
- xthick = style->klass->xthickness;
- ythick = style->klass->ythickness;
-
- dest.x = x + xthick;
- dest.y = y + ythick;
- dest.width = width - (xthick * 2);
- dest.height = height - (ythick * 2);
-
- gdk_gc_set_clip_rectangle (light_gc, &dest);
- gdk_gc_set_clip_rectangle (dark_gc, &dest);
-
- for (yy = y + ythick; yy < (y + height - ythick); yy += 3)
- for (xx = x + xthick; xx < (x + width - xthick); xx += 6)
- {
+ gint xx, yy;
+ gint xthick, ythick;
+ GdkGC *light_gc, *dark_gc;
+ GdkRectangle dest;
+
+ g_return_if_fail (style != NULL);
+ g_return_if_fail (window != NULL);
+
+ if ((width == -1) && (height == -1))
+ gdk_window_get_size (window, &width, &height);
+ else if (width == -1)
+ gdk_window_get_size (window, &width, NULL);
+ else if (height == -1)
+ gdk_window_get_size (window, NULL, &height);
+
+ gtk_paint_box (style, window, state_type, shadow_type, area, widget,
+ detail, x, y, width, height);
+
+ light_gc = style->light_gc[state_type];
+ dark_gc = style->dark_gc[state_type];
+
+ xthick = style->klass->xthickness;
+ ythick = style->klass->ythickness;
+
+ dest.x = x + xthick;
+ dest.y = y + ythick;
+ dest.width = width - (xthick * 2);
+ dest.height = height - (ythick * 2);
+
+ gdk_gc_set_clip_rectangle (light_gc, &dest);
+ gdk_gc_set_clip_rectangle (dark_gc, &dest);
+
+ for (yy = y + ythick; yy < (y + height - ythick); yy += 3)
+ for (xx = x + xthick; xx < (x + width - xthick); xx += 6)
+ {
gdk_draw_point (window, light_gc, xx, yy);
gdk_draw_point (window, dark_gc, xx + 1, yy + 1);
-
+
gdk_draw_point (window, light_gc, xx + 3, yy + 1);
gdk_draw_point (window, dark_gc, xx + 4, yy + 2);
- }
- gdk_gc_set_clip_rectangle (light_gc, NULL);
- gdk_gc_set_clip_rectangle (dark_gc, NULL);
+ }
+ gdk_gc_set_clip_rectangle (light_gc, NULL);
+ gdk_gc_set_clip_rectangle (dark_gc, NULL);
}
static void
@@ -3044,27 +3046,27 @@ gtk_style_shade (GdkColor *a,
gdouble red;
gdouble green;
gdouble blue;
-
+
red = (gdouble) a->red / 65535.0;
green = (gdouble) a->green / 65535.0;
blue = (gdouble) a->blue / 65535.0;
-
+
rgb_to_hls (&red, &green, &blue);
-
+
green *= k;
if (green > 1.0)
green = 1.0;
else if (green < 0.0)
green = 0.0;
-
+
blue *= k;
if (blue > 1.0)
blue = 1.0;
else if (blue < 0.0)
blue = 0.0;
-
+
hls_to_rgb (&red, &green, &blue);
-
+
b->red = red * 65535.0;
b->green = green * 65535.0;
b->blue = blue * 65535.0;
@@ -3082,18 +3084,18 @@ rgb_to_hls (gdouble *r,
gdouble blue;
gdouble h, l, s;
gdouble delta;
-
+
red = *r;
green = *g;
blue = *b;
-
+
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
-
+
if (green < blue)
min = green;
else
@@ -3105,24 +3107,24 @@ rgb_to_hls (gdouble *r,
max = green;
else
max = blue;
-
+
if (red < blue)
min = red;
else
min = blue;
}
-
+
l = (max + min) / 2;
s = 0;
h = 0;
-
+
if (max != min)
{
if (l <= 0.5)
s = (max - min) / (max + min);
else
s = (max - min) / (2 - max - min);
-
+
delta = max -min;
if (red == max)
h = (green - blue) / delta;
@@ -3130,12 +3132,12 @@ rgb_to_hls (gdouble *r,
h = 2 + (blue - red) / delta;
else if (blue == max)
h = 4 + (red - green) / delta;
-
+
h *= 60;
if (h < 0.0)
h += 360;
}
-
+
*r = h;
*g = l;
*b = s;
@@ -3151,16 +3153,16 @@ hls_to_rgb (gdouble *h,
gdouble saturation;
gdouble m1, m2;
gdouble r, g, b;
-
+
lightness = *l;
saturation = *s;
-
+
if (lightness <= 0.5)
m2 = lightness * (1 + saturation);
else
m2 = lightness + saturation - lightness * saturation;
m1 = 2 * lightness - m2;
-
+
if (saturation == 0)
{
*h = lightness;
@@ -3174,7 +3176,7 @@ hls_to_rgb (gdouble *h,
hue -= 360;
while (hue < 0)
hue += 360;
-
+
if (hue < 60)
r = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
@@ -3183,13 +3185,13 @@ hls_to_rgb (gdouble *h,
r = m1 + (m2 - m1) * (240 - hue) / 60;
else
r = m1;
-
+
hue = *h;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
-
+
if (hue < 60)
g = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
@@ -3198,13 +3200,13 @@ hls_to_rgb (gdouble *h,
g = m1 + (m2 - m1) * (240 - hue) / 60;
else
g = m1;
-
+
hue = *h - 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
-
+
if (hue < 60)
b = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
@@ -3213,13 +3215,13 @@ hls_to_rgb (gdouble *h,
b = m1 + (m2 - m1) * (240 - hue) / 60;
else
b = m1;
-
+
*h = r;
*l = g;
*s = b;
}
}
-
+
void
gtk_paint_hline (GtkStyle *style,
GdkWindow *window,
@@ -3234,7 +3236,7 @@ gtk_paint_hline (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_hline != NULL);
-
+
(*style->klass->draw_hline) (style, window, state_type, area, widget, detail, x1, x2, y);
}
@@ -3252,7 +3254,7 @@ gtk_paint_vline (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_vline != NULL);
-
+
(*style->klass->draw_vline) (style, window, state_type, area, widget, detail, y1, y2, x);
}
@@ -3272,7 +3274,7 @@ gtk_paint_shadow (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_shadow != NULL);
-
+
(*style->klass->draw_shadow) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3291,7 +3293,7 @@ gtk_paint_polygon (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_shadow != NULL);
-
+
(*style->klass->draw_polygon) (style, window, state_type, shadow_type, area, widget, detail, points, npoints, fill);
}
@@ -3313,7 +3315,7 @@ gtk_paint_arrow (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_arrow != NULL);
-
+
(*style->klass->draw_arrow) (style, window, state_type, shadow_type, area, widget, detail, arrow_type, fill, x, y, width, height);
}
@@ -3333,7 +3335,7 @@ gtk_paint_diamond (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_diamond != NULL);
-
+
(*style->klass->draw_diamond) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3353,7 +3355,7 @@ gtk_paint_oval (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_oval != NULL);
-
+
(*style->klass->draw_oval) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3371,7 +3373,7 @@ gtk_paint_string (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_oval != NULL);
-
+
(*style->klass->draw_string) (style, window, state_type, area, widget, detail, x, y, string);
}
@@ -3391,7 +3393,7 @@ gtk_paint_box (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_box != NULL);
-
+
(*style->klass->draw_box) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3411,7 +3413,7 @@ gtk_paint_flat_box (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_flat_box != NULL);
-
+
(*style->klass->draw_flat_box) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3431,7 +3433,7 @@ gtk_paint_check (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_check != NULL);
-
+
(*style->klass->draw_check) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3451,7 +3453,7 @@ gtk_paint_option (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_option != NULL);
-
+
(*style->klass->draw_option) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3471,7 +3473,7 @@ gtk_paint_cross (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_cross != NULL);
-
+
(*style->klass->draw_cross) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3492,7 +3494,7 @@ gtk_paint_ramp (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_ramp != NULL);
-
+
(*style->klass->draw_ramp) (style, window, state_type, shadow_type, area, widget, detail, arrow_type, x, y, width, height);
}
@@ -3512,7 +3514,7 @@ gtk_paint_tab (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_tab != NULL);
-
+
(*style->klass->draw_tab) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height);
}
@@ -3535,7 +3537,7 @@ gtk_paint_shadow_gap (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_shadow_gap != NULL);
-
+
(*style->klass->draw_shadow_gap) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
}
@@ -3559,7 +3561,7 @@ gtk_paint_box_gap (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_box_gap != NULL);
-
+
(*style->klass->draw_box_gap) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width);
}
@@ -3580,7 +3582,7 @@ gtk_paint_extension (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_extension != NULL);
-
+
(*style->klass->draw_extension) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side);
}
@@ -3598,7 +3600,7 @@ gtk_paint_focus (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_focus != NULL);
-
+
(*style->klass->draw_focus) (style, window, area, widget, detail, x, y, width, height);
}
@@ -3619,7 +3621,7 @@ gtk_paint_slider (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_slider != NULL);
-
+
(*style->klass->draw_slider) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
}
@@ -3640,6 +3642,6 @@ gtk_paint_handle (GtkStyle *style,
g_return_if_fail (style != NULL);
g_return_if_fail (style->klass != NULL);
g_return_if_fail (style->klass->draw_handle != NULL);
-
+
(*style->klass->draw_handle) (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation);
}
diff --git a/gtk/gtktogglebutton.c b/gtk/gtktogglebutton.c
index 8b6fd6a881..57c951b0e0 100644
--- a/gtk/gtktogglebutton.c
+++ b/gtk/gtktogglebutton.c
@@ -83,7 +83,7 @@ gtk_toggle_button_get_type (void)
(GtkClassInitFunc) NULL,
};
- toggle_button_type = gtk_type_unique (gtk_button_get_type (), &toggle_button_info);
+ toggle_button_type = gtk_type_unique (GTK_TYPE_BUTTON, &toggle_button_info);
}
return toggle_button_type;
@@ -177,7 +177,7 @@ gtk_toggle_button_set_arg (GtkObject *object,
switch (arg_id)
{
case ARG_ACTIVE:
- gtk_toggle_button_set_state (tb, GTK_VALUE_BOOL (*arg));
+ gtk_toggle_button_set_active (tb, GTK_VALUE_BOOL (*arg));
break;
case ARG_DRAW_INDICATOR:
gtk_toggle_button_set_mode (tb, GTK_VALUE_BOOL (*arg));
@@ -212,21 +212,32 @@ gtk_toggle_button_get_arg (GtkObject *object,
void
gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
- gint draw_indicator)
+ gboolean draw_indicator)
{
+ GtkWidget *widget;
+
g_return_if_fail (toggle_button != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
+ widget = GTK_WIDGET (toggle_button);
+
draw_indicator = draw_indicator ? TRUE : FALSE;
if (toggle_button->draw_indicator != draw_indicator)
{
- if (GTK_WIDGET_REALIZED(toggle_button))
+ if (GTK_WIDGET_REALIZED (toggle_button))
{
- gtk_widget_unrealize(GTK_WIDGET(toggle_button));
+ gboolean visible = GTK_WIDGET_VISIBLE (toggle_button);
+
+ if (visible)
+ gtk_widget_hide (widget);
+
+ gtk_widget_unrealize (widget);
toggle_button->draw_indicator = draw_indicator;
- gtk_widget_realize(GTK_WIDGET(toggle_button));
- gtk_widget_show(GTK_WIDGET(toggle_button));
+ gtk_widget_realize (widget);
+
+ if (visible)
+ gtk_widget_show (widget);
}
else
toggle_button->draw_indicator = draw_indicator;
@@ -237,19 +248,24 @@ gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
}
void
-gtk_toggle_button_set_state (GtkToggleButton *toggle_button,
- gint state)
+gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
+ gboolean is_active)
{
g_return_if_fail (toggle_button != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
- if (toggle_button->active != (state != FALSE))
+ is_active = is_active != 0;
+
+ if (toggle_button->active != is_active)
gtk_button_clicked (GTK_BUTTON (toggle_button));
}
void
gtk_toggle_button_toggled (GtkToggleButton *toggle_button)
{
+ g_return_if_fail (toggle_button != NULL);
+ g_return_if_fail (GTK_IS_TOGGLE_BUTTON (toggle_button));
+
gtk_signal_emit (GTK_OBJECT (toggle_button), toggle_button_signals[TOGGLED]);
}
@@ -309,15 +325,15 @@ gtk_toggle_button_paint (GtkWidget *widget,
shadow_type = GTK_SHADOW_IN;
else
shadow_type = GTK_SHADOW_OUT;
-
- if ((button->relief != GTK_RELIEF_NONE) ||
- ((GTK_WIDGET_STATE(widget) != GTK_STATE_NORMAL) &&
- (GTK_WIDGET_STATE(widget) != GTK_STATE_INSENSITIVE)))
+
+ if (button->relief != GTK_RELIEF_NONE ||
+ (GTK_WIDGET_STATE(widget) != GTK_STATE_NORMAL &&
+ GTK_WIDGET_STATE(widget) != GTK_STATE_INSENSITIVE))
gtk_paint_box (widget->style, widget->window,
GTK_WIDGET_STATE (widget),
shadow_type, area, widget, "togglebutton",
x, y, width, height);
-
+
if (GTK_WIDGET_HAS_FOCUS (widget))
{
x -= 1;
@@ -336,26 +352,26 @@ static void
gtk_toggle_button_draw (GtkWidget *widget,
GdkRectangle *area)
{
- GtkButton *button;
GdkRectangle child_area;
GdkRectangle tmp_area;
+ GtkBin *bin;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
g_return_if_fail (area != NULL);
+ bin = GTK_BIN (widget);
+
if (GTK_WIDGET_DRAWABLE (widget))
{
- button = GTK_BUTTON (widget);
-
tmp_area = *area;
- tmp_area.x -= GTK_CONTAINER (button)->border_width;
- tmp_area.y -= GTK_CONTAINER (button)->border_width;
+ tmp_area.x -= GTK_CONTAINER (widget)->border_width;
+ tmp_area.y -= GTK_CONTAINER (widget)->border_width;
gtk_toggle_button_paint (widget, &tmp_area);
- if (GTK_BIN (button)->child && gtk_widget_intersect (GTK_BIN (button)->child, &tmp_area, &child_area))
- gtk_widget_draw (GTK_BIN (button)->child, &child_area);
+ if (bin->child && gtk_widget_intersect (bin->child, &tmp_area, &child_area))
+ gtk_widget_draw (bin->child, &child_area);
}
}
@@ -378,10 +394,7 @@ gtk_toggle_button_pressed (GtkButton *button)
new_state = (button->in_button ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL);
if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
+ gtk_widget_set_state (GTK_WIDGET (button), new_state);
}
static void
@@ -411,10 +424,7 @@ gtk_toggle_button_released (GtkButton *button)
new_state = (button->in_button ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL);
if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
+ gtk_widget_set_state (GTK_WIDGET (button), new_state);
}
}
}
@@ -440,7 +450,8 @@ gtk_toggle_button_clicked (GtkButton *button)
if (GTK_WIDGET_STATE (button) != new_state)
gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
+ else
+ gtk_widget_queue_draw (GTK_WIDGET (button));
}
static void
@@ -460,10 +471,7 @@ gtk_toggle_button_enter (GtkButton *button)
new_state = (button->button_down ? GTK_STATE_ACTIVE : GTK_STATE_PRELIGHT);
if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
+ gtk_widget_set_state (GTK_WIDGET (button), new_state);
}
static void
@@ -480,10 +488,7 @@ gtk_toggle_button_leave (GtkButton *button)
new_state = (toggle_button->active ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL);
if (GTK_WIDGET_STATE (button) != new_state)
- {
- gtk_widget_set_state (GTK_WIDGET (button), new_state);
- gtk_widget_queue_draw (GTK_WIDGET (button));
- }
+ gtk_widget_set_state (GTK_WIDGET (button), new_state);
}
static void
@@ -520,11 +525,11 @@ gtk_toggle_button_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_ONLY;
attributes_mask = GDK_WA_X | GDK_WA_Y;
- widget->window = gtk_widget_get_parent_window(widget);
- gdk_window_ref(widget->window);
+ widget->window = gtk_widget_get_parent_window (widget);
+ gdk_window_ref (widget->window);
- toggle_button->event_window =
- gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+ toggle_button->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
gdk_window_set_user_data (toggle_button->event_window, toggle_button);
}
else
@@ -534,8 +539,8 @@ gtk_toggle_button_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
- widget->window =
- gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
+ widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes, attributes_mask);
gdk_window_set_user_data (widget->window, toggle_button);
}
@@ -572,9 +577,8 @@ gtk_toggle_button_map (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
- if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget))
- if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
- gdk_window_show (GTK_TOGGLE_BUTTON (widget)->event_window);
+ if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
+ gdk_window_show (GTK_TOGGLE_BUTTON (widget)->event_window);
GTK_WIDGET_CLASS (parent_class)->map (widget);
}
@@ -585,9 +589,8 @@ gtk_toggle_button_unmap (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOGGLE_BUTTON (widget));
- if (GTK_WIDGET_MAPPED (widget))
- if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
- gdk_window_hide (GTK_TOGGLE_BUTTON (widget)->event_window);
+ if (GTK_TOGGLE_BUTTON (widget)->draw_indicator)
+ gdk_window_hide (GTK_TOGGLE_BUTTON (widget)->event_window);
GTK_WIDGET_CLASS (parent_class)->unmap (widget);
}
diff --git a/gtk/gtktogglebutton.h b/gtk/gtktogglebutton.h
index bd216758d1..bdb2a6e697 100644
--- a/gtk/gtktogglebutton.h
+++ b/gtk/gtktogglebutton.h
@@ -61,9 +61,9 @@ GtkType gtk_toggle_button_get_type (void);
GtkWidget* gtk_toggle_button_new (void);
GtkWidget* gtk_toggle_button_new_with_label (const gchar *label);
void gtk_toggle_button_set_mode (GtkToggleButton *toggle_button,
- gint draw_indicator);
-void gtk_toggle_button_set_state (GtkToggleButton *toggle_button,
- gint state);
+ gboolean draw_indicator);
+void gtk_toggle_button_set_active (GtkToggleButton *toggle_button,
+ gboolean is_active);
void gtk_toggle_button_toggled (GtkToggleButton *toggle_button);
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index 5d5fc53867..d45290831d 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -410,7 +410,7 @@ create_radio_buttons (void)
button = gtk_radio_button_new_with_label (
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
"button2");
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
button = gtk_radio_button_new_with_label (
@@ -1429,12 +1429,12 @@ create_tree_mode_window(void)
/* create check button */
button = gtk_check_button_new_with_label("Draw line");
gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
sTreeSampleSelection.draw_line_button = button;
button = gtk_check_button_new_with_label("View Line mode");
gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
sTreeSampleSelection.view_line_button = button;
button = gtk_check_button_new_with_label("Without Root item");
@@ -2779,21 +2779,21 @@ create_entry (void)
gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(editable_check), TRUE);
gtk_widget_show (editable_check);
editable_check = gtk_check_button_new_with_label("Visible");
gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(editable_check), TRUE);
gtk_widget_show (editable_check);
sensitive_check = gtk_check_button_new_with_label("Sensitive");
gtk_box_pack_start (GTK_BOX (box2), sensitive_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(sensitive_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_sensitive), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sensitive_check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sensitive_check), TRUE);
gtk_widget_show (sensitive_check);
separator = gtk_hseparator_new ();
@@ -3000,14 +3000,14 @@ create_spins (void)
GTK_SIGNAL_FUNC (toggle_snap),
spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
button = gtk_check_button_new_with_label ("Numeric only input mode");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (toggle_numeric),
spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
val_label = gtk_label_new ("");
@@ -4107,7 +4107,7 @@ create_clist (void)
gtk_signal_connect (GTK_OBJECT (check), "clicked",
GTK_SIGNAL_FUNC (toggle_reorderable), clist);
gtk_box_pack_start (GTK_BOX (box2), check, FALSE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
label = gtk_label_new ("Selection Mode :");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
@@ -5002,7 +5002,7 @@ void create_ctree (void)
gtk_signal_connect (GTK_OBJECT (check), "clicked",
GTK_SIGNAL_FUNC (toggle_reorderable), ctree);
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
hbox = gtk_hbox_new (TRUE, 5);
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
@@ -5798,14 +5798,14 @@ create_text (void)
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_editable), text);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_widget_show (check);
check = gtk_check_button_new_with_label("Wrap Words");
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_word_wrap), text);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), FALSE);
gtk_widget_show (check);
separator = gtk_hseparator_new ();
@@ -5947,7 +5947,7 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
button = gtk_check_button_new_with_label ("Fill Tab");
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (tab_fill), child);
@@ -6254,7 +6254,7 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
@@ -6267,7 +6267,7 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_label ("Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 1, 2);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_resize),
@@ -6276,7 +6276,7 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
diff --git a/gtk/testgtkrc b/gtk/testgtkrc
index fa8cbab45b..4e097bc35a 100644
--- a/gtk/testgtkrc
+++ b/gtk/testgtkrc
@@ -26,9 +26,15 @@ class "GtkWidget" style "defaultfont"
style "window"
{
-# bg_pixmap[NORMAL] = "warning.xpm"
+# bg_pixmap[NORMAL] = "marble.xpm"
}
+style "pix"
+{
+# bg_pixmap[NORMAL] = "<parent>" # "marble.xpm" # "test.xpm"
+}
+widget_class "*Button*" style "pix"
+
style "scale"
{
fg[NORMAL] = { 1.0, 0, 0 }
diff --git a/gtk/testselection.c b/gtk/testselection.c
index 765f918f28..e7d7bbfa21 100644
--- a/gtk/testselection.c
+++ b/gtk/testselection.c
@@ -136,7 +136,7 @@ selection_toggled (GtkWidget *widget)
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
if (!have_selection)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
}
else
{
@@ -188,7 +188,7 @@ gint
selection_clear (GtkWidget *widget, GdkEventSelection *event)
{
have_selection = FALSE;
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
return TRUE;
}
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 5d5fc53867..d45290831d 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -410,7 +410,7 @@ create_radio_buttons (void)
button = gtk_radio_button_new_with_label (
gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
"button2");
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
button = gtk_radio_button_new_with_label (
@@ -1429,12 +1429,12 @@ create_tree_mode_window(void)
/* create check button */
button = gtk_check_button_new_with_label("Draw line");
gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
sTreeSampleSelection.draw_line_button = button;
button = gtk_check_button_new_with_label("View Line mode");
gtk_box_pack_start(GTK_BOX(box4), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
sTreeSampleSelection.view_line_button = button;
button = gtk_check_button_new_with_label("Without Root item");
@@ -2779,21 +2779,21 @@ create_entry (void)
gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_editable), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(editable_check), TRUE);
gtk_widget_show (editable_check);
editable_check = gtk_check_button_new_with_label("Visible");
gtk_box_pack_start (GTK_BOX (box2), editable_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(editable_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_visibility), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(editable_check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(editable_check), TRUE);
gtk_widget_show (editable_check);
sensitive_check = gtk_check_button_new_with_label("Sensitive");
gtk_box_pack_start (GTK_BOX (box2), sensitive_check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(sensitive_check), "toggled",
GTK_SIGNAL_FUNC(entry_toggle_sensitive), entry);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(sensitive_check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(sensitive_check), TRUE);
gtk_widget_show (sensitive_check);
separator = gtk_hseparator_new ();
@@ -3000,14 +3000,14 @@ create_spins (void)
GTK_SIGNAL_FUNC (toggle_snap),
spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
button = gtk_check_button_new_with_label ("Numeric only input mode");
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (toggle_numeric),
spinner1);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
val_label = gtk_label_new ("");
@@ -4107,7 +4107,7 @@ create_clist (void)
gtk_signal_connect (GTK_OBJECT (check), "clicked",
GTK_SIGNAL_FUNC (toggle_reorderable), clist);
gtk_box_pack_start (GTK_BOX (box2), check, FALSE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
label = gtk_label_new ("Selection Mode :");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
@@ -5002,7 +5002,7 @@ void create_ctree (void)
gtk_signal_connect (GTK_OBJECT (check), "clicked",
GTK_SIGNAL_FUNC (toggle_reorderable), ctree);
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
hbox = gtk_hbox_new (TRUE, 5);
gtk_box_pack_start (GTK_BOX (mbox), hbox, FALSE, FALSE, 0);
@@ -5798,14 +5798,14 @@ create_text (void)
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_editable), text);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), TRUE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), TRUE);
gtk_widget_show (check);
check = gtk_check_button_new_with_label("Wrap Words");
gtk_box_pack_start (GTK_BOX (hbox), check, FALSE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT(check), "toggled",
GTK_SIGNAL_FUNC(text_toggle_word_wrap), text);
- gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(check), FALSE);
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), FALSE);
gtk_widget_show (check);
separator = gtk_hseparator_new ();
@@ -5947,7 +5947,7 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
button = gtk_check_button_new_with_label ("Fill Tab");
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 5);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
gtk_signal_connect (GTK_OBJECT (button), "toggled",
GTK_SIGNAL_FUNC (tab_fill), child);
@@ -6254,7 +6254,7 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
@@ -6267,7 +6267,7 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_label ("Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 1, 2);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_resize),
@@ -6276,7 +6276,7 @@ create_pane_options (GtkPaned *paned,
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3);
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
diff --git a/tests/testgtkrc b/tests/testgtkrc
index fa8cbab45b..4e097bc35a 100644
--- a/tests/testgtkrc
+++ b/tests/testgtkrc
@@ -26,9 +26,15 @@ class "GtkWidget" style "defaultfont"
style "window"
{
-# bg_pixmap[NORMAL] = "warning.xpm"
+# bg_pixmap[NORMAL] = "marble.xpm"
}
+style "pix"
+{
+# bg_pixmap[NORMAL] = "<parent>" # "marble.xpm" # "test.xpm"
+}
+widget_class "*Button*" style "pix"
+
style "scale"
{
fg[NORMAL] = { 1.0, 0, 0 }
diff --git a/tests/testselection.c b/tests/testselection.c
index 765f918f28..e7d7bbfa21 100644
--- a/tests/testselection.c
+++ b/tests/testselection.c
@@ -136,7 +136,7 @@ selection_toggled (GtkWidget *widget)
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
if (!have_selection)
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
}
else
{
@@ -188,7 +188,7 @@ gint
selection_clear (GtkWidget *widget, GdkEventSelection *event)
{
have_selection = FALSE;
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON(widget), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
return TRUE;
}