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 if((rect.x <= ptr_x) && ((rect.x + rect.width) >= ptr_x)) {
28 if((rect.y <= ptr_y) && (ptr_y <= (rect.y + rect.height))) {
36 void Window::move(int x, int y)
38 invalidate(); // moved, should redraw, MUST BE CALLED FIRST
43 void Window::resize(int x, int y)
45 invalidate(); // resized, should redraw, MUST BE CALLED FIRST
50 void Window::set_title(const char *s)
54 title = new char[strlen(s) + 1];
58 const char *Window::get_title() const
63 void Window::invalidate()
66 wm->invalidate_region(rect);
73 callbacks.display(this);
77 unsigned char *Window::get_win_start_on_fb()
79 unsigned char *fb = get_framebuffer();
80 return fb + get_color_depth() * (get_screen_size().x * rect.y + rect.x) / 8;
83 int Window::get_scanline_width()
85 return get_screen_size().x;
88 void Window::set_display_callback(DisplayFuncType func)
90 callbacks.display = func;
93 void Window::set_keyboard_callback(KeyboardFuncType func)
95 callbacks.keyboard = func;
98 void Window::set_mouse_button_callback(MouseButtonFuncType func)
100 callbacks.button = func;
103 void Window::set_mouse_motion_callback(MouseMotionFuncType func)
105 callbacks.motion = func;
108 const DisplayFuncType Window::get_display_callback() const
110 return callbacks.display;
113 const KeyboardFuncType Window::get_keyboard_callback() const
115 return callbacks.keyboard;
118 const MouseButtonFuncType Window::get_mouse_button_callback() const
120 return callbacks.button;
123 const MouseMotionFuncType Window::get_mouse_motion_callback() const
125 return callbacks.motion;