diff options
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r-- | Libraries/LibGUI/ComboBox.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibGUI/ComboBox.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibGUI/ComboBox.cpp b/Libraries/LibGUI/ComboBox.cpp index e04ec4f09f..fa082c85c2 100644 --- a/Libraries/LibGUI/ComboBox.cpp +++ b/Libraries/LibGUI/ComboBox.cpp @@ -163,6 +163,11 @@ void ComboBox::set_selected_index(size_t index) this->m_list_view->selection().set(model_index); } +size_t ComboBox::selected_index() const +{ + return m_list_view->selection().first().row(); +} + void ComboBox::select_all() { m_editor->select_all(); diff --git a/Libraries/LibGUI/ComboBox.h b/Libraries/LibGUI/ComboBox.h index 0a82d17ff1..b9c3fe8e21 100644 --- a/Libraries/LibGUI/ComboBox.h +++ b/Libraries/LibGUI/ComboBox.h @@ -49,6 +49,7 @@ public: const Model* model() const; void set_model(NonnullRefPtr<Model>); + size_t selected_index() const; void set_selected_index(size_t index); bool only_allow_values_from_model() const { return m_only_allow_values_from_model; } |