-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.h
65 lines (50 loc) · 1.16 KB
/
menu.h
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
//
// Created by Admin on 03/05/2023.
//
#ifndef CHESS_MENU_H
#define CHESS_MENU_H
#include <array>
#include <functional>
#include <initializer_list>
#include <memory>
#include <string_view>
#include <vector>
class menu
{
protected:
using sharedPtr = std::shared_ptr<menu>;
public:
std::string text;
std::vector<sharedPtr> inner_menu {};
menu() = default;
menu(const menu&) = default;
menu(menu&&) noexcept = default;
menu& operator=(const menu&) = default;
menu& operator=(menu&&) noexcept = default;
~menu() = default;
menu(std::initializer_list<sharedPtr> list)
{
int i = 0;
inner_menu = {list.size(), sharedPtr {}};
for (const sharedPtr& child: list)
{
inner_menu[i] = child;
++i;
}
};
menu(std::string_view text, std::initializer_list<sharedPtr> list) : text(text)
{
int i = 0;
inner_menu = {list.size(), sharedPtr {}};
for (const sharedPtr& child: list)
{
inner_menu[i] = child;
++i;
}
};
explicit menu(std::string_view text) : text(text)
{};
void display(const int& C_Normal, const int& C_Normal_Tile) const;
virtual void be_selected(const int& C_Normal, const int& C_Normal_Tile) const;
};
#endif //CHESS_MENU_H