rectangle.hpp 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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, int minimumwidth, int minimumheight, 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_minimumwidth;
  28. int m_minimumheight;
  29. int m_width;
  30. int m_height;
  31. int m_border;
  32. int m_padding;
  33. bool m_flippedx;
  34. bool m_flippedy;
  35. private:
  36. int convertColor( float r, float g, float b );
  37. void constrain( int w, int h );
  38. };
  39. }
  40. #endif // IS_RECTANGLE_H_