forked from AuroraMiddleware/gtk
GtkFrame: Use style classes for shadow
Use the FLAT style class when shadow is set to none, and let the theme render the appropriate border. https://bugzilla.gnome.org/show_bug.cgi?id=732256
This commit is contained in:
parent
17679c168a
commit
ec7200797e
@ -597,6 +597,7 @@ gtk_frame_set_shadow_type (GtkFrame *frame,
|
||||
{
|
||||
GtkFramePrivate *priv;
|
||||
GtkWidget *widget;
|
||||
GtkStyleContext *context;
|
||||
|
||||
g_return_if_fail (GTK_IS_FRAME (frame));
|
||||
|
||||
@ -607,6 +608,12 @@ gtk_frame_set_shadow_type (GtkFrame *frame,
|
||||
widget = GTK_WIDGET (frame);
|
||||
priv->shadow_type = type;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (frame));
|
||||
if (type == GTK_SHADOW_NONE)
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_FLAT);
|
||||
else
|
||||
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_FLAT);
|
||||
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
@ -679,8 +686,6 @@ gtk_frame_draw (GtkWidget *widget,
|
||||
width = priv->child_allocation.width + padding.left + padding.right;
|
||||
height = priv->child_allocation.height + padding.top + padding.bottom;
|
||||
|
||||
if (priv->shadow_type != GTK_SHADOW_NONE)
|
||||
{
|
||||
if (priv->label_widget)
|
||||
{
|
||||
gfloat xalign;
|
||||
@ -715,11 +720,6 @@ gtk_frame_draw (GtkWidget *widget,
|
||||
gtk_render_background (context, cr, x, y, width, height);
|
||||
gtk_render_frame (context, cr, x, y, width, height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_render_background (context, cr, x, y, width, height);
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_frame_parent_class)->draw (widget, cr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user