58 lines
1.1 KiB
C
58 lines
1.1 KiB
C
#ifndef DORNE_TREE_H
|
|
#define DORNE_TREE_H
|
|
|
|
# ifndef __NCURSES_H
|
|
typedef struct _win_st WINDOW;
|
|
# endif /* __NCURSES_H */
|
|
|
|
#define NODE_CHILD_N 2
|
|
|
|
/* MACRO:
|
|
* void NODEDIMS(struct crs_node *node, struct crs_nodedims dims);
|
|
*/
|
|
#define NODEDIMS(node, dims) (getbegyx(dims.y, dims.x); getmaxyx(dims.y, dims.x))
|
|
|
|
enum crs_nodetype {
|
|
NODE_WINDOW,
|
|
NODE_ABSTRACT,
|
|
};
|
|
|
|
/* Stores a node's starting x,y coordinates, width, & height.
|
|
* NOTE: Intended for interfunction communication.
|
|
*/
|
|
struct crs_nodedims {
|
|
int x, y, width, height;
|
|
};
|
|
|
|
enum crs_axis {
|
|
AXIS_X,
|
|
AXIS_Y,
|
|
};
|
|
|
|
struct crs_node {
|
|
enum crs_nodetype type;
|
|
// union value depends on crs_node.type
|
|
union {
|
|
WINDOW *win;
|
|
struct {
|
|
float ratio;
|
|
struct crs_node *child[NODE_CHILD_N];
|
|
};
|
|
};
|
|
};
|
|
|
|
struct crs_tree {
|
|
WINDOW *stdscr;
|
|
struct crs_node *root;
|
|
};
|
|
|
|
/* === External Interface === */
|
|
// struct crs_node *init_node_window(void);
|
|
// struct crs_node *init_node_abstract(void);
|
|
// void destroy_node(struct crs_node *node);
|
|
|
|
int init_tree(struct crs_tree **tree);
|
|
void update_tree(struct crs_tree *tree);
|
|
void destroy_tree(struct crs_tree *tree);
|
|
|
|
#endif /* DORNE_TREE_H */
|