mirror of https://github.com/GNOME/gimp.git
app: port GimpColorFrame away from GtkStyle, using a new style property
This commit is contained in:
parent
dfa38fc26a
commit
1cd367845d
|
@ -129,6 +129,12 @@ gimp_color_frame_class_init (GimpColorFrameClass *klass)
|
|||
PANGO_TYPE_ELLIPSIZE_MODE,
|
||||
PANGO_ELLIPSIZE_NONE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_boxed ("number-color",
|
||||
NULL, NULL,
|
||||
GDK_TYPE_RGBA,
|
||||
GIMP_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -340,23 +346,33 @@ gimp_color_frame_draw (GtkWidget *widget,
|
|||
|
||||
if (frame->has_number)
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GtkAllocation allocation;
|
||||
GtkAllocation menu_allocation;
|
||||
GtkAllocation color_area_allocation;
|
||||
GtkAllocation coords_box_x_allocation;
|
||||
GtkAllocation coords_box_y_allocation;
|
||||
GdkRGBA *color;
|
||||
gchar buf[8];
|
||||
gint w, h;
|
||||
gdouble scale;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
gtk_widget_get_allocation (frame->menu, &menu_allocation);
|
||||
gtk_widget_get_allocation (frame->color_area, &color_area_allocation);
|
||||
gtk_widget_get_allocation (frame->coords_box_x, &coords_box_x_allocation);
|
||||
gtk_widget_get_allocation (frame->coords_box_y, &coords_box_y_allocation);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->light[GTK_STATE_NORMAL]);
|
||||
gtk_widget_style_get (widget,
|
||||
"number-color", &color,
|
||||
NULL);
|
||||
|
||||
if (color)
|
||||
{
|
||||
gdk_cairo_set_source_rgba (cr, color);
|
||||
gdk_rgba_free (color);
|
||||
}
|
||||
|
||||
g_snprintf (buf, sizeof (buf), "%d", frame->number);
|
||||
|
||||
|
@ -383,6 +399,8 @@ gimp_color_frame_draw (GtkWidget *widget,
|
|||
coords_box_x_allocation.height / 2.0 +
|
||||
coords_box_y_allocation.height / 2.0) / scale - h / 2.0);
|
||||
pango_cairo_show_layout (cr, frame->number_layout);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
return GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
|
||||
|
|
|
@ -64,6 +64,10 @@ GimpDisplayShell {
|
|||
-GtkButton-focus-padding: 0;
|
||||
}
|
||||
|
||||
GimpColorFrame {
|
||||
-GimpColorFrame-number-color: lighter (@bg_color);
|
||||
}
|
||||
|
||||
GimpOverlayFrame {
|
||||
-GtkButton-focus-line-width: 1;
|
||||
}
|
||||
|
|
|
@ -64,6 +64,10 @@ GimpDisplayShell {
|
|||
-GtkButton-focus-padding: 0;
|
||||
}
|
||||
|
||||
GimpColorFrame {
|
||||
-GimpColorFrame-number-color: lighter (@bg_color);
|
||||
}
|
||||
|
||||
GimpOverlayFrame {
|
||||
-GtkButton-focus-line-width: 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue