gdk drawing funks



hi, 
I'm trying to make use of gdks drawing funktions.
All I want to do is draw a rectangle on the toplevel window.

Here's what I tried to do, this generates a "drawable != null" message..

int main(int argc, char **argv)
{
GtkWidget *topwin;
GtkWidget *canvas;

gtk_init(&argc, &argv);

topwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);

canvas = gtk_drawing_area_new();
gtk_drawing_area_size(GTK_DRAWING_AREA(canvas), 200, 200);
gtk_widget_show(canvas);

gtk_container_add(GTK_CONTAINER(topwin), canvas);

gdk_draw_rectangle(canvas->window, canvas->style->black_gc, TRUE, 10, 10,
80, 50); 

gtk_widget_show(topwin);

gtk_main();
}



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