forked from AuroraMiddleware/gtk
e8e7692534
Thu Aug 13 09:11:11 BST 1998 Tony Gale <gale@gtk.org> * docs/gtk_tut.sgml: - Tidy up of the menufactory example from Andy Kahn <kahn@zk3.dec.com> - New section on Range Widgets from David Huggins-Daines <bn711@freenet.carleton.ca> - Started a new section on 'Advanced Event and Signal Handling' - used an email from Owen. - New appendix on Gdk Event Types - Added the tictactoe full example code to the 'Code Examples' appendix
49 lines
1.3 KiB
C
49 lines
1.3 KiB
C
/* example-start menu mfmain.c */
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
#include "mfmain.h"
|
|
#include "menufactory.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
GtkWidget *window;
|
|
GtkWidget *main_vbox;
|
|
GtkWidget *menubar;
|
|
|
|
gtk_init(&argc, &argv);
|
|
|
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
|
GTK_SIGNAL_FUNC(file_quit_cmd_callback),
|
|
"WM destroy");
|
|
gtk_window_set_title(GTK_WINDOW(window), "Menu Factory");
|
|
gtk_widget_set_usize(GTK_WIDGET(window), 300, 200);
|
|
|
|
main_vbox = gtk_vbox_new(FALSE, 1);
|
|
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
|
|
gtk_container_add(GTK_CONTAINER(window), main_vbox);
|
|
gtk_widget_show(main_vbox);
|
|
|
|
get_main_menu(window, &menubar);
|
|
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
|
gtk_widget_show(menubar);
|
|
|
|
gtk_widget_show(window);
|
|
gtk_main();
|
|
|
|
return(0);
|
|
}
|
|
|
|
/* This is just to demonstrate how callbacks work when using the
|
|
* menufactory. Often, people put all the callbacks from the menus
|
|
* in a separate file, and then have them call the appropriate functions
|
|
* from there. Keeps it more organized. */
|
|
void file_quit_cmd_callback (GtkWidget *widget, gpointer data)
|
|
{
|
|
g_print ("%s\n", (char *) data);
|
|
gtk_exit(0);
|
|
}
|
|
|
|
/* example-end */
|