#include <xtd/xtd>
class form1 :
public form {
public:
static auto main() {
}
form1() {
client_size({800, 600});
main_panel.parent(*this);
main_panel.location({10, 10});
main_panel.size({780, 520});
main_panel.padding(10);
tab_control_controls.parent(main_panel);
tab_control_controls.selected_index_changed += {*this, &form1::update_status_bar_text};
tab_page_buttons.parent(tab_control_controls);
tab_page_buttons.auto_scroll(true);
tab_page_buttons.text("Buttons");
tab_page_pickers.parent(tab_control_controls);
tab_page_pickers.auto_scroll(true);
tab_page_pickers.text("Pickers");
tab_page_texts.parent(tab_control_controls);
tab_page_texts.auto_scroll(true);
tab_page_texts.text("Texts");
tab_page_lcds.parent(tab_control_controls);
tab_page_lcds.auto_scroll(true);
tab_page_lcds.text("LCDs");
tab_page_choices.parent(tab_control_controls);
tab_page_choices.auto_scroll(true);
tab_page_choices.text("Choices");
tab_page_lists.parent(tab_control_controls);
tab_page_lists.auto_scroll(true);
tab_page_lists.text("Lists");
tab_page_progress_and_track_bars.parent(tab_control_controls);
tab_page_progress_and_track_bars.auto_scroll(true);
tab_page_progress_and_track_bars.text("Progresses");
tab_page_scrolls.parent(tab_control_controls);
tab_page_scrolls.auto_scroll(true);
tab_page_scrolls.text("Scrolls");
tab_page_animations.parent(tab_control_controls);
tab_page_animations.auto_scroll(true);
tab_page_animations.text("Animations");
image_button1.parent(tab_page_buttons);
image_button1.location({130, 10});
flat_button1.parent(tab_page_buttons);
flat_button1.location({10, 50});
flat_button1.text("Flat");
popup_button1.parent(tab_page_buttons);
popup_button1.location({130, 50});
popup_button1.text("Popup");
toggle_button1.parent(tab_page_buttons);
toggle_button1.checked(true);
toggle_button1.location({10, 90});
toggle_button1.three_state(true);
toggle_button1.text("Toggle");
light_button1.parent(tab_page_buttons);
light_button1.checked(true);
light_button1.location({130, 90});
light_button1.three_state(true);
light_button1.text("Light");
radio_button1.parent(tab_page_buttons);
radio_button1.auto_size(true);
radio_button1.checked(true);
radio_button1.location({10, 130});
radio_button1.text("Radio 1");
radio_button2.parent(tab_page_buttons);
radio_button2.auto_size(true);
radio_button2.location({130, 130});
radio_button2.text("Radio 2");
check_box1.parent(tab_page_buttons);
check_box1.auto_size(true);
check_box1.three_state(true);
check_box1.checked(true);
check_box1.location({10, 170});
check_box1.text("Check 1");
check_box2.parent(tab_page_buttons);
check_box2.auto_size(true);
check_box2.location({130, 170});
check_box2.text("Check 2");
switch_button1.parent(tab_page_buttons);
switch_button1.checked(true);
switch_button1.location({10, 210});
switch_button2.parent(tab_page_buttons);
switch_button2.checked(true);
switch_button2.rounded(false);
switch_button2.location({130, 210});
command_link_button1.parent(tab_page_buttons);
command_link_button1.texts({"Command link button", "Information"});
command_link_button1.location({10, 250});
up_down_button1.parent(tab_page_buttons);
up_down_button1.location({10, 320});
color_picker1.parent(tab_page_pickers);
color_picker1.location({10, 10});
color_picker1.text("Colors...");
font_picker1.parent(tab_page_pickers);
font_picker1.location({10, 50});
date_time_picker1.parent(tab_page_pickers);
date_time_picker1.location({10, 90});
label1.parent(tab_page_texts);
label1.auto_size(true);
label1.location({10, 13});
label1.text("Simple label text.");
link_label1.parent(tab_page_texts);
link_label1.auto_size(true);
link_label1.location({10, 43});
link_label1.text("https://gammasoft71.github.io/xtd");
text_box1.parent(tab_page_texts);
text_box1.location({10, 80});
text_box1.text("Single line text");
text_box1.width(390);
text_box2.parent(tab_page_texts);
text_box2.location({10, 120});
text_box2.size({390, 250});
text_box2.multiline(true);
text_box2.text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.\n\nUt velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.\n\nAliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet.\n");
lcd_label1.parent(tab_page_lcds);
lcd_label1.auto_size(true);
lcd_label1.location({10, 10});
lcd_label1.text("1234567890");
dot_matrix_display1.parent(tab_page_lcds);
dot_matrix_display1.height(50);
dot_matrix_display1.location({10, 50});
dot_matrix_display1.set_dots({{3, 0}, {2, 1}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}});
seven_segment_display1.parent(tab_page_lcds);
seven_segment_display1.height(50);
seven_segment_display1.location({50, 50});
nine_segment_display1.parent(tab_page_lcds);
nine_segment_display1.height(50);
nine_segment_display1.location({90, 50});
fourteen_segment_display1.parent(tab_page_lcds);
fourteen_segment_display1.height(50);
fourteen_segment_display1.location({130, 50});
sixteen_segment_display1.parent(tab_page_lcds);
sixteen_segment_display1.height(50);
sixteen_segment_display1.location({170, 50});
choice1.parent(tab_page_choices);
choice1.location({10, 10});
choice1.items().push_back_range({"Light red", "Light green", "Light blue", "Yellow", "White", "Dark gray", "Light cyan", "Light magenta", "Red", "Green", "Blue", "Brown", "Light gray", "Black", "Cyan", "Magenta"});
choice1.selected_item("Light red");
combo_box1.parent(tab_page_choices);
combo_box1.location({10, 50});
combo_box1.items().push_back_range({"Light red", "Light green", "Light blue", "Yellow", "White", "Dark gray", "Light cyan", "Light magenta", "Red", "Green", "Blue", "Brown", "Light gray", "Black", "Cyan", "Magenta"});
combo_box1.selected_item("Light green");
domain_up_down1.parent(tab_page_choices);
domain_up_down1.location({10, 90});
domain_up_down1.items().push_back_range({"Light red", "Light green", "Light blue", "Yellow", "White", "Dark gray", "Light cyan", "Light magenta", "Red", "Green", "Blue", "Brown", "Light gray", "Black", "Cyan", "Magenta"});
domain_up_down1.selected_item("Light blue");
numeric_up_down1.parent(tab_page_choices);
numeric_up_down1.location({10, 130});
numeric_up_down1.value(10);
list_box1.parent(tab_page_lists);
list_box1.location({10, 10});
list_box1.size({250, 150});
list_box1.items().push_back_range({"Light red", "Light green", "Light blue", "Yellow", "White", "Dark gray", "Light cyan", "Light magenta", "Red", "Green", "Blue", "Brown", "Light gray", "Black", "Cyan", "Magenta"});
list_box1.selected_item("Light red");
checked_list_box1.parent(tab_page_lists);
checked_list_box1.location({10, 180});
checked_list_box1.size({250, 150});
checked_list_box1.items().push_back_range({{"Light red", true}, "Light green", "Light blue", {"Yellow", true}, "White", "Dark gray", "Light cyan", "Light magenta", "Red", "Green", "Blue", "Brown", "Light gray", "Black", "Cyan", "Magenta"});
checked_list_box1.selected_item("Light green");
track_bar1.parent(tab_page_progress_and_track_bars);
track_bar1.location({10, 10});
track_bar1.maximum(100);
track_bar1.tick_frequency(10);
track_bar1.width(350);
track_bar1.value_changed += [&] {
progress_bar1.value(track_bar1.value());
};
track_bar1.value(50);
progress_bar1.parent(tab_page_progress_and_track_bars);
progress_bar1.location({10, 70});
progress_bar1.maximum(100);
progress_bar1.width(350);
h_scroll_bar1.parent(tab_page_scrolls);
h_scroll_bar1.location({40, 10});
h_scroll_bar1.width(300);
v_scroll_bar1.parent(tab_page_scrolls);
v_scroll_bar1.location({10, 40});
v_scroll_bar1.height(300);
loading_indicator1.parent(tab_page_animations);
loading_indicator1.location({10, 10});
loading_indicator1.start();
tool_bar1.parent(*this);
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, help_tool_bar_button});
tool_bar1.button_click += {*this, &form1::on_tool_bar_button_click};
status_bar1.parent(*this);
update_status_bar_text();
themes_label.parent(*this);
themes_label.auto_size(true);
themes_label.location({10, 533});
themes_label.text("Theme");
themes_choice.parent(*this);
themes_choice.location({70, 530});
themes_choice.width(560);
themes_choice.items().push_back("current theme");
sort(names.begin(), names.end());
themes_choice.items().push_back_range(names);
themes_choice.selected_index_changed += [&] {
};
themes_choice.selected_index(0);
}
protected:
};
void on_style_sheet_changed(
const event_args&
e)
override {
tool_bar1.image_list().images().clear();
tool_bar1.buttons().clear();
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, help_tool_bar_button});
}
private:
void on_menu_click(
object& sender,
const event_args&
e) {
string file_name;
if (main_menu1.menu_items()[0].get().menu_items()[1].get() == sender)
open_file_box::show(file_name, *
this);
if (main_menu1.menu_items()[0].get().menu_items()[3].get() == sender)
save_file_box::show(file_name, *
this);
if (main_menu1.menu_items()[0].get().menu_items()[4].get() == sender)
save_file_box::show(file_name, *
this,
"Save as...");
if (main_menu1.menu_items()[0].get().menu_items()[9].get() == sender)
application::exit();
}
string file_name;
}
void update_status_bar_text() {
switch (tab_control_controls.selected_index()) {
case 0: status_bar1.text("Shows button controls"); break;
case 1: status_bar1.text("Shows picker controls"); break;
case 2: status_bar1.text("Shows text controls"); break;
case 3: status_bar1.text("Shows LCD controls"); break;
case 4: status_bar1.text("Shows choice controls"); break;
case 5: status_bar1.text("Shows list controls"); break;
case 6: status_bar1.text("Shows progress controls"); break;
case 7: status_bar1.text("Shows scroll controls"); break;
case 8: status_bar1.text("Shows animation controls"); break;
default: break;
}
}
tab_page tab_page_progress_and_track_bars;
list_box list_box1;
};
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.hpp:361
static xtd::drawing::color control_text()
Gets a xtd::drawing::color structure that is the color of text in a 3-D element.
static xtd::drawing::icon xtd_logo() noexcept
Gets an xtd::drawing::icon object that contains the xtd logo icon.
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::version version() noexcept
Gets a version consisting of the major, minor, build, and revision numbers of the xtd framework.
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 Windows spin box (also known as an up-down control) that displays string values.
Definition domain_up_down.hpp:33
Represents the menu structure of a form.
Definition main_menu.hpp:42
static xtd::forms::main_menu create_standard_items(const xtd::event_handler &on_click)
A factory to create a main menu with specified on click event handler.
Represents a single tab page in a tab_control.
Definition tab_page.hpp:33
Represents a standard Windows text box.
Definition text_box.hpp:31
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:167
@ e
The E key.
Definition console_key.hpp:96
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
string to_string() const noexcept override
Returns the string representation of this xtd::read_only_span <type_t> object.
Definition read_only_span.hpp:375