mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 16:45:08 +00:00
LibGUI: Add GAbstractView base class for GTableView.
This is in preparation for adding a new view class.
This commit is contained in:
parent
994cf10b3e
commit
5707d7f547
7 changed files with 100 additions and 64 deletions
35
LibGUI/GAbstractView.cpp
Normal file
35
LibGUI/GAbstractView.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include <LibGUI/GAbstractView.h>
|
||||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GScrollBar.h>
|
||||
#include <SharedGraphics/Painter.h>
|
||||
#include <Kernel/KeyCode.h>
|
||||
|
||||
GAbstractView::GAbstractView(GWidget* parent)
|
||||
: GScrollableWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
GAbstractView::~GAbstractView()
|
||||
{
|
||||
}
|
||||
|
||||
void GAbstractView::set_model(RetainPtr<GModel>&& model)
|
||||
{
|
||||
if (model.ptr() == m_model.ptr())
|
||||
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&)
|
||||
{
|
||||
}
|
||||
|
||||
void GAbstractView::did_update_model()
|
||||
{
|
||||
model_notification(GModelNotification(GModelNotification::ModelUpdated));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue