@@ -196,6 +196,12 @@ void registerWidget(const WidgetFactory * factory)
|
|||||||
getRegisteredWidgets().push_back(factory);
|
getRegisteredWidgets().push_back(factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unregisterWidget(const WidgetFactory * factory)
|
||||||
|
{
|
||||||
|
TRACE("unregister widget %s", factory->getName());
|
||||||
|
getRegisteredWidgets().remove(factory);
|
||||||
|
}
|
||||||
|
|
||||||
const WidgetFactory * getWidgetFactory(const char * name)
|
const WidgetFactory * getWidgetFactory(const char * name)
|
||||||
{
|
{
|
||||||
auto it = getRegisteredWidgets().cbegin();
|
auto it = getRegisteredWidgets().cbegin();
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class Widget : public Button
|
|||||||
};
|
};
|
||||||
|
|
||||||
void registerWidget(const WidgetFactory * factory);
|
void registerWidget(const WidgetFactory * factory);
|
||||||
|
void unregisterWidget(const WidgetFactory * factory);
|
||||||
|
|
||||||
class WidgetFactory
|
class WidgetFactory
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -225,6 +225,11 @@ class LuaWidgetFactory: public WidgetFactory
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~LuaWidgetFactory()
|
||||||
|
{
|
||||||
|
unregisterWidget(this);
|
||||||
|
}
|
||||||
|
|
||||||
Widget * create(FormGroup * parent, const rect_t & rect, Widget::PersistentData * persistentData, bool init=true) const override
|
Widget * create(FormGroup * parent, const rect_t & rect, Widget::PersistentData * persistentData, bool init=true) const override
|
||||||
{
|
{
|
||||||
if (lsWidgets == 0) return 0;
|
if (lsWidgets == 0) return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user