GUI2/Multimenu Button: store max shown count as an unsigned int
A negative count here makes no sense...
This commit is contained in:
parent
f95dc40f13
commit
23740ea3cf
2 changed files with 6 additions and 6 deletions
|
@ -165,8 +165,8 @@ void multimenu_button::update_label()
|
|||
if(selected.size() == values_.size()) {
|
||||
set_label(_("multimenu^All Selected"));
|
||||
} else {
|
||||
if(selected.size() > static_cast<std::size_t>(max_shown_)) {
|
||||
const int excess = selected.size() - max_shown_;
|
||||
if(selected.size() > max_shown_) {
|
||||
const unsigned excess = selected.size() - max_shown_;
|
||||
selected.resize(max_shown_ + 1);
|
||||
selected.back() = VNGETTEXT("multimenu^$excess other", "$excess others", excess, {{"excess", std::to_string(excess)}});
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
*
|
||||
* @param max The maximum number of elements to show
|
||||
*/
|
||||
void set_max_shown(const int max)
|
||||
void set_max_shown(const unsigned max)
|
||||
{
|
||||
max_shown_ = max;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
*
|
||||
* @returns The maximum number of elements to show
|
||||
*/
|
||||
int get_max_shown()
|
||||
unsigned get_max_shown()
|
||||
{
|
||||
return max_shown_;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ private:
|
|||
/**
|
||||
* The maximum number of selected states to list in the label
|
||||
*/
|
||||
int max_shown_;
|
||||
unsigned max_shown_;
|
||||
|
||||
std::vector<::config> values_;
|
||||
|
||||
|
@ -213,7 +213,7 @@ public:
|
|||
virtual widget_ptr build() const override;
|
||||
|
||||
private:
|
||||
int max_shown_;
|
||||
unsigned max_shown_;
|
||||
std::vector<::config> options_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue