[gtk+] GtkLevelBar: implement clipping



commit e2cf8d21251d67a11f7605cd974e2f511ae26d87
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 18 17:47:20 2014 -0400

    GtkLevelBar: implement clipping
    
    So level bars can have shadows, too.

 gtk/gtklevelbar.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index a4ee861..91d848c 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -98,6 +98,7 @@
 #include "gtkstylecontext.h"
 #include "gtktypebuiltins.h"
 #include "gtkwidget.h"
+#include "gtkwidgetprivate.h"
 
 #include <math.h>
 #include <stdlib.h>
@@ -575,6 +576,15 @@ gtk_level_bar_get_preferred_height (GtkWidget *widget,
 }
 
 static void
+gtk_level_bar_size_allocate (GtkWidget     *widget,
+                             GtkAllocation *allocation)
+{
+  GTK_WIDGET_CLASS (gtk_level_bar_parent_class)->size_allocate (widget, allocation);
+
+  _gtk_widget_set_simple_clip (widget);
+}
+
+static void
 gtk_level_bar_update_mode_style_classes (GtkLevelBar *self)
 {
   GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
@@ -889,6 +899,7 @@ gtk_level_bar_class_init (GtkLevelBarClass *klass)
   oclass->finalize = gtk_level_bar_finalize;
 
   wclass->draw = gtk_level_bar_draw;
+  wclass->size_allocate = gtk_level_bar_size_allocate;
   wclass->get_preferred_width = gtk_level_bar_get_preferred_width;
   wclass->get_preferred_height = gtk_level_bar_get_preferred_height;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]