1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 02:15:08 +00:00
serenity/LibGUI/GTableModel.cpp
Andreas Kling 7d1142c7d9 Make it possible to sort a GTableModel by column+order.
This is accomplished by putting a GSortingProxyTableModel between the model
and the view. It's pretty simplistic but it works for this use case. :^)
2019-03-09 13:33:52 +01:00

35 lines
636 B
C++

#include <LibGUI/GTableModel.h>
#include <LibGUI/GTableView.h>
GTableModel::GTableModel()
{
}
GTableModel::~GTableModel()
{
}
void GTableModel::register_view(Badge<GTableView>, GTableView& view)
{
m_views.set(&view);
}
void GTableModel::unregister_view(Badge<GTableView>, GTableView& view)
{
m_views.remove(&view);
}
void GTableModel::for_each_view(Function<void(GTableView&)> callback)
{
for (auto* view : m_views)
callback(*view);
}
void GTableModel::did_update()
{
if (on_model_update)
on_model_update(*this);
for_each_view([] (GTableView& view) {
view.did_update_model();
});
}