void AddCheckbox(TBDebugInfo::SETTING setting, const char *str) { TBCheckBox *check = new TBCheckBox(); check->SetValue(g_tb_debug.settings[setting]); check->data.SetInt(setting); check->SetID(TBIDC("check")); TBClickLabel *label = new TBClickLabel(); label->SetText(str); label->GetContentRoot()->AddChild(check, WIDGET_Z_BOTTOM); GetWidgetByID(TBIDC("container"))->AddChild(label); }
AdvancedItemWidget::AdvancedItemWidget(AdvancedItem *item, AdvancedItemSource *source, TBSelectItemViewer *source_viewer, int index) : m_source(source) , m_source_viewer(source_viewer) , m_index(index) { SetSkinBg(TBIDC("TBSelectItem")); SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY); SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP); SetPaintOverflowFadeout(false); g_widgets_reader->LoadFile(GetContentRoot(), "Demo/demo01/ui_resources/test_list_item.tb.txt"); TBCheckBox *checkbox = GetWidgetByIDAndType<TBCheckBox>(TBIDC("check")); TBTextField *name = GetWidgetByIDAndType<TBTextField>(TBIDC("name")); TBTextField *info = GetWidgetByIDAndType<TBTextField>(TBIDC("info")); checkbox->SetValue(item->GetChecked() ? true : false); name->SetText(item->str); info->SetText(item->GetMale() ? "Male" : "Female"); }