X-Git-Url: http://git.mutantstargoat.com?p=winnie;a=blobdiff_plain;f=src%2Fwindow.h;h=b5cc36055711f19362038984ca261aa18846f2f0;hp=3a9cab0209bba2da8de0b842d9f6f73093bd7233;hb=e2626c41c841dbbfb64ddf6341b4e23089036299;hpb=5deac1a20d178aa7d2e8bb5cbc79b6584c6287f5 diff --git a/src/window.h b/src/window.h index 3a9cab0..b5cc360 100644 --- a/src/window.h +++ b/src/window.h @@ -1,22 +1,58 @@ +/* +winnie - an experimental window system + +Copyright (C) 2013 Eleni Maria Stea + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Author: Eleni Maria Stea +*/ + #ifndef WINDOW_H_ #define WINDOW_H_ +#include + #include "geom.h" #include "event.h" class Window { +public: + enum State {STATE_NORMAL, STATE_MINIMIZED, STATE_MAXIMIZED, STATE_SHADED}; + private: char *title; + State state; + Rect rect; + Rect normal_rect; // normal state rectangle managed by the wm + Callbacks callbacks; + std::vector children; + Window* parent; + bool dirty; + bool managed; // whether the wm manages (+decorates) this win + bool focusable; public: Window(); ~Window(); const Rect &get_rect() const; + Rect get_absolute_rect() const; bool contains_point(int ptr_x, int ptr_y); void move(int x, int y); @@ -30,11 +66,20 @@ public: */ void invalidate(); - void draw(); + void draw(Rect *dirty_region); + void draw_children(const Rect &dirty_region); unsigned char *get_win_start_on_fb(); int get_scanline_width(); + void set_managed(bool managed); + bool get_managed() const; + + void set_focusable(bool focusable); + bool get_focusable() const; + + bool get_dirty() const; + void set_display_callback(DisplayFuncType func); void set_keyboard_callback(KeyboardFuncType func); void set_mouse_button_callback(MouseButtonFuncType func); @@ -45,6 +90,19 @@ public: const MouseButtonFuncType get_mouse_button_callback() const; const MouseMotionFuncType get_mouse_motion_callback() const; + // win hierarchy + void add_child(Window *win); + void remove_child(Window *win); + + Window **get_children(); + int get_children_count() const; + + const Window *get_parent() const; + Window *get_parent(); + + void set_state(State state); + State get_state() const; + // XXX remove if not needed friend class WindowManager; };