| 41 | } |
| 42 | |
| 43 | void DataListUI::notifyMouseButtonClick(MyGUI::Widget* _sender) |
| 44 | { |
| 45 | std::string_view event = _sender->getUserString("Event"); |
| 46 | |
| 47 | if (event == "Undo") |
| 48 | { |
| 49 | tools::ActionManager::getInstance().undoAction(); |
| 50 | } |
| 51 | else if (event == "Redo") |
| 52 | { |
| 53 | tools::ActionManager::getInstance().redoAction(); |
| 54 | } |
| 55 | else if (event == "Add") |
| 56 | { |
| 57 | tools::ActionCreateData* command = new tools::ActionCreateData(); |
| 58 | command->setName(MyGUI::utility::toString("item ", mIndex)); |
| 59 | |
| 60 | tools::ActionManager::getInstance().doAction(command); |
| 61 | |
| 62 | mIndex++; |
| 63 | } |
| 64 | else if (event == "Remove") |
| 65 | { |
| 66 | if (mListBox->getItemCount() != 0) |
| 67 | { |
| 68 | tools::ActionDestroyData* command = new tools::ActionDestroyData(); |
| 69 | tools::Data* data = *mListBox->getItemDataAt<tools::Data*>(mListBox->getItemCount() - 1); |
| 70 | command->setData(data); |
| 71 | tools::ActionManager::getInstance().doAction(command); |
| 72 | } |
| 73 | } |
| 74 | else if (event == "Save") |
| 75 | { |
| 76 | tools::ActionManager::getInstance().resetChanges(); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | void DataListUI::updateActions() |
| 81 | { |
nothing calls this directly
no test coverage detected