xtd 0.2.0
form_and_main.cpp

demonstrates how to use startup_ keyword.

Windows
form_and_main_w.png

form_and_main_wd.png
macOS
form_and_main_m.png

form_and_main_md.png
Gnome
form_and_main_g.png

form_and_main_gd.png
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/message_box>
#include <xtd/startup>
using namespace xtd;
using namespace xtd::forms;
namespace form_and_main_example {
class form_main : public form {
public:
static auto main() {
application::run(form_main());
}
form_main() {
text("form main");
location({300, 200});
size({640, 480});
form_closing += [](object & sender, form_closing_event_args & e) {
e.cancel(message_box::show("Are you sure you want exit?", "Close form", message_box_buttons::yes_no, message_box_icon::question) == dialog_result::no);
};
button.parent(*this);
button.text("Close");
button.location({10, 10});
}
private:
};
}
startup_(form_and_main_example::form_main::main);