added SDL backend for easier testing
[winnie] / src / window.cc
index f5b1ada..46528b7 100644 (file)
@@ -7,12 +7,14 @@
 
 Window::Window()
 {
+       parent = 0;
        title = 0;
        rect.x = rect.y = 0;
        rect.width = rect.height = 128;
        memset(&callbacks, 0, sizeof callbacks);
        dirty = true;
        managed = true;
+       focusable = true;
 }
 
 Window::~Window()
@@ -30,6 +32,11 @@ const Rect &Window::get_rect() const
        return rect;
 }
 
+const Rect &Window::get_absolute_rect() const
+{
+       return rect;    // TODO implement absolute rectangle thingy
+}
+
 bool Window::contains_point(int ptr_x, int ptr_y)
 {
        return ptr_x >= rect.x && ptr_x < rect.x + rect.width &&
@@ -113,6 +120,16 @@ bool Window::get_managed() const
        return managed;
 }
 
+void Window::set_focusable(bool focusable)
+{
+       this->focusable = focusable;
+}
+
+bool Window::get_focusable() const
+{
+       return focusable;
+}
+
 void Window::set_display_callback(DisplayFuncType func)
 {
        callbacks.display = func;
@@ -172,6 +189,19 @@ void Window::remove_child(Window *win)
        }
 }
 
+Window **Window::get_children()
+{
+       if(children.empty()) {
+               return 0;
+       }
+       return &children[0];
+}
+
+int Window::get_children_count() const
+{
+       return (int)children.size();
+}
+
 const Window *Window::get_parent() const
 {
        return parent;