/* $Id$
This file is part of libmspgltk
-Copyright © 2007-2009 Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2011 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
*/
on_geometry_change();
}
+void Widget::set_parent(Container *p)
+{
+ if(parent && p)
+ throw InvalidState("Widget is already in a Container");
+ parent = p;
+
+ on_reparent();
+ update_style();
+}
+
void Widget::set_style(const string &s)
{
style_name = s;
update_style();
}
+void Widget::update_style()
+{
+ Widget *top;
+ for(top=this; top->parent; top=top->parent) ;
+ Root *root = dynamic_cast<Root *>(top);
+ if(!root)
+ style = 0;
+ else
+ {
+ string sname = get_class();
+ if(!style_name.empty())
+ {
+ sname += '-';
+ sname += style_name;
+ }
+
+ style = root->get_resources().get<Style>(sname);
+ }
+
+ on_style_change();
+}
+
void Widget::set_tooltip(const string &t)
{
tooltip = t;
state &= ~FOCUS;
}
-void Widget::update_style()
-{
- Widget *top;
- for(top=this; top->parent; top=top->parent) ;
- Root *root = dynamic_cast<Root *>(top);
- if(!root)
- style = 0;
- else
- {
- string sname = get_class();
- if(!style_name.empty())
- {
- sname += '-';
- sname += style_name;
- }
-
- style = root->get_resources().get<Style>(sname);
- }
-
- on_style_change();
-}
-
-void Widget::update_style(Widget &w)
-{
- w.update_style();
-}
-
-void Widget::set_parent(Container *p)
-{
- if(parent && p)
- throw InvalidState("Widget is already in a Container");
- parent = p;
-
- on_reparent();
- update_style();
-}
-
-void Widget::set_parent(Widget &w, Container *p)
-{
- w.set_parent(p);
-}
-
Widget::Loader::Loader(Widget &w):
wdg(w)