1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:08:12 +00:00

LibGUI: Start working on GTableView inline editing.

This is pretty shaky still, but the basic idea is that you subclass GModel
and return true for editable indices. The table view also needs to have its
editable flag set.
This commit is contained in:
Andreas Kling 2019-04-18 22:27:14 +02:00
parent 9ef06e2117
commit 0e6b273620
9 changed files with 95 additions and 6 deletions

View file

@ -4,6 +4,8 @@
#include <LibGUI/GScrollableWidget.h>
#include <AK/Function.h>
class GTextBox;
class GAbstractView : public GScrollableWidget {
friend class GModel;
public:
@ -14,6 +16,9 @@ public:
GModel* model() { return m_model.ptr(); }
const GModel* model() const { return m_model.ptr(); }
bool is_editable() const { return m_editable; }
void set_editable(bool editable) { m_editable = editable; }
virtual bool accepts_focus() const override { return true; }
virtual void did_update_model();
virtual void did_update_selection();
@ -25,6 +30,10 @@ public:
protected:
virtual void model_notification(const GModelNotification&);
bool m_editable { false };
GModelIndex m_edit_index;
GTextBox* m_edit_widget { nullptr };
private:
RetainPtr<GModel> m_model;
};