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