Visual C++ projects: Clean/fix up
[glib.git] / gio / gmenumodel.h
blob689c2ced2267ddcbb468f9edd6bbb1cf96ab9224
1 /*
2 * Copyright © 2011 Canonical Ltd.
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.
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.
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.
19 * Author: Ryan Lortie <desrt@desrt.ca>
22 #ifndef __G_MENU_MODEL_H__
23 #define __G_MENU_MODEL_H__
25 #include <glib-object.h>
27 #include <gio/giotypes.h>
29 G_BEGIN_DECLS
31 #define G_MENU_ATTRIBUTE_ACTION "action"
32 #define G_MENU_ATTRIBUTE_TARGET "target"
33 #define G_MENU_ATTRIBUTE_LABEL "label"
35 #define G_MENU_LINK_SUBMENU "submenu"
36 #define G_MENU_LINK_SECTION "section"
38 #define G_TYPE_MENU_MODEL (g_menu_model_get_type ())
39 #define G_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
40 G_TYPE_MENU_MODEL, GMenuModel))
41 #define G_MENU_MODEL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
42 G_TYPE_MENU_MODEL, GMenuModelClass))
43 #define G_IS_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
44 G_TYPE_MENU_MODEL))
45 #define G_IS_MENU_MODEL_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
46 G_TYPE_MENU_MODEL))
47 #define G_MENU_MODEL_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
48 G_TYPE_MENU_MODEL, GMenuModelClass))
50 typedef struct _GMenuModelPrivate GMenuModelPrivate;
51 typedef struct _GMenuModelClass GMenuModelClass;
53 typedef struct _GMenuAttributeIterPrivate GMenuAttributeIterPrivate;
54 typedef struct _GMenuAttributeIterClass GMenuAttributeIterClass;
55 typedef struct _GMenuAttributeIter GMenuAttributeIter;
57 typedef struct _GMenuLinkIterPrivate GMenuLinkIterPrivate;
58 typedef struct _GMenuLinkIterClass GMenuLinkIterClass;
59 typedef struct _GMenuLinkIter GMenuLinkIter;
61 struct _GMenuModel
63 GObject parent_instance;
64 GMenuModelPrivate *priv;
67 struct _GMenuModelClass
69 GObjectClass parent_class;
71 gboolean (*is_mutable) (GMenuModel *model);
72 gint (*get_n_items) (GMenuModel *model);
73 void (*get_item_attributes) (GMenuModel *model,
74 gint item_index,
75 GHashTable **attributes);
76 GMenuAttributeIter * (*iterate_item_attributes) (GMenuModel *model,
77 gint item_index);
78 GVariant * (*get_item_attribute_value) (GMenuModel *model,
79 gint item_index,
80 const gchar *attribute,
81 const GVariantType *expected_type);
82 void (*get_item_links) (GMenuModel *model,
83 gint item_index,
84 GHashTable **links);
85 GMenuLinkIter * (*iterate_item_links) (GMenuModel *model,
86 gint item_index);
87 GMenuModel * (*get_item_link) (GMenuModel *model,
88 gint item_index,
89 const gchar *link);
92 GType g_menu_model_get_type (void) G_GNUC_CONST;
94 gboolean g_menu_model_is_mutable (GMenuModel *model);
95 gint g_menu_model_get_n_items (GMenuModel *model);
97 GMenuAttributeIter * g_menu_model_iterate_item_attributes (GMenuModel *model,
98 gint item_index);
99 GVariant * g_menu_model_get_item_attribute_value (GMenuModel *model,
100 gint item_index,
101 const gchar *attribute,
102 const GVariantType *expected_type);
103 gboolean g_menu_model_get_item_attribute (GMenuModel *model,
104 gint item_index,
105 const gchar *attribute,
106 const gchar *format_string,
107 ...);
108 GMenuLinkIter * g_menu_model_iterate_item_links (GMenuModel *model,
109 gint item_index);
110 GMenuModel * g_menu_model_get_item_link (GMenuModel *model,
111 gint item_index,
112 const gchar *link);
114 void g_menu_model_items_changed (GMenuModel *model,
115 gint position,
116 gint removed,
117 gint added);
120 #define G_TYPE_MENU_ATTRIBUTE_ITER (g_menu_attribute_iter_get_type ())
121 #define G_MENU_ATTRIBUTE_ITER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
122 G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIter))
123 #define G_MENU_ATTRIBUTE_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
124 G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterClass))
125 #define G_IS_MENU_ATTRIBUTE_ITER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
126 G_TYPE_MENU_ATTRIBUTE_ITER))
127 #define G_IS_MENU_ATTRIBUTE_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
128 G_TYPE_MENU_ATTRIBUTE_ITER))
129 #define G_MENU_ATTRIBUTE_ITER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
130 G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterClass))
132 struct _GMenuAttributeIter
134 GObject parent_instance;
135 GMenuAttributeIterPrivate *priv;
138 struct _GMenuAttributeIterClass
140 GObjectClass parent_class;
142 gboolean (*get_next) (GMenuAttributeIter *iter,
143 const gchar **out_type,
144 GVariant **value);
147 GType g_menu_attribute_iter_get_type (void) G_GNUC_CONST;
149 gboolean g_menu_attribute_iter_get_next (GMenuAttributeIter *iter,
150 const gchar **out_name,
151 GVariant **value);
152 gboolean g_menu_attribute_iter_next (GMenuAttributeIter *iter);
153 const gchar * g_menu_attribute_iter_get_name (GMenuAttributeIter *iter);
154 GVariant * g_menu_attribute_iter_get_value (GMenuAttributeIter *iter);
157 #define G_TYPE_MENU_LINK_ITER (g_menu_link_iter_get_type ())
158 #define G_MENU_LINK_ITER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
159 G_TYPE_MENU_LINK_ITER, GMenuLinkIter))
160 #define G_MENU_LINK_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
161 G_TYPE_MENU_LINK_ITER, GMenuLinkIterClass))
162 #define G_IS_MENU_LINK_ITER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
163 G_TYPE_MENU_LINK_ITER))
164 #define G_IS_MENU_LINK_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
165 G_TYPE_MENU_LINK_ITER))
166 #define G_MENU_LINK_ITER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
167 G_TYPE_MENU_LINK_ITER, GMenuLinkIterClass))
169 struct _GMenuLinkIter
171 GObject parent_instance;
172 GMenuLinkIterPrivate *priv;
175 struct _GMenuLinkIterClass
177 GObjectClass parent_class;
179 gboolean (*get_next) (GMenuLinkIter *iter,
180 const gchar **out_name,
181 GMenuModel **value);
184 GType g_menu_link_iter_get_type (void) G_GNUC_CONST;
186 gboolean g_menu_link_iter_get_next (GMenuLinkIter *iter,
187 const gchar **out_link,
188 GMenuModel **value);
189 gboolean g_menu_link_iter_next (GMenuLinkIter *iter);
190 const gchar * g_menu_link_iter_get_name (GMenuLinkIter *iter);
191 GMenuModel * g_menu_link_iter_get_value (GMenuLinkIter *iter);
193 G_END_DECLS
195 #endif /* __G_MENU_MODEL_H__ */