WidgetList * WidgetList::clone(){ WidgetList * list = WidgetList::createNiceList(parent()); list->setStyle(style()); list->setLocation(mapToParent(Nimble::Vector2(0, 0))); for (ItemList::iterator it = m_itemList.begin(); it != m_itemList.end(); ++it ) { RoundTextBox * tb = dynamic_cast<RoundTextBox*>(*it); RoundTextBox * tb2 = new RoundTextBox(0, 0, MultiWidgets::TextBox::HCENTER); tb2->setCSSClass("FloatingWord_clone"); tb2->setStyle(tb->style()); tb2->setText(tb->text()); tb2->setWidth(tb->width()); tb2->setHeight(tb->height()); tb2->setAlignFlags(MultiWidgets::TextBox::HCENTER | MultiWidgets::TextBox::VCENTER); list->addItem(tb2); } //layout(); list->layout(); list->setDepth(depth()); list->setScale(scale()); list->setRotation(rotation()); return list; }
WidgetList * WidgetList::createNiceList(Widget * parent, Widget * content) { WidgetList * list = new WidgetList(parent); if (content) list->addItem(content); list->setDepth(-1); list->raiseFlag(WidgetList::LOCK_DEPTH); list->addOperator(new MultiWidgets::StayInsideParentOperator); //list->addOperator(new MultiWidgets::RotateTowardsHandsOperator); list->addOperator(new MultiWidgets::LimitScaleOperator(MultiWidgets::LimitScaleOperator::COMPARE_SCALE, 1.0f, 2.0f)); return list; }