diff --git a/Libraries/LibGUI/ComboBox.cpp b/Libraries/LibGUI/ComboBox.cpp index ebe0043357..90bc2ed743 100644 --- a/Libraries/LibGUI/ComboBox.cpp +++ b/Libraries/LibGUI/ComboBox.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include namespace GUI { @@ -38,7 +38,7 @@ namespace GUI { ComboBox::ComboBox(Widget* parent) : Widget(parent) { - m_editor = TextEditor::construct(TextEditor::Type::SingleLine, this); + m_editor = add(); m_editor->on_change = [this] { if (on_change) on_change(m_editor->text(), m_list_view->selection().first()); @@ -150,4 +150,24 @@ void ComboBox::set_only_allow_values_from_model(bool b) m_editor->set_readonly(m_only_allow_values_from_model); } +Model* ComboBox::model() +{ + return m_list_view->model(); +} + +const Model* ComboBox::model() const +{ + return m_list_view->model(); +} + +int ComboBox::model_column() const +{ + return m_list_view->model_column(); +} + +void ComboBox::set_model_column(int column) +{ + m_list_view->set_model_column(column); +} + } diff --git a/Libraries/LibGUI/ComboBox.h b/Libraries/LibGUI/ComboBox.h index 9aff51066d..51ebbd2e4c 100644 --- a/Libraries/LibGUI/ComboBox.h +++ b/Libraries/LibGUI/ComboBox.h @@ -26,7 +26,6 @@ #pragma once -#include #include namespace GUI { @@ -43,15 +42,15 @@ public: void close(); void select_all(); - Model* model() { return m_list_view->model(); } - const Model* model() const { return m_list_view->model(); } + Model* model(); + const Model* model() const; void set_model(NonnullRefPtr); bool only_allow_values_from_model() const { return m_only_allow_values_from_model; } void set_only_allow_values_from_model(bool); - int model_column() const { return m_list_view->model_column(); } - void set_model_column(int column) { m_list_view->set_model_column(column); } + int model_column() const; + void set_model_column(int); Function on_change; Function on_return_pressed; @@ -61,7 +60,7 @@ protected: virtual void resize_event(ResizeEvent&) override; private: - RefPtr m_editor; + RefPtr m_editor; RefPtr