19 #ifndef OST_GUI_WIDGET_REGISTRY_HH
20 #define OST_GUI_WIDGET_REGISTRY_HH
30 namespace ost {
namespace gui {
43 virtual Widget* Create(QWidget* parent)=0;
49 #define OST_REGISTER_WIDGET_WITH_DEFAULT_FACTORY(ns, class_name, full_name) \
50 class class_name##Factory : public WidgetFactory { \
52 class_name##Factory(): WidgetFactory(#ns"::"#class_name, full_name) {} \
53 Widget* Create(QWidget* parent) \
55 return new class_name(parent); \
58 bool class_name##_registered=WidgetRegistry::Instance()-> \
59 RegisterWidgetFactory(new class_name##Factory)
61 #define OST_REGISTER_WIDGET(class_name, factory) \
62 bool class_name##_registered=WidgetRegistry::Instance()-> \
63 RegisterWidgetFactory(new factory)
78 bool UnregisterWidgetFactory(
const QString&
id);
81 Widget* Create(
const QString&
id, QWidget* parent);
82 QString GetFullName(
const QString&
id);
85 QMap<QString, WidgetFactory*> id_to_factory_;
#define DLLEXPORT_OST_GUI