rect.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /** \file rect.h
  2. * \brief Header: rectangular class
  3. */
  4. #ifndef MC__WIDGET_RECT_H
  5. #define MC__WIDGET_RECT_H
  6. /*** typedefs (not structures) and defined constants *********************************************/
  7. #define RECT(x) ((WRect *)(x))
  8. #define CONST_RECT(x) ((const WRect *)(x))
  9. /*** enums ***************************************************************************************/
  10. /*** structures declarations (and typedefs of structures) ****************************************/
  11. struct WRect;
  12. typedef struct WRect WRect;
  13. struct WRect
  14. {
  15. int y;
  16. int x;
  17. int lines;
  18. int cols;
  19. };
  20. /*** global variables defined in .c file *********************************************************/
  21. /*** declarations of public functions ************************************************************/
  22. WRect *rect_new (int y, int x, int lines, int cols);
  23. void rect_init (WRect * r, int y, int x, int lines, int cols);
  24. void rect_move (WRect * r, int dy, int dx);
  25. void rect_resize (WRect * r, int dl, int dc);
  26. void rect_grow (WRect * r, int dl, int dc);
  27. void rect_intersect (WRect * r, const WRect * r1);
  28. void rect_union (WRect * r, const WRect * r1);
  29. gboolean rects_are_overlapped (const WRect * r1, const WRect * r2);
  30. gboolean rects_are_equal (const WRect * r1, const WRect * r2);
  31. /*** inline functions ****************************************************************************/
  32. #endif /* MC__WIDGET_RECT_H */