Slider::Slider(clan::GUIManager &manager) : clan::Window(&manager, clan::GUITopLevelDescription("Slider", clan::Rect(256 + 16, 8, clan::Size(256, 256)), false)) { func_close().set(this, &Slider::on_close); clan::Rect client_area = get_client_area(); slider_vertical = new clan::Slider(this); slider_vertical->set_geometry(clan::Rect(client_area.left + 1, client_area.top + 10, clan::Size(17, 200))); slider_vertical->set_vertical(true); slider_vertical->set_horizontal(false); slider_vertical->set_min(0); slider_vertical->set_max(100); slider_vertical->set_tick_count(10); slider_vertical->set_page_step(40); slider_vertical->set_position(50); slider_vertical->set_lock_to_ticks(false); slider_vertical->func_value_changed().set(this, &Slider::on_value_changed, slider_vertical); slider_vertical->func_value_decremented().set(this, &Slider::on_value_decremented, slider_vertical); slider_vertical->func_value_incremented().set(this, &Slider::on_value_incremented, slider_vertical); slider_vertical->func_slider_moved().set(this, &Slider::on_slider_moved, slider_vertical); slider_horizontal = new clan::Slider(this); slider_horizontal->set_geometry(clan::Rect(client_area.left + 36, client_area.top + 10, clan::Size(200, 17))); slider_horizontal->set_vertical(false); slider_horizontal->set_horizontal(true); slider_horizontal->set_min(0); slider_horizontal->set_max(100); slider_horizontal->set_tick_count(10); slider_horizontal->set_page_step(40); slider_horizontal->set_position(50); slider_horizontal->set_lock_to_ticks(false); slider_horizontal->func_value_changed().set(this, &Slider::on_value_changed, slider_horizontal); slider_horizontal->func_value_decremented().set(this, &Slider::on_value_decremented, slider_horizontal); slider_horizontal->func_value_incremented().set(this, &Slider::on_value_incremented, slider_horizontal); slider_horizontal->func_slider_moved().set(this, &Slider::on_slider_moved, slider_horizontal); clan::Size lineedit_size(42, 20); clan::Size label_size(50, 15); int lineedit_xpos = client_area.left + 146; int label_xpos = client_area.left + 190; int lineedit_ypos = client_area.top + 40; const int lineedit_gap = 25; lineedit_min = new clan::LineEdit(this); lineedit_min->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_min->set_text("0"); lineedit_min->set_numeric_mode(true); lineedit_min->func_enter_pressed().set(this, &Slider::on_min_enter_pressed, lineedit_min); lineedit_label_min = new clan::Label(this); lineedit_label_min->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_min->set_text("Min"); lineedit_ypos += lineedit_gap; lineedit_max = new clan::LineEdit(this); lineedit_max->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_max->set_text("100"); lineedit_max->set_numeric_mode(true); lineedit_max->func_enter_pressed().set(this, &Slider::on_max_enter_pressed, lineedit_max); lineedit_label_max = new clan::Label(this); lineedit_label_max->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_max->set_text("Max"); lineedit_ypos += lineedit_gap; lineedit_tick_count = new clan::LineEdit(this); lineedit_tick_count->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_tick_count->set_text("10"); lineedit_tick_count->func_enter_pressed().set(this, &Slider::on_tick_count_enter_pressed, lineedit_tick_count); lineedit_label_tick_count = new clan::Label(this); lineedit_label_tick_count->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_tick_count->set_text("Tick Count"); lineedit_ypos += lineedit_gap; lineedit_page_step = new clan::LineEdit(this); lineedit_page_step->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_page_step->set_text("40"); lineedit_page_step->func_enter_pressed().set(this, &Slider::on_page_step_enter_pressed, lineedit_page_step); lineedit_label_page_step = new clan::Label(this); lineedit_label_page_step->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_page_step->set_text("Page Step"); lineedit_ypos += lineedit_gap; lineedit_position_vert = new clan::LineEdit(this); lineedit_position_vert->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_position_vert->set_text("50"); lineedit_position_vert->func_enter_pressed().set(this, &Slider::on_position_enter_pressed_vert, lineedit_position_vert); lineedit_label_position_vert = new clan::Label(this); lineedit_label_position_vert->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_position_vert->set_text("Vertical"); lineedit_ypos += lineedit_gap; lineedit_position_horiz = new clan::LineEdit(this); lineedit_position_horiz->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_position_horiz->set_text("50"); lineedit_position_horiz->func_enter_pressed().set(this, &Slider::on_position_enter_pressed_horiz, lineedit_position_horiz); lineedit_label_position_horiz = new clan::Label(this); lineedit_label_position_horiz->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_position_horiz->set_text("Horizonal"); lineedit_ypos += lineedit_gap; pushbutton_apply = new clan::PushButton(this); pushbutton_apply->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, clan::Size(48, 20))); pushbutton_apply->set_text("Apply"); pushbutton_apply->func_clicked().set(this, &Slider::on_apply_clicked, pushbutton_apply); int xoffset = client_area.left + 21; int yoffset = client_area.top + 35; const int gap = 16; info_value_changed = new Info(this); info_value_changed->set(xoffset, yoffset, "Value Changed"); yoffset += gap; info_value_decremented = new Info(this); info_value_decremented->set(xoffset, yoffset, "Value Decr."); yoffset += gap; info_value_incremented = new Info(this); info_value_incremented->set(xoffset, yoffset, "Value Incr."); yoffset += gap; info_slider_moved = new Info(this); info_slider_moved->set(xoffset, yoffset, "Slider Moved"); yoffset += gap; xoffset = client_area.left + 36; yoffset = client_area.top + 195 - gap; checkbox_lock_to_ticks = new clan::CheckBox(this); checkbox_lock_to_ticks->set_geometry(clan::Rect(xoffset, yoffset, clan::Size(100, 15))); checkbox_lock_to_ticks->func_checked().set(this, &Slider::on_checked_lock_to_ticks, checkbox_lock_to_ticks); checkbox_lock_to_ticks->func_unchecked().set(this, &Slider::on_unchecked_lock_to_ticks, checkbox_lock_to_ticks); checkbox_lock_to_ticks->set_text("Lock to Ticks"); yoffset += gap; checkbox_disable = new clan::CheckBox(this); checkbox_disable->set_geometry(clan::Rect(xoffset, yoffset, clan::Size(100, 15))); checkbox_disable->func_checked().set(this, &Slider::on_checked_disable, checkbox_disable); checkbox_disable->func_unchecked().set(this, &Slider::on_unchecked_disable, checkbox_disable); checkbox_disable->set_text("Disable"); }
Spin::Spin(clan::GUIManager &manager) : clan::Window(&manager, clan::GUITopLevelDescription("Spin", clan::Rect(256*3 + 32, 256 + 16, clan::Size(256, 180)), false)) { func_close() = bind_member(this, &Spin::on_close); clan::Rect client_area = get_client_area(); spin1 = new clan::Spin(this); spin1->set_geometry(clan::Rect(client_area.left + 11, client_area.top + 10, clan::Size(128, 21))); spin1->set_number_of_decimal_places(2); spin1->set_value(500); spin1->set_step_size(50); spin1->set_ranges(200, 2000); spin1->set_floating_point_mode(false); spin1->func_value_changed() = bind_member(this, &Spin::on_value_changed); int xoffset = client_area.left + 16; int yoffset = client_area.top + 40; const int gap = 16; clan::Size label_size(50, 15); info_value_changed = new Info(this); info_value_changed->set(xoffset, yoffset, "Value Changed"); yoffset += gap; clan::Size lineedit_size(48, 20); int lineedit_xpos = client_area.left + 6; int label_xpos = client_area.left + 56; int lineedit_ypos = client_area.top + 60; const int lineedit_gap = 25; lineedit_value = new clan::LineEdit(this); lineedit_value->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_value->set_text("500"); lineedit_value->set_numeric_mode(true); lineedit_value->func_enter_pressed() = bind_member(this, &Spin::on_value_enter_pressed); lineedit_label_value = new clan::Label(this); lineedit_label_value->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_value->set_text("Value"); lineedit_ypos += lineedit_gap; lineedit_decimal_places = new clan::LineEdit(this); lineedit_decimal_places->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_decimal_places->set_text("2"); lineedit_decimal_places->set_numeric_mode(true, true); lineedit_decimal_places->func_enter_pressed() = bind_member(this, &Spin::on_decimal_places_enter_pressed); lineedit_label_decimal_places = new clan::Label(this); lineedit_label_decimal_places->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_decimal_places->set_text("Decimal Places"); lineedit_ypos += lineedit_gap; lineedit_decimal_places->set_enabled(false); lineedit_xpos = client_area.left + 146; label_xpos = client_area.left + 196; lineedit_ypos = client_area.top + 10; lineedit_min = new clan::LineEdit(this); lineedit_min->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_min->set_text("200"); lineedit_min->set_numeric_mode(true, true); lineedit_min->func_enter_pressed() = bind_member(this, &Spin::on_min_enter_pressed); lineedit_label_min = new clan::Label(this); lineedit_label_min->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_min->set_text("Min"); lineedit_ypos += lineedit_gap; lineedit_max = new clan::LineEdit(this); lineedit_max->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_max->set_text("2000"); lineedit_max->set_numeric_mode(true, true); lineedit_max->func_enter_pressed() = bind_member(this, &Spin::on_max_enter_pressed); lineedit_label_max = new clan::Label(this); lineedit_label_max->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_max->set_text("Max"); lineedit_ypos += lineedit_gap; lineedit_step = new clan::LineEdit(this); lineedit_step->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_step->set_text("50"); lineedit_step->set_numeric_mode(true, true); lineedit_step->func_enter_pressed() = bind_member(this, &Spin::on_step_enter_pressed); lineedit_label_step = new clan::Label(this); lineedit_label_step->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_step->set_text("Step"); lineedit_ypos += lineedit_gap; pushbutton_apply = new clan::PushButton(this); pushbutton_apply->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, clan::Size(48, 20))); pushbutton_apply->set_text("Apply"); pushbutton_apply->func_clicked() = bind_member(this, &Spin::on_apply_clicked); xoffset = client_area.left + 1; yoffset = client_area.top + 126 - gap; checkbox_fp_mode = new clan::CheckBox(this); checkbox_fp_mode->set_geometry(clan::Rect(xoffset, yoffset, clan::Size(100, 15))); checkbox_fp_mode->func_checked() = bind_member(this, &Spin::on_checked_fp_mode); checkbox_fp_mode->func_unchecked() = bind_member(this, &Spin::on_unchecked_fp_mode); checkbox_fp_mode->set_text("Floating Point Mode"); yoffset += gap; checkbox_disable = new clan::CheckBox(this); checkbox_disable->set_geometry(clan::Rect(xoffset, yoffset, clan::Size(100, 15))); checkbox_disable->func_checked() = bind_member(this, &Spin::on_checked_disable); checkbox_disable->func_unchecked() = bind_member(this, &Spin::on_unchecked_disable); checkbox_disable->set_text("Disable"); }
ProgressBar::ProgressBar(clan::GUIManager &manager) : clan::GUIComponent(&manager, clan::GUITopLevelDescription("Progress Bar", clan::Rect(24 + 256*2, 256*1 + 180*2 + 32, clan::Size(256, 180)), false), "window") { clan::Rect client_area = get_content_box(); progressbar1 = new clan::ProgressBar(this); progressbar1->set_geometry(clan::Rect(client_area.left + 5, client_area.top + 5, clan::Size(128, 32))); progressbar1->set_min(0); progressbar1->set_max(100); progressbar1->set_step_size(10); progressbar1->set_position(20); progressbar1->set_marquee_animation_speed(1000); progressbar1->set_marquee_mode(false); clan::Size lineedit_size(48, 20); clan::Size label_size(50, 15); int lineedit_xpos = client_area.left + 5; int lineedit_ypos = client_area.top + 40; int label_xpos = client_area.left + 55; const int lineedit_gap = 25; lineedit_min = new clan::LineEdit(this); lineedit_min->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_min->set_text("0"); lineedit_min->set_numeric_mode(true); lineedit_min->func_enter_pressed().set(this, &ProgressBar::on_min_enter_pressed, lineedit_min); lineedit_label_min = new clan::Label(this); lineedit_label_min->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_min->set_text("Min"); lineedit_ypos += lineedit_gap; lineedit_max = new clan::LineEdit(this); lineedit_max->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_max->set_text("100"); lineedit_max->set_numeric_mode(true); lineedit_max->func_enter_pressed().set(this, &ProgressBar::on_max_enter_pressed, lineedit_max); lineedit_label_max = new clan::Label(this); lineedit_label_max->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_max->set_text("Max"); lineedit_ypos += lineedit_gap; lineedit_step_size = new clan::LineEdit(this); lineedit_step_size->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_step_size->set_text("10"); lineedit_step_size->func_enter_pressed().set(this, &ProgressBar::on_step_size_enter_pressed, lineedit_step_size); lineedit_label_step_size = new clan::Label(this); lineedit_label_step_size->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_step_size->set_text("Step Size"); lineedit_ypos += lineedit_gap; lineedit_position = new clan::LineEdit(this); lineedit_position->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_position->set_text("20"); lineedit_position->func_enter_pressed().set(this, &ProgressBar::on_position_enter_pressed, lineedit_position); lineedit_label_position = new clan::Label(this); lineedit_label_position->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_position->set_text("Position"); lineedit_ypos += lineedit_gap; lineedit_xpos = client_area.left + 110; lineedit_ypos = client_area.top + 40; label_xpos = client_area.left + 160; checkbox_marquee_mode = new clan::CheckBox(this); checkbox_marquee_mode->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, clan::Size(100, 15))); checkbox_marquee_mode->func_checked().set(this, &ProgressBar::on_checked_marquee_mode, checkbox_marquee_mode); checkbox_marquee_mode->func_unchecked().set(this, &ProgressBar::on_unchecked_marquee_mode, checkbox_marquee_mode); checkbox_marquee_mode->set_text("Marquee Mode"); lineedit_ypos += lineedit_gap; lineedit_marquee_speed = new clan::LineEdit(this); lineedit_marquee_speed->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, lineedit_size)); lineedit_marquee_speed->set_text("1000"); lineedit_marquee_speed->func_enter_pressed().set(this, &ProgressBar::on_marquee_speed_enter_pressed, lineedit_marquee_speed); lineedit_label_marquee_speed = new clan::Label(this); lineedit_label_marquee_speed->set_geometry(clan::Rect(label_xpos, lineedit_ypos, label_size)); lineedit_label_marquee_speed->set_text("Marquee Speed"); lineedit_ypos += lineedit_gap; lineedit_marquee_speed->set_enabled(false); pushbutton_apply = new clan::PushButton(this); pushbutton_apply->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, clan::Size(48, 20))); pushbutton_apply->set_text("Apply"); pushbutton_apply->func_clicked().set(this, &ProgressBar::on_apply_clicked, pushbutton_apply); lineedit_ypos += lineedit_gap; pushbutton_step_position = new clan::PushButton(this); pushbutton_step_position->set_geometry(clan::Rect(lineedit_xpos, lineedit_ypos, clan::Size(92, 20))); pushbutton_step_position->set_text("Step Position"); pushbutton_step_position->func_clicked().set(this, &ProgressBar::on_step_position_clicked, pushbutton_step_position); }