[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: GtkDrawingArea in a GtkFrame
- From: "David F. Newman" <dnewman maraudingpirates org>
- To: Havoc Pennington <hp redhat com>
- Cc: <gtk-app-devel-list gnome org>
- Subject: Re: GtkDrawingArea in a GtkFrame
- Date: Tue, 9 Oct 2001 21:51:19 -0400 (EDT)
On 9 Oct 2001, Havoc Pennington wrote:
>
> "David F. Newman" <dnewman@maraudingpirates.org> writes:
> > I hope this isn't a FAQ, but I have a GtkDrawingArea inside a GtkFrame but
> > the drawing area doesn't expand to fill the Frame.
>
> Don't know, it should work as expected. Maybe post a small test case
> showing the behavior?
>
I striped it down to as small as possible. The top widget is a gnomeapp
that contains a GtkHBox, which contains a frame, which contains the
drawing area.
-Dave
#include <gnome.h>
gint delete_event_cb(GtkWidget *window, GdkEventAny *e, gpointer data)
{
gtk_main_quit();
return FALSE;
}
gint expose_event_cb(GtkWidget *w, GdkEventExpose *e)
{
GtkRequisition req;
/* Get the size of the Map Widget */
gtk_widget_size_request (w, &req);
printf("Map = %dx%d\n", req.width, req.height);
printf("Expose Event\n");
return FALSE;
}
static GnomeUIInfo file_menu[] = {
GNOMEUIINFO_MENU_EXIT_ITEM(delete_event_cb, NULL),
GNOMEUIINFO_END
};
static GnomeUIInfo main_menu[] = {
GNOMEUIINFO_MENU_FILE_TREE(file_menu),
GNOMEUIINFO_END
};
int main(int argc, char **argv)
{
GtkWidget *app;
GtkWidget *top;
GtkWidget *mapFrame;
GtkWidget *Map;
gnome_init("navigatrix", "0.1", argc, argv);
app = gnome_app_new("navigatrix", "Navigatrix");
gnome_app_create_menus(GNOME_APP(app), main_menu);
gtk_signal_connect(GTK_OBJECT(app),
"delete_event",
GTK_SIGNAL_FUNC(delete_event_cb),
NULL);
/* Create the top container widget. This will have the compass
and GPS data on the right and the map on the left. */
top = gtk_hbox_new(FALSE, 5);
gtk_container_set_border_width(GTK_CONTAINER(top), 5);
gnome_app_set_contents(GNOME_APP(app), GTK_WIDGET(top));
/* Create the Map Frame */
mapFrame = gtk_frame_new("Map");
gtk_box_pack_start(GTK_BOX(top), mapFrame, TRUE, TRUE, 0);
/* Create the Map drawing area. All maps get drawn here. */
Map = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(mapFrame), Map);
gtk_signal_connect(GTK_OBJECT(Map),
"expose_event",
GTK_SIGNAL_FUNC(expose_event_cb),
NULL);
gtk_widget_show_all(app);
gtk_main();
return 0;
}
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]