static void clearlooks_set_widget_parameters (GtkWidget *widget, const GtkStyle *style, GtkStateType state_type, WidgetParameters *params) { params->style_functions = &(clearlooks_style_class->style_functions[CLEARLOOKS_STYLE (style)->style]); params->active = (state_type == GTK_STATE_ACTIVE); params->prelight = (state_type == GTK_STATE_PRELIGHT); params->disabled = (state_type == GTK_STATE_INSENSITIVE); params->state_type = (ClearlooksStateType)state_type; params->corners = CR_CORNER_ALL; params->ltr = ge_widget_is_ltr ((GtkWidget*)widget); params->focus = widget && GTK_WIDGET_HAS_FOCUS (widget); params->is_default = widget && GE_WIDGET_HAS_DEFAULT (widget); params->enable_glow = FALSE; params->radius = CLEARLOOKS_STYLE (style)->radius; if (!params->active && widget && GE_IS_TOGGLE_BUTTON (widget)) params->active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); params->xthickness = style->xthickness; params->ythickness = style->ythickness; /* This is used in GtkEntry to fake transparency. The reason to do this * is that the entry has it's entire background filled with base[STATE]. * This is not a very good solution as it will eg. fail if one changes * the background color of a notebook. */ params->parentbg = CLEARLOOKS_STYLE (style)->colors.bg[state_type]; clearlooks_get_parent_bg (widget, ¶ms->parentbg); }
static void clearlooks_style_draw_flat_box (DRAW_ARGS) { if (detail && state_type == GTK_STATE_SELECTED && ( !strncmp ("cell_even", detail, 9) || !strncmp ("cell_odd", detail, 8))) { WidgetParameters params; ClearlooksStyle *clearlooks_style; ClearlooksColors *colors; cairo_t *cr; CHECK_ARGS SANITIZE_SIZE clearlooks_style = CLEARLOOKS_STYLE (style); clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); colors = &clearlooks_style->colors; cr = ge_gdk_drawable_to_cairo (window, area); /* XXX: We could expose the side details by setting params->corners accordingly * or adding another option. */ STYLE_FUNCTION (draw_selected_cell) (cr, colors, ¶ms, x, y, width, height); cairo_destroy (cr); } else if (DETAIL ("tooltip")) { WidgetParameters params; ClearlooksStyle *clearlooks_style; ClearlooksColors *colors; cairo_t *cr; CHECK_ARGS SANITIZE_SIZE clearlooks_style = CLEARLOOKS_STYLE (style); clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); colors = &clearlooks_style->colors; cr = ge_gdk_drawable_to_cairo (window, area); STYLE_FUNCTION (draw_tooltip) (cr, colors, ¶ms, x, y, width, height); cairo_destroy (cr); } else if ((CLEARLOOKS_STYLE (style)->style == CL_STYLE_GLOSSY || CLEARLOOKS_STYLE (style)->style == CL_STYLE_GUMMY) && ((DETAIL("checkbutton") || DETAIL("radiobutton")) && state_type == GTK_STATE_PRELIGHT)) { /* XXX: Don't draw any check/radiobutton bg in GLOSSY or GUMMY mode. */ } else { clearlooks_parent_class->draw_flat_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } }
void cl_draw_inset (GtkStyle *style, GdkWindow *window, GtkWidget *widget, GdkRectangle *area, gint x, gint y, gint width, gint height, int tl, int tr, int bl, int br ) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE(style); ClearlooksStyle *clwindowstyle; /* style of the window this widget is on */ GtkStateType windowstate; CLRectangle r; cl_rectangle_init (&r, NULL, style->black_gc, tl, tr, bl, br); r.gradient_type = CL_GRADIENT_VERTICAL; cl_get_window_style_state(widget, (GtkStyle**)&clwindowstyle, &windowstate); g_assert (clwindowstyle != NULL); if (GTK_WIDGET_HAS_DEFAULT (widget)) { r.bordergc = style->mid_gc[GTK_STATE_NORMAL]; } else { cl_rectangle_set_gradient (&r.border_gradient, &clwindowstyle->inset_dark[windowstate], &clwindowstyle->inset_light[windowstate]); } cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x, y, width, height, &r); cl_rectangle_reset_clip_rectangle (&r); }
static void clearlooks_style_draw_vline (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint y1, gint y2, gint x) { (void) state_type; (void) widget; (void) detail; ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); const ClearlooksColors *colors; SeparatorParameters separator = { FALSE }; cairo_t *cr; CHECK_ARGS colors = &clearlooks_style->colors; cr = ge_gdk_drawable_to_cairo (window, area); /* There is no such thing as a vertical menu separator * (and even if, a normal one should be better on menu bars) */ STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator, x, y1, 2, y2-y1+1); cairo_destroy (cr); }
static void clearlooks_style_draw_option (DRAW_ARGS) { const ClearlooksColors *colors; WidgetParameters params; CheckboxParameters checkbox; cairo_t *cr; ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); (void) detail; CHECK_ARGS SANITIZE_SIZE cr = ge_gdk_drawable_to_cairo (window, area); colors = &clearlooks_style->colors; checkbox.shadow_type = shadow_type; checkbox.in_menu = (widget && GTK_IS_MENU(widget->parent)); clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); STYLE_FUNCTION(draw_radiobutton) (cr, colors, ¶ms, &checkbox, x, y, width, height); cairo_destroy (cr); }
static void clearlooks_style_draw_check (DRAW_ARGS) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); WidgetParameters params; CheckboxParameters checkbox; cairo_t *cr; CHECK_ARGS SANITIZE_SIZE cr = ge_gdk_drawable_to_cairo (window, area); clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_ALL; checkbox.shadow_type = shadow_type; checkbox.in_cell = DETAIL("cellcheck"); checkbox.in_menu = (widget && widget->parent && GTK_IS_MENU(widget->parent)); STYLE_FUNCTION(draw_checkbox) (cr, &clearlooks_style->colors, ¶ms, &checkbox, x, y, width, height); cairo_destroy (cr); }
void cl_rectangle_set_entry (CLRectangle *r, GtkStyle *style, GtkStateType state_type, CLBorderType tl, CLBorderType tr, CLBorderType bl, CLBorderType br, gboolean has_focus) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); GdkGC *bordergc; if (has_focus) bordergc = clearlooks_style->spot3_gc; else if (state_type != GTK_STATE_INSENSITIVE) bordergc = clearlooks_style->border_gc[CL_BORDER_LOWER]; else bordergc = clearlooks_style->shade_gc[3]; cl_rectangle_init (r, style->base_gc[state_type], bordergc, tl, tr, bl, br); if (state_type != GTK_STATE_INSENSITIVE ) r->topleft = (has_focus) ? clearlooks_style->spot1_gc : style->bg_gc[GTK_STATE_NORMAL]; if (has_focus) r->bottomright = clearlooks_style->spot1_gc; else if (state_type == GTK_STATE_INSENSITIVE) r->bottomright = style->base_gc[state_type]; }
void cl_draw_optionmenu(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) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE(style); GtkRequisition indicator_size; GtkBorder indicator_spacing; int line_pos; option_menu_get_props (widget, &indicator_size, &indicator_spacing); if (get_direction (widget) == GTK_TEXT_DIR_RTL) line_pos = x + (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + style->xthickness; else line_pos = x + width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - style->xthickness; cl_draw_button (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); gdk_draw_line (window, clearlooks_style->shade_gc[3], line_pos, y + style->ythickness - 1, line_pos, y + height - style->ythickness); gdk_draw_line (window, style->light_gc[state_type], line_pos+1, y + style->ythickness - 1, line_pos+1, y + height - style->ythickness); }
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); }
static void clearlooks_style_draw_tab (DRAW_ARGS) { ClearlooksColors *colors; WidgetParameters params; ArrowParameters arrow; cairo_t *cr; ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); (void) shadow_type; (void) detail; colors = &clearlooks_style->colors; CHECK_ARGS SANITIZE_SIZE cr = ge_gdk_drawable_to_cairo (window, area); clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); arrow.type = CL_ARROW_COMBO; arrow.direction = CL_DIRECTION_DOWN; STYLE_FUNCTION(draw_arrow) (cr, colors, ¶ms, &arrow, x, y, width, height); cairo_destroy (cr); }
static void clearlooks_style_copy (GtkStyle * style, GtkStyle * src) { ClearlooksStyle * cl_style = CLEARLOOKS_STYLE (style); ClearlooksStyle * cl_src = CLEARLOOKS_STYLE (src); cl_style->colors = cl_src->colors; cl_style->menubarstyle = cl_src->menubarstyle; cl_style->toolbarstyle = cl_src->toolbarstyle; cl_style->scrollbar_color = cl_src->scrollbar_color; cl_style->has_scrollbar_color = cl_src->has_scrollbar_color; cl_style->colorize_scrollbar = cl_src->colorize_scrollbar; cl_style->animation = cl_src->animation; cl_style->radius = cl_src->radius; cl_style->style = cl_src->style; clearlooks_parent_class->copy (style, src); }
static void clearlooks_style_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) { (void) detail; GdkGC *gc; g_return_if_fail (GTK_IS_STYLE (style)); g_return_if_fail (window != NULL); gc = use_text ? style->text_gc[state_type] : style->fg_gc[state_type]; if (area) gdk_gc_set_clip_rectangle (gc, area); if (state_type == GTK_STATE_INSENSITIVE) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); ClearlooksColors *colors = &clearlooks_style->colors; WidgetParameters params; GdkColor etched; CairoColor temp; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); if (GTK_WIDGET_NO_WINDOW (widget)) ge_shade_color (¶ms.parentbg, 1.2, &temp); else ge_shade_color (&colors->bg[widget->state], 1.2, &temp); etched.red = (int) (temp.r * 65535); etched.green = (int) (temp.g * 65535); etched.blue = (int) (temp.b * 65535); gdk_draw_layout_with_colors (window, gc, x + 1, y + 1, layout, &etched, NULL); gdk_draw_layout (window, gc, x, y, layout); } else gdk_draw_layout (window, gc, x, y, layout); if (area) gdk_gc_set_clip_rectangle (gc, NULL); }
static void clearlooks_style_draw_extension (DRAW_ARGS, GtkPositionType gap_side) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); ClearlooksColors *colors = &clearlooks_style->colors; cairo_t *cr; CHECK_ARGS SANITIZE_SIZE cr = ge_gdk_drawable_to_cairo (window, area); if (DETAIL ("tab")) { WidgetParameters params; TabParameters tab; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); tab.gap_side = (ClearlooksGapSide)gap_side; switch (gap_side) { case CL_GAP_BOTTOM: params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT; break; case CL_GAP_TOP: params.corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT; break; case CL_GAP_RIGHT: params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT; break; case CL_GAP_LEFT: params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT; } STYLE_FUNCTION(draw_tab) (cr, colors, ¶ms, &tab, x, y, width, height); } else { clearlooks_parent_class->draw_extension (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side); } cairo_destroy (cr); }
static void clearlooks_style_draw_shadow_gap (DRAW_ARGS, GtkPositionType gap_side, gint gap_x, gint gap_width) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); const ClearlooksColors *colors; cairo_t *cr; CHECK_ARGS SANITIZE_SIZE cr = ge_gdk_drawable_to_cairo (window, area); colors = &clearlooks_style->colors; if (DETAIL ("frame")) { WidgetParameters params; FrameParameters frame; frame.shadow = shadow_type; frame.gap_side = gap_side; frame.gap_x = gap_x; frame.gap_width = gap_width; frame.border = &colors->shade[5]; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_ALL; STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame, x, y, width, height); } else { clearlooks_parent_class->draw_shadow_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); } cairo_destroy (cr); }
static void clearlooks_style_init_from_rc (GtkStyle * style, GtkRcStyle * rc_style) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); clearlooks_parent_class->init_from_rc (style, rc_style); g_assert ((CLEARLOOKS_RC_STYLE (rc_style)->style < CL_NUM_STYLES)); clearlooks_style->style = CLEARLOOKS_RC_STYLE (rc_style)->style; clearlooks_style->menubarstyle = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle; clearlooks_style->toolbarstyle = CLEARLOOKS_RC_STYLE (rc_style)->toolbarstyle; clearlooks_style->has_scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_SCROLLBAR_COLOR; clearlooks_style->colorize_scrollbar = CLEARLOOKS_RC_STYLE (rc_style)->colorize_scrollbar; clearlooks_style->animation = CLEARLOOKS_RC_STYLE (rc_style)->animation; clearlooks_style->radius = CLAMP (CLEARLOOKS_RC_STYLE (rc_style)->radius, 0.0, 10.0); if (clearlooks_style->has_scrollbar_color) clearlooks_style->scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->scrollbar_color; }
static void clearlooks_style_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) { ClearlooksColors *colors; cairo_t *cr; WidgetParameters params; ResizeGripParameters grip; ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); (void) detail; colors = &clearlooks_style->colors; CHECK_ARGS SANITIZE_SIZE grip.edge = (ClearlooksWindowEdge)edge; g_return_if_fail (window != NULL); cr = ge_gdk_drawable_to_cairo (window, area); clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); STYLE_FUNCTION(draw_resize_grip) (cr, colors, ¶ms, &grip, x, y, width, height); cairo_destroy (cr); }
void cl_rectangle_set_button(CLRectangle *r, GtkStyle *style, GtkStateType state_type, gboolean has_default, gboolean has_focus, CLBorderType tl, CLBorderType tr, CLBorderType bl, CLBorderType br) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); int my_state_type = (state_type == GTK_STATE_ACTIVE) ? 2 : 0; GdkGC *border_gc = clearlooks_style->border_gc[CL_BORDER_UPPER+my_state_type]; cl_rectangle_init (r, style->bg_gc[state_type], clearlooks_style->border_gc[CL_BORDER_UPPER+my_state_type], tl, tr, bl, br); if (state_type != GTK_STATE_INSENSITIVE && !has_default) { cl_rectangle_set_gradient (&r->border_gradient, &clearlooks_style->border[CL_BORDER_UPPER+my_state_type], &clearlooks_style->border[CL_BORDER_LOWER+my_state_type]); } else if (has_default) r->bordergc = style->black_gc; else r->bordergc = clearlooks_style->shade_gc[4]; r->gradient_type = CL_GRADIENT_VERTICAL; r->topleft = (state_type != GTK_STATE_ACTIVE) ? style->light_gc[state_type] : clearlooks_style->shade_gc[4]; r->bottomright = (state_type != GTK_STATE_ACTIVE) ? clearlooks_style->shade_gc[1] : NULL; shade (&style->bg[state_type], &r->tmp_color, 0.93); cl_rectangle_set_gradient (&r->fill_gradient, &style->bg[state_type], &r->tmp_color); }
void cl_draw_shadow(GdkWindow *window, GtkWidget *widget, GtkStyle *style, int x, int y, int width, int height, CLRectangle *r) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); int x1, y1, x2, y2; if (r->bottomright != NULL) { x1 = x+1+(r->corners[CL_CORNER_BOTTOMLEFT]/2); y1 = y2 = y+height-2; x2 = x+width - 1 - (1+r->corners[CL_CORNER_BOTTOMRIGHT]/2); gdk_draw_line (window, r->bottomright, x1, y1, x2, y2); x1 = x2 = x+width-2; y1 = y+1+(r->corners[CL_CORNER_TOPRIGHT]/2); y2 = y+height - 1 - (1+r->corners[CL_CORNER_BOTTOMRIGHT]/2); gdk_draw_line (window, r->bottomright, x1, y1, x2, y2); } if (r->topleft != NULL) { x1 = x+1+(r->corners[CL_CORNER_TOPLEFT]/2); y1 = y2 = y+1; x2 = x+width-1-(1+r->corners[CL_CORNER_TOPRIGHT]/2); gdk_draw_line (window, r->topleft, x1, y1, x2, y2); x1 = x2 = x+1; y1 = y+1+(r->corners[CL_CORNER_TOPLEFT]/2); y2 = y+height-1-(1+r->corners[CL_CORNER_BOTTOMLEFT]/2); gdk_draw_line (window, r->topleft, x1, y1, x2, y2); } }
static void clearlooks_style_realize (GtkStyle * style) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); double shades[] = {1.15, 0.95, 0.896, 0.82, 0.7, 0.665, 0.475, 0.45, 0.4}; CairoColor spot_color; CairoColor bg_normal; double contrast; int i; clearlooks_parent_class->realize (style); contrast = CLEARLOOKS_RC_STYLE (style->rc_style)->contrast; /* Lighter to darker */ ge_gdk_color_to_cairo (&style->bg[GTK_STATE_NORMAL], &bg_normal); for (i = 0; i < 9; i++) { ge_shade_color(&bg_normal, (shades[i]-0.7) * contrast + 0.7, &clearlooks_style->colors.shade[i]); } ge_gdk_color_to_cairo (&style->bg[GTK_STATE_SELECTED], &spot_color); ge_shade_color(&spot_color, 1.42, &clearlooks_style->colors.spot[0]); ge_shade_color(&spot_color, 1.05, &clearlooks_style->colors.spot[1]); ge_shade_color(&spot_color, 0.65, &clearlooks_style->colors.spot[2]); for (i=0; i<5; i++) { ge_gdk_color_to_cairo (&style->fg[i], &clearlooks_style->colors.fg[i]); ge_gdk_color_to_cairo (&style->bg[i], &clearlooks_style->colors.bg[i]); ge_gdk_color_to_cairo (&style->base[i], &clearlooks_style->colors.base[i]); ge_gdk_color_to_cairo (&style->text[i], &clearlooks_style->colors.text[i]); } }
static void clearlooks_style_draw_hline (GtkStyle *style, GdkWindow *window, GtkStateType state_type, GdkRectangle *area, GtkWidget *widget, const gchar *detail, gint x1, gint x2, gint y) { const ClearlooksColors *colors; cairo_t *cr; SeparatorParameters separator; ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); (void) state_type; (void) widget; CHECK_ARGS colors = &clearlooks_style->colors; cr = ge_gdk_drawable_to_cairo (window, area); separator.horizontal = TRUE; if (!DETAIL ("menuitem")) STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator, x1, y, x2-x1+1, 2); else STYLE_FUNCTION(draw_menu_item_separator) (cr, colors, NULL, &separator, x1, y, x2-x1+1, 2); cairo_destroy (cr); }
static void clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); ClearlooksColors *colors = &clearlooks_style->colors; cairo_t *cr; gboolean is_horizontal; CHECK_ARGS SANITIZE_SIZE cr = ge_gdk_drawable_to_cairo (window, area); /* Evil hack to work around broken orientation for toolbars */ is_horizontal = (width > height); if (DETAIL ("handlebox")) { WidgetParameters params; HandleParameters handle; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); handle.type = CL_HANDLE_TOOLBAR; handle.horizontal = is_horizontal; /* Is this ever true? -Daniel */ if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE) { ToolbarParameters toolbar; clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y); toolbar.style = clearlooks_style->toolbarstyle; cairo_save (cr); STYLE_FUNCTION(draw_toolbar) (cr, colors, ¶ms, &toolbar, x, y, width, height); cairo_restore (cr); } STYLE_FUNCTION(draw_handle) (cr, colors, ¶ms, &handle, x, y, width, height); } else if (DETAIL ("paned")) { WidgetParameters params; HandleParameters handle; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); handle.type = CL_HANDLE_SPLITTER; handle.horizontal = orientation == GTK_ORIENTATION_HORIZONTAL; STYLE_FUNCTION(draw_handle) (cr, colors, ¶ms, &handle, x, y, width, height); } else { WidgetParameters params; HandleParameters handle; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); handle.type = CL_HANDLE_TOOLBAR; handle.horizontal = is_horizontal; /* Is this ever true? -Daniel */ if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE) { ToolbarParameters toolbar; clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y); toolbar.style = clearlooks_style->toolbarstyle; cairo_save (cr); STYLE_FUNCTION(draw_toolbar) (cr, colors, ¶ms, &toolbar, x, y, width, height); cairo_restore (cr); } STYLE_FUNCTION(draw_handle) (cr, colors, ¶ms, &handle, x, y, width, height); } cairo_destroy (cr); }
GdkPixmap* cl_progressbar_tile_new (GdkDrawable *drawable, GtkWidget *widget, GtkStyle *style, gint height, gint offset) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); int width = height; int line = 0; int center = width/2; int xdir = 1; int trans; int stripe_width = height/2; int topright = height + stripe_width; int topright_div_2 = topright/2; double shift; GdkPoint points[4]; GtkProgressBarOrientation orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget)); gboolean is_horizontal = (orientation == GTK_PROGRESS_LEFT_TO_RIGHT || orientation == GTK_PROGRESS_RIGHT_TO_LEFT) ? 1 : 0; GdkPixmap *tmp = gdk_pixmap_new (widget->window, width, height, -1); GdkColor tmp_color; shade (&clearlooks_style->spot2, &tmp_color, 0.90); if (is_horizontal) draw_hgradient (tmp, style->black_gc, style, 0, 0, width, height, &clearlooks_style->spot2, &tmp_color ); else draw_vgradient (tmp, style->black_gc, style, 0, 0, width, height, &tmp_color, &clearlooks_style->spot2); /* TODO: swap for RTL */ if (orientation == GTK_PROGRESS_RIGHT_TO_LEFT || orientation == GTK_PROGRESS_BOTTOM_TO_TOP) { offset = -offset; xdir = -1; } if (get_direction (widget) == GTK_TEXT_DIR_RTL) offset = -offset; if (is_horizontal) { points[0] = (GdkPoint){xdir*(topright - stripe_width - topright_div_2), 0}; /* topleft */ points[1] = (GdkPoint){xdir*(topright - topright_div_2), 0}; /* topright */ points[2] = (GdkPoint){xdir*(stripe_width - topright_div_2), height}; /* bottomright */ points[3] = (GdkPoint){xdir*(-topright_div_2), height}; /* bottomleft */ } else { points[0] = (GdkPoint){height, xdir*(topright - stripe_width - topright_div_2)}; /* topleft */ points[1] = (GdkPoint){height, xdir*(topright - topright_div_2)}; /* topright */ points[2] = (GdkPoint){0, xdir*(stripe_width - topright_div_2)}; /* bottomright */ points[3] = (GdkPoint){0, xdir*(-topright_div_2)}; /* bottomleft */ } shift = (stripe_width*2)/(double)10; cl_progressbar_points_transform (points, 4, (offset*shift), is_horizontal); trans = (width/2)-1-(stripe_width*2); cl_progressbar_points_transform (points, 4, trans, is_horizontal); gdk_draw_polygon (tmp, clearlooks_style->spot2_gc, TRUE, points, 4); cl_progressbar_points_transform (points, 4, -trans, is_horizontal); trans = width/2-1; cl_progressbar_points_transform (points, 4, trans, is_horizontal); gdk_draw_polygon (tmp, clearlooks_style->spot2_gc, TRUE, points, 4); cl_progressbar_points_transform (points, 4, -trans, is_horizontal); trans = (width/2)-1+(stripe_width*2); cl_progressbar_points_transform (points, 4, trans, is_horizontal); gdk_draw_polygon (tmp, clearlooks_style->spot2_gc, TRUE, points, 4); return tmp; }
void cl_draw_treeview_header (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) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); gint columns = 0, column_index = -1, fill_width = width; gboolean is_etree = strcmp("ETree", G_OBJECT_TYPE_NAME(widget->parent)) == 0; gboolean resizable = TRUE; GdkGC *bottom = clearlooks_style->shade_gc[5]; if ( width < 2 || height < 2 ) return; if (GTK_IS_TREE_VIEW (widget->parent)) { gtk_treeview_get_header_index (GTK_TREE_VIEW(widget->parent), widget, &column_index, &columns, &resizable); } else if (GTK_IS_CLIST (widget->parent)) { gtk_clist_get_header_index (GTK_CLIST(widget->parent), widget, &column_index, &columns); } if (area) { gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[0], area); gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[4], area); gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area); gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[5], area); } if (state_type != GTK_STATE_NORMAL) fill_width-=2; gdk_draw_rectangle (window, style->bg_gc[state_type], TRUE, x, y, fill_width, height-(height/3)+1); draw_hgradient (window, style->bg_gc[state_type], style, x, 1+y+height-(height/3), fill_width, height/3, &style->bg[state_type], &clearlooks_style->inset_dark[state_type]); if (resizable || (column_index != columns-1)) { gdk_draw_line (window, clearlooks_style->shade_gc[4], x+width-2, y+4, x+width-2, y+height-5); gdk_draw_line (window, clearlooks_style->shade_gc[0], x+width-1, y+4, x+width-1, y+height-5); } /* left light line */ if (column_index == 0) gdk_draw_line (window, clearlooks_style->shade_gc[0], x, y+1, x, y+height-2); /* top light line */ gdk_draw_line (window, clearlooks_style->shade_gc[0], x, y, x+width-1, y); /* bottom dark line */ if (state_type == GTK_STATE_INSENSITIVE) bottom = clearlooks_style->shade_gc[3]; gdk_draw_line (window, bottom, x, y+height-1, x+width-1, y+height-1); if (area) { gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[0], NULL); gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[4], NULL); gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL); gdk_gc_set_clip_rectangle (clearlooks_style->shade_gc[5], NULL); } }
static void clearlooks_style_draw_shadow (DRAW_ARGS) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); ClearlooksColors *colors = &clearlooks_style->colors; cairo_t *cr = ge_gdk_drawable_to_cairo (window, area); CHECK_ARGS SANITIZE_SIZE if ((DETAIL ("entry") && !(widget && widget->parent && GE_IS_TREE_VIEW (widget->parent))) || (DETAIL ("frame") && ge_is_in_combo_box (widget))) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); /* Override the entries state type, because we are too lame to handle this via * the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */ if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget)) params.state_type = GTK_WIDGET_STATE (widget); if (widget && (ge_is_in_combo_box (widget) || GE_IS_SPIN_BUTTON (widget))) { width += style->xthickness; if (!params.ltr) x -= style->xthickness; if (params.ltr) params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT; else params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT; } STYLE_FUNCTION (draw_entry) (cr, &clearlooks_style->colors, ¶ms, x, y, width, height); } else if (DETAIL ("frame") && widget && GE_IS_STATUSBAR (widget->parent)) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); gtk_style_apply_default_background (style, window, TRUE, state_type, area, x, y, width, height); STYLE_FUNCTION (draw_statusbar) (cr, colors, ¶ms, x, y, width, height); } else if (DETAIL ("frame")) { WidgetParameters params; FrameParameters frame; frame.shadow = shadow_type; frame.gap_x = -1; /* No gap will be drawn */ frame.border = &colors->shade[4]; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_NONE; if (widget && !g_str_equal ("XfcePanelWindow", gtk_widget_get_name (gtk_widget_get_toplevel (widget)))) STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame, x, y, width, height); } else if (DETAIL ("scrolled_window") || DETAIL ("viewport") || detail == NULL) { CairoColor *border = (CairoColor*)&colors->shade[5]; cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1); ge_cairo_set_color (cr, border); cairo_set_line_width (cr, 1); cairo_stroke (cr); } else { WidgetParameters params; FrameParameters frame; frame.shadow = shadow_type; frame.gap_x = -1; frame.border = &colors->shade[5]; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_ALL; STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame, x, y, width, height); } cairo_destroy (cr); }
static void clearlooks_style_draw_box_gap (DRAW_ARGS, GtkPositionType gap_side, gint gap_x, gint gap_width) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); ClearlooksColors *colors = &clearlooks_style->colors; cairo_t *cr; CHECK_ARGS SANITIZE_SIZE cr = ge_gdk_drawable_to_cairo (window, area); if (DETAIL ("notebook")) { WidgetParameters params; FrameParameters frame; gboolean start, end; frame.shadow = shadow_type; frame.gap_side = gap_side; frame.gap_x = gap_x; frame.gap_width = gap_width; frame.border = &colors->shade[5]; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); clearlooks_get_notebook_tab_position (widget, &start, &end); params.corners = CR_CORNER_ALL; switch (gap_side) { case GTK_POS_LEFT: if (start) params.corners ^= CR_CORNER_TOPLEFT; if (end) params.corners ^= CR_CORNER_BOTTOMLEFT; break; case GTK_POS_RIGHT: if (start) params.corners ^= CR_CORNER_TOPRIGHT; if (end) params.corners ^= CR_CORNER_BOTTOMRIGHT; break; case GTK_POS_TOP: if (ge_widget_is_ltr (widget)) { if (start) params.corners ^= CR_CORNER_TOPLEFT; if (end) params.corners ^= CR_CORNER_TOPRIGHT; } else { if (start) params.corners ^= CR_CORNER_TOPRIGHT; if (end) params.corners ^= CR_CORNER_TOPLEFT; } break; case GTK_POS_BOTTOM: if (ge_widget_is_ltr (widget)) { if (start) params.corners ^= CR_CORNER_BOTTOMLEFT; if (end) params.corners ^= CR_CORNER_BOTTOMRIGHT; } else { if (start) params.corners ^= CR_CORNER_BOTTOMRIGHT; if (end) params.corners ^= CR_CORNER_BOTTOMLEFT; } break; } /* Fill the background with bg[NORMAL] */ ge_cairo_rounded_rectangle (cr, x, y, width, height, params.radius, params.corners); ge_cairo_set_color (cr, &colors->bg[GTK_STATE_NORMAL]); cairo_fill (cr); STYLE_FUNCTION(draw_frame) (cr, colors, ¶ms, &frame, x, y, width, height); } else { clearlooks_parent_class->draw_box_gap (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, gap_side, gap_x, gap_width); } cairo_destroy (cr); }
/* Draw a normal (toggle)button. Not spinbuttons.*/ void cl_draw_button(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) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE(style); int my_state_type = (state_type == GTK_STATE_ACTIVE) ? 2 : 0; GdkGC *bg_gc = NULL; gboolean is_active = FALSE; CLRectangle r; /* Get the background color of the window we're on */ bg_gc = cl_get_window_bg_gc(widget); cl_rectangle_set_button (&r, style, state_type, GTK_WIDGET_HAS_DEFAULT (widget), GTK_WIDGET_HAS_FOCUS (widget), CL_CORNER_ROUND, CL_CORNER_ROUND, CL_CORNER_ROUND, CL_CORNER_ROUND); if (state_type == GTK_STATE_ACTIVE) is_active = TRUE; if (GTK_IS_TOGGLE_BUTTON(widget) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget)) && state_type == GTK_STATE_PRELIGHT) { cl_rectangle_set_gradient (&r.fill_gradient, &clearlooks_style->shade[1], &clearlooks_style->shade[1]); r.topleft = clearlooks_style->shade_gc[3]; r.bottomright = clearlooks_style->shade_gc[1]; is_active = TRUE; } if (!is_active) r.fillgc = NULL; if (!GTK_IS_NOTEBOOK (widget->parent)) { gdk_draw_rectangle (window, bg_gc, FALSE, x, y, width-1, height-1); /* Draw "sunken" look when border thickness is more than 2 pixels. */ if (style->xthickness > 2 && style->ythickness > 2) cl_draw_inset (style, window, widget, area, x, y, width, height, CL_CORNER_ROUND, CL_CORNER_ROUND, CL_CORNER_ROUND, CL_CORNER_ROUND); } /* Draw "sunken" look when border thickness is more than 2 pixels.*/ if (style->xthickness > 2 && style->ythickness > 2) { x++; y++; height-=2; width-=2; } /* Don't draw the normal gradient for normal buttons. */ cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x, y, width, height, &r); if (!is_active) { int tmp_height = (float)height*0.25; gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area); draw_hgradient (window, style->bg_gc[state_type], style, x+2,y+2,width-4,tmp_height, &clearlooks_style->button_g1[state_type], &clearlooks_style->button_g2[state_type]); draw_hgradient (window, style->bg_gc[state_type], style, x+2, y+2+tmp_height, width-4, height-3-tmp_height*2, &clearlooks_style->button_g2[state_type], &clearlooks_style->button_g3[state_type]); draw_hgradient (window, style->bg_gc[state_type], style, x+2,y+height-tmp_height-1,width-4,tmp_height, &clearlooks_style->button_g3[state_type], &clearlooks_style->button_g4[state_type]); gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL); } cl_draw_shadow (window, widget, style, x, y, width, height, &r); cl_rectangle_reset_clip_rectangle (&r); }
static void clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); const ClearlooksColors *colors; cairo_t *cr; cr = ge_gdk_drawable_to_cairo (window, area); colors = &clearlooks_style->colors; CHECK_ARGS SANITIZE_SIZE if (DETAIL ("hscale") || DETAIL ("vscale")) { WidgetParameters params; SliderParameters slider; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); slider.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL); slider.lower = FALSE; slider.fill_level = FALSE; if (clearlooks_style->style == CL_STYLE_GLOSSY) /* XXX! */ params.corners = CR_CORNER_ALL; STYLE_FUNCTION(draw_slider_button) (cr, &clearlooks_style->colors, ¶ms, &slider, x, y, width, height); } else if (DETAIL ("slider")) { WidgetParameters params; ScrollBarParameters scrollbar; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_NONE; scrollbar.has_color = FALSE; scrollbar.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL); scrollbar.junction = clearlooks_scrollbar_get_junction (widget); if (clearlooks_style->colorize_scrollbar) { scrollbar.color = colors->spot[1]; scrollbar.has_color = TRUE; } /* Set scrollbar color */ if (clearlooks_style->has_scrollbar_color) { ge_gdk_color_to_cairo (&clearlooks_style->scrollbar_color, &scrollbar.color); scrollbar.has_color = TRUE; } if ((clearlooks_style->style == CL_STYLE_GLOSSY || clearlooks_style->style == CL_STYLE_GUMMY) && !scrollbar.has_color) scrollbar.color = colors->bg[0]; STYLE_FUNCTION(draw_scrollbar_slider) (cr, colors, ¶ms, &scrollbar, x, y, width, height); } else { clearlooks_parent_class->draw_slider (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height, orientation); } cairo_destroy (cr); }
void cl_draw_combobox_button (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) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE(style); gboolean is_active = FALSE; gboolean draw_inset = FALSE; CLRectangle r; cl_rectangle_set_button (&r, style, state_type, GTK_WIDGET_HAS_DEFAULT (widget), GTK_WIDGET_HAS_FOCUS (widget), CL_CORNER_NONE, CL_CORNER_ROUND, CL_CORNER_NONE, CL_CORNER_ROUND); if (state_type == GTK_STATE_ACTIVE) is_active = TRUE; else r.fillgc = NULL; /* Seriously, why can't non-gtk-apps at least try to be decent citizens? Take this fscking OpenOffice.org 1.9 for example. The morons responsible for this utter piece of crap give the clip size wrong values! :'( */ if (area) { area->x = x; area->y = y; area->width = width; area->height = height; } x--; width++; /* Draw "sunken" look when border thickness is more than 2 pixels. */ if (GTK_IS_COMBO(widget->parent)) draw_inset = (widget->parent->style->xthickness > 2 && widget->parent->style->ythickness > 2); else draw_inset = (style->xthickness > 2 && style->ythickness > 2); if (draw_inset) { cl_draw_inset (style, window, widget, area, x, y, width, height, CL_CORNER_NONE, CL_CORNER_ROUND, CL_CORNER_NONE, CL_CORNER_ROUND); x++; y++; height-=2; width-=2; } else { x++; width--; } if (area) cl_rectangle_set_clip_rectangle (&r, area); cl_draw_rectangle (window, widget, style, x, y, width, height, &r); if (!is_active) { int tmp_height = (float)height*0.25; gdk_gc_set_clip_rectangle (style->bg_gc[state_type], area); draw_hgradient (window, style->bg_gc[state_type], style, x+2,y+2,width-4,tmp_height, &clearlooks_style->button_g1[state_type], &clearlooks_style->button_g2[state_type]); draw_hgradient (window, style->bg_gc[state_type], style, x+2, y+2+tmp_height, width-4, height-3-tmp_height*2, &clearlooks_style->button_g2[state_type], &clearlooks_style->button_g3[state_type]); draw_hgradient (window, style->bg_gc[state_type], style, x+2,y+height-tmp_height-1,width-4,tmp_height, &clearlooks_style->button_g3[state_type], &clearlooks_style->button_g4[state_type]); gdk_gc_set_clip_rectangle (style->bg_gc[state_type], NULL); } cl_draw_shadow (window, widget, style, x, y, width, height, &r); if (area) cl_rectangle_reset_clip_rectangle (&r); }
static void clearlooks_style_draw_box (DRAW_ARGS) { ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style); const ClearlooksColors *colors; cairo_t *cr; cr = ge_gdk_drawable_to_cairo (window, area); colors = &clearlooks_style->colors; CHECK_ARGS SANITIZE_SIZE if (DETAIL ("menubar") && !ge_is_panel_widget_item(widget)) { WidgetParameters params; MenuBarParameters menubar; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); menubar.style = clearlooks_style->menubarstyle; STYLE_FUNCTION(draw_menubar) (cr, colors, ¶ms, &menubar, x, y, width, height); } else if (DETAIL ("button") && widget && widget->parent && (GE_IS_TREE_VIEW(widget->parent) || GE_IS_CLIST (widget->parent) || ge_object_is_a (G_OBJECT(widget->parent), "ETree"))) /* ECanvas inside ETree */ { WidgetParameters params; ListViewHeaderParameters header; gint columns, column_index; gboolean resizable = TRUE; /* XXX: This makes unknown treeview header CL_ORDER_MIDDLE, in need for something nicer */ columns = 3; column_index = 1; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_NONE; if (GE_IS_TREE_VIEW (widget->parent)) { clearlooks_treeview_get_header_index (GTK_TREE_VIEW(widget->parent), widget, &column_index, &columns, &resizable); } else if (GE_IS_CLIST (widget->parent)) { clearlooks_clist_get_header_index (GTK_CLIST(widget->parent), widget, &column_index, &columns); } header.resizable = resizable; if (column_index == 0) header.order = params.ltr ? CL_ORDER_FIRST : CL_ORDER_LAST; else if (column_index == columns-1) header.order = params.ltr ? CL_ORDER_LAST : CL_ORDER_FIRST; else header.order = CL_ORDER_MIDDLE; gtk_style_apply_default_background (style, window, FALSE, state_type, area, x, y, width, height); STYLE_FUNCTION(draw_list_view_header) (cr, colors, ¶ms, &header, x, y, width, height); } else if (DETAIL ("button") || DETAIL ("buttondefault")) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); if (ge_is_in_combo_box(widget)) { if (params.ltr) params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT; else params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT; if (params.xthickness > 2) { if (params.ltr) x--; width++; } } else { params.corners = CR_CORNER_ALL; /* if (!(ge_is_combo_box (widget, FALSE))) */ params.enable_glow = TRUE; } if (GE_IS_TOGGLE_BUTTON (widget) && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) params.active = TRUE; STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, ¶ms, x, y, width, height); } else if (DETAIL ("spinbutton_up") || DETAIL ("spinbutton_down")) { if (state_type == GTK_STATE_ACTIVE) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); if (style->xthickness == 3) { width++; if (params.ltr) x--; } if (DETAIL ("spinbutton_up")) { height+=2; if (params.ltr) params.corners = CR_CORNER_TOPRIGHT; else params.corners = CR_CORNER_TOPLEFT; } else { if (params.ltr) params.corners = CR_CORNER_BOTTOMRIGHT; else params.corners = CR_CORNER_BOTTOMLEFT; } STYLE_FUNCTION(draw_spinbutton_down) (cr, &clearlooks_style->colors, ¶ms, x, y, width, height); } } else if (DETAIL ("spinbutton")) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); if (params.ltr) params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT; else params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT; if (style->xthickness == 3) { if (params.ltr) x--; width++; } STYLE_FUNCTION(draw_spinbutton) (cr, &clearlooks_style->colors, ¶ms, x, y, width, height); } else if (detail && g_str_has_prefix (detail, "trough") && GE_IS_SCALE (widget)) { WidgetParameters params; SliderParameters slider; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_NONE; slider.lower = DETAIL ("trough-lower"); slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full"); slider.horizontal = (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL); STYLE_FUNCTION(draw_scale_trough) (cr, &clearlooks_style->colors, ¶ms, &slider, x, y, width, height); } else if (DETAIL ("trough") && widget && GE_IS_PROGRESS_BAR (widget)) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, ¶ms, x, y, width, height); } else if (DETAIL ("trough") && widget && (GE_IS_VSCROLLBAR (widget) || GE_IS_HSCROLLBAR (widget))) { WidgetParameters params; ScrollBarParameters scrollbar; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_NONE; scrollbar.horizontal = TRUE; scrollbar.junction = clearlooks_scrollbar_get_junction (widget); if (GE_IS_RANGE (widget)) scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL; if (scrollbar.horizontal) { x += 2; width -= 4; } else { y += 2; height -= 4; } STYLE_FUNCTION(draw_scrollbar_trough) (cr, colors, ¶ms, &scrollbar, x, y, width, height); } else if (DETAIL ("bar")) { WidgetParameters params; ProgressBarParameters progressbar; gdouble elapsed = 0.0; #ifdef HAVE_ANIMATION if(clearlooks_style->animation && CL_IS_PROGRESS_BAR (widget)) { gboolean activity_mode = GTK_PROGRESS (widget)->activity_mode; if (!activity_mode) clearlooks_animation_progressbar_add ((gpointer)widget); } elapsed = clearlooks_animation_elapsed (widget); #endif clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); if (widget && GE_IS_PROGRESS_BAR (widget)) { progressbar.orientation = gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget)); progressbar.value = gtk_progress_bar_get_fraction(GTK_PROGRESS_BAR(widget)); progressbar.pulsing = GTK_PROGRESS (widget)->activity_mode; } else { progressbar.orientation = CL_ORIENTATION_LEFT_TO_RIGHT; progressbar.value = 0; progressbar.pulsing = FALSE; } if (!params.ltr) { if (progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_LEFT_TO_RIGHT) progressbar.orientation = GTK_PROGRESS_RIGHT_TO_LEFT; else if (progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_RIGHT_TO_LEFT) progressbar.orientation = GTK_PROGRESS_LEFT_TO_RIGHT; } /* Following is a hack to have a larger clip area, the one passed in * does not allow for the shadow. */ if (area) { GdkRectangle tmp = *area; if (!progressbar.pulsing) { switch (progressbar.orientation) { case GTK_PROGRESS_RIGHT_TO_LEFT: tmp.x -= 1; case GTK_PROGRESS_LEFT_TO_RIGHT: tmp.width += 1; break; case GTK_PROGRESS_BOTTOM_TO_TOP: tmp.y -= 1; case GTK_PROGRESS_TOP_TO_BOTTOM: tmp.height += 1; break; } } else { if (progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_RIGHT_TO_LEFT || progressbar.orientation == (ClearlooksOrientation)GTK_PROGRESS_LEFT_TO_RIGHT) { tmp.x -= 1; tmp.width += 2; } else { tmp.y -= 1; tmp.height += 2; } } cairo_reset_clip (cr); gdk_cairo_rectangle (cr, &tmp); cairo_clip (cr); } STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, ¶ms, &progressbar, x, y, width, height, 10 - (int)(elapsed * 10.0) % 10); } else if (DETAIL ("optionmenu")) { WidgetParameters params; OptionMenuParameters optionmenu; GtkRequisition indicator_size; GtkBorder indicator_spacing; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.enable_glow = TRUE; ge_option_menu_get_props (widget, &indicator_size, &indicator_spacing); if (ge_widget_is_ltr (widget)) optionmenu.linepos = width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - 1; else optionmenu.linepos = (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + 1; STYLE_FUNCTION(draw_optionmenu) (cr, colors, ¶ms, &optionmenu, x, y, width, height); } else if (DETAIL ("menuitem")) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); if (widget && GE_IS_MENU_BAR (widget->parent)) { params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT; height += 1; STYLE_FUNCTION(draw_menubaritem) (cr, colors, ¶ms, x, y, width, height); } else { params.corners = CR_CORNER_ALL; STYLE_FUNCTION(draw_menuitem) (cr, colors, ¶ms, x, y, width, height); } } else if (DETAIL ("hscrollbar") || DETAIL ("vscrollbar")) /* This can't be "stepper" for scrollbars ... */ { WidgetParameters params; ScrollBarParameters scrollbar; ScrollBarStepperParameters stepper; GdkRectangle this_rectangle; this_rectangle.x = x; this_rectangle.y = y; this_rectangle.width = width; this_rectangle.height = height; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); params.corners = CR_CORNER_NONE; scrollbar.has_color = FALSE; scrollbar.horizontal = TRUE; scrollbar.junction = clearlooks_scrollbar_get_junction (widget); if (clearlooks_style->colorize_scrollbar || clearlooks_style->has_scrollbar_color) { scrollbar.has_color = TRUE; } scrollbar.horizontal = DETAIL ("hscrollbar"); stepper.stepper = clearlooks_scrollbar_get_stepper (widget, &this_rectangle); STYLE_FUNCTION(draw_scrollbar_stepper) (cr, colors, ¶ms, &scrollbar, &stepper, x, y, width, height); } else if (DETAIL ("toolbar") || DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin")) { WidgetParameters params; ToolbarParameters toolbar; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y); toolbar.style = clearlooks_style->toolbarstyle; /* Only draw the shadows on horizontal toolbars */ if (shadow_type != GTK_SHADOW_NONE && height < 2*width ) STYLE_FUNCTION(draw_toolbar) (cr, colors, ¶ms, &toolbar, x, y, width, height); } else if (DETAIL ("trough")) { } else if (DETAIL ("menu")) { WidgetParameters params; clearlooks_set_widget_parameters (widget, style, state_type, ¶ms); STYLE_FUNCTION(draw_menu_frame) (cr, colors, ¶ms, x, y, width, height); } else if (DETAIL ("hseparator") || DETAIL ("vseparator")) { const gchar *new_detail = detail; /* Draw a normal separator, we just use this because it gives more control * over sizing (currently). */ /* This isn't nice ... but it seems like the best cleanest way to me right now. * It will get slightly nicer in the future hopefully. */ if (GE_IS_MENU_ITEM (widget)) new_detail = "menuitem"; if (DETAIL ("hseparator")) { gtk_paint_hline (style, window, state_type, area, widget, new_detail, x, x + width - 1, y + height/2); } else gtk_paint_vline (style, window, state_type, area, widget, new_detail, y, y + height - 1, x + width/2); } else { clearlooks_parent_class->draw_box (style, window, state_type, shadow_type, area, widget, detail, x, y, width, height); } cairo_destroy (cr); }