#include <xtd/drawing/texts>
#include <xtd/forms/application>
#include <xtd/forms/choice>
#include <xtd/forms/form>
#include <xtd/forms/list_box>
#include <xtd/forms/progress_bar>
#include <xtd/forms/timer>
#include <xtd/forms/tool_bar>
#include <xtd/forms/tool_bar_images>
namespace tool_bar_example {
class form1 :
public form {
public:
form1() {
client_size({820, 500});
controls().push_back_range({list_box1, tool_bar2, tool_bar1});
active_control(list_box1);
choice1.items().push_back_range({"Item1", "Item2", "Item3", "Item4", "Item5", "Item6", "Item7", "Item8", "Item9", "Item10"});
choice1.selected_index(0);
choice1.selected_value_changed += [&] {
list_box1.items().push_back(string::format("{} selected", choice1.selected_item()));
list_box1.selected_index(list_box1.items().size() - 1);
};
progress_bar1.width(150);
progress_timer1.interval_milliseconds(50);
progress_timer1.start();
progress_timer1.tick += [&] {
progress_bar1.value(progress_bar1.value() < progress_bar1.maximum() ? progress_bar1.value() + 1 : progress_bar1.minimum());
};
tool_bar1.buttons().push_back_range({new_tool_bar_button, open_tool_bar_button, save_tool_bar_button, print_tool_bar_button, tool_bar1_separator1, cut_tool_bar_button, copy_tool_bar_button, paste_tool_bar_button, tool_bar1_separator2, choice_tool_bar_button, tool_bar1_separator3, help_tool_bar_button});
tool_bar1.button_click += {*this, &form1::on_tool_bar_button_click};
tool_bar2.show_text(true);
tool_bar2.image_list().image_size({24, 24});
tool_bar2.buttons().push_back_range({play_tool_bar_button, tool_bar2_separator1, skip_backward_tool_bar_button, stop_tool_bar_button, skip_forward_tool_bar_button, tool_bar2_separator2, record_tool_bar_button, tool_bar2_separator3, progress_tool_bar_button, tool_bar2_separator4, eject_tool_bar_button});
tool_bar2.button_click += {*this, &form1::on_tool_bar_button_click};
record_tool_bar_button.enabled(false);
}
private:
list_box1.items().push_back(string::format(
"Button {} clicked, pushed = {}",
e.button().text(),
e.button().pushed()));
else
list_box1.items().push_back(string::format(
"Button {} clicked",
e.button().text()));
list_box1.selected_index(list_box1.items().size() - 1);
}
void on_menu_click(
object& sender,
const event_args&
e) {
list_box1.items().push_back(string::format(
"Menu item {} clicked",
as<menu_item>(sender).
text()));
list_box1.selected_index(list_box1.items().size() - 1);
}
list_box list_box1;
menu_item context_help_context_menu_item {
"Help context", {*
this, &form1::on_menu_click}};
menu_item context_help_index_menu_item {
"Help index", {*
this, &form1::on_menu_click}};
menu_item context_help_search_menu_item {
"Help search", {*
this, &form1::on_menu_click}};
forms::context_menu context_menu1 {context_help_context_menu_item, context_help_index_menu_item, context_help_search_menu_item, context_separator_menu_item, context_about_menu_item};
};
}
auto main() -> int {
}
static xtd::string help()
Gets a system-defined text that has a string value of "&Help". This field is constant.
static xtd::string new_()
Gets a system-defined text that has a string value of "&New". This field is constant.
static xtd::string print()
Gets a system-defined text that has a string value of "&Print...". This field is constant.
static xtd::string save()
Gets a system-defined text that has a string value of "&Save". This field is constant.
static xtd::string cut()
Gets a system-defined text that has a string value of "Cu&t". This field is constant.
static xtd::string copy()
Gets a system-defined text that has a string value of "&Copy". This field is constant.
static xtd::string open()
Gets a system-defined text that has a string value of "&Open...". This field is constant.
static xtd::string paste()
Gets a system-defined text that has a string value of "&Paste". This field is constant.
static xtd::string about()
Gets a system-defined text that has a string value of "&About". This field is constant.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
type_t as(any_object &o)
Casts a type into another type.
Definition __as_any_object.hpp:59
@ e
The E key.
Definition console_key.hpp:96
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8