716832f0c1e4f590d107979861e9334527043799
[platform/upstream/glib.git] / gio / gmenu.h
1 /*
2  * Copyright © 2011 Canonical Ltd.
3  *
4  * This library is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * licence, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17  * USA.
18  *
19  * Author: Ryan Lortie <desrt@desrt.ca>
20  */
21
22 #ifndef __G_MENU_H__
23 #define __G_MENU_H__
24
25 #include <gio/gmenumodel.h>
26
27 G_BEGIN_DECLS
28
29 #define G_TYPE_MENU                                         (g_menu_get_type ())
30 #define G_MENU(inst)                                        (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
31                                                              G_TYPE_MENU, GMenu))
32 #define G_IS_MENU(inst)                                     (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
33                                                              G_TYPE_MENU))
34
35 #define G_TYPE_MENU_ITEM                                    (g_menu_item_get_type ())
36 #define G_MENU_ITEM(inst)                                   (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
37                                                              G_TYPE_MENU_ITEM, GMenuItem))
38 #define G_IS_MENU_ITEM(inst)                                (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
39                                                              G_TYPE_MENU_ITEM))
40
41 typedef struct _GMenuItem                                   GMenuItem;
42 typedef struct _GMenu                                       GMenu;
43
44 GType                   g_menu_get_type                                 (void) G_GNUC_CONST;
45 GMenu *                 g_menu_new                                      (void);
46
47 void                    g_menu_freeze                                   (GMenu              *menu);
48
49 void                    g_menu_insert_item                              (GMenu              *menu,
50                                                                          gint                position,
51                                                                          GMenuItem          *item);
52 void                    g_menu_prepend_item                             (GMenu              *menu,
53                                                                          GMenuItem          *item);
54 void                    g_menu_append_item                              (GMenu              *menu,
55                                                                          GMenuItem          *item);
56 void                    g_menu_remove                                   (GMenu              *menu,
57                                                                          gint                position);
58
59 void                    g_menu_insert                                   (GMenu              *menu,
60                                                                          gint                position,
61                                                                          const gchar        *label,
62                                                                          const gchar        *detailed_action);
63 void                    g_menu_prepend                                  (GMenu              *menu,
64                                                                          const gchar        *label,
65                                                                          const gchar        *detailed_action);
66 void                    g_menu_append                                   (GMenu              *menu,
67                                                                          const gchar        *label,
68                                                                          const gchar        *detailed_action);
69
70 void                    g_menu_insert_section                           (GMenu              *menu,
71                                                                          gint                position,
72                                                                          const gchar        *label,
73                                                                          GMenuModel         *section);
74 void                    g_menu_prepend_section                          (GMenu              *menu,
75                                                                          const gchar        *label,
76                                                                          GMenuModel         *section);
77 void                    g_menu_append_section                           (GMenu              *menu,
78                                                                          const gchar        *label,
79                                                                          GMenuModel         *section);
80
81 void                    g_menu_insert_submenu                           (GMenu              *menu,
82                                                                          gint                position,
83                                                                          const gchar        *label,
84                                                                          GMenuModel         *submenu);
85 void                    g_menu_prepend_submenu                          (GMenu              *menu,
86                                                                          const gchar        *label,
87                                                                          GMenuModel         *submenu);
88 void                    g_menu_append_submenu                           (GMenu              *menu,
89                                                                          const gchar        *label,
90                                                                          GMenuModel         *submenu);
91
92
93 GType                   g_menu_item_get_type                            (void) G_GNUC_CONST;
94 GMenuItem *             g_menu_item_new                                 (const gchar        *label,
95                                                                          const gchar        *detailed_action);
96
97 GMenuItem *             g_menu_item_new_submenu                         (const gchar        *label,
98                                                                          GMenuModel         *submenu);
99
100 GMenuItem *             g_menu_item_new_section                         (const gchar        *label,
101                                                                          GMenuModel         *section);
102
103 void                    g_menu_item_set_attribute_value                 (GMenuItem          *menu_item,
104                                                                          const char         *attribute,
105                                                                          GVariant           *value);
106 void                    g_menu_item_set_attribute                       (GMenuItem          *menu_item,
107                                                                          const char         *attribute,
108                                                                          const gchar        *format_string,
109                                                                          ...);
110 void                    g_menu_item_set_link                            (GMenuItem          *menu_item,
111                                                                          const char         *link,
112                                                                          GMenuModel         *model);
113 void                    g_menu_item_set_label                           (GMenuItem          *menu_item,
114                                                                          const gchar        *label);
115 void                    g_menu_item_set_submenu                         (GMenuItem          *menu_item,
116                                                                          GMenuModel         *submenu);
117 void                    g_menu_item_set_section                         (GMenuItem          *menu_item,
118                                                                          GMenuModel         *section);
119 void                    g_menu_item_set_action_and_target_value         (GMenuItem          *menu_item,
120                                                                          const gchar        *action,
121                                                                          GVariant           *target_value);
122 void                    g_menu_item_set_action_and_target               (GMenuItem          *menu_item,
123                                                                          const gchar        *action,
124                                                                          const gchar        *format_string,
125                                                                          ...);
126 void                    g_menu_item_set_detailed_action                 (GMenuItem          *menu_item,
127                                                                          const gchar        *detailed_action);
128 G_END_DECLS
129
130 #endif /* __G_MENU_H__ */