also abstracted ncurses WINDOW into the ct_surface structure. and added ct_bounds to complement ct_dims.
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
#ifndef CURSETREE_DIMS_H
|
|
#define CURSETREE_DIMS_H
|
|
|
|
#define __BOUND_UNLIMITED (-1)
|
|
#define __BOUND_ABS_MIN (1)
|
|
#define __BOUND_ABS_MAX (INT_MAX)
|
|
#define __BOUND_REL_MIN ((float)0)
|
|
#define __BOUND_REL_MAX ((float)1)
|
|
|
|
enum ct_axis {
|
|
AXIS_X,
|
|
AXIS_Y,
|
|
};
|
|
|
|
enum ct_boundtype {
|
|
BOUND_NONE,
|
|
BOUND_ABSOLUTE,
|
|
BOUND_RELATIVE,
|
|
};
|
|
|
|
/* Stores a node's starting x,y coordinates, width, & height.
|
|
* NOTE: Intended for interfunction communication.
|
|
*/
|
|
struct ct_dims {
|
|
int x, y, width, height;
|
|
};
|
|
|
|
struct ct_bounds {
|
|
enum ct_boundtype type;
|
|
int wmin, wmax, hmin, hmax;
|
|
};
|
|
|
|
struct ct_dims *new_dims(int x, int y, int width, int height);
|
|
struct ct_dims *dup_dims(const struct ct_dims *const dims);
|
|
|
|
struct ct_bounds *bounds_none(void);
|
|
struct ct_bounds *bounds_absolute(int wmin, int wmax, int hmin, int hmax);
|
|
struct ct_bounds *bounds_relative(int wmin, int wmax, int hmin, int hmax);
|
|
struct ct_bounds *dup_bounds(const struct ct_bounds *const bounds);
|
|
|
|
// int bifurcate_dims(const struct ct_dims *const parent_dims,
|
|
// const enum ct_axis axis, const float ratio,
|
|
// struct ct_dims **const dims0, struct ct_dims **const
|
|
// dims1);
|
|
|
|
#endif /* CURSETREE_DIMS_H */
|