summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkgraphview.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/gtkgraphview.c')
-rw-r--r--src/gtkext/gtkgraphview.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index 6255602..5b32f69 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -71,6 +71,9 @@ struct _GtkGraphViewClass
};
+/* Profondeur de l'ombre */
+#define SHADOW_SIZE 4
+
/* Initialise la classe générique des graphiques de code. */
static void gtk_graph_view_class_init(GtkGraphViewClass *);
@@ -152,8 +155,14 @@ G_DEFINE_TYPE(GtkGraphView, gtk_graph_view, GTK_TYPE_VIEW_PANEL)
static void gtk_graph_view_class_init(GtkGraphViewClass *class)
{
+ GObjectClass *object; /* Autre version de la classe */
GtkViewPanelClass *panel_class; /* Classe parente */
+ object = G_OBJECT_CLASS(class);
+
+ object->dispose = (GObjectFinalizeFunc/* ! */)gtk_graph_view_dispose;
+ object->finalize = (GObjectFinalizeFunc)gtk_graph_view_finalize;
+
panel_class = GTK_VIEW_PANEL_CLASS(class);
panel_class->compute_size = (compute_requested_size_fc)gtk_graph_view_compute_requested_size;
@@ -314,8 +323,8 @@ static void gtk_graph_view_compute_requested_size(GtkGraphView *view, gint *widt
needed.height = 0;
}
- if (width != NULL) *width = needed.width;
- if (height != NULL) *height = needed.height;
+ if (width != NULL) *width = needed.width + SHADOW_SIZE;
+ if (height != NULL) *height = needed.height + SHADOW_SIZE;
}
@@ -366,6 +375,41 @@ static gboolean gtk_graph_view_draw(GtkWidget *widget, cairo_t *cr, GtkGraphView
{
size_t i; /* Boucle de parcours */
+ void draw_shadow(GtkWidget *child, gpointer unused)
+ {
+ GtkAllocation alloc; /* Emplacement de l'enfant */
+ gint j; /* Boucle de parcours */
+ cairo_pattern_t *pattern; /* Zones d'application */
+
+ gtk_widget_get_allocation(child, &alloc);
+
+ for (j = 1; j < SHADOW_SIZE; j++)
+ {
+ cairo_push_group(cr);
+
+ gtk_view_panel_define_border_path(GTK_VIEW_PANEL(child), cr, alloc.x + j, alloc.y + j);
+ cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0);
+ cairo_fill(cr);
+
+ cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+
+ gtk_view_panel_define_border_path(GTK_VIEW_PANEL(child), cr, alloc.x, alloc.y);
+ cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.0);
+ cairo_fill(cr);
+
+ pattern = cairo_pop_group(cr);
+
+ cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.3);
+ cairo_mask(cr, pattern);
+ cairo_fill(cr);
+
+ }
+
+ }
+
+ gtk_container_foreach(GTK_CONTAINER(view->support), (GtkCallback)draw_shadow, NULL);
+
+
for (i = 0; i < view->edges_count; i++)
g_graph_edge_draw(view->edges[i], cr, true);