diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-06-04 18:19:30 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-06-04 18:19:30 (GMT) |
commit | 83ba2204e700501023cb78dfd84978c611fe61b0 (patch) | |
tree | 6fecf15dda7b1d115d1fe1c0c6b4d262ac30d332 /src/gtkext | |
parent | 1b66b99cbb621bd97d917ef7830697b93fa36ae5 (diff) |
Restored nice colors for buffer views.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@377 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkbufferview.c | 40 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview.h | 8 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel.c | 28 |
3 files changed, 24 insertions, 52 deletions
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index bcf7ba0..38fff5a 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -483,8 +483,8 @@ static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr) cairo_rectangle_int_t area; /* Surface correspondante */ gint fake_x; /* Abscisse virtuelle */ gint fake_y; /* Ordonnée virtuelle */ - GtkStateFlags state; /* Etat du composant */ - GdkRGBA *color; /* Couleur du curseur */ + GtkStyleContext *context; /* Contexte du thème actuel */ + GdkRGBA color; /* Couleur du curseur */ view = GTK_BUFFER_VIEW(widget); widget = GTK_WIDGET(view); @@ -498,40 +498,18 @@ static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr) fake_y = 0; gtk_buffer_view_compute_fake_coord(view, &fake_x, &fake_y); - - do - { - - - GtkStyleContext *context; - - - context = gtk_widget_get_style_context(widget); - - gtk_render_background(context, cr, 0, 0, 250, 250); - - printf("Passage!\n"); - - - } while (0); - - - /* Dessin de la marge gauche */ - state = gtk_widget_get_state_flags(widget); + context = gtk_widget_get_style_context(widget); - gtk_style_context_get(gtk_widget_get_style_context(widget), state, - GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color, NULL); + gtk_style_context_save(context); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_TROUGH); + gtk_style_context_get_color(context, GTK_STATE_FLAG_BACKDROP | GTK_STATE_FLAG_DIR_LTR, &color); + gtk_style_context_restore(context); - cairo_rectangle(cr, fake_x, area.y, view->left_margin, area.y + area.height); - cairo_fill(cr); + cairo_set_source_rgb(cr, color.red, color.green, color.blue); - gtk_style_context_get(gtk_widget_get_style_context(widget), state, - GTK_STYLE_PROPERTY_BORDER_COLOR, &color, NULL); - - cairo_move_to(cr, fake_x + view->left_margin, area.y); - cairo_line_to(cr, fake_x + view->left_margin, area.y + area.height); + cairo_rectangle(cr, fake_x, area.y, view->left_margin, area.y + area.height); cairo_fill(cr); /* Eventuelle bordure globale */ diff --git a/src/gtkext/gtkbufferview.h b/src/gtkext/gtkbufferview.h index 40fbe74..7505cdd 100644 --- a/src/gtkext/gtkbufferview.h +++ b/src/gtkext/gtkbufferview.h @@ -59,4 +59,12 @@ GBufferView *gtk_buffer_view_get_buffer(const GtkBufferView *); +/* --------------------------- CONVERSIONS DE COORDONNEES --------------------------- */ + + +/* Transcrit les coordonnées absolues en coordonnées à l'écran. */ +void gtk_buffer_view_compute_relative_coords(GtkBufferView *, gint *, gint *); + + + #endif /* _GTK_BUFFERVIEW_H */ diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c index f9944a3..f10713f 100644 --- a/src/gtkext/gtkviewpanel.c +++ b/src/gtkext/gtkviewpanel.c @@ -315,39 +315,25 @@ static void gtk_view_panel_realize(GtkWidget *widget) static gboolean gtk_view_panel_draw(GtkWidget *widget, cairo_t *cr) { GtkViewPanel *panel; /* Autre version du composant */ -#if 0 - GdkGCValues values; /* Propriétés du contexte */ - GtkStyle *style; /* Style associé au composant */ GtkRequisition req; /* Taille allouée à l'élément */ - GtkStateType state; /* Etat du composant */ -#endif + GtkStyleContext *context; /* Contexte du thème actuel */ + panel = GTK_VIEW_PANEL(widget); if (panel->show_border) { - GtkStyleContext *context; - + gtk_widget_get_preferred_size(widget, NULL, &req); context = gtk_widget_get_style_context(widget); - gtk_render_background(context, cr, 0, 0, 250, 250); - - printf("Passage!\n"); - - /* - gdk_gc_get_values(panel->gc, &values); - style = gtk_widget_get_style(widget); + gtk_style_context_save(context); - gtk_widget_size_request(widget, &req); + gtk_style_context_add_class(context, GTK_STYLE_CLASS_FRAME); - state = gtk_widget_get_state(widget); - gdk_gc_set_foreground(panel->gc, &style->dark[state]); + gtk_render_frame(context, cr, 0, 0, req.width, req.height); - gdk_draw_rectangle(GDK_DRAWABLE(widget->window), panel->gc, - FALSE, 0, 0, req.width - 1, req.height - 1); + gtk_style_context_restore(context); - gdk_gc_set_foreground(panel->gc, &values.foreground); - */ } return FALSE; |