r2228: Made 'Automatic' an icon size, rather than a separate option.
[rox-filer.git] / ROX-Filer / src / view_iface.h
blobbde95d6efe69592db3806c4f11a41ba7d9488da0
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>
13 #include <gdk/gdk.h>
15 typedef enum {
16 /* iter->next moves to selected items only */
17 VIEW_ITER_SELECTED = 1 << 0,
19 /* iteration starts from cursor (first call to next() returns
20 * iter AFTER cursor). If there is no cursor, flag is ignored
21 * (will iterate over everything).
23 VIEW_ITER_FROM_CURSOR = 1 << 1,
25 /* next() moves backwards */
26 VIEW_ITER_BACKWARDS = 1 << 2,
28 /* next() always returns NULL and has no effect */
29 VIEW_ITER_ONE_ONLY = 1 << 3,
31 /* Like FROM_CURSOR, but using the base position. The base is set
32 * from the cursor position when the path minibuffer is opened.
34 VIEW_ITER_FROM_BASE = 1 << 4,
35 } IterFlags;
37 typedef struct _ViewIfaceClass ViewIfaceClass;
39 /* A viewport containing a Collection which also handles redraw.
40 * This is the Collection-based implementation of the View interface.
42 typedef struct _ViewCollection ViewCollection;
44 struct _ViewIter {
45 /* Returns the value last returned by next() */
46 DirItem *(*peek)(ViewIter *iter);
48 DirItem *(*next)(ViewIter *iter);
50 /* private fields */
51 ViewCollection *view_collection; /* XXX (use ->view instead) */
52 ViewIface *view;
53 int i, n_remaining;
54 int flags;
57 struct _ViewIfaceClass {
58 GTypeInterface base_iface;
60 void (*sort)(ViewIface *obj);
61 void (*style_changed)(ViewIface *obj, int flags);
62 gboolean (*autoselect)(ViewIface *obj, const gchar *leaf);
63 void (*add_items)(ViewIface *obj, GPtrArray *items);
64 void (*update_items)(ViewIface *obj, GPtrArray *items);
65 void (*delete_if)(ViewIface *obj,
66 gboolean (*test)(gpointer item, gpointer data),
67 gpointer data);
68 void (*clear)(ViewIface *obj);
69 void (*select_all)(ViewIface *obj);
70 void (*clear_selection)(ViewIface *obj);
71 int (*count_items)(ViewIface *obj);
72 int (*count_selected)(ViewIface *obj);
73 void (*show_cursor)(ViewIface *obj);
75 void (*get_iter)(ViewIface *obj, ViewIter *iter, IterFlags flags);
76 void (*get_iter_at_point)(ViewIface *obj, ViewIter *iter, int x, int y);
77 void (*cursor_to_iter)(ViewIface *obj, ViewIter *iter);
79 void (*set_selected)(ViewIface *obj, ViewIter *iter, gboolean selected);
80 gboolean (*get_selected)(ViewIface *obj, ViewIter *iter);
81 void (*set_frozen)(ViewIface *obj, gboolean frozen);
82 void (*select_only)(ViewIface *obj, ViewIter *iter);
83 void (*wink_item)(ViewIface *obj, ViewIter *iter);
84 void (*autosize)(ViewIface *obj);
85 gboolean (*cursor_visible)(ViewIface *obj);
86 void (*set_base)(ViewIface *obj, ViewIter *iter);
87 void (*start_lasso_box)(ViewIface *obj, GdkEventButton *event);
88 void (*extend_tip)(ViewIface *obj, ViewIter *iter, GString *tip);
91 #define VIEW_TYPE_IFACE (view_iface_get_type())
93 #define VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
94 VIEW_TYPE_IFACE, ViewIface))
96 #define VIEW_IS_IFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
97 VIEW_TYPE_IFACE))
99 #define VIEW_IFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), \
100 VIEW_TYPE_IFACE, ViewIfaceClass))
102 /* Flags for view_style_changed() */
103 enum {
104 VIEW_UPDATE_VIEWDATA = 1 << 0,
105 VIEW_UPDATE_NAME = 1 << 1,
108 GType view_iface_get_type(void);
109 void view_sort(ViewIface *obj);
110 void view_style_changed(ViewIface *obj, int flags);
111 gboolean view_autoselect(ViewIface *obj, const gchar *leaf);
112 void view_add_items(ViewIface *obj, GPtrArray *items);
113 void view_update_items(ViewIface *obj, GPtrArray *items);
114 void view_delete_if(ViewIface *obj,
115 gboolean (*test)(gpointer item, gpointer data),
116 gpointer data);
117 void view_clear(ViewIface *obj);
118 void view_select_all(ViewIface *obj);
119 void view_clear_selection(ViewIface *obj);
120 int view_count_items(ViewIface *obj);
121 int view_count_selected(ViewIface *obj);
122 void view_show_cursor(ViewIface *obj);
124 void view_get_iter(ViewIface *obj, ViewIter *iter, IterFlags flags);
125 void view_get_iter_at_point(ViewIface *obj, ViewIter *iter, int x, int y);
126 void view_get_cursor(ViewIface *obj, ViewIter *iter);
127 void view_cursor_to_iter(ViewIface *obj, ViewIter *iter);
129 void view_set_selected(ViewIface *obj, ViewIter *iter, gboolean selected);
130 gboolean view_get_selected(ViewIface *obj, ViewIter *iter);
131 void view_select_only(ViewIface *obj, ViewIter *iter);
132 void view_freeze(ViewIface *obj);
133 void view_thaw(ViewIface *obj);
134 void view_select_if(ViewIface *obj,
135 gboolean (*test)(ViewIter *iter, gpointer data),
136 gpointer data);
138 void view_wink_item(ViewIface *obj, ViewIter *iter);
139 void view_autosize(ViewIface *obj);
140 gboolean view_cursor_visible(ViewIface *obj);
141 void view_set_base(ViewIface *obj, ViewIter *iter);
142 void view_start_lasso_box(ViewIface *obj, GdkEventButton *event);
143 void view_extend_tip(ViewIface *obj, ViewIter *iter, GString *tip);
145 #endif /* __VIEW_IFACE_H__ */