stocks: Support getSelectedItem()

develop
lethosor 2016-12-27 17:40:54 -05:00
parent 8bd92b6a08
commit cd0d9fed18
1 changed files with 12 additions and 0 deletions

@ -1062,6 +1062,18 @@ public:
std::string getFocusString() { return "stocks_view"; } std::string getFocusString() { return "stocks_view"; }
df::item *getSelectedItem() override
{
if (is_grouped)
return nullptr;
vector<item_grouped_entry*> items = getSelectedItems();
if (items.size() != 1)
return nullptr;
if (items[0]->entries.size() != 1)
return nullptr;
return items[0]->entries[0];
}
private: private:
StockListColumn<item_grouped_entry *> items_column; StockListColumn<item_grouped_entry *> items_column;
int selected_column; int selected_column;