summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-09-12 22:45:27 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-09-12 22:45:27 (GMT)
commit2e87fbdf79b41314ef84b695705e20d5c38ffe31 (patch)
tree9545d352ddc2fd622c9aa4287e75473abceda953
parentb7a6baa6ec7b45637ad56418e8e3ab736409835f (diff)
Updated diagram sizes on value updates.
-rw-r--r--src/gtkext/diagram.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gtkext/diagram.c b/src/gtkext/diagram.c
index 760e3ae..395d019 100644
--- a/src/gtkext/diagram.c
+++ b/src/gtkext/diagram.c
@@ -642,6 +642,7 @@ static GtkSizeRequestMode gtk_diagram_get_request_mode(GtkWidget *widget)
static void gtk_diagram_get_preferred_width_for_height(GtkWidget *widget, gint height, gint *minimum, gint *natural)
{
+ GdkWindow *window; /* FenĂȘtre du composant */
GtkDiagram *diagram; /* Autre version du composant */
gint text_width; /* Plus grande longueur */
cairo_surface_t *surface; /* Espace graphique de support */
@@ -649,6 +650,14 @@ static void gtk_diagram_get_preferred_width_for_height(GtkWidget *widget, gint h
size_t i; /* Boucle de parcours */
cairo_text_extents_t extents; /* Taille de la police */
+ window = gtk_widget_get_window(widget);
+
+ if (window == NULL)
+ {
+ *minimum = 1;
+ goto conclusion;
+ }
+
diagram = GTK_DIAGRAM(widget);
text_width = 0;
@@ -703,6 +712,8 @@ static void gtk_diagram_get_preferred_width_for_height(GtkWidget *widget, gint h
cairo_destroy(cr);
cairo_surface_destroy(surface);
+ conclusion:
+
/* RĂ©percution */
*natural = *minimum;
@@ -738,6 +749,8 @@ void gtk_diagram_clear_stats(GtkDiagram *diagram)
diagram->stats = NULL;
diagram->count = 0;
+ gtk_widget_queue_resize(GTK_WIDGET(diagram));
+
}
@@ -780,4 +793,6 @@ void gtk_diagram_add_stats(GtkDiagram *diagram, const diagram_stat_t *stats, siz
diagram->count += count;
+ gtk_widget_queue_resize(GTK_WIDGET(diagram));
+
}