struct mola::gui::Button

Overview

A push button.

Icons are specified independently per backend:

  • icon_entypo : ENTYPO_ICON_* integer constant (nanogui).

  • icon_imgui : UTF-8 string containing the icon codepoint, typically a FontAwesome macro such as ICON_FA_SAVE (u8”uf0c7”). The ImGui backend prepends this to the label string: e.g. ICON_FA_SAVE “ Save map now”. Requires the icon font to have been loaded into the ImGui font atlas before the first frame.

Either field may be left at its zero/empty default to omit the icon on that backend. Both can be set simultaneously if you support both backends at runtime.

#include <GuiWidgetDescription.h>

struct Button
{
    // fields

    std::string label;
    int icon_entypo = 0;
    std::string icon_imgui;
    int font_size = 0;
    std::function<void()> on_click;
};

Fields

int icon_entypo = 0

nanogui: ENTYPO_ICON_* constant

std::string icon_imgui

ImGui: UTF-8 codepoint string, e.g. ICON_FA_SAVE.