rectangle.hpp 995B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // rectangle.hpp: handles creating rectangles on screen.
  2. #ifndef IS_RECTANGLE_H_
  3. #define IS_RECTANGLE_H_
  4. #include "x.hpp"
  5. #include <unistd.h>
  6. #include <X11/Xlib.h>
  7. #include <X11/extensions/shape.h>
  8. #include <cstdlib>
  9. #include <cmath>
  10. #include <cstdio>
  11. #include <string>
  12. #include <vector>
  13. namespace slop {
  14. class Rectangle {
  15. public:
  16. Rectangle( int x, int y, int width, int height, int border, int padding, float r, float g, float b );
  17. ~Rectangle();
  18. void setPos( int x, int y );
  19. void setDim( int w, int h );
  20. void setGeo( int x, int y, int w, int h );
  21. Window m_window;
  22. XColor m_color;
  23. int m_x;
  24. int m_y;
  25. int m_xoffset;
  26. int m_yoffset;
  27. int m_width;
  28. int m_height;
  29. int m_border;
  30. int m_padding;
  31. bool m_flippedx;
  32. bool m_flippedy;
  33. private:
  34. int convertColor( float r, float g, float b );
  35. void constrain( int w, int h );
  36. };
  37. }
  38. #endif // IS_RECTANGLE_H_