mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
add get_label_text, use lambda function on switch_page, rename page_number variables
This commit is contained in:
parent
8e3730f61d
commit
fbfb8039b0
2 changed files with 37 additions and 23 deletions
|
|
@ -15,9 +15,9 @@ Tab::Tab()
|
|||
signal_switch_page().connect(
|
||||
[this](Gtk::Widget * page, guint page_num)
|
||||
{
|
||||
on_switch(
|
||||
page,
|
||||
page_num
|
||||
// Refresh window elements, e.g. tab label to header bar
|
||||
activate_action(
|
||||
"win.refresh"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
@ -25,6 +25,26 @@ Tab::Tab()
|
|||
|
||||
Tab::~Tab() = default;
|
||||
|
||||
// Getters
|
||||
Glib::ustring Tab::get_label_text(
|
||||
int page_number
|
||||
) {
|
||||
auto page = get_nth_page(
|
||||
page_number
|
||||
);
|
||||
|
||||
if (page != nullptr)
|
||||
{
|
||||
return get_tab_label_text(
|
||||
* get_nth_page(
|
||||
page_number
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return ""; // @TODO
|
||||
};
|
||||
|
||||
// Actions
|
||||
void Tab::append(
|
||||
const char * request,
|
||||
|
|
@ -92,22 +112,17 @@ void Tab::close_all()
|
|||
}
|
||||
|
||||
void Tab::update(
|
||||
int number
|
||||
int page_number
|
||||
) {
|
||||
auto page = get_nth_page(
|
||||
number
|
||||
page_number
|
||||
);
|
||||
|
||||
page->activate_action(
|
||||
"page.update"
|
||||
);
|
||||
if (page != nullptr)
|
||||
{
|
||||
page->activate_action(
|
||||
"page.update"
|
||||
);
|
||||
}
|
||||
|
||||
} // @TODO
|
||||
|
||||
// Events
|
||||
void Tab::on_switch(
|
||||
Gtk::Widget * page,
|
||||
guint page_num
|
||||
) {
|
||||
// @TODO update header text
|
||||
}
|
||||
} // @TODO
|
||||
Loading…
Add table
Add a link
Reference in a new issue