-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.h
More file actions
34 lines (29 loc) · 880 Bytes
/
menu.h
File metadata and controls
34 lines (29 loc) · 880 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
#ifndef MENU_H
#define MENU_H
#include "item.h"
#include "color.h"
class Menu: public Item
{
public:
struct MenuItem {
MenuItem(const char *title = "", const char* icon = "", const char* badge = "", Color badgeColor = 0xFF):
title(title), icon(icon), badge(badge), badgeColor(badgeColor) {
}
std::string title;
std::string icon;
std::string badge;
Color badgeColor;
};
public:
Menu(const char *title);
void addMenuItem(MenuItem item);
protected:
virtual void draw(NVGcontext* ctx) override;
virtual bool focusEvent(bool focused) override;
virtual bool mouseMotionEvent(float mx, float my, float rx, float ry, int button, int modifiers) override;
private:
std::string mTitle;
std::vector<MenuItem> mMenuItems;
const MenuItem *mHoveredItem = nullptr;
};
#endif // MENU_H