regedit: add multicolumn list widget
[Samba.git] / source3 / utils / regedit_treeview.h
blobcd17a3c265ea4f71c80c1fa273c67658a3ae666f
1 /*
2 * Samba Unix/Linux SMB client library
3 * Registry Editor
4 * Copyright (C) Christopher Davis 2012
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.
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.
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/>.
20 #ifndef _REGEDIT_TREEVIEW_H_
21 #define _REGEDIT_TREEVIEW_H_
23 #include "includes.h"
24 #include <ncurses.h>
25 #include <panel.h>
27 struct registry_key;
29 struct tree_node {
31 char *name;
32 struct registry_key *key;
34 struct tree_node *parent;
35 struct tree_node *child_head;
36 struct tree_node *previous;
37 struct tree_node *next;
40 struct multilist;
42 struct tree_view {
44 struct tree_node *root;
45 WINDOW *window;
46 WINDOW *sub;
47 PANEL *panel;
48 struct multilist *list;
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 void tree_node_free_recursive(struct tree_node *list);
59 size_t tree_node_print_path(WINDOW *label, 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_update(struct tree_view *view, struct tree_node *list);
69 bool tree_node_has_children(struct tree_node *node);
70 WERROR tree_node_load_children(struct tree_node *node);
71 void tree_node_insert_sorted(struct tree_node *list, struct tree_node *node);
72 bool tree_view_is_node_visible(struct tree_view *view, struct tree_node *node);
73 void tree_view_set_current_node(struct tree_view *view, struct tree_node *node);
74 struct tree_node *tree_view_get_current_node(struct tree_view *view);
75 void tree_view_driver(struct tree_view *view, int c);
77 #endif