r1824: Internal changes: moved menu and toolbar over to View interface.
[rox-filer.git] / ROX-Filer / src / view_iface.h
blob30987e656f917708f9f568cdaa055c98c087a852
1 /*
2 * $Id$
5 * ROX-Filer, filer for the ROX desktop project
6 * By Thomas Leonard, <tal197@users.sourceforge.net>.
7 */
9 #ifndef __VIEW_IFACE_H__
10 #define __VIEW_IFACE_H__
12 #include <glib-object.h>
14 enum {
15 VIEW_ITER_SELECTED = 1 << 0,
18 typedef struct _ViewIfaceClass ViewIfaceClass;
20 struct _ViewIter {
21 /* Returns the value last returned by next() */
22 DirItem *(*peek)(ViewIter *iter);
24 DirItem *(*next)(ViewIter *iter);
26 /* private fields */
27 Collection *collection;
28 int i, n_remaining;
29 int flags;
32 struct _ViewIfaceClass {
33 GTypeInterface base_iface;
35 void (*sort)(ViewIface *obj);
36 void (*style_changed)(ViewIface *obj, int flags);
37 gboolean (*autoselect)(ViewIface *obj, const gchar *leaf);
38 void (*add_items)(ViewIface *obj, GPtrArray *items);
39 void (*update_items)(ViewIface *obj, GPtrArray *items);
40 void (*delete_if)(ViewIface *obj,
41 gboolean (*test)(gpointer item, gpointer data),
42 gpointer data);
43 void (*clear)(ViewIface *obj);
44 void (*select_all)(ViewIface *obj);
45 void (*clear_selection)(ViewIface *obj);
46 int (*count_items)(ViewIface *obj);
47 int (*count_selected)(ViewIface *obj);
48 void (*show_cursor)(ViewIface *obj);
50 void (*get_iter)(ViewIface *obj, ViewIter *iter);
51 void (*get_cursor)(ViewIface *obj, ViewIter *iter);
52 void (*cursor_to_iter)(ViewIface *obj, ViewIter *iter);
54 void (*set_selected)(ViewIface *obj, ViewIter *iter, gboolean selected);
55 gboolean (*get_selected)(ViewIface *obj, ViewIter *iter);
56 void (*set_frozen)(ViewIface *obj, gboolean frozen);
57 void (*select_only)(ViewIface *obj, ViewIter *iter);
58 void (*wink_item)(ViewIface *obj, ViewIter *iter);
61 #define VIEW_TYPE_IFACE (view_iface_get_type())
63 #define VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
64 VIEW_TYPE_IFACE, ViewIface))
66 #define VIEW_IS_IFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
67 VIEW_TYPE_IFACE))
69 #define VIEW_IFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
70 VIEW_TYPE_IFACE, ViewIfaceClass))
72 /* Flags for view_style_changed() */
73 enum {
74 VIEW_UPDATE_VIEWDATA = 1 << 0,
75 VIEW_UPDATE_NAME = 1 << 1,
78 GType view_iface_get_type(void);
79 void view_sort(ViewIface *obj);
80 void view_style_changed(ViewIface *obj, int flags);
81 gboolean view_autoselect(ViewIface *obj, const gchar *leaf);
82 void view_add_items(ViewIface *obj, GPtrArray *items);
83 void view_update_items(ViewIface *obj, GPtrArray *items);
84 void view_delete_if(ViewIface *obj,
85 gboolean (*test)(gpointer item, gpointer data),
86 gpointer data);
87 void view_clear(ViewIface *obj);
88 void view_select_all(ViewIface *obj);
89 void view_clear_selection(ViewIface *obj);
90 int view_count_items(ViewIface *obj);
91 int view_count_selected(ViewIface *obj);
92 void view_show_cursor(ViewIface *obj);
94 void view_get_iter(ViewIface *obj, ViewIter *iter, int flags);
95 void view_get_cursor(ViewIface *obj, ViewIter *iter);
96 void view_cursor_to_iter(ViewIface *obj, ViewIter *iter);
98 void view_set_selected(ViewIface *obj, ViewIter *iter, gboolean selected);
99 gboolean view_get_selected(ViewIface *obj, ViewIter *iter);
100 void view_select_only(ViewIface *obj, ViewIter *iter);
101 void view_freeze(ViewIface *obj);
102 void view_thaw(ViewIface *obj);
103 void view_select_if(ViewIface *obj,
104 gboolean (*test)(ViewIter *iter, gpointer data),
105 gpointer data);
107 void view_wink_item(ViewIface *obj, ViewIter *iter);
109 #endif /* __VIEW_IFACE_H__ */