3 This file is part of libmspgltk
4 Copyright © 2007, 2009-2011 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
17 Label::Label(const string &t)
23 void Label::autosize()
30 if(const Part *text_part = style->get_part("text"))
32 const Sides &margin = text_part->get_margin();
33 geom.w = max(geom.w, text.get_width()+margin.left+margin.right);
34 geom.h = max(geom.h, text.get_height()+margin.top+margin.bottom);
38 void Label::set_text(const string &t)
43 void Label::render_special(const Part &part) const
45 if(part.get_name()=="text")
46 text.render(part, geom);
49 void Label::on_style_change()
51 text.set_style(style);
55 Label::Loader::Loader(Label &l):
58 add("text", &Loader::text);
61 void Label::Loader::text(const string &t)
63 static_cast<Label &>(obj).text = t;