mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
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.
43 lines
971 B
C++
43 lines
971 B
C++
#include <LibGUI/GAbstractView.h>
|
|
#include <LibGUI/GModel.h>
|
|
#include <LibGUI/GScrollBar.h>
|
|
#include <LibGUI/GPainter.h>
|
|
#include <LibGUI/GTextBox.h>
|
|
#include <Kernel/KeyCode.h>
|
|
|
|
GAbstractView::GAbstractView(GWidget* parent)
|
|
: GScrollableWidget(parent)
|
|
{
|
|
}
|
|
|
|
GAbstractView::~GAbstractView()
|
|
{
|
|
delete m_edit_widget;
|
|
}
|
|
|
|
void GAbstractView::set_model(RetainPtr<GModel>&& model)
|
|
{
|
|
if (model == m_model)
|
|
return;
|
|
if (m_model)
|
|
m_model->unregister_view(Badge<GAbstractView>(), *this);
|
|
m_model = move(model);
|
|
if (m_model)
|
|
m_model->register_view(Badge<GAbstractView>(), *this);
|
|
did_update_model();
|
|
}
|
|
|
|
void GAbstractView::model_notification(const GModelNotification& notification)
|
|
{
|
|
if (on_model_notification)
|
|
on_model_notification(notification);
|
|
}
|
|
|
|
void GAbstractView::did_update_model()
|
|
{
|
|
model_notification(GModelNotification(GModelNotification::ModelUpdated));
|
|
}
|
|
|
|
void GAbstractView::did_update_selection()
|
|
{
|
|
}
|