r2525: Use stock icons in pinboard and panel menus.
[rox-filer.git] / ROX-Filer / src / view_iface.h
blob1282e0873b3d175ec383d7ff9582d4bd7e955a42
1 /*
2 * ROX-Filer, filer for the ROX desktop project
3 * By Thomas Leonard, <tal197@users.sourceforge.net>.
4 */
6 #ifndef __VIEW_IFACE_H__
7 #define __VIEW_IFACE_H__
9 #define AUTOSCROLL_STEP 20
11 #include <glib-object.h>
12 #include <gdk/gdk.h>
14 typedef enum {
15 /* iter->next moves to selected items only */
16 VIEW_ITER_SELECTED = 1 << 0,
18 /* iteration starts from cursor (first call to next() returns
19 * iter AFTER cursor). If there is no cursor, flag is ignored
20 * (will iterate over everything).
22 VIEW_ITER_FROM_CURSOR = 1 << 1,
24 /* next() moves backwards */
25 VIEW_ITER_BACKWARDS = 1 << 2,
27 /* next() always returns NULL and has no effect */
28 VIEW_ITER_ONE_ONLY = 1 << 3,
30 /* Like FROM_CURSOR, but using the base position. The base is set
31 * from the cursor position when the path minibuffer is opened.
33 VIEW_ITER_FROM_BASE = 1 << 4,
34 } IterFlags;
36 typedef struct _ViewIfaceClass ViewIfaceClass;
38 /* A viewport containing a Collection which also handles redraw.
39 * This is the Collection-based implementation of the View interface.
41 typedef struct _ViewCollection ViewCollection;
43 struct _ViewIter {
44 /* Returns the value last returned by next() */
45 DirItem *(*peek)(ViewIter *iter);
47 DirItem *(*next)(ViewIter *iter);
49 /* private fields */
50 ViewIface *view;
51 int i, n_remaining;
52 int flags;
55 struct _ViewIfaceClass {
56 GTypeInterface base_iface;
58 void (*sort)(ViewIface *obj);
59 void (*style_changed)(ViewIface *obj, int flags);
60 gboolean (*autoselect)(ViewIface *obj, const gchar *leaf);
61 void (*add_items)(ViewIface *obj, GPtrArray *items);
62 void (*update_items)(ViewIface *obj, GPtrArray *items);
63 void (*delete_if)(ViewIface *obj,
64 gboolean (*test)(gpointer item, gpointer data),
65 gpointer data);
66 void (*clear)(ViewIface *obj);
67 void (*select_all)(ViewIface *obj);
68 void (*clear_selection)(ViewIface *obj);
69 int (*count_items)(ViewIface *obj);
70 int (*count_selected)(ViewIface *obj);
71 void (*show_cursor)(ViewIface *obj);
73 void (*get_iter)(ViewIface *obj, ViewIter *iter, IterFlags flags);
74 void (*get_iter_at_point)(ViewIface *obj, ViewIter *iter,
75 GdkWindow *src, int x, int y);
76 void (*cursor_to_iter)(ViewIface *obj, ViewIter *iter);
78 void (*set_selected)(ViewIface *obj, ViewIter *iter, gboolean selected);
79 gboolean (*get_selected)(ViewIface *obj, ViewIter *iter);
80 void (*set_frozen)(ViewIface *obj, gboolean frozen);
81 void (*select_only)(ViewIface *obj, ViewIter *iter);
82 void (*wink_item)(ViewIface *obj, ViewIter *iter);
83 void (*autosize)(ViewIface *obj);
84 gboolean (*cursor_visible)(ViewIface *obj);
85 void (*set_base)(ViewIface *obj, ViewIter *iter);
86 void (*start_lasso_box)(ViewIface *obj, GdkEventButton *event);
87 void (*extend_tip)(ViewIface *obj, ViewIter *iter, GString *tip);
88 gboolean (*auto_scroll_callback)(ViewIface *obj);
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,
106 VIEW_UPDATE_HEADERS = 1 << 2,
109 GType view_iface_get_type(void);
110 void view_sort(ViewIface *obj);
111 void view_style_changed(ViewIface *obj, int flags);
112 gboolean view_autoselect(ViewIface *obj, const gchar *leaf);
113 void view_add_items(ViewIface *obj, GPtrArray *items);
114 void view_update_items(ViewIface *obj, GPtrArray *items);
115 void view_delete_if(ViewIface *obj,
116 gboolean (*test)(gpointer item, gpointer data),
117 gpointer data);
118 void view_clear(ViewIface *obj);
119 void view_select_all(ViewIface *obj);
120 void view_clear_selection(ViewIface *obj);
121 int view_count_items(ViewIface *obj);
122 int view_count_selected(ViewIface *obj);
123 void view_show_cursor(ViewIface *obj);
125 void view_get_iter(ViewIface *obj, ViewIter *iter, IterFlags flags);
126 void view_get_iter_at_point(ViewIface *obj, ViewIter *iter,
127 GdkWindow *src, int x, int y);
128 void view_get_cursor(ViewIface *obj, ViewIter *iter);
129 void view_cursor_to_iter(ViewIface *obj, ViewIter *iter);
131 void view_set_selected(ViewIface *obj, ViewIter *iter, gboolean selected);
132 gboolean view_get_selected(ViewIface *obj, ViewIter *iter);
133 void view_select_only(ViewIface *obj, ViewIter *iter);
134 void view_freeze(ViewIface *obj);
135 void view_thaw(ViewIface *obj);
136 void view_select_if(ViewIface *obj,
137 gboolean (*test)(ViewIter *iter, gpointer data),
138 gpointer data);
140 void view_wink_item(ViewIface *obj, ViewIter *iter);
141 void view_autosize(ViewIface *obj);
142 gboolean view_cursor_visible(ViewIface *obj);
143 void view_set_base(ViewIface *obj, ViewIter *iter);
144 void view_start_lasso_box(ViewIface *obj, GdkEventButton *event);
145 void view_extend_tip(ViewIface *obj, ViewIter *iter, GString *tip);
146 gboolean view_auto_scroll_callback(ViewIface *obj);
148 #endif /* __VIEW_IFACE_H__ */