build/api-examples/MenuItem.cpp¶
Complete program from the MenuItem API reference. Save it at the path shown above and use the build command in the reference page.
Source files · Download MenuItem.cpp
#include "widgets.hpp"
#include <cstdio>
#include <cstring>
int main()
{
gaspardos::gui::Widgets widgets(320, 200);
if (widgets.add(gaspardos::gui::Menu(1, 10, 10, 100, 26, "File")) < 0)
return 1;
gaspardos::gui::MenuItem item(2, 1, 10, 40, 100, 26, "Open");
return widgets.add(item) == 0 ? 0 : 1;
}