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

GTK newbie



GTK people,

Im a newbie to GTK and graphical progamming as well. I am hoping that
somebody can point me in the right direction. What I would like to do
with this code is
be able to open 1 or more pictures each in its own window on its own
canvas. In other words, when Open calls back I would like to call the open
method that will open the picture on a new canvas.

void open(GtkWidget* can)
{
	GnomeCanvasGroup* group;
	group = gnome_canvas_root( GNOME_CANVAS (can));
	//I segfault at the above line. Without it I don't but from what I
can tell I need group for the gnome_canvas_item_new func.

}

gint main (gint argc, gchar *argv[])
{
	GtkWidget* app1;
	GtkWidget* win;
	GtkWidget* canvas;

	gnome_init ("dicer", "0.5.0", argc, argv);
	win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gdk_imlib_init();
	//Set up visual & colormap
	gtk_widget_push_visual(gdk_imlib_get_visual());
	gtk_widget_push_colormap(gdk_imlib_get_colormap());

	canvas = gnome_canvas_new();

	//pop visual & colormap
	gtk_widget_pop_visual();
	gtk_widget_pop_colormap();

	app1 = create_app1 ();

	gnome_canvas_set_scroll_region(canvas,0.0,0.0,320.0,320.0);

	open(canvas);
	gtk_container_add (GTK_CONTAINER (win), canvas);

	gtk_widget_show (app1)
	gtk_widget_show_all (win);
	gtk_main ();
	return 0;
}




Sincerely, Jim Pharis

      www.grlug.org webmaster

Student @ Grand Valley State University

---------------------------------------
One by one the Penguins steal my sanity
---------------------------------------




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