9
|
1 /*
|
|
2 * (SLIK) SimpLIstic sKin functions
|
|
3 * (C) 2004 John Ellis
|
|
4 *
|
|
5 * Author: John Ellis
|
|
6 *
|
|
7 * This software is released under the GNU General Public License (GNU GPL).
|
|
8 * Please read the included file COPYING for more information.
|
|
9 * This software comes with no warranty of any kind, use at your own risk!
|
|
10 */
|
|
11
|
|
12
|
|
13 #ifndef UI_TREE_EDIT_H
|
|
14 #define UI_TREE_EDIT_H
|
|
15
|
|
16
|
|
17 typedef struct _TreeEditData TreeEditData;
|
|
18 struct _TreeEditData
|
|
19 {
|
|
20 GtkWidget *window;
|
|
21 GtkWidget *entry;
|
|
22
|
|
23 gchar *old_name;
|
|
24 gchar *new_name;
|
|
25
|
|
26 gint (*edit_func)(TreeEditData *ted, const gchar *oldname, const gchar *newname, gpointer data);
|
|
27 gpointer edit_data;
|
|
28
|
|
29 GtkTreeView *tree;
|
|
30 GtkTreePath *path;
|
|
31 GtkTreeViewColumn *column;
|
|
32 GtkCellRenderer *cell;
|
|
33 };
|
|
34
|
|
35
|
|
36 /*
|
|
37 * edit_func: return TRUE if rename successful, FALSE on failure.
|
|
38 */
|
|
39 gint tree_edit_by_path(GtkTreeView *tree, GtkTreePath *tpath, gint column, const gchar *text,
|
|
40 gint (*edit_func)(TreeEditData *, const gchar *, const gchar *, gpointer), gpointer data);
|
|
41
|
|
42
|
|
43 /* returns location of cell in screen coordinates */
|
|
44 gint tree_view_get_cell_origin(GtkTreeView *widget, GtkTreePath *tpath, gint column, gint text_cell_only,
|
|
45 gint *x, gint *y, gint *width, gint *height);
|
|
46 /* similar to above, but limits the returned area to that of the tree window */
|
|
47 void tree_view_get_cell_clamped(GtkTreeView *widget, GtkTreePath *tpath, gint column, gint text_cell_only,
|
|
48 gint *x, gint *y, gint *width, gint *height);
|
|
49
|
|
50 /* return 0 = row visible, -1 = row is above, 1 = row is below visible region
|
|
51 * if fully_visible is TRUE, the bahavior changes to return -1/1 if _any_ part of the cell is out of view */
|
|
52 gint tree_view_row_get_visibility(GtkTreeView *widget, GtkTreeIter *iter, gint fully_visible);
|
|
53
|
|
54 /* scrolls to make row visible, if necessary
|
|
55 * return is same as above (before the scroll)
|
|
56 */
|
|
57 gint tree_view_row_make_visible(GtkTreeView *widget, GtkTreeIter *iter, gint center);
|
|
58
|
|
59 /* if iter is location of cursor, moves cursor to nearest row */
|
|
60 gint tree_view_move_cursor_away(GtkTreeView *widget, GtkTreeIter *iter, gint only_selected);
|
|
61
|
|
62 /* utility to return row position of given GtkTreePath
|
|
63 */
|
|
64 gint tree_path_to_row(GtkTreePath *tpath);
|
|
65
|
|
66
|
|
67 /* shifts a GdkColor values lighter or darker
|
|
68 * val is percent from 1 to 100, or -1 for default (usually 10%)
|
|
69 * direction is -1 darker, 0 auto, 1 lighter
|
|
70 */
|
|
71 void shift_color(GdkColor *src, gshort val, gint direction);
|
|
72
|
|
73 /*
|
|
74 * Shifts a style's color for given state
|
|
75 * Useful for alternating dark/light rows in lists.
|
|
76 *
|
|
77 * shift_value is 1 to 100, representing the percent of the shift.
|
|
78 */
|
|
79 void style_shift_color(GtkStyle *style, GtkStateType type, gshort shift_value, gint direction);
|
|
80
|
|
81 /*
|
|
82 * The standard shift percent for alternating list row colors
|
|
83 */
|
|
84 #define STYLE_SHIFT_STANDARD 10
|
|
85
|
|
86 /*
|
|
87 * auto scroll, set scroll_speed or region_size to -1 to their respective the defaults
|
|
88 * notify_func will be called before a scroll, return FALSE to turn off autoscroll
|
|
89 */
|
|
90 gint widget_auto_scroll_start(GtkWidget *widget, GtkAdjustment *v_adj, gint scroll_speed, gint region_size,
|
|
91 gint (*notify_func)(GtkWidget *widget, gint x, gint y, gpointer data), gpointer notify_data);
|
|
92 void widget_auto_scroll_stop(GtkWidget *widget);
|
|
93
|
|
94
|
|
95 /*
|
|
96 * Various g_list utils, do not really fit anywhere, so they are here.
|
|
97 */
|
|
98 GList *uig_list_insert_link(GList *list, GList *link, gpointer data);
|
|
99 GList *uig_list_insert_list(GList *parent, GList *insert_link, GList *list);
|
|
100
|
|
101
|
|
102 #endif
|