diff options
author | Tim Janik <timj@gtk.org> | 1999-01-11 18:49:54 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1999-01-11 18:49:54 +0000 |
commit | d2e69a89d4b8a0f9ceedbe87362cf9609e5b7c52 (patch) | |
tree | 9552de529756e2ce086f0965601290dad6d31c52 /gtk/gtkstyle.c | |
parent | 0b84fc27424dfe1a3dbd7cb35b80a95eadd8aa17 (diff) | |
download | gtk+-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.
Diffstat (limited to 'gtk/gtkstyle.c')
-rw-r--r-- | gtk/gtkstyle.c | 2014 |
1 files changed, 1008 insertions, 1006 deletions
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); } |