3 * (c) 2010 Alexander Warg <warg@os.inf.tu-dresden.de>
4 * economic rights: Technische Universität Dresden (Germany)
6 * This file is part of TUD:OS and distributed under the terms of the
7 * GNU General Public License 2.
8 * Please see the COPYING-GPL-2 file for details.
12 #include <l4/re/video/view>
14 #include <l4/mag-gfx/canvas>
15 #include <l4/mag/server/view>
19 namespace Mag_server {
21 using namespace Mag_gfx;
26 class Dummy_view : public View
29 Dummy_view() : View(Rect(Point(0,0), Area(0,0)), F_ignore) {}
30 void draw(Canvas *, View_stack const *, Mode) const {}
34 View *const _no_stay_top;
36 View *const _background;
40 L4Re::Video::View *_canvas_view;
43 Dummy_view _no_stay_top_v;
45 View *top() const { return _top; }
47 Rect outline(View const *v) const;
49 void draw_frame(View const *v) const;
50 void draw_label(View const *v) const;
52 void insert_before(View *o, View *p)
60 void insert_after(View *o, View *p)
71 explicit View_stack(Canvas *canvas, L4Re::Video::View *canvas_view, View *bg)
72 : _canvas(canvas), _no_stay_top(&_no_stay_top_v), _top(bg),
73 _background(bg), _canvas_view(canvas_view)
76 insert_before(_no_stay_top, _top);
80 void refresh_view(View const *v, View const *dst, Rect const &rect) const;
83 * Draw whole view stack
85 void update_all_views() const
87 //_place_labels(Rect(Point(), _canvas->size()));
88 refresh_view(0, 0, Rect(Point(), _canvas->size()));
93 Canvas *canvas() const { return _canvas; }
95 Mode mode() const { return _mode; }
97 void toggle_mode(Mode::Mode_flag m, bool update = false)
104 void set_mode(Mode::Mode_flag m, bool on, bool update = false)
112 void viewport(View *v, Rect const &pos, bool redraw) const;
114 void draw_recursive(View const *v, View const *dst, Rect const &) const;
117 void stack(View *v, View *pivot, bool behind = true);
119 void push_top(View *v, bool stay_top = false)
120 { stack(v, _no_stay_top, !stay_top); }
122 void push_bottom(View *v) { stack(v, _background, false); }
137 void forget_view(View *v)
139 assert (v != _no_stay_top);
140 assert (v != _background);
142 refresh_view(0, 0, outline(v));
145 bool on_top(View const *v) const
146 { return _no_stay_top->next() == v; }
149 View *find(Point const &pos) const;
151 virtual ~View_stack() {}