MCPcopy Create free account
hub / github.com/MyGUI/mygui / notifyMouseButtonClick

Method notifyMouseButtonClick

UnitTests/TestApp/DataListUI.cpp:43–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 9

toStringFunction · 0.85
getUserStringMethod · 0.80
resetChangesMethod · 0.80
undoActionMethod · 0.45
redoActionMethod · 0.45
setNameMethod · 0.45
doActionMethod · 0.45
getItemCountMethod · 0.45
setDataMethod · 0.45

Tested by

no test coverage detected