diff --git a/widgets.cpp b/widgets.cpp new file mode 100644 index 0000000000000000000000000000000000000000..878f29a501e5afb9a01700a01b77ab40cae1ee3b --- /dev/null +++ b/widgets.cpp @@ -0,0 +1,14 @@ +#include "widgets.hpp" +#include "application.hpp" + +using namespace genv; + +Widget::Widget(Application * parent, int x, int y, int sx, int sy) : _parent(parent), _x(x), _y(y), _size_x(sx), _size_y(sy) +{ + _parent->registerWidget(this); +} + +bool Widget::is_selected(int mouse_x, int mouse_y) +{ + return mouse_x > _x && mouse_x < _x + _size_x && mouse_y >_y && mouse_y < _y + _size_y; +}