2 * \brief Browser window interface
4 * \author Norman Feske <norman.feske@genode-labs.com>
8 * Copyright (C) 2005-2009
9 * Genode Labs, Feske & Helmuth Systementwicklung GbR
11 * This file is part of the Genode OS framework, which is distributed
12 * under the terms of the GNU General Public License version 2.
17 #include <l4/scout-gfx/scroll_pane>
18 #include <l4/scout-gfx/horizontal_shadow>
20 #include <l4/scout-gfx/redraw_manager>
22 #include <l4/scout-gfx/basic_window>
23 #include <l4/scout-gfx/titlebar>
28 : public Scout_browser,
29 public Scout_gfx::Basic_window
39 _TH = 32, /* height of title bar */
40 _SB_XPAD = 5, /* hor. pad of scrollbar */
41 _SB_YPAD = 10, /* vert. pad of scrollbar */
47 int _attr; /* attribute mask */
52 Scout_gfx::Titlebar _titlebar;
53 Scout_gfx::Widget *_texture;
54 Scout_gfx::Widget *_shadow;
55 Scout_gfx::Parent_widget *_cont;
56 Scout_gfx::Scroll_pane *_cont_pane;
57 Scout_gfx::Icon *_sizer;
58 Scout_gfx::Parent_widget *_panel;
65 void _content(Scout_gfx::Parent_widget *content);
66 Scout_gfx::Parent_widget *_content();
71 * Browser window attributes
75 ATTR_SIZER = 0x1, /* browser window has resize handle */
76 ATTR_TITLEBAR = 0x2, /* browser window has titlebar */
77 ATTR_BORDER = 0x4, /* draw black outline around browser */
83 * \param scr_adr base address of screen buffer
84 * \param scr_w width of screen buffer
85 * \param scr_h height of screen buffer
86 * \param doc initial content
87 * \param w, h initial size of the browser window
89 Browser_window(Factory *f,
90 Scout_gfx::Document *content, Scout_gfx::View *pf,
92 int attr = ATTR_SIZER | ATTR_TITLEBAR);
95 * Return visible document offset
97 inline int doc_offset()
98 { return 10 + _panel->size().h() + (_attr & ATTR_TITLEBAR ? _TH : 0); }
100 Widget *curr_anchor();
101 Browser *browser() { return this; }
106 void draw(Mag_gfx::Canvas *c, Point const &p)
108 using Scout_gfx::Color;
109 Basic_window::draw(c, p);
111 if (_attr & ATTR_BORDER)
114 Rect g = Rect(p, geometry().area());
115 c->draw_box(g.top(1), col);
116 c->draw_box(g.bottom(1), col);
117 c->draw_box(g.left(1), col);
118 c->draw_box(g.right(1), col);