twindow *build(CVideo &video, const std::string &type) { std::vector<twindow_builder::tresolution>::const_iterator definition = get_window_builder(type); twindow *window = build(video, &*definition); window->set_id(type); return window; }
/*WIKI * @page = GUIWidgetInstanceWML * @order = 1 * * THIS PAGE IS AUTOMATICALLY GENERATED, DO NOT MODIFY DIRECTLY !!! * * = Widget instance = * * Inside a grid (which is inside all container widgets) a widget is * instantiated. With this instantiation some more variables of a widget can * be tuned. This page will describe what can be tuned. * */ twindow* build(CVideo& video, const std::string& type) { std::vector<twindow_builder::tresolution>::const_iterator definition = get_window_builder(type); // We set the values from the definition since we can only determine the // best size (if needed) after all widgets have been placed. twindow* window = new twindow(video , definition->x , definition->y , definition->width , definition->height , definition->automatic_placement , definition->horizontal_placement , definition->vertical_placement , definition->maximum_width , definition->maximum_height , definition->definition); assert(window); window->set_id(type); foreach(const twindow_builder::tresolution::tlinked_group& lg, definition->linked_groups) { if(window->has_linked_size_group(lg.id)) { utils::string_map symbols; symbols["id"] = lg.id; t_string msg = vgettext( "Linked '$id' group has multiple definitions." , symbols); VALIDATE(false, msg); } window->init_linked_size_group( lg.id, lg.fixed_width, lg.fixed_height); } window->set_click_dismiss(definition->click_dismiss); boost::intrusive_ptr<const twindow_definition::tresolution> conf = boost::dynamic_pointer_cast< const twindow_definition::tresolution>(window->config()); assert(conf); if(conf->grid) { window->init_grid(conf->grid); window->finalize(definition->grid); } else { window->init_grid(definition->grid); } window->add_to_keyboard_chain(window); return window; }
/*WIKI * @page = GUIWidgetInstanceWML * @order = 1 * * THIS PAGE IS AUTOMATICALLY GENERATED, DO NOT MODIFY DIRECTLY !!! * * = Widget instance = * * Inside a grid (which is inside all container widgets) a widget is * instantiated. With this instantiation some more variables of a widget can * be tuned. This page will describe what can be tuned. * */ twindow* build(CVideo& video, const std::string& type) { std::vector<twindow_builder::tresolution>::const_iterator definition = get_window_builder(type); // We set the values from the definition since we can only determine the // best size (if needed) after all widgets have been placed. twindow* window = new twindow(video, definition->x, definition->y, definition->width, definition->height, definition->automatic_placement, definition->horizontal_placement, definition->vertical_placement, definition->definition); assert(window); log_scope2(gui, "Window builder: building grid for window"); window->set_easy_close(definition->easy_close); const unsigned rows = definition->grid->rows; const unsigned cols = definition->grid->cols; window->set_rows_cols(rows, cols); for(unsigned x = 0; x < rows; ++x) { window->set_row_grow_factor(x, definition->grid->row_grow_factor[x]); for(unsigned y = 0; y < cols; ++y) { if(x == 0) { window->set_col_grow_factor(y, definition->grid->col_grow_factor[y]); } twidget* widget = definition->grid->widgets[x * cols + y]->build(); window->set_child(widget, x, y, definition->grid->flags[x * cols + y], definition->grid->border_size[x * cols + y]); } } window->add_to_keyboard_chain(window); return window; }