Button::Loader::Loader(Button &btn):
- Widget::Loader(btn)
+ DataFile::DerivedObjectLoader<Button, Widget::Loader>(btn)
{
add("text", &Loader::text);
}
void Button::Loader::text(const std::string &t)
{
- static_cast<Button &>(obj).text = t;
+ obj.text = t;
}
} // namespace GLtk
class Button: public Widget
{
public:
- class Loader: public Widget::Loader
+ class Loader: public DataFile::DerivedObjectLoader<Button, Widget::Loader>
{
public:
Loader(Button &);
Dropdown::Loader::Loader(Dropdown &d):
- Widget::Loader(d)
+ DataFile::DerivedObjectLoader<Dropdown, Widget::Loader>(d)
{
add("item", &Loader::item);
}
void Dropdown::Loader::item(const string &v)
{
- dynamic_cast<BasicListData<string> &>(dynamic_cast<Dropdown &>(obj).list.get_data()).append(v);
+ dynamic_cast<BasicListData<string> &>(obj.list.get_data()).append(v);
}
} // namespace GLtk
class Dropdown: virtual public Widget, private Container
{
public:
- class Loader: public Widget::Loader
+ class Loader: public DataFile::DerivedObjectLoader<Dropdown, Widget::Loader>
{
public:
Loader(Dropdown &);
first_row = text.get_n_lines()-visible_rows-static_cast<unsigned>(value);
}
-
-Entry::Loader::Loader(Entry &ent):
- Widget::Loader(ent)
-{ }
-
} // namespace GLtk
} // namespace Msp
class Entry: virtual public Widget, private Container
{
public:
- class Loader: public Widget::Loader
- {
- public:
- Loader(Entry &);
- };
-
sigc::signal<void> signal_enter;
private:
Label::Loader::Loader(Label &l):
- Widget::Loader(l)
+ DataFile::DerivedObjectLoader<Label, Widget::Loader>(l)
{
add("text", &Loader::text);
}
void Label::Loader::text(const string &t)
{
- static_cast<Label &>(obj).text = t;
+ obj.text = t;
}
} // namespace GLtk
class Label: public Widget
{
public:
- class Loader: public Widget::Loader
+ class Loader: public DataFile::DerivedObjectLoader<Label, Widget::Loader>
{
public:
Loader(Label &);
}
-List::Loader::Loader(List &l):
- Widget::Loader(l)
-{
- add("item", &Loader::item);
-}
-
-
void List::Item::autosize()
{
Widget::autosize();
}
+List::Loader::Loader(List &l):
+ DataFile::DerivedObjectLoader<List, Widget::Loader>(l)
+{
+ add("item", &Loader::item);
+}
+
void List::Loader::item(const string &v)
{
- dynamic_cast<BasicListData<string> &>(*dynamic_cast<List &>(obj).data).append(v);
+ dynamic_cast<BasicListData<string> &>(*obj.data).append(v);
}
} // namespace GLtk
class List: virtual public Widget, private Container
{
public:
- class Loader: public Widget::Loader
+ class Loader: public DataFile::DerivedObjectLoader<List, Widget::Loader>
{
public:
Loader(List &);
Panel::Loader::Loader(Panel &p, map<string, Widget *> &m):
- Widget::Loader(p),
- pnl(p),
+ DataFile::DerivedObjectLoader<Panel, Widget::Loader>(p),
wdg_map(m)
{
add("button", &Loader::child<Button>);
{
RefPtr<T> chl = new T();
load_sub(*chl);
- pnl.add(*chl.get());
+ obj.add(*chl.get());
wdg_map[n] = chl.release();
}
{
RefPtr<Panel> p = new Panel();
load_sub(*p, wdg_map);
- pnl.add(*p.get());
+ obj.add(*p.get());
wdg_map[n] = p.release();
}
class Panel: public Container
{
public:
- class Loader: public Widget::Loader
+ class Loader: public DataFile::DerivedObjectLoader<Panel, Widget::Loader>
{
public:
typedef std::map<std::string, Widget *> WidgetMap;
private:
- Panel &pnl;
WidgetMap &wdg_map;
public:
Slider::Loader::Loader(Slider &s):
- Widget::Loader(s)
+ DataFile::DerivedObjectLoader<Slider, Widget::Loader>(s)
{
add("range", &Slider::min, &Slider::max);
add("step", &Slider::step);
add("value", &Slider::value);
}
-Slider &Slider::Loader::get_object() const
-{
- return static_cast<Slider &>(obj);
-}
-
} // namespace GLtk
} // namespace Msp
class Slider: public Widget
{
public:
- class Loader: public Widget::Loader
+ class Loader: public DataFile::DerivedObjectLoader<Slider, Widget::Loader>
{
public:
Loader(Slider &);
- Slider &get_object() const;
};
sigc::signal<void, double> signal_value_changed;
Toggle::Loader::Loader(Toggle &t):
- Widget::Loader(t)
+ DataFile::DerivedObjectLoader<Toggle, Widget::Loader>(t)
{
add("exclusive", &Toggle::exclusive);
add("text", &Loader::text);
add("value", &Toggle::value);
}
-Toggle &Toggle::Loader::get_object() const
-{
- return static_cast<Toggle &>(obj);
-}
-
void Toggle::Loader::finish()
{
- Toggle &tgl = get_object();
- tgl.set_state(ACTIVE, (tgl.value ? ACTIVE : NORMAL));
+ obj.set_state(ACTIVE, (obj.value ? ACTIVE : NORMAL));
}
void Toggle::Loader::text(const string &t)
{
- get_object().text = t;
+ obj.text = t;
}
} // namespace GLtk
class Toggle: public Widget
{
public:
- class Loader: public Widget::Loader
+ class Loader: public DataFile::DerivedObjectLoader<Toggle, Widget::Loader>
{
public:
Loader(Toggle &);
- Toggle &get_object() const;
private:
virtual void finish();
void text(const std::string &);