]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/widget.cpp
Rearrange members
[libs/gltk.git] / source / widget.cpp
index 434ec454ea022beb1a31964025c7a98808d25d8f..9cd9066bc82663150daa9ad8fddc65b629650c02 100644 (file)
@@ -1,7 +1,7 @@
 /* $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
 */
 
@@ -53,12 +53,44 @@ void Widget::set_geometry(const Geometry &g)
        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;
@@ -129,48 +161,6 @@ void Widget::focus_out()
        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)