static void clearlooks_style_draw_arrow (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GtkShadowType shadow, GdkRectangle *area, GtkWidget *widget, const gchar *detail, GtkArrowType arrow_type, gboolean fill, gint x, gint y, gint width, gint height) { ClearlooksColors *colors; WidgetParameters params; ArrowParameters arrow; cairo_t *cr; ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); (void) shadow; (void) detail; (void) fill; cr = ge_gdk_drawable_to_cairo (window, area); colors = &clearlooks_style->colors; CHECK_ARGS SANITIZE_SIZE if (arrow_type == GTK_ARROW_NONE) { cairo_destroy (cr); return; } clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); arrow.type = CL_ARROW_NORMAL; arrow.direction = (ClearlooksDirection)arrow_type; if (ge_is_combo_box (widget, FALSE) && !ge_is_combo_box_entry (widget)) { arrow.type = CL_ARROW_COMBO; } /* I have no idea why, but the arrow of GtkCombo is larger than in other places. * Subtracting 3 seems to fix this. */ if (widget && widget->parent && GE_IS_COMBO (widget->parent->parent)) { if (params.ltr) x += 1; else x += 2; width -= 3; } STYLE_FUNCTION(draw_arrow) (cr, colors, ¶ms, &arrow, x, y, width, height); cairo_destroy (cr); }
gboolean ge_is_combo_box (GtkWidget * widget, gboolean as_list) { gboolean result = FALSE; if ((widget) && (gtk_widget_get_parent (widget))) { if (GE_IS_COMBO_BOX (gtk_widget_get_parent (widget))) { if (as_list) result = (ge_combo_box_is_using_list(gtk_widget_get_parent (widget))); else result = (!ge_combo_box_is_using_list(gtk_widget_get_parent (widget))); } else result = ge_is_combo_box (gtk_widget_get_parent (widget), as_list); } return result; }
static void thinice_style_draw_vline(GtkStyle * style, cairo_t * cr, GtkStateType state_type, GtkWidget * widget, const gchar *detail, gint y1, gint y2, gint x) { ThiniceStyle *thinice_style = THINICE_STYLE (style); CairoColor *dark; CairoColor *light; CHECK_ARGS if (ge_is_combo_box(widget, FALSE) && (!ge_is_combo_box_entry(widget))) return; dark = &thinice_style->color_cube.dark[state_type]; light = &thinice_style->color_cube.light[state_type]; thinice_draw_separator(cr, dark, light, FALSE, x, y1, 2, y2-y1); }
static void thinice_style_draw_box(GtkStyle * style, cairo_t *cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget * widget, const gchar *detail, gint x, gint y, gint width, gint height) { ThiniceStyle *thinice_style = THINICE_STYLE (style); gboolean draw_border = TRUE; /***********************************************/ /* GTK Sanity Checks */ /***********************************************/ CHECK_ARGS /***********************************************/ /* GTK Special Cases - Ignored Widgets */ /***********************************************/ if ((CHECK_DETAIL(detail, "optionmenutab")) || (CHECK_DETAIL (detail, "slider")) || (CHECK_DETAIL (detail, "buttondefault")) || (CHECK_DETAIL (detail, "bar") && ((height < 1) && (width < 1)))) { return; } /***********************************************/ /* GTK Special Cases - adjust Size/Offset */ /***********************************************/ if ((CHECK_DETAIL (detail, "bar"))) { x += 1; y += 1; width -= 2; height -= 2; draw_border=FALSE; } else if (CHECK_DETAIL (detail, "handlebox_bin")) { draw_border=FALSE; } else if (CHECK_DETAIL (detail, "entry-progress")) { draw_border=FALSE; } /***********************************************/ /* Fill Box */ /***********************************************/ gtk_style_apply_default_background(style, cr, gtk_widget_get_window (widget), state_type, x, y, width, height); /***********************************************/ /* Draw Box Border */ /***********************************************/ if (draw_border) { thinice_style_draw_shadow(style, cr, state_type, shadow_type, widget, detail, x, y, width, height); } /***********************************************/ /* Draw Widget Specific Sub-Parts */ /***********************************************/ if (CHECK_DETAIL (detail, "button")) { /* Paint a triangle here instead of in "buttondefault" which is drawn _behind_ the current button */ if (widget && GE_WIDGET_HAS_DEFAULT (widget)) { ge_cairo_set_color(cr, &thinice_style->color_cube.bg[GTK_STATE_SELECTED]); cairo_move_to(cr, x+2.5, y+2.5); cairo_line_to(cr, x+10.5, y+2.5); cairo_line_to(cr, x+2.5, y+10.5); cairo_line_to(cr, x+2.5, y+2.5); cairo_fill(cr); ge_cairo_set_color(cr, &thinice_style->color_cube.dark[state_type]); cairo_move_to(cr, x + 2.5, y + 11); cairo_line_to(cr, x + 2.5, y + 2.5); cairo_line_to(cr, x + 11, y + 2.5); cairo_stroke(cr); cairo_set_line_width (cr, 0.5); ge_cairo_set_color(cr, &thinice_style->color_cube.light[state_type]); cairo_move_to(cr, x+11, y+3); cairo_line_to(cr, x+3, y+11); cairo_stroke(cr); } } /* Draw Option Menus and Combo Box "Tab" The Same Way Here */ if (CHECK_DETAIL(detail, "optionmenu") || (CHECK_DETAIL(detail, "button") && (ge_is_combo_box(widget, FALSE)) && !(ge_is_combo_box_entry(widget)))) { GtkRequisition indicator_size; GtkBorder indicator_spacing; CairoColor *dark; CairoColor *light; gint vline_x; if (state_type != GTK_STATE_INSENSITIVE) state_type = GTK_STATE_NORMAL; ge_option_menu_get_props (widget, &indicator_size, &indicator_spacing); if ((!widget) || (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)) vline_x = x + indicator_size.width + indicator_spacing.left + indicator_spacing.right; else vline_x = x + width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness; dark = &thinice_style->color_cube.dark[state_type]; light = &thinice_style->color_cube.light[state_type]; thinice_draw_separator(cr, dark, light, FALSE, vline_x, y + style->ythickness + 1, style->xthickness, height - 2*style->ythickness - 2); if ((widget) && (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL)) x += indicator_spacing.right + style->xthickness; else x += width - indicator_size.width - indicator_spacing.right - style->xthickness; y += ((height - indicator_size.height) / 2) + 1; width = indicator_size.width; height = indicator_size.height; thinice_style_draw_arrow (style, cr, state_type, shadow_type, NULL, "optionmenu", GTK_ARROW_DOWN, TRUE, x, y, width, height); } }
static void thinice_style_draw_arrow(GtkStyle * style, cairo_t * cr, GtkStateType state_type, GtkShadowType shadow_type, GtkWidget * widget, const gchar *detail, GtkArrowType arrow_type, gint fill, gint x, gint y, gint width, gint height) { ThiniceStyle *thinice_style = THINICE_STYLE (style); CairoColor *color1, *color2, *color3=NULL,*color4=NULL; gint half_width, half_height; CHECK_ARGS if (ge_is_combo_box(widget, FALSE) && (!ge_is_combo_box_entry(widget))) return; half_width = width / 2; half_height = height / 2; switch (shadow_type) { case GTK_SHADOW_IN: color1 = &thinice_style->color_cube.bg[state_type]; color2 = &thinice_style->color_cube.dark[state_type]; color3 = &thinice_style->color_cube.light[state_type]; color4 = &thinice_style->color_cube.black; break; case GTK_SHADOW_OUT: color1 = &thinice_style->color_cube.dark[state_type]; color2 = &thinice_style->color_cube.light[state_type]; color3 = &thinice_style->color_cube.black; color4 = &thinice_style->color_cube.bg[state_type]; break; case GTK_SHADOW_ETCHED_IN: color2 = &thinice_style->color_cube.light[state_type]; color1 = &thinice_style->color_cube.dark[state_type]; break; case GTK_SHADOW_ETCHED_OUT: color1 = &thinice_style->color_cube.dark[state_type]; color2 = &thinice_style->color_cube.light[state_type]; break; case GTK_SHADOW_NONE: color1 = &thinice_style->color_cube.bg[state_type]; color2 = &thinice_style->color_cube.bg[state_type]; break; default: return; } if (CHECK_DETAIL (detail, "vscrollbar") || CHECK_DETAIL (detail, "hscrollbar")) { switch (THINICE_RC_STYLE (style->rc_style)->mark_type2) { case MARKS_NOTHING: break; case MARKS_INVSLASH: thinice_slash_one(cr, color2, color1, x, y, width, height); break; case MARKS_DOT: thinice_dot(cr, color2, color1, x + half_width, y + half_height); break; case MARKS_INVDOT: thinice_dot(cr, color1, color2, x + half_width, y + half_height); break; case MARKS_ARROW: if (state_type == GTK_STATE_INSENSITIVE) thinice_arrow (cr, &thinice_style->color_cube.white, arrow_type, TRUE, x+1, y+1, width, height); thinice_arrow (cr, &thinice_style->color_cube.fg[state_type], arrow_type, TRUE, x, y, width, height); break; case MARKS_SLASH: default: thinice_slash_one(cr, color1, color2, x, y, width - 1, height - 1); break; } } else { if (state_type == GTK_STATE_INSENSITIVE) thinice_arrow (cr, &thinice_style->color_cube.white, arrow_type, TRUE, x+1, y+1, width, height); thinice_arrow (cr, &thinice_style->color_cube.fg[state_type], arrow_type, TRUE, x, y, width, height); } }
gboolean ge_is_in_combo_box (GtkWidget * widget) { return ((ge_is_combo (widget) || ge_is_combo_box (widget, TRUE) || ge_is_combo_box_entry (widget))); }