-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectMenu.cpp
More file actions
156 lines (124 loc) · 3.2 KB
/
ProjectMenu.cpp
File metadata and controls
156 lines (124 loc) · 3.2 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#include "ProjectMenu.hpp"
#include "Controller.hpp"
#include "ProjectCtl.hpp"
namespace wayround_i2p::ccedit
{
ProjectMenuGenerator::ProjectMenuGenerator(ProjectCtl_shared project_ctl) :
project_ctl(project_ctl)
{
}
ProjectMenuGenerator::~ProjectMenuGenerator()
{
}
Glib::RefPtr<Gio::Menu> ProjectMenuGenerator::createProjectMenu(
std::string group_name
)
{
auto sect_m = Gio::Menu::create();
auto sect_m0 = Gio::Menu::create();
sect_m0->append(
"New FileExplorer",
group_name + ".action_create_new_explorer"
);
auto sect_m1 = Gio::Menu::create();
sect_m1->append(
"Project Manager",
group_name + ".action_show_project_mgr"
);
sect_m1->append(
"Project Controller",
group_name + ".action_show_project_ctl"
);
auto sect_m2 = Gio::Menu::create();
sect_m2->append(
"Close Project's Work Subjects",
group_name + ".action_close_project_work_subjects"
);
sect_m2->append(
"Close Project's Editors",
group_name + ".action_close_project_editors"
);
auto sect_m3 = Gio::Menu::create();
sect_m3->append(
"Close Project",
group_name + ".action_close_project"
);
sect_m3->append(
"Quit Program",
group_name + ".action_close_ccedit"
);
sect_m->append_section(sect_m0);
sect_m->append_section(sect_m1);
sect_m->append_section(sect_m2);
sect_m->append_section(sect_m3);
return sect_m;
}
void ProjectMenuGenerator::addActionsToActionGroup(
Glib::RefPtr<Gio::SimpleActionGroup> action_group
)
{
action_group->add_action(
"action_show_project_mgr",
[this]()
{ action_show_project_mgr(); }
);
action_group->add_action(
"action_show_project_ctl",
[this]()
{ action_show_project_ctl(); }
);
action_group->add_action(
"action_create_new_explorer",
[this]()
{ action_create_new_explorer(); }
);
action_group->add_action(
"action_close_project_work_subjects",
[this]()
{ action_close_project_work_subjects(); }
);
action_group->add_action(
"action_close_project_editors",
[this]()
{ action_close_project_editors(); }
);
action_group->add_action(
"action_close_project",
[this]()
{ action_close_project(); }
);
action_group->add_action(
"action_close_ccedit",
[this]()
{ action_close_ccedit(); }
);
}
void ProjectMenuGenerator::action_show_project_mgr()
{
project_ctl->getController()->showProjectMgr();
}
void ProjectMenuGenerator::action_show_project_ctl()
{
project_ctl->showWindow();
}
void ProjectMenuGenerator::action_create_new_explorer()
{
project_ctl->createNewFileExplorer();
}
void ProjectMenuGenerator::action_close_project_work_subjects()
{
project_ctl->destroyAllWorkSubjects();
}
void ProjectMenuGenerator::action_close_project_editors()
{
project_ctl->destroyAllEditors();
}
void ProjectMenuGenerator::action_close_project()
{
project_ctl->destroy();
}
void ProjectMenuGenerator::action_close_ccedit()
{
project_ctl->getController()->destroy();
}
} // namespace wayround_i2p::ccedit