MCPcopy Create free account
hub / github.com/benkuper/Chataigne / showMenuAndAddItem

Method showMenuAndAddItem

Source/StateMachine/ui/StateMachineView.cpp:135–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void StateMachineView::showMenuAndAddItem(bool fromAddButton, Point<int> position)
136{
137 PopupMenu p;
138 p.addItem(1, "Add State");
139 p.addItem(2, "Add Comment");
140 p.addItem(3, "Create Transition", manager->items.size() >= 2);
141 p.addItem(4, "Snapping",true, enableSnapping);
142 p.addItem(5, showTools ? "Hide Tools" : "Show Tools");
143
144 p.showMenuAsync(PopupMenu::Options(), [this, fromAddButton, position](int result)
145 {
146 if (result == 1) BaseManagerViewUI::addItemFromMenu(fromAddButton, position);
147 else if (result == 2) commentManagerUI->addItemFromMenu(fromAddButton, position);
148 else if (result == 3) startCreateTransition(nullptr);
149 else if (result == 4) enableSnapping = !enableSnapping;
150 else if (result == 5) setShowTools(!showTools);
151 }
152 );
153}
154
155
156void StateMachineView::startCreateTransition(StateViewUI * sourceUI)

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
addItemFromMenuMethod · 0.45

Tested by

no test coverage detected