3 This file is part of libmspgltk
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
17 Label::Label(const Resources &r, const string &t):
26 void Label::autosize()
28 const list<Part> &parts = style->get_parts();
29 const Part *text_part = 0;
30 for(list<Part>::const_iterator i=parts.begin(); (!text_part && i!=parts.end()); ++i)
31 if(i->get_name()=="text")
34 geom.h = text.get_height();
35 geom.w = text.get_width();
38 const Sides &margin = text_part->get_margin();
39 geom.w += margin.left+margin.right;
40 geom.h += margin.top+margin.bottom;
44 void Label::set_text(const string &t)
49 void Label::render_special(const Part &part) const
51 if(part.get_name()=="text")
52 text.render(part, geom);
55 void Label::on_style_change()
57 text.set_style(style);
61 Label::Loader::Loader(Label &l):
64 add("text", &Loader::text);
67 void Label::Loader::text(const string &t)
69 static_cast<Label &>(wdg).text = t;