3 This file is part of R²C²
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
13 Toolbar::Toolbar(const string &name, unsigned w):
19 add(*(lbl_title = new GLtk::Label(name)));
21 add(*(btn_expand = new GLtk::Button));
22 btn_expand->set_size(15, 20);
23 btn_expand->set_style("arrow_left");
24 btn_expand->set_tooltip("Collapse toolbar");
25 btn_expand->signal_clicked.connect(sigc::mem_fun(this, &Toolbar::expand_clicked));
27 add(*(pnl_content = new GLtk::Panel));
28 pnl_content->set_size(content_width, 40);
29 pnl_content->set_style("group");
32 void Toolbar::expand(bool e)
35 btn_expand->set_style(expanded ? "arrow_left" : "arrow_right");
36 btn_expand->set_tooltip(expanded ? "Collapse toolbar" : "Expand toolbar");
37 pnl_content->set_visible(expanded);
39 unsigned w = lbl_title->get_geometry().w+40;
44 signal_expanded.emit(expanded);
47 void Toolbar::expand_clicked()
52 void Toolbar::on_style_change()
54 lbl_title->autosize();
55 const GLtk::Geometry &lbl_geom = lbl_title->get_geometry();
56 unsigned w = lbl_geom.w+40;
61 lbl_title->set_position(10, (geom.h-lbl_geom.h)/2);
62 btn_expand->set_position(lbl_geom.w+15, 10);
63 pnl_content->set_position(lbl_geom.w+35, 0);