mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
use tab page private getter
This commit is contained in:
parent
f2e4981fdc
commit
47c68deb7a
2 changed files with 28 additions and 25 deletions
|
|
@ -29,35 +29,13 @@ Tab::~Tab() = default;
|
||||||
Glib::ustring Tab::get_page_title(
|
Glib::ustring Tab::get_page_title(
|
||||||
const int & PAGE_NUMBER
|
const int & PAGE_NUMBER
|
||||||
) {
|
) {
|
||||||
auto pageWidget = get_nth_page(
|
return get_tab_page(PAGE_NUMBER)->get_title();
|
||||||
PAGE_NUMBER
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pageWidget == nullptr)
|
|
||||||
{
|
|
||||||
throw _("Tab page not found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
auto tabPage = (tab::Page *) pageWidget;
|
|
||||||
|
|
||||||
return tabPage->get_title();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Glib::ustring Tab::get_page_subtitle(
|
Glib::ustring Tab::get_page_subtitle(
|
||||||
const int & PAGE_NUMBER
|
const int & PAGE_NUMBER
|
||||||
) {
|
) {
|
||||||
auto pageWidget = get_nth_page(
|
return get_tab_page(PAGE_NUMBER)->get_subtitle();
|
||||||
PAGE_NUMBER
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pageWidget == nullptr)
|
|
||||||
{
|
|
||||||
throw _("Tab page not found!");
|
|
||||||
}
|
|
||||||
|
|
||||||
auto tabPage = (tab::Page *) pageWidget;
|
|
||||||
|
|
||||||
return tabPage->get_subtitle();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
@ -168,3 +146,19 @@ void Tab::update(
|
||||||
}
|
}
|
||||||
|
|
||||||
} // @TODO
|
} // @TODO
|
||||||
|
|
||||||
|
// Private helpers
|
||||||
|
tab::Page * Tab::get_tab_page(
|
||||||
|
const int & PAGE_NUMBER
|
||||||
|
) {
|
||||||
|
auto pageWidget = get_nth_page(
|
||||||
|
PAGE_NUMBER
|
||||||
|
);
|
||||||
|
|
||||||
|
if (pageWidget == nullptr)
|
||||||
|
{
|
||||||
|
throw _("Tab page not found!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (tab::Page *) pageWidget;
|
||||||
|
}
|
||||||
|
|
@ -7,11 +7,20 @@
|
||||||
|
|
||||||
namespace app::browser::main
|
namespace app::browser::main
|
||||||
{
|
{
|
||||||
|
namespace tab
|
||||||
|
{
|
||||||
|
class Page;
|
||||||
|
}
|
||||||
|
|
||||||
class Tab : public Gtk::Notebook
|
class Tab : public Gtk::Notebook
|
||||||
{
|
{
|
||||||
const bool REORDERABLE = true;
|
const bool REORDERABLE = true;
|
||||||
const bool SCROLLABLE = true;
|
const bool SCROLLABLE = true;
|
||||||
|
|
||||||
|
tab::Page * get_tab_page(
|
||||||
|
const int & PAGE_NUMBER
|
||||||
|
);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Tab();
|
Tab();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue