X-Git-Url: https://eleni.mutantstargoat.com/git/?p=winnie;a=blobdiff_plain;f=src%2Fwindow.cc;h=f3937f14240c417405b319896d947aa2ac03514b;hp=880a6ed9c98445f78af89b95f754cc3e23a75eaf;hb=52e08b5a5e7d44271d217892372c6c0878484c44;hpb=ffd2c0a0f8b898cb4199a0c63aff255a85cc0f11 diff --git a/src/window.cc b/src/window.cc index 880a6ed..f3937f1 100644 --- a/src/window.cc +++ b/src/window.cc @@ -22,6 +22,17 @@ const Rect &Window::get_rect() const return rect; } +bool Window::contains_ptr(int ptr_x, int ptr_y) +{ + if((rect.x <= ptr_x) && ((rect.x + rect.width) >= ptr_x)) { + if((rect.y <= ptr_y) && (ptr_y <= (rect.y + rect.height))) { + return true; + } + } + + return false; +} + void Window::move(int x, int y) { invalidate(); // moved, should redraw, MUST BE CALLED FIRST