Statistics
| Revision:

root / src / menu.h @ 1573

History | View | Annotate | Download (3.2 kB)

1 1 hiro
/*
2 1 hiro
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 909 hiro
 * Copyright (C) 1999-2006 Hiroyuki Yamamoto
4 1 hiro
 *
5 1 hiro
 * This program is free software; you can redistribute it and/or modify
6 1 hiro
 * it under the terms of the GNU General Public License as published by
7 1 hiro
 * the Free Software Foundation; either version 2 of the License, or
8 1 hiro
 * (at your option) any later version.
9 1 hiro
 *
10 1 hiro
 * This program is distributed in the hope that it will be useful,
11 1 hiro
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1 hiro
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 1 hiro
 * GNU General Public License for more details.
14 1 hiro
 *
15 1 hiro
 * You should have received a copy of the GNU General Public License
16 1 hiro
 * along with this program; if not, write to the Free Software
17 1 hiro
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 1 hiro
 */
19 1 hiro
20 1 hiro
#ifndef __MENU_H__
21 1 hiro
#define __MENU_H__
22 1 hiro
23 1 hiro
#include <glib.h>
24 1 hiro
#include <gtk/gtkwidget.h>
25 1 hiro
#include <gtk/gtkitemfactory.h>
26 1 hiro
#include <gtk/gtkmenu.h>
27 1 hiro
#include <gtk/gtkmenushell.h>
28 1 hiro
#include <gtk/gtkoptionmenu.h>
29 1 hiro
30 1 hiro
#define MENU_VAL_ID "Sylpheed::Menu::ValueID"
31 1 hiro
32 896 hiro
#define MENUITEM_ADD(menu, menuitem, label, data)                         \
33 896 hiro
{                                                                         \
34 896 hiro
        if (label)                                                         \
35 909 hiro
                menuitem = gtk_menu_item_new_with_label(label);                 \
36 909 hiro
        else {                                                                 \
37 909 hiro
                menuitem = gtk_menu_item_new();                                 \
38 909 hiro
                gtk_widget_set_sensitive(menuitem, FALSE);                 \
39 909 hiro
        }                                                                 \
40 909 hiro
        gtk_widget_show(menuitem);                                         \
41 909 hiro
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);                 \
42 909 hiro
        if (data)                                                         \
43 909 hiro
                g_object_set_data(G_OBJECT(menuitem),                         \
44 909 hiro
                                  MENU_VAL_ID,                                 \
45 909 hiro
                                  GINT_TO_POINTER(data));                 \
46 909 hiro
}
47 909 hiro
48 909 hiro
#define MENUITEM_ADD_WITH_MNEMONIC(menu, menuitem, label, data)                 \
49 909 hiro
{                                                                         \
50 909 hiro
        if (label)                                                         \
51 896 hiro
                menuitem = gtk_menu_item_new_with_mnemonic(label);         \
52 896 hiro
        else {                                                                 \
53 896 hiro
                menuitem = gtk_menu_item_new();                                 \
54 896 hiro
                gtk_widget_set_sensitive(menuitem, FALSE);                 \
55 896 hiro
        }                                                                 \
56 896 hiro
        gtk_widget_show(menuitem);                                         \
57 896 hiro
        gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);                 \
58 896 hiro
        if (data)                                                         \
59 896 hiro
                g_object_set_data(G_OBJECT(menuitem),                         \
60 896 hiro
                                  MENU_VAL_ID,                                 \
61 896 hiro
                                  GINT_TO_POINTER(data));                 \
62 1 hiro
}
63 1 hiro
64 1 hiro
#define menu_set_insensitive_all(menu_shell) \
65 1 hiro
        menu_set_sensitive_all(menu_shell, FALSE);
66 1 hiro
67 1 hiro
GtkWidget *menubar_create        (GtkWidget                *window,
68 1 hiro
                                 GtkItemFactoryEntry        *entries,
69 1 hiro
                                 guint                         n_entries,
70 1 hiro
                                 const gchar                *path,
71 1 hiro
                                 gpointer                 data);
72 1 hiro
GtkWidget *menu_create_items        (GtkItemFactoryEntry        *entries,
73 1 hiro
                                 guint                         n_entries,
74 1 hiro
                                 const gchar                *path,
75 1 hiro
                                 GtkItemFactory               **factory,
76 1 hiro
                                 gpointer                 data);
77 1 hiro
78 1 hiro
GString *menu_factory_get_rc        (const gchar                *path);
79 1 hiro
void menu_factory_clear_rc        (const gchar                *rc_str);
80 1 hiro
void menu_factory_copy_rc        (const gchar                *src_path,
81 1 hiro
                                 const gchar                *dest_path);
82 1 hiro
83 1 hiro
void menu_set_sensitive                (GtkItemFactory                *ifactory,
84 1 hiro
                                 const gchar                *path,
85 1 hiro
                                 gboolean                 sensitive);
86 1 hiro
void menu_set_sensitive_all        (GtkMenuShell                *menu_shell,
87 1 hiro
                                 gboolean                 sensitive);
88 1 hiro
89 1 hiro
void menu_set_active                (GtkItemFactory                *ifactory,
90 1 hiro
                                 const gchar                *path,
91 1 hiro
                                 gboolean                 is_active);
92 1 hiro
93 1 hiro
void menu_button_position        (GtkMenu                *menu,
94 1 hiro
                                 gint                        *x,
95 1 hiro
                                 gint                        *y,
96 1 hiro
                                 gboolean                *push_in,
97 1 hiro
                                 gpointer                 user_data);
98 1 hiro
99 1 hiro
gint menu_find_option_menu_index(GtkOptionMenu                *optmenu,
100 1 hiro
                                 gpointer                 data,
101 1 hiro
                                 GCompareFunc                 func);
102 1 hiro
103 1 hiro
gint menu_get_option_menu_active_index
104 1 hiro
                                (GtkOptionMenu                *optmenu);
105 1 hiro
106 1 hiro
#endif /* __MENU_H__ */