how to draw in the GtkDrawingArea



I don't know how to draw by using GtkDrawingArea.
Here is my sample code:
I have a drawing area named "GtkWidget *drawingarea_title"

I try to draw a line:
{
    drawingarea_title = gtk_drawing_area_new ();
    gtk_widget_ref (drawingarea_title);
    gtk_object_set_data_full (GTK_OBJECT (window_dishpointer),
"drawingarea_title", drawingarea_title,
                            (GtkDestroyNotify) gtk_widget_unref);
    gtk_box_pack_start (GTK_BOX (vbox1), drawingarea_title, TRUE, TRUE,
0);
    gtk_widget_set_usize (drawingarea_title, 640, -2);

    //drawing a line!!
    gtk_widget_realize(drawingarea_title);
    gtk_widget_show (drawingarea_title);

gdk_draw_line(drawingarea_title->window,style->fg_gc[drawingarea_title->state],0,0,300,100);

}

If somebody knows that, please tell me ASAP

Thanks!

Jiang



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]