mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
add is_selected_page option
This commit is contained in:
parent
2b898d9b47
commit
d074ef17fe
4 changed files with 18 additions and 6 deletions
|
|
@ -8,13 +8,22 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new_arc(tab_view: &TabView, page: &Box, title: Option<&str>) -> Arc<Self> {
|
||||
pub fn new_arc(
|
||||
tab_view: &TabView,
|
||||
page: &Box,
|
||||
title: Option<&str>,
|
||||
is_selected_page: bool,
|
||||
) -> Arc<Self> {
|
||||
let gobject = tab_view.append(page);
|
||||
|
||||
if let Some(value) = title {
|
||||
gobject.set_title(value);
|
||||
}
|
||||
|
||||
if is_selected_page {
|
||||
tab_view.set_selected_page(&gobject);
|
||||
}
|
||||
|
||||
Arc::new(Self { gobject })
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue