Skip to content

Commit 0d35d27

Browse files
committed
stuff
1 parent 03f9bbc commit 0d35d27

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

src/ruis/widget/group/table_list.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@ class provider : public list_provider
3333

3434
const utki::shared_ref<table_list::provider> table_list_provider;
3535

36-
provider(table_list& owner, utki::shared_ref<table_list::provider> table_list_provider) :
36+
provider(
37+
table_list& owner, //
38+
utki::shared_ref<table_list::provider> table_list_provider
39+
) :
3740
list_provider(table_list_provider.get().context),
3841
owner(owner),
3942
table_list_provider(std::move(table_list_provider))
40-
{}
43+
{
44+
this->table_list_provider.get().model_change_signal.connect([this]() {
45+
this->notify_model_change();
46+
});
47+
}
4148

4249
size_t count() const noexcept override
4350
{
@@ -195,6 +202,13 @@ void table_list::arrange_list_item_cells(ruis::semiconst_widget_list& cells)
195202
}
196203
}
197204

205+
void table_list::provider::notify_model_change()
206+
{
207+
this->context.get().post_to_ui_thread([this]() {
208+
this->model_change_signal.emit();
209+
});
210+
}
211+
198212
utki::shared_ref<ruis::table_list> make::table_list(
199213
utki::shared_ref<ruis::context> context, //
200214
ruis::table_list::all_parameters params

src/ruis/widget/group/table_list.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ class table_list :
4747
*/
4848
class provider
4949
{
50+
friend class ruis::internal::provider;
51+
52+
utki::signal<> model_change_signal;
53+
5054
public:
5155
const utki::shared_ref<ruis::context> context;
5256

@@ -73,6 +77,12 @@ class table_list :
7377
* @return A list of widgets for table row cell.
7478
*/
7579
virtual widget_list get_row_widgets(size_t index) = 0;
80+
81+
/**
82+
* @brief Notify about change of items model.
83+
* The user is supposed to invoke this function when items model change.
84+
*/
85+
void notify_model_change();
7686
};
7787

7888
struct parameters {

0 commit comments

Comments
 (0)