-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.cpp
More file actions
31 lines (23 loc) · 766 Bytes
/
Copy pathexample.cpp
File metadata and controls
31 lines (23 loc) · 766 Bytes
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
#include <string>
#include "menu.h"
//Methods for all Menu Entries
void firstMethod() { std::cout << "I Do one thing." << std::endl; }
void seconMethod() { std::cout << "I Do two things." << std::endl; }
//Initial Setup of Menu. Adds Functions to entries
void ConfigureMenu(Menu *menu) {
menu->AddSubMenu("sub", "Sub Menu");
menu->AddEntry("f", "first Entry.", firstMethod);
menu->AddEntry("s", "second entry.", seconMethod);
menu->GetSubMenu()->AddEntry("ff", "first Sub entry.", []() {
std::cout << "i am a Sub entry" << std::endl;
});
}
int main() {
//Create Menu Object
Menu *mainMenu = new Menu("Main Menu");
//Setup Entries
ConfigureMenu(mainMenu);
//Enter Menu
mainMenu->EnterMenu();
return 0;
}