1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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, bool highlight, 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. bool m_highlight;
  30. private:
  31. XColor convertColor( float r, float g, float b );
  32. void constrain( int w, int h );
  33. };
  34. }
  35. #endif // IS_RECTANGLE_H_