From f0b19c1a12ad28667a84c177aabb32ed848a5e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Horv=C3=A1th=20=C3=81d=C3=A1m?= <horvath.adam.7@hallgato.ppke.hu> Date: Mon, 20 May 2024 00:00:45 +0000 Subject: [PATCH] =?UTF-8?q?lehet=20v=C3=A9gleges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- widgets.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 widgets.cpp diff --git a/widgets.cpp b/widgets.cpp new file mode 100644 index 0000000..878f29a --- /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; +} -- GitLab