Remove some obsolete listbox code.
This commit is contained in:
parent
2f2d2326ae
commit
f93038fc35
5 changed files with 2 additions and 194 deletions
|
@ -1,6 +1,8 @@
|
|||
Version 1.7.3+svn:
|
||||
* Language and i18n:
|
||||
* Updated translations:
|
||||
* Miscellaneous and bugfixes:
|
||||
* Removed obsolete code for implicit linked widgets for the listbox
|
||||
|
||||
Version 1.7.3:
|
||||
* AI:
|
||||
|
|
|
@ -37,8 +37,6 @@ tbuilder_listbox::tbuilder_listbox(const config& cfg)
|
|||
, footer(NULL)
|
||||
, list_builder(NULL)
|
||||
, list_data()
|
||||
, linked_widgets_disabled_(
|
||||
utils::string_bool(cfg["linked_widgets_disabled"]))
|
||||
{
|
||||
if(const config &h = cfg.child("header")) {
|
||||
header = new tbuilder_grid(h);
|
||||
|
@ -87,8 +85,6 @@ twidget* tbuilder_listbox::build() const
|
|||
widget->set_vertical_scrollbar_mode(vertical_scrollbar_mode);
|
||||
widget->set_horizontal_scrollbar_mode(horizontal_scrollbar_mode);
|
||||
|
||||
widget->set_linked_widgets_disabled(linked_widgets_disabled_);
|
||||
|
||||
DBG_GUI_G << "Window builder: placed listbox '"
|
||||
<< id << "' with defintion '"
|
||||
<< definition << "'.\n";
|
||||
|
@ -148,14 +144,6 @@ twidget* tbuilder_listbox::build() const
|
|||
* must have the same number of columns as
|
||||
* the 'list_definition'.
|
||||
*
|
||||
* linked_widgets_disabled (bool = false)
|
||||
* Should the listbox automatically
|
||||
* enable linked widgets? This feature is
|
||||
* there for backwards compatibility and
|
||||
* will be removed in the future. It needs
|
||||
* to be set to true now since the old way
|
||||
* is no longer supported.
|
||||
*
|
||||
* @end_table
|
||||
*
|
||||
* In order to force widgets to be the same size inside a listbox, the widgets
|
||||
|
|
|
@ -46,8 +46,6 @@ struct tbuilder_listbox
|
|||
* serialize the data in the config, so the config is no longer required.
|
||||
*/
|
||||
std::vector<string_map> list_data;
|
||||
|
||||
bool linked_widgets_disabled_;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
|
|
|
@ -37,8 +37,6 @@ tlistbox::tlistbox(const bool has_minimum, const bool has_maximum,
|
|||
, generator_(NULL)
|
||||
, list_builder_(NULL)
|
||||
, callback_value_changed_(NULL)
|
||||
, linked_size_initialized_(false)
|
||||
, linked_widgets_disabled_(false)
|
||||
{
|
||||
generator_ = tgenerator_::build(
|
||||
has_minimum, has_maximum, placement, select);
|
||||
|
@ -49,27 +47,6 @@ void tlistbox::add_row(const string_map& item)
|
|||
assert(generator_);
|
||||
generator_->create_item(
|
||||
-1, list_builder_, item, callback_list_item_clicked);
|
||||
|
||||
tgrid& grid = generator_->get_item(get_item_count() - 1);
|
||||
twindow* window = get_window();
|
||||
assert(window);
|
||||
|
||||
if(get_item_count() == 1) {
|
||||
init_linked_size_widets(*window, grid.begin(), grid.end());
|
||||
|
||||
/**
|
||||
* @todo add footer and make one function to do this part since the
|
||||
* code is duplicated at two places.
|
||||
*/
|
||||
tgrid* header_grid = dynamic_cast<tgrid*>(
|
||||
content_grid()->find_widget("_header_grid", false));
|
||||
|
||||
if(header_grid) {
|
||||
add_linked_size_widgets(*window, header_grid->begin(),
|
||||
header_grid->end());
|
||||
}
|
||||
}
|
||||
add_linked_size_widgets(*window, grid.begin(), grid.end());
|
||||
}
|
||||
|
||||
void tlistbox::add_row(
|
||||
|
@ -78,25 +55,6 @@ void tlistbox::add_row(
|
|||
assert(generator_);
|
||||
generator_->create_item(
|
||||
-1, list_builder_, data, callback_list_item_clicked);
|
||||
|
||||
tgrid& grid = generator_->get_item(get_item_count() - 1);
|
||||
twindow* window = get_window();
|
||||
assert(window);
|
||||
|
||||
if(!linked_size_initialized_) {
|
||||
linked_size_initialized_ = true;
|
||||
|
||||
init_linked_size_widets(*window, grid.begin(), grid.end());
|
||||
|
||||
tgrid* header_grid = dynamic_cast<tgrid*>(
|
||||
content_grid()->find_widget("_header_grid", false));
|
||||
|
||||
if(header_grid) {
|
||||
add_linked_size_widgets(*window, header_grid->begin(),
|
||||
header_grid->end());
|
||||
}
|
||||
}
|
||||
add_linked_size_widgets(*window, grid.begin(), grid.end());
|
||||
}
|
||||
|
||||
void tlistbox::remove_row(const unsigned row, unsigned count)
|
||||
|
@ -112,14 +70,6 @@ void tlistbox::remove_row(const unsigned row, unsigned count)
|
|||
}
|
||||
|
||||
for(; count; --count) {
|
||||
twindow* window = get_window();
|
||||
assert(window);
|
||||
|
||||
tgrid* grid = get_row_grid(row);
|
||||
assert(grid);
|
||||
|
||||
remove_linked_size_widgets(*window, grid->begin(), grid->end());
|
||||
|
||||
generator_->delete_item(row);
|
||||
}
|
||||
}
|
||||
|
@ -282,86 +232,6 @@ void tlistbox::handle_key_right_arrow(SDLMod modifier, bool& handled)
|
|||
}
|
||||
}
|
||||
|
||||
void tlistbox::init_linked_size_widets(twindow& window,
|
||||
const tgrid::iterator& begin, const tgrid::iterator& end)
|
||||
{
|
||||
if(linked_widgets_disabled_) {
|
||||
return;
|
||||
}
|
||||
ERR_GUI_G << "The listbox uses the "
|
||||
"deprecated automatic linked widget feature.\n";
|
||||
assert(false);
|
||||
|
||||
for(tgrid::iterator itor = begin; itor != end; ++itor) {
|
||||
|
||||
assert(*itor);
|
||||
|
||||
// Add to list.
|
||||
if(!itor->id().empty()) {
|
||||
window.init_linked_size_group(itor->id(), true, false);
|
||||
}
|
||||
|
||||
// Recurse though the children.
|
||||
tcontainer_* container = dynamic_cast<tcontainer_*>(*itor);
|
||||
if(container) {
|
||||
init_linked_size_widets(window,
|
||||
container->begin(), container->end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tlistbox::add_linked_size_widgets(twindow& window,
|
||||
const tgrid::iterator& begin, const tgrid::iterator& end)
|
||||
{
|
||||
if(linked_widgets_disabled_) {
|
||||
return;
|
||||
}
|
||||
assert(false);
|
||||
|
||||
for(tgrid::iterator itor = begin; itor != end; ++itor) {
|
||||
|
||||
assert(*itor);
|
||||
|
||||
// Add to list.
|
||||
if(!itor->id().empty()) {
|
||||
window.add_linked_widget(itor->id(), *itor);
|
||||
}
|
||||
|
||||
// Recurse though the children.
|
||||
tcontainer_* container = dynamic_cast<tcontainer_*>(*itor);
|
||||
if(container) {
|
||||
add_linked_size_widgets(window,
|
||||
container->begin(), container->end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tlistbox::remove_linked_size_widgets(twindow& window,
|
||||
const tgrid::iterator& begin, const tgrid::iterator& end)
|
||||
{
|
||||
if(linked_widgets_disabled_) {
|
||||
return;
|
||||
}
|
||||
assert(false);
|
||||
|
||||
for(tgrid::iterator itor = begin; itor != end; ++itor) {
|
||||
|
||||
assert(*itor);
|
||||
|
||||
// Add to list.
|
||||
if(!itor->id().empty()) {
|
||||
window.remove_linked_widget(itor->id(), *itor);
|
||||
}
|
||||
|
||||
// Recurse though the children.
|
||||
tcontainer_* container = dynamic_cast<tcontainer_*>(*itor);
|
||||
if(container) {
|
||||
remove_linked_size_widgets(window,
|
||||
container->begin(), container->end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
|
|
|
@ -195,48 +195,6 @@ private:
|
|||
* For now it's always fixed width depending on the first row.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initializes the linked size list.
|
||||
*
|
||||
* The routine goes from begin to end through the widgets and if the
|
||||
* widget has an id it's used to initialize the linked size list of the
|
||||
* parent window. If the widget is a container all its children are also
|
||||
* initialized.
|
||||
*
|
||||
* @param window The parent window.
|
||||
* @param begin Begin iterator.
|
||||
* @param end End iterator.
|
||||
*/
|
||||
void init_linked_size_widets(twindow& window,
|
||||
const tgrid::iterator& begin, const tgrid::iterator& end);
|
||||
|
||||
/**
|
||||
* Adds widgets to the linked size list.
|
||||
*
|
||||
* The routine goes from begin to end through the widgets and if the
|
||||
* widget has an id it's added to the linked size list of the parent
|
||||
* window. If the widget is a container all its children are also added.
|
||||
*
|
||||
* @param window The parent window.
|
||||
* @param begin Begin iterator.
|
||||
* @param end End iterator.
|
||||
*/
|
||||
void add_linked_size_widgets(twindow& window,
|
||||
const tgrid::iterator& begin, const tgrid::iterator& end);
|
||||
|
||||
/**
|
||||
* Removes widgets from the linked size list.
|
||||
*
|
||||
* The routine goes from begin to end through the widgets and if the
|
||||
* widget has an id it's removed from the linked size list of the parent
|
||||
* window. If the widget is a container all its children are also added.
|
||||
*
|
||||
* @param window The parent window.
|
||||
* @param begin Begin iterator.
|
||||
* @param end End iterator.
|
||||
*/
|
||||
void remove_linked_size_widgets(twindow& window,
|
||||
const tgrid::iterator& begin, const tgrid::iterator& end);
|
||||
|
||||
/**
|
||||
* Finishes the building initialization of the widget.
|
||||
|
@ -268,14 +226,6 @@ private:
|
|||
*/
|
||||
void (*callback_value_changed_) (twidget*);
|
||||
|
||||
/**
|
||||
* Is the linked size list initialized.
|
||||
*
|
||||
* This needs to be tracked since a listbox can be cleared during its
|
||||
* usage.
|
||||
*/
|
||||
bool linked_size_initialized_;
|
||||
|
||||
/**
|
||||
* Automatically add the linked widget style for the listbox?
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue