1#include "help_menu_entry.h"
3#include <cgv/gui/gui_driver.h>
12 wnd = driver->create_window(400, 300,
"Help: " +
get_name(),
"generic");
13 std::string value =
"scroll_group";
14 wnd->set_void(
"group",
"string", &value);
16 for(
const auto& section : sections) {
17 switch(section.type) {
18 case SectionType::kHeading1:
19 wnd->add_decorator(section.content,
"heading",
"level=0",
"");
21 case SectionType::kHeading2:
22 wnd->add_decorator(section.content,
"heading",
"level=1",
"");
24 case SectionType::kHeading3:
25 wnd->add_decorator(section.content,
"heading",
"level=2",
"");
27 case SectionType::kHeading4:
28 wnd->add_decorator(section.content,
"heading",
"level=3",
"");
30 case SectionType::kText:
31 wnd->add_decorator(section.content,
"text",
"",
"");
33 case SectionType::kItems:
35 std::vector<cgv::utils::token> tokens;
41 for(
const auto&
token : tokens) {
42 std::string text =
" -\t" + to_string(
token);
44 wnd->add_decorator(text,
"text",
"",
"");
49 case SectionType::kKeyBindings:
51 std::vector<cgv::utils::token> tokens;
57 std::string group_options =
"layout=table;border-style=framed;cols=2";
58 group_options +=
";rows=" + std::to_string(tokens.size());
60 auto group = wnd->add_group(
"",
"layout_group", group_options,
"");
61 groups.push_back(group);
63 for(
const auto&
token : tokens) {
64 std::vector<cgv::utils::token> sides;
67 if(sides.size() != 2) {
76 group->add_decorator(
" " + lhs,
"text",
"w=100;border=true",
"S");
77 group->add_decorator(rhs,
"text",
"border=true",
"sSxX");
const std::string & get_name() const
return the parent node
the tokenizer allows to split text into tokens in a convenient way.
tokenizer & set_ws(const std::string &ws)
set the list of white spaces, that separate tokens and are skipped
tokenizer & set_skip(const std::string &open, const std::string &close)
set several character pairs that enclose tokens that are not split
void unregister_object(base_ptr object, const std::string &options)
unregister an object and send event to all current registration ref_listeners()
gui_driver_ptr get_gui_driver()
return the currently registered gui driver or an empty pointer if non has been registered
std::string & trim(std::string &str, const std::string &chars)
trim white space or other characters from start and end of string
void bite_all(tokenizer &t, std::vector< token > &result)
bite all tokens into a token vector