lecui 1.0.0-alpha.20
lecui C++ user interface library
form_menu.h
1//
2// form_menu.h - form menu interface
3//
4// lecui user interface library, part of the liblec library
5// Copyright (c) 2019 Alec Musasa (alecmus at live dot com)
6//
7// Released under the MIT license. For full details see the
8// file LICENSE.txt
9//
10
11#pragma once
12
13#if defined(LECUI_EXPORTS)
14#include "../form.h"
15#else
16#include <liblec/lecui/form.h>
17#endif
18
19namespace liblec {
20 namespace lecui {
24 std::string label;
25
27 std::function<void()> action = nullptr;
28
30 std::vector<form_menu_item> children;
31
35
38 std::string image_file;
39
41 std::string font = "Segoe UI";
42
44 float font_size = 9.f;
45 };
46
49 class lecui_api form_menu {
50 public:
54
57
65 bool add(const std::string& text,
66 const std::string& tooltip,
67 const std::vector<form_menu_item>& items,
68 std::string& error);
69
70 private:
71 class impl;
72 impl& _d;
73
74 // Default constructor and copying an object of this class are not allowed
75 form_menu() = delete;
76 form_menu(const form_menu&) = delete;
77 form_menu& operator=(const form_menu&) = delete;
78 };
79 }
80}
Form menu.
Definition: form_menu.h:49
bool add(const std::string &text, const std::string &tooltip, const std::vector< form_menu_item > &items, std::string &error)
Add form menu label.
form_menu(form &fm)
Constructor.
Form base class. The user must inherit from this class and call one of the two constructors from its ...
Definition: form.h:122
Top level namespace for the liblec libraries.
Definition: appearance.h:19
Menu items.
Definition: form_menu.h:22
std::function< void()> action
The action handler.
Definition: form_menu.h:27
float font_size
The font size.
Definition: form_menu.h:44
std::string label
The label text of the menu item.
Definition: form_menu.h:24
int image_png_resource
The image resource to use for the menu item (placed on the left).
Definition: form_menu.h:34
std::vector< form_menu_item > children
The children of the menu item (used to make a tree).
Definition: form_menu.h:30
std::string image_file
The image to use for the menu item (placed on the left).
Definition: form_menu.h:38
std::string font
The font to use.
Definition: form_menu.h:41