forked from cnjinhao/nana-docs
Widget menu
James Bremner edited this page Apr 6, 2019
·
3 revisions
Doxygen description of pop-up menu Note that the example code in the doxygen docs for menu is hopelessly out of date - ignore.
#include <nana/gui.hpp>
#include <nana/gui/widgets/menu.hpp>
int main()
{
using namespace nana;
form fm;
// build menu
menu mobj;
mobj.append("Item 0");
mobj.append("Item 1", [](menu::item_proxy&)
{
msgbox m("Item 1 selected");
m.show();
});
// pop-up menu when right mouse button pressed
fm.events().mouse_down([&](const arg_mouse& arg)
{
if( arg.right_button )
mobj.popup_await ( fm, arg.pos.x, arg.pos.y);
});
fm.show();
exec();
}
Doxygen description of menubar
Use to display a menu toolbar across top of application window.