Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

menus.c

Go to the documentation of this file.
00001 
00006 /* GtkSQL -- an interactive graphical query tool for PostgreSQL
00007  *
00008  * Copyright (C) 1998-2003 Lionel ULMER, Darryl Luff
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00023  */
00024 
00025 #include <string.h>
00026 #include "menus.h"
00027 
00029 GtkWidget *create_menu(SubMenu *cmenu)
00030 {
00031     int j;
00032     GtkWidget *item;
00033     GtkWidget *menu;
00034 
00035     /* First we create the menu */
00036     menu = gtk_menu_new();
00037 
00038     /* Then we add all the items */
00039     j = 0;
00040     while (cmenu[j].label != NULL) {
00041         if (strlen(cmenu[j].label) == 0)
00042             item = gtk_menu_item_new();
00043         else {
00044             if (cmenu[j].type == TOGGLE_BUTTON) {
00045                 item = gtk_check_menu_item_new_with_label(cmenu[j].label);
00046                 gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(item), TRUE);
00047             }
00048             else
00049                 item = gtk_menu_item_new_with_label(cmenu[j].label);
00050         }
00051 
00052         gtk_menu_append(GTK_MENU(menu), item);
00053         if (cmenu[j].callback != NULL)
00054             gtk_signal_connect_object(GTK_OBJECT(item), "activate",
00055                                       GTK_SIGNAL_FUNC(cmenu[j].callback),
00056                                       cmenu[j].data);
00057         gtk_widget_show(item);
00058 
00059         if (cmenu[j].store_to != NULL)
00060             *(cmenu[j].store_to) = item;
00061 
00062         j++;
00063     }
00064     return menu;
00065 }

Generated on Sun May 9 19:19:17 2004 for GtkSQL by doxygen1.2.18