GtkDrawingArea size in a GtkScrolledWindow
- From: Simon Gornall <simon unique-id com>
- To: GTK mailing list <gtk-list gnome org>
- Subject: GtkDrawingArea size in a GtkScrolledWindow
- Date: Sun, 26 Aug 2001 10:23:14 +0000
I've been scoring the FAQ/mailing list, but everyone else seems
to have no problems, so if anyone can see what I'm doing wrong
here, I'll be very grateful...
Basically my scrolled window is never being created at the
correct size - it always ends up at ~100x100 or so. The map.w
and map.h print out to be 1280x640, so the scrolled window should
be 640x320 in size!
/**********************************************************************\
|* Create a new window for the UI to be packed into
\**********************************************************************/
_win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/**********************************************************************\
|* Create a new vbox
\**********************************************************************/
vbox1 = gtk_vbox_new(FALSE, 0);
gtk_container_add (GTK_CONTAINER (_win), vbox1);
gtk_widget_show (vbox1);
/**********************************************************************\
|* create a scrollable drawing area for the map
\**********************************************************************/
mapWin = gtk_scrolled_window_new(NULL, NULL);
map = gtk_drawing_area_new();
gtk_drawing_area_size((GtkDrawingArea *)map, info.w/2, info.h/2);
fprintf(stderr, "Size is %d by %d\n", info.w, info.h);
gtk_scrolled_window_add_with_viewport((GtkScrolledWindow *)mapWin, map);
gtk_scrolled_window_set_policy((GtkScrolledWindow *)mapWin,
GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS);
gtk_signal_connect (GTK_OBJECT (map), "expose-event",
GTK_SIGNAL_FUNC (drawMap), &info);
gtk_widget_show_all(mapWin);
gtk_box_pack_start (GTK_BOX (vbox1), mapWin, TRUE, TRUE, 0);
/**********************************************************************\
|* Show the whole lot...
\**********************************************************************/
gtk_widget_show (_win);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]