summaryrefslogtreecommitdiff
path: root/src/analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis')
-rw-r--r--src/analysis/line-int.h2
-rw-r--r--src/analysis/line.c50
-rw-r--r--src/analysis/line.h1
3 files changed, 48 insertions, 5 deletions
diff --git a/src/analysis/line-int.h b/src/analysis/line-int.h
index 142230e..a70df85 100644
--- a/src/analysis/line-int.h
+++ b/src/analysis/line-int.h
@@ -72,6 +72,8 @@ struct _GRenderingLineClass
{
GObjectClass parent; /* A laisser en premier */
+ GtkStyle *style; /* Style GTK commun aux lignes */
+
/* Signaux */
void (* rendering_line_flags_changed) (GRenderingLine *);
diff --git a/src/analysis/line.c b/src/analysis/line.c
index b1af518..2697f77 100644
--- a/src/analysis/line.c
+++ b/src/analysis/line.c
@@ -48,6 +48,8 @@ static void g_rendering_line_class_init(GRenderingLineClass *);
/* Initialise une instance de ligne de représentation. */
static void g_rendering_line_init(GRenderingLine *);
+/* Charge une image destinée à être rendue avec la ligne. */
+static GdkPixbuf *g_rendering_line_render_icon(const GRenderingLine *, const char *, GtkIconSize);
/* Indique le type définit pour une ligne de représentation. */
@@ -69,6 +71,8 @@ G_DEFINE_TYPE(GRenderingLine, g_rendering_line, G_TYPE_OBJECT);
static void g_rendering_line_class_init(GRenderingLineClass *klass)
{
+ klass->style = gtk_style_new();
+
g_signal_new("rendering-line-flags-changed",
G_TYPE_RENDERING_LINE,
G_SIGNAL_RUN_LAST,
@@ -224,6 +228,43 @@ RenderingLineFlag g_rendering_line_get_flags(const GRenderingLine *line)
/******************************************************************************
* *
+* Paramètres : line = ligne dont les informations sont à consulter. *
+* stock_id = identifiant GTK de l'image à charger. *
+* size = taille de l'image souhaitée. *
+* *
+* Description : Charge une image destinée à être rendue avec la ligne. *
+* *
+* Retour : Image prête à emploi ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GdkPixbuf *g_rendering_line_render_icon(const GRenderingLine *line, const char *stock_id, GtkIconSize size)
+{
+ GdkPixbuf *result; /* Elément mis en place / NULL */
+ GtkStyle *style; /* Style GTK à utiliser */
+ GtkIconSet *icon_set; /* Liste d'icones */
+
+ style = G_RENDERING_LINE_GET_CLASS(line)->style;
+
+ icon_set = gtk_style_lookup_icon_set(style, stock_id);
+
+ if (icon_set == NULL)
+ return NULL;
+
+ result = gtk_icon_set_render_icon(icon_set, style,
+ gtk_widget_get_default_direction(),
+ GTK_STATE_NORMAL, size,
+ NULL, NULL);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : line = adresse de la structure à représenter. *
* drawable = support de rendu pour le dessin. *
* gc = contexte graphique à utiliser. *
@@ -246,12 +287,11 @@ void g_rendering_line_draw(GRenderingLine *line, GdkDrawable *drawable, GdkGC *g
gdk_draw_layout(drawable, gc, x1, y, line->layout);
-#if 0
if (line->flags & RLF_BREAK_POINT)
- pixbuf = gtk_widget_render_icon(mywid, "gtk-yes", GTK_ICON_SIZE_MENU, NULL);
+ pixbuf = g_rendering_line_render_icon(line, "gtk-yes", GTK_ICON_SIZE_MENU);
else if (line->flags & RLF_RUNNING_BP)
- pixbuf = gtk_widget_render_icon(mywid, "gtk-no", GTK_ICON_SIZE_MENU, NULL);
+ pixbuf = g_rendering_line_render_icon(line, "gtk-no", GTK_ICON_SIZE_MENU);
else pixbuf = NULL;
@@ -268,7 +308,7 @@ void g_rendering_line_draw(GRenderingLine *line, GdkDrawable *drawable, GdkGC *g
/* Le point d'entrée prime */
if (line->flags & RLF_ENTRY_POINT)
- pixbuf = gtk_widget_render_icon(mywid, "gtk-go-forward", GTK_ICON_SIZE_MENU, NULL);
+ pixbuf = g_rendering_line_render_icon(line, "gtk-go-forward", GTK_ICON_SIZE_MENU);
else pixbuf = NULL;
@@ -281,7 +321,7 @@ void g_rendering_line_draw(GRenderingLine *line, GdkDrawable *drawable, GdkGC *g
g_object_unref(pixbuf);
}
-#endif
+
}
diff --git a/src/analysis/line.h b/src/analysis/line.h
index 5744d24..ae7698e 100644
--- a/src/analysis/line.h
+++ b/src/analysis/line.h
@@ -70,6 +70,7 @@ typedef struct _disass_options
#define G_RENDERING_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_rendering_line_get_type(), GRenderingLine))
#define G_IS_RENDERING_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_rendering_line_get_type()))
#define G_RENDERING_LINE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_rendering_line_get_type(), GRenderingLineIface))
+#define G_RENDERING_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_RENDERING_LINE, GRenderingLineClass))
/* Ligne de représentation générique (instance) */