how to label a cairo drawings in gtk+-2.0
- From: Mahesh Chaudhari <mahesh chaudhari ymail com>
- To: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: how to label a cairo drawings in gtk+-2.0
- Date: Fri, 4 Oct 2013 13:41:07 +0800 (SGT)
Hi List,
I have drawn five circles in GtkDrawingArea as below :
#include <gtk/gtk.h>
#include <cairo.h>
#include<math.h>
GtkWidget* window;
GtkWidget* darea;
static gboolean on_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
cairo_t *cr;
cr = gdk_cairo_create(darea->window);
cairo_arc(cr,50,60,20,0,2*M_PI);
cairo_arc(cr,110,60,20,0,2*M_PI);
cairo_arc(cr,170,60,20,0,2*M_PI);
cairo_arc(cr,230,60,20,0,2*M_PI);
cairo_arc(cr,300,60,20,0,2*M_PI);
cairo_set_source_rgba (cr, 0.5, 0, 0, 0.5);
cairo_fill(cr);
}
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size(GTK_WINDOW(window), 400, 100);
darea = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(window), darea);
g_signal_connect(darea, "expose-event",
G_CALLBACK(on_expose_event), NULL);
gtk_widget_show_all(window);
gtk_main();
return 0;
}
I want to put label(text) above each circle, Also colour should be change after few seconds
How can I do this ? I have to use CentOS-5.3 which has gtk+-2.10.0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]