mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-01 17:47:56 +00:00
Listbox columns have the same width again.
The header row still has a different width, which will be fixed later.
This commit is contained in:
parent
2150ae4c15
commit
360471880f
@ -7,6 +7,8 @@ Version 1.5.11+svn:
|
|||||||
* Miscellaneous and bug fixes:
|
* Miscellaneous and bug fixes:
|
||||||
* Removed last binaryWML references by making the save_index gzip
|
* Removed last binaryWML references by making the save_index gzip
|
||||||
compressed. (We can still receive binaryWML via the network.)
|
compressed. (We can still receive binaryWML via the network.)
|
||||||
|
* User interface:
|
||||||
|
* Listbox columns have the same width again
|
||||||
|
|
||||||
Version 1.5.11:
|
Version 1.5.11:
|
||||||
* Campaigns:
|
* Campaigns:
|
||||||
|
@ -6,6 +6,8 @@ Version 1.5.11+svn:
|
|||||||
* Language and translations
|
* Language and translations
|
||||||
* updated translations: Chinese (Simplified), Czech, French, Polish,
|
* updated translations: Chinese (Simplified), Czech, French, Polish,
|
||||||
Portuguese (Brazil), Spanish, Turkish.
|
Portuguese (Brazil), Spanish, Turkish.
|
||||||
|
* User interface
|
||||||
|
* Listbox columns have the same width again.
|
||||||
|
|
||||||
Version 1.5.11:
|
Version 1.5.11:
|
||||||
* Graphics
|
* Graphics
|
||||||
|
@ -44,6 +44,15 @@ void tlistbox::add_row(const string_map& item)
|
|||||||
assert(generator_);
|
assert(generator_);
|
||||||
generator_->create_item(
|
generator_->create_item(
|
||||||
-1, list_builder_, item, callback_list_item_clicked);
|
-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());
|
||||||
|
}
|
||||||
|
add_linked_size_widgets(*window, grid.begin(), grid.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
void tlistbox::add_row(
|
void tlistbox::add_row(
|
||||||
@ -52,6 +61,15 @@ void tlistbox::add_row(
|
|||||||
assert(generator_);
|
assert(generator_);
|
||||||
generator_->create_item(
|
generator_->create_item(
|
||||||
-1, list_builder_, data, callback_list_item_clicked);
|
-1, list_builder_, data, 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());
|
||||||
|
}
|
||||||
|
add_linked_size_widgets(*window, grid.begin(), grid.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned tlistbox::get_item_count() const
|
unsigned tlistbox::get_item_count() const
|
||||||
@ -190,6 +208,48 @@ 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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,6 +153,49 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo A listbox must have the following config parameters in the
|
||||||
|
* instanciation:
|
||||||
|
* - fixed row height?
|
||||||
|
* - fixed column width?
|
||||||
|
* and if so the following ways to set them
|
||||||
|
* - fixed depending on header ids
|
||||||
|
* - fixed depending on footer ids
|
||||||
|
* - fixed depending on first row ids
|
||||||
|
* - fixed depending on list (the user has to enter a list of ids)
|
||||||
|
*
|
||||||
|
* 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 it's 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 it's 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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finishes the building initialization of the widget.
|
* Finishes the building initialization of the widget.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user