-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp_menu.hpp
60 lines (49 loc) · 1.27 KB
/
app_menu.hpp
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
//@ {"targets":[{"name":"app_menu.hpp","type":"include"}]}
#ifndef TEXPAINTER_APP_APPMENU_HPP
#define TEXPAINTER_APP_APPMENU_HPP
#include "ui/menu_item.hpp"
#include "libenum/empty.hpp"
namespace Texpainter
{
enum class AppAction : int
{
Help,
About,
Quit
};
constexpr auto begin(Enum::Empty<AppAction>) { return AppAction::Help; }
constexpr auto end(Enum::Empty<AppAction>)
{
return static_cast<AppAction>(static_cast<int>(AppAction::Quit) + 1);
}
template<AppAction>
struct AppActionTraits;
template<>
struct AppActionTraits<AppAction::Help>
{
using type = Ui::MenuItem;
static constexpr char const* displayName() { return "Help"; }
static constexpr char const* description()
{
return "Opens the online help in the default web browser";
}
};
template<>
struct AppActionTraits<AppAction::About>
{
using type = Ui::MenuItem;
static constexpr char const* displayName() { return "About"; }
static constexpr char const* description()
{
return "Opens the about page in the default web browser";
}
};
template<>
struct AppActionTraits<AppAction::Quit>
{
using type = Ui::MenuItem;
static constexpr char const* displayName() { return "Quit"; }
static constexpr char const* description() { return "Exits the application"; }
};
}
#endif