mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 03:05:07 +00:00
LibGUI: Rename GTableModel => GModel.
This commit is contained in:
parent
9d4b4c2689
commit
994cf10b3e
23 changed files with 105 additions and 105 deletions
46
LibGUI/GModel.cpp
Normal file
46
LibGUI/GModel.cpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#include <LibGUI/GModel.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
|
||||
GModel::GModel()
|
||||
{
|
||||
}
|
||||
|
||||
GModel::~GModel()
|
||||
{
|
||||
}
|
||||
|
||||
void GModel::register_view(Badge<GTableView>, GTableView& view)
|
||||
{
|
||||
m_views.set(&view);
|
||||
}
|
||||
|
||||
void GModel::unregister_view(Badge<GTableView>, GTableView& view)
|
||||
{
|
||||
m_views.remove(&view);
|
||||
}
|
||||
|
||||
void GModel::for_each_view(Function<void(GTableView&)> callback)
|
||||
{
|
||||
for (auto* view : m_views)
|
||||
callback(*view);
|
||||
}
|
||||
|
||||
void GModel::did_update()
|
||||
{
|
||||
if (on_model_update)
|
||||
on_model_update(*this);
|
||||
for_each_view([] (GTableView& view) {
|
||||
view.did_update_model();
|
||||
});
|
||||
}
|
||||
|
||||
void GModel::set_selected_index(const GModelIndex& index)
|
||||
{
|
||||
if (m_selected_index == index)
|
||||
return;
|
||||
m_selected_index = index;
|
||||
if (on_selection_changed)
|
||||
on_selection_changed(index);
|
||||
if (m_activates_on_selection && is_valid(index))
|
||||
activate(index);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue