ListViewItemWidget::ListViewItemWidget(ListViewItem *item, ListViewItemSource *source, TBSelectItemViewer *sourceviewer, int index) : source_(source) , sourceviewer_(sourceviewer) , index_(index) , item_(item) , expandBox_(0) , textField_(0) , icon_(0) { SetLayoutDistribution(LAYOUT_DISTRIBUTION_GRAVITY); SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION_LEFT_TOP); SetPaintOverflowFadeout(false); item_->widget_ = this; for (int i = 0; i < item->depth_; i++) { LayoutParams lp; lp.SetWidth(6); lp.SetHeight(4); TBWidget* spacer = new TBWidget(); spacer->SetLayoutParams(lp); GetContentRoot()->AddChild(spacer); } if (item_->children_.Size()) { expandBox_ = new TBCheckBox(); expandBox_->SetSkinBg(TBIDC("TBCheckBox.uilistview")); expandBox_->SetValue(item_->GetExpanded()); expandBox_->SetID(item->id); GetContentRoot()->AddChild(expandBox_); } else { LayoutParams lp; lp.SetWidth(12); lp.SetHeight(4); TBWidget* spacer = new TBWidget(); spacer->SetLayoutParams(lp); GetContentRoot()->AddChild(spacer); } if (item->icon_.Length()) { icon_ = new TBSkinImage(TBIDC(item->icon_.CString())); icon_->SetIgnoreInput(true); GetContentRoot()->AddChild(icon_); } TBFontDescription fd; fd.SetID(TBIDC("Vera")); fd.SetSize(11); TBTextField* tfield = textField_ = new TBTextField(); tfield->SetIgnoreInput(true); tfield->SetSkinBg(item->textSkin_.Length() ? TBIDC(item->textSkin_.CString()) : TBIDC("Folder")); tfield->SetText(item->str); tfield->SetFontDescription(fd); SetSkinBg(TBIDC("TBSelectItem")); GetContentRoot()->AddChild(tfield); SetID(item->id); }