10 rect.width = rect.height = 128;
11 memset(&callbacks, 0, sizeof callbacks);
20 const Rect &Window::get_rect() const
25 bool Window::contains_point(int ptr_x, int ptr_y)
27 return ptr_x >= rect.x && ptr_x < rect.x + rect.width &&
28 ptr_y >= rect.y && ptr_y < rect.y + rect.height;
31 void Window::move(int x, int y)
33 invalidate(); // moved, should redraw, MUST BE CALLED FIRST
38 void Window::resize(int x, int y)
40 invalidate(); // resized, should redraw, MUST BE CALLED FIRST
45 void Window::set_title(const char *s)
49 title = new char[strlen(s) + 1];
53 const char *Window::get_title() const
58 void Window::invalidate()
61 wm->invalidate_region(rect);
68 callbacks.display(this);
72 unsigned char *Window::get_win_start_on_fb()
74 unsigned char *fb = get_framebuffer();
75 return fb + get_color_depth() * (get_screen_size().x * rect.y + rect.x) / 8;
78 int Window::get_scanline_width()
80 return get_screen_size().x;
83 void Window::set_display_callback(DisplayFuncType func)
85 callbacks.display = func;
88 void Window::set_keyboard_callback(KeyboardFuncType func)
90 callbacks.keyboard = func;
93 void Window::set_mouse_button_callback(MouseButtonFuncType func)
95 callbacks.button = func;
98 void Window::set_mouse_motion_callback(MouseMotionFuncType func)
100 callbacks.motion = func;
103 const DisplayFuncType Window::get_display_callback() const
105 return callbacks.display;
108 const KeyboardFuncType Window::get_keyboard_callback() const
110 return callbacks.keyboard;
113 const MouseButtonFuncType Window::get_mouse_button_callback() const
115 return callbacks.button;
118 const MouseMotionFuncType Window::get_mouse_motion_callback() const
120 return callbacks.motion;