1 /*! 2 @file 3 @author Albert Semenov 4 @date 07/2012 5 */ 6 7 #include "Precompiled.h" 8 #include "ActionDestroyData.h" 9 #include "DataManager.h" 10 #include "DataSelectorManager.h" 11 #include "PropertyUtility.h" 12 13 namespace tools 14 { 15 ActionDestroyData()16 ActionDestroyData::ActionDestroyData() : 17 mData(nullptr), 18 mParent(nullptr), 19 mIndex(MyGUI::ITEM_NONE) 20 { 21 } 22 doAction()23 void ActionDestroyData::doAction() 24 { 25 mParent = mData->getParent(); 26 mIndex = mParent->getChildIndex(mData); 27 mParent->removeChild(mData); 28 29 DataSelectorManager::getInstance().changeParent(mParent); 30 31 if (!mUniqueProperty.empty()) 32 PropertyUtility::storeUniqueNameProperty("Name", mUniqueProperty, mParent, mOldValues); 33 } 34 undoAction()35 void ActionDestroyData::undoAction() 36 { 37 mParent->insertChild(mIndex, mData); 38 39 DataSelectorManager::getInstance().changeParent(mParent); 40 41 PropertyUtility::restoreUniqueNameProperty(mOldValues); 42 } 43 setData(DataPtr _data)44 void ActionDestroyData::setData(DataPtr _data) 45 { 46 mData = _data; 47 } 48 setUniqueProperty(const std::string & _value)49 void ActionDestroyData::setUniqueProperty(const std::string& _value) 50 { 51 mUniqueProperty = _value; 52 } 53 54 } 55