##// END OF EJS Templates
Add a lambda in SeletionZoneAction to enable or disable the action
Add a lambda in SeletionZoneAction to enable or disable the action

File last commit:

r1115:c55ac7376de6
r1115:c55ac7376de6
Show More
VisualizationActionManager.cpp
30 lines | 1.1 KiB | text/x-c | CppLexer
/ gui / src / Visualization / VisualizationActionManager.cpp
#include "Visualization/VisualizationActionManager.h"
#include "Visualization/VisualizationGraphWidget.h"
#include "Visualization/VisualizationSelectionZoneItem.h"
#include <Actions/ActionsGuiController.h>
#include <SqpApplication.h>
VisualizationActionManager::VisualizationActionManager() {}
void VisualizationActionManager::installSelectionZoneActions()
{
auto &actionController = sqpApp->actionsGuiController();
actionController.addSectionZoneAction("Remove Selected Zone(s)", [](auto &zones) {
for (auto selectionZone : zones) {
if (auto graph = selectionZone->parentGraphWidget()) {
graph->removeSelectionZone(selectionZone);
}
}
});
auto alignEnableFuntion = [](auto &items) { return items.count() > 0; };
auto alignLeftAction = actionController.addSectionZoneAction("Align Left Vertically", [](auto &zones) {});
alignLeftAction->setEnableFunction(alignEnableFuntion);
auto alignRightAction
= actionController.addSectionZoneAction("Align Right vertically", [](auto &zones) {});
alignRightAction->setEnableFunction(alignEnableFuntion);
}