--- cleanice-draw.c 2008-02-15 01:11:17.000000000 +0100 +++ /home/mangler/Desktop/gtk-engines-cleanice-2.4.1/src/cleanice-draw.c 2007-08-08 21:15:13.000000000 +0200 @@ -30,142 +30,142 @@ static void cleanice_style_class_init (CleanIceStyleClass * klass); static void draw_hline (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, gint x1, gint x2, gint y); + GdkWindow * window, + GtkStateType state_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, gint x1, gint x2, gint y); static void draw_vline (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, gint y1, gint y2, gint x); + GdkWindow * window, + GtkStateType state_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, gint y1, gint y2, gint x); static void draw_shadow (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height); static void draw_arrow (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - GtkArrowType arrow_type, - gint fill, - gint x, gint y, gint width, gint height); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + GtkArrowType arrow_type, + gint fill, + gint x, gint y, gint width, gint height); static void draw_box (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height); static void draw_flat_box (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height); static void draw_check (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height); static void draw_option (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height); static void draw_gap (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, - gint y, - gint width, - gint height, - GtkPositionType gap_side, - gint gap_x, gint gap_width); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, + gint y, + gint width, + gint height, + GtkPositionType gap_side, + gint gap_x, gint gap_width); static void draw_extension (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, - gint y, - gint width, - gint height, GtkPositionType gap_side); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, + gint y, + gint width, + gint height, GtkPositionType gap_side); static void draw_slider (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, - gint y, - gint width, - gint height, GtkOrientation orientation); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, + gint y, + gint width, + gint height, GtkOrientation orientation); static void draw_handle (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, - gint y, - gint width, - gint height, GtkOrientation orientation); + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, + gint y, + gint width, + gint height, GtkOrientation orientation); static void draw_resize_grip (GtkStyle * style, GdkWindow * window, - GtkStateType state_type, GdkRectangle * area, - GtkWidget * widget, const gchar * detail, - GdkWindowEdge edge, gint x, gint y, - gint width, gint height); + GtkStateType state_type, GdkRectangle * area, + GtkWidget * widget, const gchar * detail, + GdkWindowEdge edge, gint x, gint y, + gint width, gint height); static void draw_layout (GtkStyle * style, GdkWindow * window, - GtkStateType state_type, gboolean use_text, - GdkRectangle * area, GtkWidget * widget, - const gchar * detail, gint x, gint y, - PangoLayout * layout); - + GtkStateType state_type, gboolean use_text, + GdkRectangle * area, GtkWidget * widget, + const gchar * detail, gint x, gint y, + PangoLayout * layout); + static void cleanice_dot(GdkWindow *window, - GdkGC *gc1, - GdkGC *gc2, - gint x, - gint y); + GdkGC *gc1, + GdkGC *gc2, + gint x, + gint y); static GtkStyleClass *parent_class = NULL; static void calculate_arrow_geometry (GtkArrowType arrow_type, - gint *x, - gint *y, - gint *width, - gint *height) { + gint *x, + gint *y, + gint *width, + gint *height) { gint w = *width; gint h = *height; @@ -182,13 +182,13 @@ if (arrow_type == GTK_ARROW_DOWN) { - if (*height % 2 == 1 || h % 2 == 0) - *height += 1; + if (*height % 2 == 1 || h % 2 == 0) + *height += 1; } else { - if (*height % 2 == 0 || h % 2 == 0) - *height -= 1; + if (*height % 2 == 0 || h % 2 == 0) + *height -= 1; } break; @@ -199,19 +199,19 @@ if (w > *width) { - w = *width; - h = 2 * w - 1; + w = *width; + h = 2 * w - 1; } if (arrow_type == GTK_ARROW_RIGHT) { - if (*width % 2 == 1 || w % 2 == 0) - *width += 1; + if (*width % 2 == 1 || w % 2 == 0) + *width += 1; } else { - if (*width % 2 == 0 || w % 2 == 0) - *width -= 1; + if (*width % 2 == 0 || w % 2 == 0) + *width -= 1; } break; @@ -236,103 +236,103 @@ } static void real_draw_line (GtkStyle * style, GdkWindow * window, - GtkOrientation orientation, - GdkRectangle * area, GtkShadowType shadow_type, - GtkStateType state_type, const gchar * detail, - gint y1, gint y2, gint x1, gint x2) { + GtkOrientation orientation, + GdkRectangle * area, GtkShadowType shadow_type, + GtkStateType state_type, const gchar * detail, + gint y1, gint y2, gint x1, gint x2) { g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); if (area) { gdk_gc_set_clip_rectangle (style->light_gc[state_type], - area); + area); gdk_gc_set_clip_rectangle (style->dark_gc[state_type], - area); + area); } if (orientation == GTK_ORIENTATION_VERTICAL) { if (shadow_type == GTK_SHADOW_OUT) { gdk_draw_line (window, style->light_gc[state_type], - x1 + 1, y1, x1 + 1, y2); + x1 + 1, y1, x1 + 1, y2); gdk_draw_line (window, style->dark_gc[state_type], - x1, y1, x1, y2); + x1, y1, x1, y2); gdk_draw_line (window, style->light_gc[state_type], - x1, y1, x1, y2 - 1); + x1, y1, x1, y2 - 1); gdk_draw_line (window, style->dark_gc[state_type], - x1 + 1, y1 + 1, x1 + 1, y2); + x1 + 1, y1 + 1, x1 + 1, y2); } else { gdk_draw_line (window, style->dark_gc[state_type], - x1 + 1, y1, x1 + 1, y2); + x1 + 1, y1, x1 + 1, y2); gdk_draw_line (window, style->light_gc[state_type], - x1, y1, x1, y2); + x1, y1, x1, y2); gdk_draw_line (window, style->dark_gc[state_type], - x1, y1, x1, y2 - 1); + x1, y1, x1, y2 - 1); gdk_draw_line (window, style->light_gc[state_type], - x1 + 1, y1 + 1, x1 + 1, y2); + x1 + 1, y1 + 1, x1 + 1, y2); } } else { if (shadow_type == GTK_SHADOW_OUT) { gdk_draw_line (window, style->light_gc[state_type], - x1, y1 + 1, x2, y1 + 1); + x1, y1 + 1, x2, y1 + 1); gdk_draw_line (window, style->dark_gc[state_type], - x1, y1, x2, y1); + x1, y1, x2, y1); gdk_draw_line (window, style->light_gc[state_type], - x1, y1, x2 - 1, y1); + x1, y1, x2 - 1, y1); gdk_draw_line (window, style->dark_gc[state_type], - x1 + 1, y1 + 1, x2, y1 + 1); + x1 + 1, y1 + 1, x2, y1 + 1); } else { gdk_draw_line (window, style->dark_gc[state_type], - x1, y1 + 1, x2, y1 + 1); + x1, y1 + 1, x2, y1 + 1); gdk_draw_line (window, style->light_gc[state_type], - x1, y1, x2, y1); + x1, y1, x2, y1); gdk_draw_line (window, style->dark_gc[state_type], - x1, y1, x2 - 1, y1); + x1, y1, x2 - 1, y1); gdk_draw_line (window, style->light_gc[state_type], - x1 + 1, y1 + 1, x2, y1 + 1); + x1 + 1, y1 + 1, x2, y1 + 1); } } if (area) { gdk_gc_set_clip_rectangle (style->light_gc[state_type], - NULL); + NULL); gdk_gc_set_clip_rectangle (style->dark_gc[state_type], - NULL); + NULL); } } static void draw_hline (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, gint x1, gint x2, gint y) { + GdkWindow * window, + GtkStateType state_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, gint x1, gint x2, gint y) { if (DETAIL ("handlebox") || DETAIL ("dockitem")) { real_draw_line (style, window, GTK_ORIENTATION_HORIZONTAL, - area, GTK_SHADOW_OUT, - state_type, detail, y, 0, x1, x2); + area, GTK_SHADOW_OUT, + state_type, detail, y, 0, x1, x2); } else { real_draw_line (style, window, GTK_ORIENTATION_HORIZONTAL, - area, GTK_SHADOW_IN, - state_type, detail, y, 0, x1, x2); + area, GTK_SHADOW_IN, + state_type, detail, y, 0, x1, x2); } } static void draw_vline (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, gint y1, gint y2, gint x) { + GdkWindow * window, + GtkStateType state_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, gint y1, gint y2, gint x) { if (DETAIL ("handlebox") || DETAIL ("dockitem")) { real_draw_line (style, window, GTK_ORIENTATION_VERTICAL, - area, GTK_SHADOW_OUT, - state_type, detail, y1, y2, x, 0); + area, GTK_SHADOW_OUT, + state_type, detail, y1, y2, x, 0); } else { real_draw_line (style, window, GTK_ORIENTATION_VERTICAL, - area, GTK_SHADOW_IN, - state_type, detail, y1, y2, x, 0); + area, GTK_SHADOW_IN, + state_type, detail, y1, y2, x, 0); } } @@ -354,13 +354,13 @@ } static void do_draw_shadow_with_gap (GdkWindow * window, GdkRectangle * area, - GtkStyle * style, GtkWidget * widget, - GtkStateType state_type, - GdkGC * tl_gc, GdkGC * br_gc, - const gchar * detail, - gint x, gint y, gint width, gint height, - GtkPositionType gap_side, gint gap_pos, - gint gap_size) { + GtkStyle * style, GtkWidget * widget, + GtkStateType state_type, + GdkGC * tl_gc, GdkGC * br_gc, + const gchar * detail, + gint x, gint y, gint width, gint height, + GtkPositionType gap_side, gint gap_pos, + gint gap_size) { gboolean is_first, selected; if (area) { @@ -376,55 +376,55 @@ switch (gap_side) { case GTK_POS_TOP: if (DETAIL ("tab") && !is_first && !selected) { - x += 2; - width -= 2; + x += 2; + width -= 2; } gdk_draw_line(window, tl_gc, x, y, x, y + height - 1); if (gap_size <= 0) - gdk_draw_line(window, tl_gc, x, y, x + width - 1, y); + gdk_draw_line(window, tl_gc, x, y, x + width - 1, y); else { - if (gap_pos > 0) - gdk_draw_line(window, tl_gc, x, y, x + gap_pos, y); - if ((width - (gap_pos + gap_size)) > 0) - gdk_draw_line (window, tl_gc, x + gap_pos + gap_size - 1, y, - x + width - 1, y); + if (gap_pos > 0) + gdk_draw_line(window, tl_gc, x, y, x + gap_pos, y); + if ((width - (gap_pos + gap_size)) > 0) + gdk_draw_line (window, tl_gc, x + gap_pos + gap_size - 1, y, + x + width - 1, y); } gdk_draw_line(window, br_gc, x, y + height - 1, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); gdk_draw_line(window, br_gc, x + width - 1, y, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); break; case GTK_POS_BOTTOM: if (DETAIL ("tab") && !is_first && !selected) { - x += 2; - width -= 2; + x += 2; + width -= 2; } gdk_draw_line(window, tl_gc, x, y, x + width - 1, y); if (gap_size <= 0) gdk_draw_line(window, br_gc, x, y + height - 1, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); else { if (gap_pos > 0) gdk_draw_line(window, br_gc, x, y + height-1, - x + gap_pos - 1, y + height-1); + x + gap_pos - 1, y + height-1); if ((width - (gap_pos + gap_size)) > 0) gdk_draw_line(window, br_gc, x + gap_pos + gap_size - 1, - y + height - 1, x + width - 1, y + height - 1); + y + height - 1, x + width - 1, y + height - 1); } gdk_draw_line(window, br_gc, x + width - 1, y, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); gdk_draw_line(window, tl_gc, x, y + 1, x, y + height - 1); break; case GTK_POS_LEFT: if (DETAIL ("tab") && !is_first && !selected) { - y += 2; - height -= 2; + y += 2; + height -= 2; } if (gap_size <= 0) @@ -443,8 +443,8 @@ break; case GTK_POS_RIGHT: if (DETAIL ("tab") && !is_first && !selected) { - y += 2; - height -= 2; + y += 2; + height -= 2; } gdk_draw_line(window, tl_gc, x, y, x, y + height-1); @@ -472,16 +472,16 @@ } static void draw_shadow_with_gap (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, - gint height, - GtkPositionType gap_side, - gint gap_pos, gint gap_size) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, + gint height, + GtkPositionType gap_side, + gint gap_pos, gint gap_size) { g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); @@ -494,48 +494,48 @@ if (DETAIL ("menuitem")) { gdk_draw_rectangle (window, style->dark_gc[state_type], - FALSE, x, y, width - 1, height - 1); + FALSE, x, y, width - 1, height - 1); } else { switch (shadow_type) { case GTK_SHADOW_NONE: break; case GTK_SHADOW_IN: do_draw_shadow_with_gap (window, area, style, widget, state_type, - style->dark_gc[state_type], - style->light_gc[state_type], - detail, x, y, width, height, - gap_side, gap_pos, gap_size); + style->dark_gc[state_type], + style->light_gc[state_type], + detail, x, y, width, height, + gap_side, gap_pos, gap_size); break; case GTK_SHADOW_ETCHED_IN: do_draw_shadow_with_gap (window, area, style, widget, state_type, - style->light_gc[state_type], - style->light_gc[state_type], - detail, x + 1, y + 1, width - 2, height - 2, - gap_side, gap_pos, gap_size); + style->light_gc[state_type], + style->light_gc[state_type], + detail, x + 1, y + 1, width - 2, height - 2, + gap_side, gap_pos, gap_size); do_draw_shadow_with_gap (window, area, style, widget, state_type, - style->dark_gc[state_type], - style->dark_gc[state_type], - detail, x, y, width - 2, height - 2, - gap_side, gap_pos, gap_size); + style->dark_gc[state_type], + style->dark_gc[state_type], + detail, x, y, width - 2, height - 2, + gap_side, gap_pos, gap_size); break; case GTK_SHADOW_OUT: do_draw_shadow_with_gap (window, area, style, widget, state_type, - style->light_gc[state_type], - style->dark_gc[state_type], - detail, x, y, width, height, - gap_side, gap_pos, gap_size); + style->light_gc[state_type], + style->dark_gc[state_type], + detail, x, y, width, height, + gap_side, gap_pos, gap_size); break; case GTK_SHADOW_ETCHED_OUT: do_draw_shadow_with_gap (window, area, style, widget, state_type, - style->dark_gc[state_type], - style->dark_gc[state_type], - detail, x + 1, y + 1, width - 2, height - 2, - gap_side, gap_pos, gap_size); + style->dark_gc[state_type], + style->dark_gc[state_type], + detail, x + 1, y + 1, width - 2, height - 2, + gap_side, gap_pos, gap_size); do_draw_shadow_with_gap (window, area, style, widget, state_type, - style->light_gc[state_type], - style->light_gc[state_type], - detail, x, y, width - 2, height - 2, - gap_side, gap_pos, gap_size); + style->light_gc[state_type], + style->light_gc[state_type], + detail, x, y, width - 2, height - 2, + gap_side, gap_pos, gap_size); break; } } @@ -546,34 +546,35 @@ } static void draw_shadow (GtkStyle * style, GdkWindow * window, - GtkStateType state_type, GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, const gchar * detail, - gint x, gint y, gint width, gint height) { + GtkStateType state_type, GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, const gchar * detail, + gint x, gint y, gint width, gint height) { if (DETAIL ("notebook")) { draw_shadow_with_gap (style, window, state_type, shadow_type, - area, widget, detail, - x, y, width, height, - GTK_POS_BOTTOM, 0, 0); + area, widget, detail, + x, y, width, height, + GTK_POS_BOTTOM, 0, 0); } else { draw_shadow_with_gap (style, window, state_type, shadow_type, - area, widget, detail, - x, y, width, height, - GTK_POS_TOP, 0, 0); + area, widget, detail, + x, y, width, height, + GTK_POS_TOP, 0, 0); } } static void draw_black_arrow (GdkWindow *window, - GtkWidget *widget, - GdkGC *gc, - GdkRectangle *area, - GtkStateType state_type, - GtkArrowType arrow_type, - gboolean fill, - gint x, - gint y, - gint width, - gint height) { + GtkWidget *widget, + GdkGC *gc, + GdkRectangle *area, + GtkStateType state_type, + GtkArrowType arrow_type, + GtkShadowType shadow_type, + gboolean fill, + gint x, + gint y, + gint width, + gint height) { gint i, j; if (area) @@ -583,49 +584,142 @@ case GTK_ARROW_DOWN: if (fill) { for (i = 0, j = 0; i < height; i++, j++) - gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); + gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); } else { gdk_draw_line (window, gc, x, y, x + width - 1, y); gdk_draw_line (window, gc, x, y, x + (width - 1) / 2, y + height - 1); gdk_draw_line (window, gc, x + (width - 1) / 2, y + height - 1, - x + width - 1, y); + x + width - 1, y); + } + switch (shadow_type) { + case GTK_SHADOW_IN: + case GTK_SHADOW_ETCHED_IN: + gdk_draw_line (window, widget->style->dark_gc[state_type], + x, y, x + width - 1, y); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x, y, x + (width - 1) / 2, y + height - 1); + gdk_draw_line (window, widget->style->light_gc[state_type], + x + (width - 1) / 2, y + height - 1, x + width - 1, y); + break; + case GTK_SHADOW_OUT: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, widget->style->light_gc[state_type], + x, y, x + width - 1, y); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x, y, x + (width - 1) / 2, y + height - 1); + gdk_draw_line (window, widget->style->dark_gc[state_type], + x + (width - 1) / 2, y + height - 1, x + width - 1, y); + break; + + case GTK_SHADOW_NONE: + break; } break; case GTK_ARROW_UP: if (fill) { for (i = height - 1, j = 0; i >= 0; i--, j++) - gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); + gdk_draw_line (window, gc, x + j, y + i, x + width - j - 1, y + i); } else { gdk_draw_line (window, gc, x, y + height - 1, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); gdk_draw_line (window, gc, x + (width - 1) / 2, y, - x, y + height - 1); + x, y + height - 1); gdk_draw_line (window, gc, x + (width - 1) / 2, y, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); + } + switch (shadow_type) { + case GTK_SHADOW_IN: + case GTK_SHADOW_ETCHED_IN: + gdk_draw_line (window, widget->style->light_gc[state_type], + x, y + height - 1, x + width - 1, y + height - 1); + gdk_draw_line (window, widget->style->dark_gc[state_type], + x + (width - 1) / 2, y, x, y + height - 1); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x + (width - 1) / 2, y, x + width - 1, y + height - 1); + break; + case GTK_SHADOW_OUT: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, widget->style->dark_gc[state_type], + x, y + height - 1, x + width - 1, y + height - 1); + gdk_draw_line (window, widget->style->light_gc[state_type], + x + (width - 1) / 2, y, x, y + height - 1); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x + (width - 1) / 2, y, x + width - 1, y + height - 1); + break; + + case GTK_SHADOW_NONE: + break; } break; case GTK_ARROW_LEFT: if (fill) { for (i = width - 1, j = 0; i >= 0; i--, j++) - gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); + gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); } else { gdk_draw_line (window, gc, x + width - 1, y, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); gdk_draw_line (window, gc, x, y + (height - 1) / 2, - x + width - 1, y); + x + width - 1, y); gdk_draw_line (window, gc, x, y + (height - 1) / 2, - x + width - 1, y + height - 1); + x + width - 1, y + height - 1); + } + break; + switch (shadow_type) { + case GTK_SHADOW_IN: + case GTK_SHADOW_ETCHED_IN: + gdk_draw_line (window, widget->style->light_gc[state_type], + x + width - 1, y, x + width - 1, y + height - 1); + gdk_draw_line (window, widget->style->dark_gc[state_type], + x, y + (height - 1) / 2, x + width - 1, y); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x, y + (height - 1) / 2, x + width - 1, y + height - 1); + break; + case GTK_SHADOW_OUT: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, widget->style->dark_gc[state_type], + x + width - 1, y, x + width - 1, y + height - 1); + gdk_draw_line (window, widget->style->light_gc[state_type], + x, y + (height - 1) / 2, x + width - 1, y); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x, y + (height - 1) / 2, x + width - 1, y + height - 1); + break; + + case GTK_SHADOW_NONE: + break; } break; case GTK_ARROW_RIGHT: if (fill) { for (i = 0, j = 0; i < width; i++, j++) - gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); + gdk_draw_line (window, gc, x + i, y + j, x + i, y + height - j - 1); } else { gdk_draw_line (window, gc, x, y, x, y + height - 1); gdk_draw_line (window, gc, x, y, x + width - 1, y + (height - 1) / 2); gdk_draw_line (window, gc, x, y + height - 1, - x + width - 1, y + (height - 1) / 2); + x + width - 1, y + (height - 1) / 2); + } + switch (shadow_type) { + case GTK_SHADOW_IN: + case GTK_SHADOW_ETCHED_IN: + gdk_draw_line (window, widget->style->dark_gc[state_type], + x, y, x, y + height - 1); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x, y, x + width - 1, y + (height - 1) / 2); + gdk_draw_line (window, widget->style->light_gc[state_type], + x, y + height - 1, x + width - 1, y + (height - 1) / 2); + break; + case GTK_SHADOW_OUT: + case GTK_SHADOW_ETCHED_OUT: + gdk_draw_line (window, widget->style->light_gc[state_type], + x, y, x, y + height - 1); + gdk_draw_line (window, widget->style->mid_gc[state_type], + x, y, x + width - 1, y + (height - 1) / 2); + gdk_draw_line (window, widget->style->dark_gc[state_type], + x, y + height - 1, x + width - 1, y + (height - 1) / 2); + break; + + case GTK_SHADOW_NONE: + break; } break; } @@ -635,15 +729,15 @@ } static void draw_arrow (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - GtkArrowType arrow_type, - gboolean fill, gint x, gint y, - gint width, gint height) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + GtkArrowType arrow_type, + gboolean fill, gint x, gint y, + gint width, gint height) { gint ax, ay, aw, ah; g_return_if_fail(style != NULL); @@ -657,6 +751,19 @@ calculate_arrow_geometry (arrow_type, &ax, &ay, &aw, &ah); + /* + GTK+ sucks at drawing arrows, or telling itself what to draw in + some cases, and so we must do this stupid lame hack, so that the + arrows in CleanIce draw correctly + */ + if (DETAIL ("vscrollbar") || DETAIL ("hscrollbar") || + DETAIL ("spinbutton") || DETAIL ("notebook") || + DETAIL ("calendar") || DETAIL ("menuitem") || + DETAIL ("tearoffmenuitem") || DETAIL ("header") || + DETAIL ("menu_scroll_arrow_up") || DETAIL ("menu_scroll_arrow_down") || + widget->parent->parent && GTK_IS_COMBO (widget->parent->parent)) + shadow_type = GTK_SHADOW_NONE; + if (DETAIL ("vscrollbar")) { ax -= (width % 2); aw += 2; @@ -685,58 +792,58 @@ switch (arrow_type) { case GTK_ARROW_UP: case GTK_ARROW_DOWN: - if (aw < 7) aw = 7; - if (ah < 4) ah = 4; + if (aw < 5) aw = 5; + if (ah < 3) ah = 3; break; case GTK_ARROW_RIGHT: case GTK_ARROW_LEFT: - if (aw < 4) aw = 4; - if (ah < 7) ah = 7; + if (aw < 3) aw = 3; + if (ah < 5) ah = 5; break; } if (DETAIL ("expander") && state_type == GTK_STATE_PRELIGHT) { draw_black_arrow (window, widget, style->bg_gc[state_type], area, - state_type, arrow_type, - fill, ax, ay, aw, ah); + state_type, arrow_type, shadow_type, + fill, ax, ay, aw, ah); } else if (DETAIL ("treeview") && state_type == GTK_STATE_SELECTED && - !GTK_WID3ET_HAS_FOCUS (widget)) { + !GTK_WIDGET_HAS_FOCUS (widget)) { draw_black_arrow (window, widget, style->text_gc[GTK_STATE_ACTIVE], area, - state_type, arrow_type, - fill, ax, ay, aw, ah); + state_type, arrow_type, shadow_type, + fill, ax, ay, aw, ah); } else { if ((widget->parent->parent && - GTK_IS_COMBO_BOX (widget->parent->parent) && - !GTK_IS_COMBO_BOX_ENTRY (widget->parent->parent)) || - (widget->parent->parent && widget->parent->parent->parent && - GTK_IS_COMBO_BOX (widget->parent->parent->parent) && - !GTK_IS_COMBO_BOX_ENTRY (widget->parent->parent->parent))) { + GTK_IS_COMBO_BOX (widget->parent->parent) && + !GTK_IS_COMBO_BOX_ENTRY (widget->parent->parent)) || + (widget->parent->parent && widget->parent->parent->parent && + GTK_IS_COMBO_BOX (widget->parent->parent->parent) && + !GTK_IS_COMBO_BOX_ENTRY (widget->parent->parent->parent))) { draw_black_arrow (window, widget->parent, style->fg_gc[state_type], area, - state_type, GTK_ARROW_UP, - fill, ax, ay - ah / 2 - 1, aw, ah); + state_type, GTK_ARROW_UP, shadow_type, + fill, ax, ay - ah / 2 - 1, aw, ah); draw_black_arrow (window, widget->parent, style->fg_gc[state_type], area, - state_type, GTK_ARROW_DOWN, - fill, ax, ay + ah / 2 + 1, aw, ah); + state_type, GTK_ARROW_DOWN, shadow_type, + fill, ax, ay + ah / 2 + 1, aw, ah); } else { draw_black_arrow (window, widget, style->fg_gc[state_type], area, - state_type, arrow_type, - fill, ax, ay, aw, ah); + state_type, arrow_type, shadow_type, + fill, ax, ay, aw, ah); } } } static void real_draw_box (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, - gint y, - gint width, - gint height, - gboolean draw_shadow) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, + gint y, + gint width, + gint height, + gboolean draw_shadow) { g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); @@ -748,8 +855,8 @@ } gtk_style_apply_default_background (style, window, - widget && !GTK_WIDGET_NO_WINDOW (widget), - state_type, area, x, y, width, height); + widget && !GTK_WIDGET_NO_WINDOW (widget), + state_type, area, x, y, width, height); if (area) { gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL); @@ -757,19 +864,19 @@ if (draw_shadow) { gtk_paint_shadow (style, window, state_type, - shadow_type, area, widget, - detail, x, y, width, height); + shadow_type, area, widget, + detail, x, y, width, height); } } static void draw_box (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height) { g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); @@ -778,31 +885,31 @@ if (DETAIL ("optionmenu")) { real_draw_box (style, window, state_type, - shadow_type, area, widget, - detail, x, y, width, height, TRUE); + shadow_type, area, widget, + detail, x, y, width, height, TRUE); draw_vline (style, window, state_type, - area, widget, detail, - y + style->ythickness + 1, - y + height - style->ythickness - 2, - x + width - 19 - style->xthickness); + area, widget, detail, + y + style->ythickness + 1, + y + height - style->ythickness - 2, + x + width - 19 - style->xthickness); } else if (DETAIL ("trough")) { if (GTK_IS_SCALE (widget)) { if (width > height) { - draw_hline (style, window, state_type, area, widget, detail, - x, x + width, y + (height / 2) - 1); + draw_hline (style, window, state_type, area, widget, detail, + x, x + width, y + (height / 2) - 1); } else { - draw_vline (style, window, state_type, area, widget, detail, - y, y + height, x + (width / 2) - 1); + draw_vline (style, window, state_type, area, widget, detail, + y, y + height, x + (width / 2) - 1); } } else if (GTK_IS_PROGRESS_BAR (widget)) { real_draw_box (style, window, GTK_STATE_ACTIVE, - shadow_type, area, widget, detail, - x, y, width, height, TRUE); + shadow_type, area, widget, detail, + x, y, width, height, TRUE); } else { real_draw_box (style, window, state_type, - shadow_type, area, widget, - detail, x, y, width, height, TRUE); + shadow_type, area, widget, + detail, x, y, width, height, TRUE); } } else if (DETAIL ("buttondefault")) { /* I don't want no background on default buttons.. @@ -818,63 +925,63 @@ points2[2].x = x+3; points2[2].y = y+10; if (GTK_IS_COMBO (widget->parent) || - GTK_IS_COMBO_BOX_ENTRY (widget->parent)) { + GTK_IS_COMBO_BOX_ENTRY (widget->parent)) { if (state_type == GTK_STATE_ACTIVE) { - real_draw_box (style, window, state_type, GTK_SHADOW_IN, - area, widget, detail, x, y, width, height, TRUE); + real_draw_box (style, window, state_type, GTK_SHADOW_IN, + area, widget, detail, x, y, width, height, TRUE); } else { - real_draw_box (style, window, GTK_STATE_NORMAL, GTK_SHADOW_IN, - area, widget, detail, x, y, width, height, TRUE); - real_draw_box (style, window, state_type, shadow_type, - area, widget, detail, x + 1, y + 1, - width - 2, height - 2, TRUE); + real_draw_box (style, window, GTK_STATE_NORMAL, GTK_SHADOW_IN, + area, widget, detail, x, y, width, height, TRUE); + real_draw_box (style, window, state_type, shadow_type, + area, widget, detail, x + 1, y + 1, + width - 2, height - 2, TRUE); } } else { real_draw_box (style, window, state_type, shadow_type, - area, widget, detail, x, y, width, height, TRUE); + area, widget, detail, x, y, width, height, TRUE); } /* Paint a triangle here instead of in "buttondefault" which is drawn _behind_ the current button */ if (GTK_WIDGET_HAS_DEFAULT (widget)) { gdk_draw_polygon(window, style->dark_gc[state_type], - FALSE, points1, 3); + FALSE, points1, 3); gdk_draw_polygon(window, style->light_gc[state_type], - FALSE, points2, 3); + FALSE, points2, 3); if (state_type != GTK_STATE_PRELIGHT) { - gdk_draw_polygon(window, style->bg_gc[GTK_STATE_PRELIGHT], - TRUE, points2, 3); + gdk_draw_polygon(window, style->bg_gc[GTK_STATE_PRELIGHT], + TRUE, points2, 3); } else { - gdk_draw_polygon(window, style->fg_gc[GTK_STATE_PRELIGHT], - TRUE, points2, 3); + gdk_draw_polygon(window, style->fg_gc[GTK_STATE_PRELIGHT], + TRUE, points2, 3); } } } else if (DETAIL ("bar")) { real_draw_box (style, window, GTK_STATE_PRELIGHT, GTK_SHADOW_NONE, - area, widget, detail, - x - 1, y - 1, width + 2, height + 2, TRUE); + area, widget, detail, + x - 1, y - 1, width + 2, height + 2, TRUE); } else if (DETAIL ("spinbutton_up") || DETAIL ("spinbutton_down")) { if (state_type == GTK_STATE_PRELIGHT || state_type == GTK_STATE_ACTIVE) { real_draw_box (style, window, state_type, shadow_type, - area, widget, detail, x, y, width, height, TRUE); + area, widget, detail, x, y, width, height, TRUE); } else { real_draw_box (style, window, GTK_STATE_NORMAL, shadow_type, - area, widget, detail, x, y, width, height, FALSE); + area, widget, detail, x, y, width, height, FALSE); } } else { real_draw_box (style, window, state_type, shadow_type, - area, widget, detail, x, y, width, height, TRUE); + area, widget, detail, x, y, width, height, TRUE); } } static void draw_flat_box (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height) { g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); @@ -882,12 +989,12 @@ if (DETAIL ("entry_bg")) { parent_class->draw_flat_box (style, window, state_type, shadow_type, - area, widget, detail, - x + 1, y + 1, width - 2, height - 2); + area, widget, detail, + x + 1, y + 1, width - 2, height - 2); if (GTK_WIDGET_HAS_FOCUS (widget)) { gtk_paint_focus (style, window, state_type, area, widget, detail, - x, y, width, height); + x, y, width, height); } } else if (DETAIL ("checkbutton") && state_type == GTK_STATE_PRELIGHT) { if (area) { @@ -895,10 +1002,10 @@ } gtk_style_apply_default_background (style, window, - widget && - !GTK_WIDGET_NO_WINDOW (widget), - GTK_STATE_NORMAL, area, - x, y, width, height); + widget && + !GTK_WIDGET_NO_WINDOW (widget), + GTK_STATE_NORMAL, area, + x, y, width, height); if (area) { gdk_gc_set_clip_rectangle (style->bg_gc[GTK_STATE_NORMAL], NULL); @@ -906,30 +1013,30 @@ } else if (DETAIL ("cell_even") || DETAIL ("cell_odd")) { if (state_type == GTK_STATE_SELECTED) { if (GTK_WIDGET_HAS_FOCUS (widget)) { - 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); } else { - gdk_draw_rectangle (window, style->bg_gc[GTK_STATE_ACTIVE], TRUE, - x, y, width, height); + gdk_draw_rectangle (window, style->bg_gc[GTK_STATE_ACTIVE], TRUE, + x, y, width, height); } } else if (state_type == GTK_STATE_PRELIGHT) { gdk_draw_rectangle (window, style->light_gc[state_type], TRUE, - x, y, width, height); + x, y, width, height); gdk_draw_rectangle (window, style->dark_gc[state_type], FALSE, - x, y, width - 1, height - 1); + x, y, width - 1, height - 1); } else { gdk_draw_rectangle (window, style->base_gc[state_type], TRUE, - x, y, width, height); + x, y, width, height); } } else { parent_class->draw_flat_box (style, window, state_type, shadow_type, - area, widget, detail, x, y, width, height); + area, widget, detail, x, y, width, height); } } static void draw_check_item (GdkWindow * window, GdkGC * gc, - GdkRectangle * area, - gint x, gint y, gint width, gint height) { + GdkRectangle * area, + gint x, gint y, gint width, gint height) { gdk_draw_line(window, gc, x + 1, y + height - 6, x + 1, y + height - 3); gdk_draw_line(window, gc, x + 2, y + height - 5, x + 2, y + height - 2); @@ -939,79 +1046,79 @@ } static void draw_check (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height) { - if (DETAIL ("check")) { /* Menu item */ + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height) { + if (DETAIL ("check")) { /* Menu item */ if (shadow_type == GTK_SHADOW_IN) { draw_check_item (window, style->fg_gc[state_type], area, - x, y, width + 1, height + 1); + x, y, width + 1, height + 1); } } else { gtk_paint_box (style, window, GTK_STATE_NORMAL, - GTK_SHADOW_IN, area, widget, - detail, x, y - 2, width + 3, height + 3); + GTK_SHADOW_IN, area, widget, + detail, x, y - 2, width + 3, height + 3); gdk_draw_rectangle (window, style->base_gc[state_type], TRUE, - x + 1, y - 1, width + 1, height + 1); + x + 1, y - 1, width + 1, height + 1); if (shadow_type == GTK_SHADOW_IN) { draw_check_item (window, style->text_gc[state_type], area, - x + 2, y, width, height); + x + 2, y, width, height); } } } static void draw_option (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height) { if (DETAIL ("option")) { /* Menu item */ if (shadow_type == GTK_SHADOW_IN) { gdk_draw_arc (window, style->fg_gc[state_type], TRUE, - x + 2, y + 2, width / 2, height / 2, 0, 360 * 64); + x + 2, y + 2, width / 2, height / 2, 0, 360 * 64); gdk_draw_arc (window, style->fg_gc[state_type], FALSE, - x + 2, y + 2, width / 2, height / 2, 0, 360 * 64); + x + 2, y + 2, width / 2, height / 2, 0, 360 * 64); } } else { gdk_draw_arc (window, style->base_gc[state_type], - TRUE, x, y, width, height, 0, 360 * 64); + TRUE, x, y, width, height, 0, 360 * 64); gdk_draw_arc (window, style->mid_gc[GTK_STATE_NORMAL], FALSE, - x, y, width, height, 45 * 64, 225 * 64); + x, y, width, height, 45 * 64, 225 * 64); gdk_draw_arc (window, style->light_gc[GTK_STATE_NORMAL], FALSE, - x, y, width, height, 225 * 64, 180 * 64); + x, y, width, height, 225 * 64, 180 * 64); if (shadow_type == GTK_SHADOW_IN) { gdk_draw_arc (window, style->text_gc[state_type], TRUE, - x + width / 4, - y + height / 4, - width / 2 + 1, height / 2 + 1, - 0, 360 * 64); + x + width / 4, + y + height / 4, + width / 2 + 1, height / 2 + 1, + 0, 360 * 64); gdk_draw_arc (window, style->mid_gc[state_type], FALSE, - x + width / 4, - y + height / 4, - width / 2 + 1, height / 2 + 1, - 0, 360 * 64); + x + width / 4, + y + height / 4, + width / 2 + 1, height / 2 + 1, + 0, 360 * 64); } } } static void draw_gap (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height, - GtkPositionType gap_side, - gint gap_x, gint gap_width) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height, + GtkPositionType gap_side, + gint gap_x, gint gap_width) { g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); @@ -1021,29 +1128,29 @@ widget, detail, x, y, width, height, FALSE); draw_shadow_with_gap (style, window, state_type, shadow_type, - area, widget, detail, - x, y, width, height, - gap_side, gap_x, gap_width); + area, widget, detail, + x, y, width, height, + gap_side, gap_x, gap_width); } static void draw_extension (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height, - GtkPositionType gap_side) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height, + GtkPositionType gap_side) { draw_gap (style, window, state_type, shadow_type, area, widget, - detail, x, y, width, height, gap_side, 0, width); + detail, x, y, width, height, gap_side, 0, width); } static void cleanice_dot(GdkWindow *window, - GdkGC *gc1, GdkGC *gc2, - gint x, gint y) { + GdkGC *gc1, GdkGC *gc2, + gint x, gint y) { GdkPoint points[3]; points[0].x = x-1; points[0].y = y; @@ -1060,23 +1167,23 @@ } static void draw_slider (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height, - GtkOrientation orientation) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height, + GtkOrientation orientation) { g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); sanitize_size (GDK_DRAWABLE (window), &width, &height); real_draw_box(style, window, state_type, - shadow_type, area, widget, - detail, x, y, width, height, - TRUE); + shadow_type, area, widget, + detail, x, y, width, height, + TRUE); if (area) { gdk_gc_set_clip_rectangle(style->light_gc[state_type], area); @@ -1085,23 +1192,23 @@ if (DETAIL ("slider")) { if (orientation == GTK_ORIENTATION_HORIZONTAL) { cleanice_dot(window, style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 - 4, y + height / 2); + style->dark_gc[state_type], + x + width / 2 - 4, y + height / 2); cleanice_dot(window, style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 + 4, y + height / 2); + style->dark_gc[state_type], + x + width / 2 + 4, y + height / 2); } else { cleanice_dot(window, style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, y + height / 2 - 4); + style->dark_gc[state_type], + x + width / 2, y + height / 2 - 4); cleanice_dot(window, style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, y + height / 2 + 4); + style->dark_gc[state_type], + x + width / 2, y + height / 2 + 4); } } cleanice_dot(window, style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, y + height / 2); + style->dark_gc[state_type], + x + width / 2, y + height / 2); if (area) { gdk_gc_set_clip_rectangle(style->light_gc[state_type], NULL); gdk_gc_set_clip_rectangle(style->dark_gc[state_type], NULL); @@ -1109,14 +1216,14 @@ } static void draw_handle (GtkStyle * style, - GdkWindow * window, - GtkStateType state_type, - GtkShadowType shadow_type, - GdkRectangle * area, - GtkWidget * widget, - const gchar * detail, - gint x, gint y, gint width, gint height, - GtkOrientation orientation) { + GdkWindow * window, + GtkStateType state_type, + GtkShadowType shadow_type, + GdkRectangle * area, + GtkWidget * widget, + const gchar * detail, + gint x, gint y, gint width, gint height, + GtkOrientation orientation) { GdkRectangle dest; g_return_if_fail(style != NULL); @@ -1142,100 +1249,100 @@ if (DETAIL("paned")) { if (orientation == GTK_ORIENTATION_HORIZONTAL) { gtk_paint_box(style, window, state_type, GTK_SHADOW_NONE, area, widget, - detail, x, y, width, height); + detail, x, y, width, height); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 - 8, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2 - 8, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 - 4, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2 - 4, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 + 4, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2 + 4, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 + 8, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2 + 8, + y + height / 2); } else { gtk_paint_box(style, window, state_type, GTK_SHADOW_NONE, area, widget, - detail, x, y, width, height); + detail, x, y, width, height); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2 - 8); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2 - 8); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2 - 4); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2 - 4); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2 + 4); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2 + 4); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2 + 8); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2 + 8); } } else { if (orientation == GTK_ORIENTATION_HORIZONTAL) { gtk_paint_box(style, window, state_type, GTK_SHADOW_OUT, area, widget, - detail, x, y, width, height); + detail, x, y, width, height); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 - 4, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2 - 4, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2 + 4, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2 + 4, + y + height / 2); } else { gtk_paint_box(style, window, state_type, GTK_SHADOW_OUT, area, widget, - detail, x, y, width, height); + detail, x, y, width, height); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2 - 4); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2 - 4); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2); cleanice_dot(window, - style->light_gc[state_type], - style->dark_gc[state_type], - x + width / 2, - y + height / 2 + 4); + style->light_gc[state_type], + style->dark_gc[state_type], + x + width / 2, + y + height / 2 + 4); } } @@ -1244,142 +1351,39 @@ } static void draw_resize_grip (GtkStyle * style, GdkWindow * window, - GtkStateType state_type, GdkRectangle * area, - GtkWidget * widget, const gchar * detail, - GdkWindowEdge edge, gint x, gint y, - gint width, gint height) { - int xi, yi; - int max_x, max_y; - int threshold; - - g_return_if_fail(style != NULL); - g_return_if_fail(window != NULL); - - sanitize_size (GDK_DRAWABLE (window), &width, &height); - - switch (edge) { - case GDK_WINDOW_EDGE_NORTH_WEST: - /* make it square */ - if (width < height) { - height = width; - } - else if (height < width) { - width = height; - } - break; - case GDK_WINDOW_EDGE_NORTH: - if (width < height) { - height = width; - } - break; - case GDK_WINDOW_EDGE_NORTH_EAST: - /* make it square, aligning to top right */ - if (width < height) { - height = width; - } else if (height < width) { - x += (width - height); - width = height; - } - break; - case GDK_WINDOW_EDGE_WEST: - if (height < width) { - width = height; - } - break; - case GDK_WINDOW_EDGE_EAST: - /* aligning to right */ - if (height < width) { - x += (width - height); - width = height; - } - break; - case GDK_WINDOW_EDGE_SOUTH_WEST: - /* make it square, aligning to bottom left */ - if (width < height) { - y += (height - width); - height = width; - } else if (height < width) { - width = height; - } - break; - case GDK_WINDOW_EDGE_SOUTH: - /* align to bottom */ - if (width < height) { - y += (height - width); - height = width; - } - break; - case GDK_WINDOW_EDGE_SOUTH_EAST: - /* make it square, aligning to bottom right */ - if (width < height) { - y += (height - width); - height = width; - } else if (height < width) { - x += (width - height); - width = height; - } - break; - default: - g_assert_not_reached (); - } - - max_x = (width - 2) / 4; - max_y = (height - 2) / 4; - - threshold = max_x; - - for (xi = 0; xi <= max_x; xi++) { - for (yi = 0; yi <= max_y; yi++) { - gboolean draw_dot; - - switch (edge) { - case GDK_WINDOW_EDGE_NORTH: - case GDK_WINDOW_EDGE_WEST: - case GDK_WINDOW_EDGE_EAST: - case GDK_WINDOW_EDGE_SOUTH: - draw_dot = TRUE; - break; - case GDK_WINDOW_EDGE_NORTH_WEST: - draw_dot = (xi + yi <= threshold); - break; - case GDK_WINDOW_EDGE_NORTH_EAST: - draw_dot = (xi >= yi); - break; - case GDK_WINDOW_EDGE_SOUTH_WEST: - draw_dot = (xi <= yi); - break; - case GDK_WINDOW_EDGE_SOUTH_EAST: - draw_dot = (xi + yi >= threshold); - break; - default: - g_assert_not_reached (); - } - - if (draw_dot) { - cleanice_dot(window, - style->dark_gc[state_type], - style->light_gc[state_type], - x + (xi * 4) + 1, - y + (yi * 4) + 1); - } - } - } - + GtkStateType state_type, GdkRectangle * area, + GtkWidget * widget, const gchar * detail, + GdkWindowEdge edge, gint x, gint y, + gint width, gint height) { + GdkPoint points2[3]; /* light */ + + if (GTK_IS_STATUSBAR (widget)) + gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (widget), FALSE); + return; + + points2[0].x = x + width; points2[0].y = y - 1; + points2[1].x = x + width; points2[1].y = y + height; + points2[2].x = x + (width - height) - 1; points2[2].y = y + height; + + gtk_paint_box(style, window, state_type, GTK_SHADOW_OUT, area, widget, + detail, x + (width - height) - 2, y - 2, + height + 6, height + 6); + gdk_draw_polygon(window, style->dark_gc[state_type], TRUE, points2, 3); } static void draw_layout (GtkStyle * style, GdkWindow * window, - GtkStateType state_type, gboolean use_text, - GdkRectangle * area, GtkWidget * widget, - const gchar * detail, gint x, gint y, - PangoLayout * layout) { + GtkStateType state_type, gboolean use_text, + GdkRectangle * area, GtkWidget * widget, + const gchar * detail, gint x, gint y, + PangoLayout * layout) { if ((widget && widget->parent) && (GTK_IS_RADIO_BUTTON (widget->parent) || GTK_IS_CHECK_BUTTON (widget->parent) || (widget->parent->parent && - (strcmp (g_type_name (GTK_WIDGET_TYPE (widget->parent->parent)), - "EExpander") == 0 || - strcmp (g_type_name (GTK_WIDGET_TYPE (widget->parent->parent)), - "GtkExpander") == 0))) && + (strcmp (g_type_name (GTK_WIDGET_TYPE (widget->parent->parent)), + "EExpander") == 0 || + strcmp (g_type_name (GTK_WIDGET_TYPE (widget->parent->parent)), + "GtkExpander") == 0))) && state_type == GTK_STATE_PRELIGHT) { if (area) { gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area); @@ -1390,14 +1394,14 @@ } } else { parent_class->draw_layout (style, window, state_type, use_text, - area, widget, detail, x, y, layout); + area, widget, detail, x, y, layout); } } static void draw_expander (GtkStyle * style, GdkWindow * window, - GtkStateType state_type, GdkRectangle * area, - GtkWidget * widget, const gchar * detail, - gint x, gint y, GtkExpanderStyle expander_style) { + GtkStateType state_type, GdkRectangle * area, + GtkWidget * widget, const gchar * detail, + gint x, gint y, GtkExpanderStyle expander_style) { gint expander_size; gint line_width; GtkArrowType arrow_type; @@ -1425,15 +1429,15 @@ if (state_type == GTK_STATE_PRELIGHT && !DETAIL ("expander")) { gtk_paint_arrow (style, window, state_type, GTK_SHADOW_NONE, area, - widget, detail, arrow_type, TRUE, - x, y, expander_size, expander_size); + widget, detail, arrow_type, TRUE, + x, y, expander_size, expander_size); gtk_paint_arrow (style, window, GTK_STATE_NORMAL, GTK_SHADOW_NONE, area, - widget, detail, arrow_type, FALSE, - x, y, expander_size, expander_size); + widget, detail, arrow_type, FALSE, + x, y, expander_size, expander_size); } else { gtk_paint_arrow (style, window, state_type, GTK_SHADOW_NONE, area, - widget, detail, arrow_type, TRUE, - x, y, expander_size, expander_size); + widget, detail, arrow_type, TRUE, + x, y, expander_size, expander_size); } } @@ -1445,17 +1449,17 @@ (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) cleanice_style_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ + NULL, /* class_finalize */ + NULL, /* class_data */ sizeof (CleanIceStyle), - 0, /* n_preallocs */ + 0, /* n_preallocs */ (GInstanceInitFunc) cleanice_style_init, }; cleanice_type_style = g_type_module_register_type (module, - GTK_TYPE_STYLE, - "CleanIceStyle", - &object_info, 0); + GTK_TYPE_STYLE, + "CleanIceStyle", + &object_info, 0); } static void cleanice_style_init (CleanIceStyle * style) { @@ -1482,5 +1486,5 @@ style_class->draw_resize_grip = draw_resize_grip; style_class->draw_layout = draw_layout; style_class->draw_expander = draw_expander; -} +}