rectangle.hpp 860B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 sx, int sy, int ex, int ey, int border, 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_width;
  26. int m_height;
  27. int m_border;
  28. private:
  29. int convertColor( float r, float g, float b );
  30. void constrain( int w, int h );
  31. };
  32. }
  33. #endif // IS_RECTANGLE_H_