how to keep top window from shrinking



The top level window has a nice default size, EXCEPT when I pack the
MenuBar into the MainVBox.

Once MenuBar goes into MainVBox, the main window shrinks to the size of
the word "File".

Is this standard behavior?  I know I can force the issue, but I'm
curious if this behavior is because I'm doing something wrong.

Thanks!
pete



#include <gtk/gtk.h>
#define HOMOG       TRUE
#define NO_HOMOG    FALSE
#define SPACING     TRUE
#define NO_SPACING  FALSE
#define EXPAND      TRUE
#define NO_EXPAND   FALSE
#define FILL        TRUE
#define NO_FILL     FALSE
#define NO_PADDING  0

void callback_delete(void);
void CreateMenuSystem(GtkWidget *MainVBox);


int main(int argc, char *argv[])
{

	GtkWidget *MainWin, *MainVBox;

	gtk_init(&argc, &argv);

	MainWin  = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	MainVBox = gtk_vbox_new(HOMOG, NO_SPACING);
	CreateMenuSystem(MainVBox);

	gtk_signal_connect( GTK_OBJECT(MainWin), "delete_event",
			GTK_SIGNAL_FUNC(callback_delete), NULL);

	gtk_container_add(GTK_CONTAINER(MainWin), MainVBox);

	gtk_widget_show_all(MainWin);
	gtk_main();

	return 0;
}



void callback_delete(void)
{
	gtk_main_quit();
}




void CreateMenuSystem(GtkWidget *MainVBox)
{
	GtkWidget *MenuBar;
	GtkWidget *file_item;

	MenuBar = gtk_menu_bar_new();
	file_item = gtk_menu_item_new_with_label("File");

	gtk_box_pack_start(GTK_BOX(MainVBox), MenuBar, EXPAND, FILL, NO_PADDING);
	gtk_menu_bar_append(GTK_MENU_BAR(MenuBar), file_item);
}

-- 
GPG Fingerprint: B9F1 6CF3 47C4 7CD8 D33E  70A9 A3B9 1945 67EA 951D




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