]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/panel.cpp
Loader improvements
[libs/gltk.git] / source / panel.cpp
index 59553b45de0122136a4c410ebf06a50ed378f6e4..0ecdf1077ca0a7ae05abaa957dad2fb327493c5c 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
 */
 
@@ -25,14 +25,15 @@ using namespace std;
 namespace Msp {
 namespace GLtk {
 
-Panel::Panel(const Resources &r):
-       Widget(r),
-       Container(r),
+Panel::Panel():
        pointer_focus(0),
        pointer_grabbed(false),
        input_focus(0)
+{ }
+
+Panel::Child *Panel::create_child(Widget *wdg)
 {
-       update_style();
+       return new Child(*this, wdg);
 }
 
 void Panel::raise(Widget &wdg)
@@ -58,6 +59,16 @@ Widget *Panel::get_final_input_focus() const
        return input_focus;
 }
 
+void Panel::render_special(const Part &part) const
+{
+       if(part.get_name()=="children")
+       {
+               for(list<Container::Child *>::const_iterator i=children.begin(); i!=children.end(); ++i)
+                       if((*i)->widget->is_visible())
+                               (*i)->widget->render();
+       }
+}
+
 void Panel::button_press(int x, int y, unsigned btn)
 {
        if(pointer_grabbed)
@@ -125,21 +136,6 @@ void Panel::focus_out()
        set_input_focus(0);
 }
 
-void Panel::render_special(const Part &part) const
-{
-       if(part.get_name()=="children")
-       {
-               for(list<Container::Child *>::const_iterator i=children.begin(); i!=children.end(); ++i)
-                       if((*i)->widget->is_visible())
-                               (*i)->widget->render();
-       }
-}
-
-Panel::Child *Panel::create_child(Widget *wdg)
-{
-       return new Child(*this, wdg);
-}
-
 void Panel::set_pointer_focus(Widget *wdg)
 {
        if(wdg!=pointer_focus)
@@ -193,7 +189,7 @@ Panel::Loader::Loader(Panel &p, map<string, Widget *> &m):
 template<typename T>
 void Panel::Loader::child(const string &n)
 {
-       RefPtr<T> chl = new T(pnl.res);
+       RefPtr<T> chl = new T();
        load_sub(*chl);
        pnl.add(*chl.get());
        wdg_map[n] = chl.release();
@@ -201,7 +197,7 @@ void Panel::Loader::child(const string &n)
 
 void Panel::Loader::panel(const string &n)
 {
-       RefPtr<Panel> p = new Panel(pnl.res);
+       RefPtr<Panel> p = new Panel();
        load_sub(*p, wdg_map);
        pnl.add(*p.get());
        wdg_map[n] = p.release();