Boost.UI
User Interface Boost library
cpp11/minimal.cpp

Minimal sample

// Copyright (c) 2018 Kolya Kosenko
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// Re-implemented wxWidgets minimal sample:
// https://github.com/wxWidgets/wxWidgets/blob/master/samples/minimal/minimal.cpp
#include <boost/ui.hpp>
namespace ui = boost::ui;
class my_frame : public ui::frame
{
public:
my_frame(const ui::uistring& title);
};
my_frame::my_frame(const ui::uistring& title)
: ui::frame(title)
{
menu_bar()
<< ( ui::menu("&File")
<< ui::menu::item("E&xit\tAlt-X")
.on_press(&my_frame::close, this)
)
<< ( ui::menu("&Help")
<< ui::menu::item("&About\tF1")
.on_press([]
{
ui::uiostringstream ss;
ss << "Welcome to Boost " << BOOST_VERSION / 100000
<< '.' << BOOST_VERSION / 100 % 1000
<< '.' << BOOST_VERSION % 100
<< "!\n"
<< "\n"
<< "This is the minimal Boost.UI sample\n"
<< "running under " << BOOST_PLATFORM << "."
;
ui::info_dialog(ss.str(), "About Boost.UI minimal sample");
})
)
;
status_bar().text("Welcome to Boost.UI!");
}
int ui_main()
{
my_frame frame("Minimal Boost.UI App");
frame.show_modal();
return 0;
}
int main(int argc, char* argv[])
{
return ui::entry(&ui_main, argc, argv);
}
boost::ui
Boost.UI library namespace.
Definition: window.hpp:20
boost::ui::info_dialog
BOOST_UI_DECL void info_dialog(const uistring &message, const uistring &title=ascii("Information"))
Display information in application-modal dialog.
boost::ui::entry
int entry(int(*ui_main)(int, char *[]), int argc, char *argv[])
UI application entry.
ui.hpp
Master Boost.UI file.