X-Git-Url: https://eleni.mutantstargoat.com/git/?p=winnie;a=blobdiff_plain;f=src%2Fwindow.cc;h=84d1004c34a726659911dd46d5034d648aa79301;hp=76c51773ac66fd900a0db1cbe013283ef0bd1320;hb=5deac1a20d178aa7d2e8bb5cbc79b6584c6287f5;hpb=8a92836b3af157fd47c657cfe546887e5f5683a8 diff --git a/src/window.cc b/src/window.cc index 76c5177..84d1004 100644 --- a/src/window.cc +++ b/src/window.cc @@ -22,6 +22,17 @@ const Rect &Window::get_rect() const return rect; } +bool Window::contains_point(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 @@ -57,6 +68,8 @@ void Window::invalidate() void Window::draw() { + //TODO + //titlebar, frame callbacks.display(this); dirty = false; } @@ -71,3 +84,43 @@ int Window::get_scanline_width() { return get_screen_size().x; } + +void Window::set_display_callback(DisplayFuncType func) +{ + callbacks.display = func; +} + +void Window::set_keyboard_callback(KeyboardFuncType func) +{ + callbacks.keyboard = func; +} + +void Window::set_mouse_button_callback(MouseButtonFuncType func) +{ + callbacks.button = func; +} + +void Window::set_mouse_motion_callback(MouseMotionFuncType func) +{ + callbacks.motion = func; +} + +const DisplayFuncType Window::get_display_callback() const +{ + return callbacks.display; +} + +const KeyboardFuncType Window::get_keyboard_callback() const +{ + return callbacks.keyboard; +} + +const MouseButtonFuncType Window::get_mouse_button_callback() const +{ + return callbacks.button; +} + +const MouseMotionFuncType Window::get_mouse_motion_callback() const +{ + return callbacks.motion; +}