/* Copyright (C) 1999 Southern Gold Development * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gview.h" void gAddSubMenu(sgview *view, GtkMenu *menu, GtkWidget *submenu, gchar *text) { GtkWidget *item; item = gtk_menu_item_new_with_label(text); gtk_menu_append(menu, item); gtk_menu_item_set_submenu(GTK_MENU_ITEM (item), submenu); gtk_widget_show(item); } void gAddMenu(sgview *view, GtkMenu *menu, gchar *text, GtkSignalFunc callb) { GtkWidget *item; item = gtk_menu_item_new_with_label(text); gtk_signal_connect(GTK_OBJECT (item), "activate", callb, (gpointer) view); gtk_menu_append(menu, item); gtk_widget_show(item); } void gAddToolbar(sgview *view, GtkToolbar *tool, char *pixmap[], gchar *text, gchar *tip, GtkSignalFunc callb) { GtkWidget *pix; GdkPixmap *pmap; GdkBitmap *bmap; GtkStyle *style; style = gtk_widget_get_default_style(); pmap = gdk_pixmap_create_from_xpm_d(view->main->window, &bmap, &style->bg[GTK_STATE_NORMAL], pixmap); pix = gtk_pixmap_new(pmap, bmap); gtk_toolbar_append_item(tool, text, tip, NULL, pix, (GtkSignalFunc) callb, (gpointer) view); } GtkWidget *gAddButtonFix(sgview *view, gpointer data, GtkFixed *fix, gchar *text, gchar *tip, GtkSignalFunc callb, gint w, gint h, gint x, gint y) { GtkWidget *btn; btn = gtk_button_new_with_label(text); gtk_tooltips_set_tip(view->tips, btn, tip, NULL); if (callb) gtk_signal_connect(GTK_OBJECT (btn), "clicked", (GtkSignalFunc) callb, data); gtk_widget_set_usize(GTK_WIDGET (btn), w, h); gtk_fixed_put(fix, btn, x, y); gtk_widget_show(btn); return(btn); } GtkWidget *gAddButtonBox(sgview *view, gpointer data, GtkBox *box, gchar *text, gchar *tip, GtkSignalFunc callb) { GtkWidget *btn; btn = gtk_button_new_with_label(text); gtk_tooltips_set_tip(view->tips, btn, tip, NULL); if (callb) gtk_signal_connect(GTK_OBJECT (btn), "clicked", (GtkSignalFunc) callb, data); gtk_box_pack_start(box, btn, TRUE, TRUE, 0); gtk_widget_show(btn); return(btn); }