xtd 0.2.0
Loading...
Searching...
No Matches
hello_world_xtd.cpp

The classic first application "Hello, World!" with xtd::forms::main_menu menu, xtd::sorms::status_bar control, and xtd::event_handler.

Windows

macOS

Gnome

#include <xtd/xtd>
using namespace xtd;
using namespace drawing;
using namespace xtd::forms;
namespace hello_world_xtd_example {
class main_form : public form {
public:
main_form() {
text("Hello world (xtd)");
status.parent(*this);
status.text("Welcome to xtd!");
}
private:
void on_exit_menu_click(object& sender, const event_args& e) {
close();
}
void on_hello_menu_click(object& sender, const event_args& e) {
message_box::show("Hello world from xtd!");
}
void on_about_menu_click(object& sender, const event_args& e) {
about_box::show("This is a xtd Hello World example", "About Hello World");
}
menu_item hello_menu {"&Hello...", {*this, &main_form::on_hello_menu_click}, shortcut::ctrl_h};
menu_item separator_menu {"-"};
menu_item exit_menu {texts::exit(), {*this, &main_form::on_exit_menu_click}, shortcut::alt_f4};
menu_item about_menu {texts::about(), {*this, &main_form::on_about_menu_click}};
menu_item file_menu_item {texts::file(), {hello_menu, separator_menu, exit_menu}};
menu_item help_menu_item {texts::help(), {about_menu}};
forms::main_menu main_menu {file_menu_item, help_menu_item};
};
}
auto main() -> int {
application::run(hello_world_xtd_example::main_form {});
}
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents the menu structure of a form.
Definition main_menu.hpp:41
Represents an individual item that is displayed within a main_menu or context_menu.
Definition menu_item.hpp:31
Represents the base functionality for all menus. Although tool_strip_drop_down and tool_strip_drop_do...
Definition menu.hpp:37
Represents a Windows status bar control.
Definition status_bar.hpp:48
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.hpp:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10