void LLWidgetReg::initClass(bool register_widgets) { // Only need to register if the Windows linker has optimized away the // references to the object files. if (register_widgets) { LLDefaultChildRegistry::Register<LLButton> button("button"); LLDefaultChildRegistry::Register<LLMenuButton> menu_button("menu_button"); LLDefaultChildRegistry::Register<LLCheckBoxCtrl> check_box("check_box"); LLDefaultChildRegistry::Register<LLComboBox> combo_box("combo_box"); LLDefaultChildRegistry::Register<LLFilterEditor> filter_editor("filter_editor"); LLDefaultChildRegistry::Register<LLFlyoutButton> flyout_button("flyout_button"); LLDefaultChildRegistry::Register<LLContainerView> container_view("container_view"); LLDefaultChildRegistry::Register<LLIconCtrl> icon("icon"); LLDefaultChildRegistry::Register<LLLoadingIndicator> loading_indicator("loading_indicator"); LLDefaultChildRegistry::Register<LLLineEditor> line_editor("line_editor"); LLDefaultChildRegistry::Register<LLMenuItemSeparatorGL> menu_item_separator("menu_item_separator"); LLDefaultChildRegistry::Register<LLMenuItemCallGL> menu_item_call_gl("menu_item_call"); LLDefaultChildRegistry::Register<LLMenuItemCheckGL> menu_item_check_gl("menu_item_check"); LLDefaultChildRegistry::Register<LLMenuGL> menu("menu"); LLDefaultChildRegistry::Register<LLMenuBarGL> menu_bar("menu_bar"); LLDefaultChildRegistry::Register<LLContextMenu> context_menu("context_menu"); LLDefaultChildRegistry::Register<LLMultiSlider> multi_slider_bar("multi_slider_bar"); LLDefaultChildRegistry::Register<LLMultiSliderCtrl> multi_slider("multi_slider"); LLDefaultChildRegistry::Register<LLPanel> panel("panel", &LLPanel::fromXML); LLDefaultChildRegistry::Register<LLLayoutStack> layout_stack("layout_stack"); LLDefaultChildRegistry::Register<LLProgressBar> progress_bar("progress_bar"); LLDefaultChildRegistry::Register<LLRadioGroup> radio_group("radio_group"); LLDefaultChildRegistry::Register<LLSearchEditor> search_editor("search_editor"); LLDefaultChildRegistry::Register<LLScrollContainer> scroll_container("scroll_container"); LLDefaultChildRegistry::Register<LLScrollingPanelList> scrolling_panel_list("scrolling_panel_list"); LLDefaultChildRegistry::Register<LLScrollListCtrl> scroll_list("scroll_list"); LLDefaultChildRegistry::Register<LLSlider> slider_bar("slider_bar"); LLDefaultChildRegistry::Register<LLSliderCtrl> slider("slider"); LLDefaultChildRegistry::Register<LLSpinCtrl> spinner("spinner"); LLDefaultChildRegistry::Register<LLStatBar> stat_bar("stat_bar"); //LLDefaultChildRegistry::Register<LLPlaceHolderPanel> placeholder("placeholder"); LLDefaultChildRegistry::Register<LLTabContainer> tab_container("tab_container"); LLDefaultChildRegistry::Register<LLTextBox> text("text"); LLDefaultChildRegistry::Register<LLTimeCtrl> time("time"); LLDefaultChildRegistry::Register<LLTextEditor> simple_text_editor("simple_text_editor"); LLDefaultChildRegistry::Register<LLUICtrl> ui_ctrl("ui_ctrl"); LLDefaultChildRegistry::Register<LLStatView> stat_view("stat_view"); //LLDefaultChildRegistry::Register<LLUICtrlLocate> locate("locate"); //LLDefaultChildRegistry::Register<LLUICtrlLocate> pad("pad"); LLDefaultChildRegistry::Register<LLViewBorder> view_border("view_border"); } // *HACK: Usually this is registered as a viewer text editor LLDefaultChildRegistry::Register<LLTextEditor> text_editor("text_editor"); }
bool show() { label(Far::get_msg(MSG_SFX_OPTIONS_DLG_PROFILE)); vector<wstring> profile_names; profile_names.reserve(profiles.size()); for (unsigned i = 0; i < profiles.size(); i++) { profile_names.push_back(profiles[i].name); } profile_names.push_back(wstring()); profile_ctrl_id = combo_box(profile_names, profiles.size(), 30, DIF_DROPDOWNLIST); new_line(); separator(); new_line(); label(Far::get_msg(MSG_SFX_OPTIONS_DLG_MODULE)); vector<wstring> module_names; const SfxModules& sfx_modules = ArcAPI::sfx(); module_names.reserve(sfx_modules.size() + 1); unsigned name_width = 0; for_each(sfx_modules.begin(), sfx_modules.end(), [&] (const SfxModule& sfx_module) { wstring name = sfx_module.description(); module_names.push_back(name); if (name_width < name.size()) name_width = name.size(); }); module_names.push_back(wstring()); module_ctrl_id = combo_box(module_names, sfx_modules.find_by_name(options.name), name_width + 6, DIF_DROPDOWNLIST); new_line(); replace_icon_ctrl_id = check_box(Far::get_msg(MSG_SFX_OPTIONS_DLG_REPLACE_ICON), options.replace_icon); new_line(); spacer(2); label(Far::get_msg(MSG_SFX_OPTIONS_DLG_ICON_PATH)); icon_path_ctrl_id = history_edit_box(options.icon_path, L"arclite.icon_path", AUTO_SIZE, DIF_EDITPATH | DIF_SELECTONENTRY); new_line(); unsigned label_len = 0; vector<wstring> labels; labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_VER_INFO_PRODUCT_NAME)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_VER_INFO_VERSION)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_VER_INFO_COMPANY_NAME)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_VER_INFO_FILE_DESCRIPTION)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_VER_INFO_COMMENTS)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_VER_INFO_LEGAL_COPYRIGHT)); for (unsigned i = 0; i < labels.size(); i++) if (label_len < labels[i].size()) label_len = labels[i].size(); label_len += 2; vector<wstring>::const_iterator label_text = labels.cbegin(); replace_version_ctrl_id = check_box(Far::get_msg(MSG_SFX_OPTIONS_DLG_REPLACE_VERSION), options.replace_version); new_line(); spacer(2); label(*label_text++); pad(label_len); ver_info_product_name_ctrl_id = edit_box(options.ver_info.product_name, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); ver_info_version_ctrl_id = edit_box(options.ver_info.version, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); ver_info_company_name_ctrl_id = edit_box(options.ver_info.company_name, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); ver_info_file_description_ctrl_id = edit_box(options.ver_info.file_description, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); ver_info_comments_ctrl_id = edit_box(options.ver_info.comments, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); ver_info_legal_copyright_ctrl_id = edit_box(options.ver_info.legal_copyright, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); label_len = 0; labels.clear(); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_INSTALL_CONFIG_TITLE)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_INSTALL_CONFIG_BEGIN_PROMPT)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_INSTALL_CONFIG_PROGRESS)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_INSTALL_CONFIG_RUN_PROGRAM)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_INSTALL_CONFIG_DIRECTORY)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_INSTALL_CONFIG_EXECUTE_FILE)); labels.push_back(Far::get_msg(MSG_SFX_OPTIONS_DLG_INSTALL_CONFIG_EXECUTE_PARAMETERS)); for (unsigned i = 0; i < labels.size(); i++) if (label_len < labels[i].size()) label_len = labels[i].size(); label_len += 2; label_text = labels.cbegin(); append_install_config_ctrl_id = check_box(Far::get_msg(MSG_SFX_OPTIONS_DLG_APPEND_INSTALL_CONFIG), options.append_install_config); new_line(); spacer(2); label(*label_text++); pad(label_len); install_config_title_ctrl_id = edit_box(options.install_config.title, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); install_config_begin_prompt_ctrl_id = edit_box(options.install_config.begin_prompt, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); TriState value; if (options.install_config.progress == L"yes") value = triTrue; else if (options.install_config.progress == L"no") value = triFalse; else value = triUndef; install_config_progress_ctrl_id = check_box3(wstring(), value); new_line(); spacer(2); label(*label_text++); pad(label_len); install_config_run_program_ctrl_id = edit_box(options.install_config.run_program, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); install_config_directory_ctrl_id = edit_box(options.install_config.directory, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); install_config_execute_file_ctrl_id = edit_box(options.install_config.execute_file, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); spacer(2); label(*label_text++); pad(label_len); install_config_execute_parameters_ctrl_id = edit_box(options.install_config.execute_parameters, AUTO_SIZE, DIF_SELECTONENTRY); new_line(); separator(); new_line(); ok_ctrl_id = def_button(Far::get_msg(MSG_BUTTON_OK), DIF_CENTERGROUP); cancel_ctrl_id = button(Far::get_msg(MSG_BUTTON_CANCEL), DIF_CENTERGROUP); new_line(); int item = Far::Dialog::show(); return (item != -1) && (item != cancel_ctrl_id); }
bool show() { use_full_install_ui_ctrl_id = check_box(Far::get_msg(MSG_CONFIG_USE_FULL_INSTALL_UI), options.use_full_install_ui); new_line(); update_stable_builds_ctrl_id = check_box(Far::get_msg(MSG_CONFIG_UPDATE_STABLE_BUILDS), options.update_stable_builds); new_line(); logged_install_ctrl_id = check_box(Far::get_msg(MSG_CONFIG_LOGGED_INSTALL), options.logged_install); new_line(); open_changelog_ctrl_id = check_box(Far::get_msg(MSG_CONFIG_OPEN_CHANGELOG), options.open_changelog); new_line(); label(Far::get_msg(MSG_CONFIG_INSTALL_PROPERTIES)); install_properties_ctrl_id = edit_box(options.install_properties, 30); new_line(); separator(); new_line(); use_proxy_ctrl_id = check_box(Far::get_msg(MSG_CONFIG_USE_PROXY), options.http.use_proxy); new_line(); spacer(2); label(Far::get_msg(MSG_CONFIG_PROXY_SERVER)); proxy_server_ctrl_id = edit_box(options.http.proxy_server, 20); spacer(2); label(Far::get_msg(MSG_CONFIG_PROXY_PORT)); proxy_port_ctrl_id = edit_box(options.http.proxy_port ? int_to_str(options.http.proxy_port) : wstring(), 6); new_line(); spacer(2); label(Far::get_msg(MSG_CONFIG_PROXY_AUTH_SCHEME)); vector<wstring> auth_scheme_list; auth_scheme_list.push_back(Far::get_msg(MSG_CONFIG_PROXY_AUTH_BASIC)); auth_scheme_list.push_back(Far::get_msg(MSG_CONFIG_PROXY_AUTH_NTLM)); auth_scheme_list.push_back(Far::get_msg(MSG_CONFIG_PROXY_AUTH_PASSPORT)); auth_scheme_list.push_back(Far::get_msg(MSG_CONFIG_PROXY_AUTH_DIGEST)); auth_scheme_list.push_back(Far::get_msg(MSG_CONFIG_PROXY_AUTH_NEGOTIATE)); proxy_auth_scheme_ctrl_id = combo_box(auth_scheme_list, options.http.proxy_auth_scheme, AUTO_SIZE, DIF_DROPDOWNLIST); new_line(); spacer(2); label(Far::get_msg(MSG_CONFIG_PROXY_USER_NAME)); proxy_user_name_ctrl_id = edit_box(options.http.proxy_user_name, 15); spacer(2); label(Far::get_msg(MSG_CONFIG_PROXY_PASSWORD)); proxy_password_ctrl_id = edit_box(options.http.proxy_password, 15); new_line(); separator(); new_line(); cache_enabled_ctrl_id = check_box(Far::get_msg(MSG_CONFIG_CACHE_ENABLED), options.cache_enabled); new_line(); spacer(2); label(Far::get_msg(MSG_CONFIG_CACHE_MAX_SIZE)); cache_max_size_ctrl_id = edit_box(int_to_str(options.cache_max_size), 2); new_line(); spacer(2); label(Far::get_msg(MSG_CONFIG_CACHE_DIR)); cache_dir_ctrl_id = edit_box(options.cache_dir, 30); new_line(); separator(); new_line(); ok_ctrl_id = def_button(Far::get_msg(MSG_BUTTON_OK), DIF_CENTERGROUP); cancel_ctrl_id = button(Far::get_msg(MSG_BUTTON_CANCEL), DIF_CENTERGROUP); new_line(); int item = Far::Dialog::show(); return (item != -1) && (item != cancel_ctrl_id); }
/* ----------------------------------------------------------------- * WIDGETS * ----------------------------------------------------------------- */ static void widget_panel(struct gui_panel_layout *panel, struct state *demo) { /* Labels */ gui_panel_row_dynamic(panel, 30, 1); demo->scaleable = gui_panel_check(panel, "Scaleable Layout", demo->scaleable); if (!demo->scaleable) gui_panel_row_static(panel, 30, 150, 1); gui_panel_label(panel, "text left", GUI_TEXT_LEFT); gui_panel_label(panel, "text center", GUI_TEXT_CENTERED); gui_panel_label(panel, "text right", GUI_TEXT_RIGHT); /* Buttons */ if (gui_panel_button_text(panel, "button", GUI_BUTTON_DEFAULT)) demo->popup = gui_true; if (gui_panel_button_text_triangle(panel, GUI_RIGHT, "next", GUI_TEXT_LEFT, GUI_BUTTON_DEFAULT)) fprintf(stdout, "right triangle button pressed!\n"); if (gui_panel_button_text_triangle(panel,GUI_LEFT,"previous",GUI_TEXT_RIGHT,GUI_BUTTON_DEFAULT)) fprintf(stdout, "left triangle button pressed!\n"); demo->toggle = gui_panel_button_toggle(panel, "toggle", demo->toggle); /* checkbox + radio buttons */ demo->checkbox = gui_panel_check(panel, "checkbox", demo->checkbox); if (!demo->scaleable) gui_panel_row_static(panel, 30, 75, 2); else gui_panel_row_dynamic(panel, 30, 2); if (gui_panel_option(panel, "option 0", demo->option == 0)) demo->option = 0; if (gui_panel_option(panel, "option 1", demo->option == 1)) demo->option = 1; { /* retain mode custom row layout */ const gui_float ratio[] = {0.8f, 0.2f}; const gui_float pixel[] = {150.0f, 30.0f}; enum gui_panel_row_layout_format fmt = (demo->scaleable) ? GUI_DYNAMIC : GUI_STATIC; gui_panel_row(panel, fmt, 30, 2, (fmt == GUI_DYNAMIC) ? ratio: pixel); demo->slider = gui_panel_slider(panel, 0, demo->slider, 10, 1.0f); gui_panel_labelf(panel, GUI_TEXT_LEFT, "%.2f", demo->slider); demo->progressbar = gui_panel_progress(panel, demo->progressbar, 100, gui_true); gui_panel_labelf(panel, GUI_TEXT_LEFT, "%lu", demo->progressbar); } /* item selection */ if (!demo->scaleable) gui_panel_row_static(panel, 30, 150, 1); else gui_panel_row_dynamic(panel, 30, 1); demo->item_current = gui_panel_selector(panel, weapons, LEN(weapons), demo->item_current); combo_box(panel, &demo->combo, weapons, LEN(weapons)); prog_combo_box(panel, demo->prog_values, LEN(demo->prog_values), &demo->progcom); color_combo_box(panel, &demo->colcom); check_combo_box(panel, demo->check_values, LEN(demo->check_values), &demo->checkcom); demo->spinner = gui_panel_spinner_int(panel, 0, demo->spinner, 250, 10, &demo->spinner_active); { /* immediate mode custom row layout */ enum gui_panel_row_layout_format fmt = (demo->scaleable) ? GUI_DYNAMIC : GUI_STATIC; gui_panel_row_begin(panel, fmt, 30, 2); { gui_panel_row_push(panel,(fmt == GUI_DYNAMIC) ? 0.7f : 100); gui_panel_editbox(panel, &demo->edit); gui_panel_row_push(panel, (fmt == GUI_DYNAMIC) ? 0.3f : 80); if (gui_panel_button_text(panel, "submit", GUI_BUTTON_DEFAULT)) { gui_edit_box_clear(&demo->edit); fprintf(stdout, "command executed!\n"); } } gui_panel_row_end(panel); } }