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)
41 signal_autosize_changed.emit();
44 void Label::render_special(const Part &part) const
46 if(part.get_name()=="text")
47 text.render(part, geom);
50 void Label::on_style_change()
52 text.set_style(style);
56 Label::Loader::Loader(Label &l):
59 add("text", &Loader::text);
62 void Label::Loader::text(const string &t)
64 static_cast<Label &>(obj).text = t;