Add callback to self in menu_t class
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
@@ -4,7 +4,7 @@
include(cmake/prelude.cmake)
project(
stamen
VERSION 1.2.1
VERSION 1.2.2
DESCRIPTION "Static menu generator"
HOMEPAGE_URL "https://git.dimitrijedobrota.com/stamen"
LANGUAGES C CXX
@@ -87,6 +87,7 @@
void generate_include_cpp(std::ostream& ost, const arguments_t& args)
ost << R"(
struct menu_t {
std::string title;
stamen::callback_f callback;
std::vector<stamen::item_t> items;
static int visit(const menu_t& menu);
@@ -128,7 +129,8 @@
void generate_source_cpp(std::ostream& ost,
ost << "\tstatic const menu_t menu = {\n";
ost << std::format("\t\t.title = \"{}\",\n", menu.get_title());
ost << "\t\t.items = {\n";
ost << std::format("\t\t.callback = {},\n", menu.get_code());
ost << std::format("\t\t.items = {{\n");
for (auto i = 0UL; i < menu.get_size(); i++)
{
ost << std::format("\t\t\t{{.callback = {}, .prompt = \"{}\"}},\n",