dorne/cursetree/dims.h

42 lines
1,006 B
C
Raw Normal View History

#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(const int x, const int y, const int width, const 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);
#endif /* CURSETREE_DIMS_H */