hgui.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef HV_GUI_H_
  2. #define HV_GUI_H_
  3. typedef unsigned int HColor; // 0xAARRGGBB
  4. #define CLR_B(c) (c & 0xff)
  5. #define CLR_G(c) ((c >> 8) & 0xff)
  6. #define CLR_R(c) ((c >> 16) & 0xff)
  7. #define CLR_A(c) ((c >> 24) & 0xff)
  8. #define ARGB(a, r, g, b) MAKE_FOURCC(a, r, g, b)
  9. typedef struct hpoint_s {
  10. int x;
  11. int y;
  12. #ifdef __cplusplus
  13. hpoint_s() {
  14. x = y = 0;
  15. }
  16. hpoint_s(int x, int y) {
  17. this->x = x;
  18. this->y = y;
  19. }
  20. #endif
  21. } HPoint;
  22. typedef struct hsize_s {
  23. int w;
  24. int h;
  25. #ifdef __cplusplus
  26. hsize_s() {
  27. w = h = 0;
  28. }
  29. hsize_s(int w, int h) {
  30. this->w = w;
  31. this->h = h;
  32. }
  33. #endif
  34. } HSize;
  35. typedef struct hrect_s {
  36. int x;
  37. int y;
  38. int w;
  39. int h;
  40. #ifdef __cplusplus
  41. hrect_s() {
  42. x = y = w = h = 0;
  43. }
  44. hrect_s(int x, int y, int w, int h) {
  45. this->x = x;
  46. this->y = y;
  47. this->w = w;
  48. this->h = h;
  49. }
  50. int left() {return x;}
  51. int right() {return x+w;}
  52. int top() {return y;}
  53. int bottom() {return y+h;}
  54. #endif
  55. } HRect;
  56. #endif // HV_GUI_H_