-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathController.cpp
More file actions
49 lines (48 loc) · 2.38 KB
/
Copy pathController.cpp
File metadata and controls
49 lines (48 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "Controller.h"
#include <iostream>
Controller::Controller(View* view) : view(view)
{
if (view) {
view->onActionHelpTriggered = []() {
std::cout << "Available commands:" << std::endl;
std::cout << " help - Show list of commands" << std::endl;
std::cout << " add - Add new document" << std::endl;
std::cout << " import - Import new document" << std::endl;
std::cout << " export - Export new document" << std::endl;
std::cout << " insertGr - Insert Graphical Object to current document" << std::endl;
std::cout << " listGr - Show list of Graphical Objects from document" << std::endl;
std::cout << " removeGr - Remove Graphical Object from current document" << std::endl;
std::cout << " exit - Exit the program" << std::endl;
};
view->onActionAddTriggered = [this](const std::string& message) {
std::cout << "A request to create a document has been sent!" << std::endl;
if (model)
model->createDoc(message);
};
view->onActionImportTriggered = [this](const std::string& message) {
std::cout << "A request to import a document has been sent!" << std::endl;
if (model)
model->importDoc(message);
};
view->onActionExportTriggered = [this](const std::string& message) {
std::cout << "A request to export a document has been sent!" << std::endl;
if (model)
model->exportDoc(message);
};
view->onActionInsertGrObjectTriggered = [this](const std::string& message) {
std::cout << "A request to add GrObject to document has been sent!" << std::endl;
if (model)
model->addGrObject(message);
};
view->onActionListGrObjectTriggered = [this]() {
std::cout << "A request to show list of GrObjects from document has been sent!" << std::endl;
if (model)
model->showListGrObject();
};
view->onActionRemoveGrObjectTriggered = [this](const std::string& message) {
std::cout << "A request to remove GrObject from document has been sent!" << std::endl;
if (model)
model->removeGrObject(message);
};
}
}