6 #ifndef TBWIDGETS_READER_H
7 #define TBWIDGETS_READER_H
9 #include "tb_linklist.h"
10 #include "tb_widgets.h"
15 class TBWidgetsReader;
16 class TBWidgetFactory;
65 #define TB_WIDGET_FACTORY(classname, sync_type, add_child_z) \
66 class classname##WidgetFactory : public TBWidgetFactory \
69 classname##WidgetFactory() \
70 : TBWidgetFactory(#classname, sync_type) { Register(); } \
71 virtual TBWidget *Create(INFLATE_INFO *info) \
73 classname *widget = new classname(); \
75 if (widget->m_sync_type != sync_type) std::cerr << #classname "ERROR\n"; \
76 widget->GetContentRoot()->SetZInflate(add_child_z); \
77 ReadCustomProps(widget, info); \
81 void ReadCustomProps(classname *widget, INFLATE_INFO *info); \
83 static classname##WidgetFactory classname##_wf; \
84 void classname##WidgetFactory::ReadCustomProps(classname *widget, INFLATE_INFO *info)
155 bool LoadFile(TBWidget *target,
const TBStr & filename);
156 bool LoadFormatted(TBWidget *target,
const char *format, ...) TB_POST_FORMAT(3,4);
157 bool LoadData(TBWidget *target, const
char *data);
158 bool LoadData(TBWidget *target, const
char *data,
int data_len);
159 void LoadNodeTree(TBWidget *target, TBNode *node);
161 bool DumpFile(TBWidget *source, const TBStr & filename);
162 bool DumpData(TBWidget *source, TBStr & data);
166 bool CreateWidget(TBWidget *target, TBNode *node);
167 bool CreateNode(TBNode *target, TBWidget *widget);
168 TBLinkListOf<TBWidgetFactory> factories;
173 #endif // TBWIDGETS_READER_H
TYPE
The current type of the value.
Definition: tb_value.h:64
TBNode * node
The node containing properties.
Definition: tb_widgets_reader.h:29
INFLATE_INFO contains info passed to TBWidget::OnInflate during resource loading. ...
Definition: tb_widgets_reader.h:21
TBWidget * target
The widget that that will be parent to the inflated widget.
Definition: tb_widgets_reader.h:27
TBNode is a tree node with a string name and a value (TBValue).
Definition: tb_node_tree.h:30
Definition: tb_linklist.h:83
TBValue::TYPE sync_type
The data type that should be synchronized through TBWidgetValue.
Definition: tb_widgets_reader.h:31