-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubMenu.h
More file actions
41 lines (30 loc) · 805 Bytes
/
Copy pathSubMenu.h
File metadata and controls
41 lines (30 loc) · 805 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
32
33
34
35
36
37
38
39
40
41
#ifndef SUBMENUH
#define SUBMENUH
#ifndef MENUH
// You should not use "SubMenu.h" by itself, rather include "Menu.h"
// #error "SubMenu.h can't be included alone"
#endif
#include <iostream>
#include <vector>
#include <unordered_map>
#include <functional>
#include <windows.h>
class SubMenu {
public:
SubMenu();
SubMenu& addTitle(const std::string& title);
SubMenu& addOption(std::string option, std::function<void()> funct);
size_t size() const;
std::pair<std::string, std::function<void()>>& operator[] (size_t index);
SubMenu& operator++();
SubMenu& operator--();
size_t getIndex() const;
std::string getTitle();
void print();
private:
std::vector<std::pair<std::string, std::function<void()>>> sm_data;
size_t sm_index = 0;
std::string sm_title;
void setcolor(int k);
};
#endif