regedit: add a refresh command to clear cache and reload current path
[samba.git] / source3 / utils / regedit_treeview.h
1 /*
2  * Samba Unix/Linux SMB client library
3  * Registry Editor
4  * Copyright (C) Christopher Davis 2012
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef _REGEDIT_TREEVIEW_H_
21 #define _REGEDIT_TREEVIEW_H_
22
23 #include "includes.h"
24 #include <ncurses.h>
25 #include <panel.h>
26
27 struct registry_key;
28
29 struct tree_node {
30
31         char *name;
32         struct registry_key *key;
33
34         struct tree_node *parent;
35         struct tree_node *child_head;
36         struct tree_node *previous;
37         struct tree_node *next;
38 };
39
40 struct multilist;
41
42 struct tree_view {
43
44         struct tree_node *root;
45         WINDOW *window;
46         WINDOW *sub;
47         PANEL *panel;
48         struct multilist *list;
49 };
50
51 struct tree_node *tree_node_new(TALLOC_CTX *ctx, struct tree_node *parent,
52                                 const char *name, struct registry_key *key);
53 void tree_node_append(struct tree_node *left, struct tree_node *right);
54 struct tree_node *tree_node_pop(struct tree_node **plist);
55 struct tree_node *tree_node_first(struct tree_node *list);
56 struct tree_node *tree_node_last(struct tree_node *list);
57 void tree_node_append_last(struct tree_node *list, struct tree_node *node);
58 size_t tree_node_print_path(WINDOW *label, struct tree_node *node);
59 const char **tree_node_get_path(TALLOC_CTX *ctx, struct tree_node *node);
60 struct tree_view *tree_view_new(TALLOC_CTX *ctx, struct tree_node *root,
61                                 int nlines, int ncols,
62                                 int begin_y, int begin_x);
63 void tree_view_set_selected(struct tree_view *view, bool select);
64 void tree_view_resize(struct tree_view *view, int nlines, int ncols,
65                              int begin_y, int begin_x);
66 void tree_view_show(struct tree_view *view);
67 void tree_view_clear(struct tree_view *view);
68 WERROR tree_view_set_root(struct tree_view *view, struct tree_node *root);
69 WERROR tree_view_set_path(struct tree_view *view, const char **path);
70 WERROR tree_view_update(struct tree_view *view, struct tree_node *list);
71 WERROR tree_node_reopen_key(struct tree_node *node);
72 bool tree_node_has_children(struct tree_node *node);
73 WERROR tree_node_load_children(struct tree_node *node);
74 void tree_node_insert_sorted(struct tree_node *list, struct tree_node *node);
75 bool tree_view_is_node_visible(struct tree_view *view, struct tree_node *node);
76 void tree_view_set_current_node(struct tree_view *view, struct tree_node *node);
77 struct tree_node *tree_view_get_current_node(struct tree_view *view);
78 void tree_view_driver(struct tree_view *view, int c);
79
80 #endif