mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 23:10:22 +00:00
notebook: Improve the style of the default arrows
https://bugzilla.gnome.org/show_bug.cgi?id=707920
This commit is contained in:
parent
81b0808849
commit
8dd100d9b0
@ -1262,26 +1262,6 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
add_path_arrow (cairo_t *cr,
|
||||
gdouble angle,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble size)
|
||||
{
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_translate (cr, x + (size / 2), y + (size / 2));
|
||||
cairo_rotate (cr, angle);
|
||||
|
||||
cairo_move_to (cr, 0, - (size / 4));
|
||||
cairo_line_to (cr, - (size / 2), (size / 4));
|
||||
cairo_line_to (cr, (size / 2), (size / 4));
|
||||
cairo_close_path (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_theming_engine_render_arrow (GtkThemingEngine *engine,
|
||||
cairo_t *cr,
|
||||
@ -1290,24 +1270,33 @@ gtk_theming_engine_render_arrow (GtkThemingEngine *engine,
|
||||
gdouble y,
|
||||
gdouble size)
|
||||
{
|
||||
GtkStateFlags flags;
|
||||
GdkRGBA fg_color;
|
||||
double line_width;
|
||||
GtkStateFlags state;
|
||||
GdkRGBA color;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
flags = gtk_theming_engine_get_state (engine);
|
||||
gtk_theming_engine_get_color (engine, flags, &fg_color);
|
||||
line_width = size / 3.0 / sqrt (2);
|
||||
cairo_set_line_width (cr, line_width);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
|
||||
|
||||
if (flags & GTK_STATE_FLAG_INSENSITIVE)
|
||||
{
|
||||
add_path_arrow (cr, angle, x + 1, y + 1, size);
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
cairo_translate (cr, x + size / 2.0, y + size / 2.0);
|
||||
cairo_rotate (cr, angle - G_PI_2);
|
||||
cairo_translate (cr, size / 4.0, 0);
|
||||
|
||||
add_path_arrow (cr, angle, x, y, size);
|
||||
gdk_cairo_set_source_rgba (cr, &fg_color);
|
||||
cairo_fill (cr);
|
||||
cairo_scale (cr,
|
||||
(size / (size + line_width)),
|
||||
(size / (size + line_width)));
|
||||
|
||||
cairo_move_to (cr, -size / 2.0, -size / 2.0);
|
||||
cairo_rel_line_to (cr, size / 2.0, size / 2.0);
|
||||
cairo_rel_line_to (cr, - size / 2.0, size / 2.0);
|
||||
|
||||
state = gtk_theming_engine_get_state (engine);
|
||||
gtk_theming_engine_get_color (engine, state, &color);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user