summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibGUI/ComboBox.cpp24
-rw-r--r--Libraries/LibGUI/ComboBox.h11
-rw-r--r--Libraries/LibGUI/Forward.h1
3 files changed, 28 insertions, 8 deletions
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 <LibGUI/ListView.h>
#include <LibGUI/Model.h>
#include <LibGUI/ScrollBar.h>
-#include <LibGUI/TextEditor.h>
+#include <LibGUI/TextBox.h>
#include <LibGUI/Window.h>
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<TextBox>();
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 <LibGUI/ListView.h>
#include <LibGUI/Widget.h>
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<Model>);
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<void(const String&, const ModelIndex&)> on_change;
Function<void()> on_return_pressed;
@@ -61,7 +60,7 @@ protected:
virtual void resize_event(ResizeEvent&) override;
private:
- RefPtr<TextEditor> m_editor;
+ RefPtr<TextBox> m_editor;
RefPtr<Button> m_open_button;
RefPtr<Window> m_list_window;
RefPtr<ListView> m_list_view;
diff --git a/Libraries/LibGUI/Forward.h b/Libraries/LibGUI/Forward.h
index 4c1068f21a..3fc85b72e4 100644
--- a/Libraries/LibGUI/Forward.h
+++ b/Libraries/LibGUI/Forward.h
@@ -45,6 +45,7 @@ class JsonArrayModel;
class KeyEvent;
class Label;
class Layout;
+class ListView;
class Menu;
class MenuBar;
class MenuItem;