Ejemplo n.º 1
0
	void Data::removeChild(DataPtr _child)
	{
		MYGUI_ASSERT(_child->getParent() == mWeakThis.lock(), "Child not found");

		if (_child == getChildSelected())
			mIndexSelected = MyGUI::ITEM_NONE;

		mChilds.erase(std::remove(mChilds.begin(), mChilds.end(), _child), mChilds.end());
		_child->mParent = nullptr;
	}
Ejemplo n.º 2
0
	void Data::insertChild(size_t _index, DataPtr _child)
	{
		MYGUI_ASSERT(_child != nullptr, "Child is nullptr");
		MYGUI_ASSERT(_child->getParent() == nullptr, "Child already attached");
		MYGUI_ASSERT(_child->getType() != nullptr, "Type not found");
		MYGUI_ASSERT(getType() != nullptr, "Type not found");
		MYGUI_ASSERT(getType()->isChild(_child->getType()->getName()), "Type is not child");

		MYGUI_ASSERT_RANGE_INSERT(_index, mChilds.size(), "Data::insertChild");

		if (_index == MyGUI::ITEM_NONE)
			_index = mChilds.size();

		mChilds.insert(mChilds.begin() + _index, _child);
		_child->mParent = mWeakThis.lock();
	}