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
void Window::draw()
{
+ //TODO
+ //titlebar, frame
callbacks.display(this);
dirty = false;
}
{
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;
+}