#ifndef CURSETREE_NODE_H #define CURSETREE_NODE_H #ifndef __NCURSES_H typedef struct _win_st WINDOW; #endif /* __NCURSES_H */ #define NODE_CHILD_N 2 /* MACRO: * Get widnow node start x,y coordinates, width, & height. * void NODEDIMS(struct crs_node *node, struct crs_nodedims dims); */ #define GET_WNODEDIMS(dims, node) \ (getbegyx((node)->win, dims.y, dims.x)); \ getmaxyx((node)->win, 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 { enum crs_axis axis; float ratio; struct crs_nodedims *dims; struct crs_node *child[NODE_CHILD_N]; }; }; }; /* === External Interface === */ #endif /* CURSETREE_NODE_H */