Skip to content

Commit

Permalink
Add geChoice::hasItem() method
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Dec 3, 2023
1 parent 616db4a commit 8bd0b2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gui/elems/basics/choice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ std::size_t geChoice::countItems() const

/* -------------------------------------------------------------------------- */

bool geChoice::hasItem(ID oid) const
{
return u::vector::has(m_ids, [oid](const ID& id) { return oid == id; });
}

/* -------------------------------------------------------------------------- */

void geChoice::clear()
{
m_menu->clear();
Expand Down
1 change: 1 addition & 0 deletions src/gui/elems/basics/choice.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class geChoice : public geFlex
ID getSelectedId() const;
std::string getSelectedLabel() const;
std::size_t countItems() const;
bool hasItem(ID) const;

/* addItem
Adds a new item with a certain ID. Pass id = -1 to auto-increment it (ID
Expand Down

0 comments on commit 8bd0b2e

Please sign in to comment.