rectangle.hpp 892B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <X11/Xatom.h>
  9. #include <cstdlib>
  10. #include <cmath>
  11. #include <cstdio>
  12. #include <string>
  13. #include <vector>
  14. namespace slop {
  15. class Rectangle {
  16. public:
  17. Rectangle( int sx, int sy, int ex, int ey, int border, float r, float g, float b, float a );
  18. ~Rectangle();
  19. void setPos( int x, int y );
  20. void setDim( int w, int h );
  21. void setGeo( int x, int y, int w, int h );
  22. Window m_window;
  23. XColor m_color;
  24. int m_x;
  25. int m_y;
  26. int m_width;
  27. int m_height;
  28. int m_border;
  29. private:
  30. int convertColor( float r, float g, float b );
  31. void constrain( int w, int h );
  32. };
  33. }
  34. #endif // IS_RECTANGLE_H_