mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 13:19:47 +00:00
LibGUI: Take ProcessManager's process view and turn it into GTableView.
Make it sufficiently generic that it can be reused for any table data. :^)
This commit is contained in:
33
LibGUI/GTableModel.cpp
Normal file
33
LibGUI/GTableModel.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#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()
|
||||
{
|
||||
for_each_view([] (GTableView& view) {
|
||||
view.did_update_model();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user