s3:locking: pass servicename_new to leases_db_rename()
[Samba.git] / source3 / utils / regedit_treeview.h
blob4b892bbb84e4fec43fe465e5c8990ebbabe85b6e
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 registry_context;
53 struct tree_node *tree_node_new(TALLOC_CTX *ctx, struct tree_node *parent,
54 const char *name, struct registry_key *key);
55 struct tree_node *tree_node_new_root(TALLOC_CTX *ctx,
56 struct registry_context *regctx);
57 #define tree_node_is_root(node) ((node)->key == NULL)
58 #define tree_node_is_top_level(node) tree_node_is_root((node)->parent)
59 void tree_node_append(struct tree_node *left, struct tree_node *right);
60 struct tree_node *tree_node_pop(struct tree_node **plist);
61 struct tree_node *tree_node_first(struct tree_node *list);
62 struct tree_node *tree_node_last(struct tree_node *list);
63 bool tree_node_next(struct tree_node **node, bool depth, WERROR *err);
64 bool tree_node_prev(struct tree_node **node, bool depth, WERROR *err);
65 void tree_node_append_last(struct tree_node *list, struct tree_node *node);
66 size_t tree_node_print_path(WINDOW *label, struct tree_node *node);
67 const char **tree_node_get_path(TALLOC_CTX *ctx, struct tree_node *node);
68 struct tree_view *tree_view_new(TALLOC_CTX *ctx, struct tree_node *root,
69 int nlines, int ncols,
70 int begin_y, int begin_x);
71 void tree_view_set_selected(struct tree_view *view, bool select);
72 void tree_view_resize(struct tree_view *view, int nlines, int ncols,
73 int begin_y, int begin_x);
74 void tree_view_show(struct tree_view *view);
75 void tree_view_clear(struct tree_view *view);
76 WERROR tree_view_set_root(struct tree_view *view, struct tree_node *root);
77 WERROR tree_view_set_path(struct tree_view *view, const char **path);
78 WERROR tree_view_update(struct tree_view *view, struct tree_node *list);
79 WERROR tree_node_reopen_key(struct registry_context *ctx,
80 struct tree_node *node);
81 bool tree_node_has_children(struct tree_node *node);
82 WERROR tree_node_load_children(struct tree_node *node);
83 void tree_node_insert_sorted(struct tree_node *list, struct tree_node *node);
84 bool tree_view_is_node_visible(struct tree_view *view, struct tree_node *node);
85 void tree_view_set_current_node(struct tree_view *view, struct tree_node *node);
86 struct tree_node *tree_view_get_current_node(struct tree_view *view);
87 void tree_view_driver(struct tree_view *view, int c);
89 #endif