Sync to Wine-0_9_5:
[reactos.git] / rosapps / mc / src / tree.h
1 #ifndef __TREE_H
2 #define __TREE_H
3
4 typedef struct tree_entry {
5 char *name; /* The full path of directory */
6 int sublevel; /* Number of parent directories (slashes) */
7 long submask; /* Bitmask of existing sublevels after this entry */
8 char *subname; /* The last part of name (the actual name) */
9 int mark; /* Flag: Is this entry marked (e. g. for delete)? */
10 struct tree_entry *next; /* Next item in the list */
11 struct tree_entry *prev; /* Previous item in the list */
12 } tree_entry;
13
14 #include "dlg.h"
15 typedef struct {
16 Widget widget;
17 tree_entry *tree_first; /* First entry in the list */
18 tree_entry *tree_last; /* Last entry in the list */
19 tree_entry *selected_ptr; /* The selected directory */
20 char search_buffer [256]; /* Current search string */
21 int done; /* Flag: exit tree */
22 char check_name [MC_MAXPATHLEN];/* Directory which is been checked */
23 tree_entry *check_start; /* Start of checked subdirectories */
24 tree_entry **tree_shown; /* Entries currently on screen */
25 int is_panel; /* panel or plain widget flag */
26 int active; /* if it's currently selected */
27 int searching; /* Are we on searching mode? */
28 int topdiff; /* The difference between the topmost shown and the selected */
29 } WTree;
30
31 #define tlines(t) (t->is_panel ? t->widget.lines-2 - (show_mini_info ? 2 : 0) : t->widget.lines)
32
33 int tree_init (char *current_dir, int lines);
34 void load_tree (WTree *tree);
35 void save_tree (WTree *tree);
36 void show_tree (WTree *tree);
37 void tree_chdir (WTree *tree, char *dir);
38 void tree_rescan_cmd (WTree *tree);
39 int tree_forget_cmd (WTree *tree);
40 void tree_copy (WTree *tree, char *default_dest);
41 void tree_move (WTree *tree, char *default_dest);
42 void tree_event (WTree *tree, int y);
43 char *tree (char *current_dir);
44
45 int search_tree (WTree *tree, char *text);
46
47 tree_entry *tree_add_entry (WTree *tree, char *name);
48 void tree_remove_entry (WTree *tree, char *name);
49 void tree_destroy (WTree *tree);
50 void tree_check (const char *subname);
51 void start_tree_check (WTree *tree);
52 void do_tree_check (WTree *tree, const char *subname);
53 void end_tree_check (WTree *tree);
54
55 void tree_move_backward (WTree *tree, int i);
56 void tree_move_forward (WTree *tree, int i);
57 int tree_move_to_parent (WTree *tree);
58 void tree_move_to_child (WTree *tree);
59 void tree_move_to_top (WTree *tree);
60 void tree_move_to_bottom (WTree *tree);
61
62 extern int tree_navigation_flag;
63 extern int xtree_mode;
64
65 WTree *tree_new (int is_panel, int y, int x, int lines, int cols);
66 extern WTree *the_tree;
67
68 #ifdef OS2_NT
69 # define MC_TREE "mc.tre"
70 #else
71 # define MC_TREE ".mc/tree"
72 #endif
73
74 #endif