Add better support for default ListColumn values

This is only necessary for multiple-selection columns, and there aren't any
with non-pointer entry types currently, but casting nullptr to non-pointer types
isn't a great idea.
develop
lethosor 2016-01-06 17:30:07 -05:00
parent 7eb442e98c
commit 97fb50c28f
1 changed files with 4 additions and 2 deletions

@ -35,8 +35,9 @@ public:
bool allow_search;
bool feed_mouse_set_highlight;
bool feed_changed_highlight;
T default_value;
ListColumn()
ListColumn(const T default_value_ = T())
{
bottom_margin = 3;
clear();
@ -50,6 +51,7 @@ public:
allow_search = true;
feed_mouse_set_highlight = false;
feed_changed_highlight = false;
default_value = default_value_;
}
void clear()
@ -310,7 +312,7 @@ public:
{
vector<T> results = getSelectedElems(true);
if (results.size() == 0)
return (T)nullptr;
return default_value;
else
return results[0];
}