mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:14:58 +00:00
Userland: Set tab-widget properties in GML instead of code
This commit is contained in:
parent
24a8a260c0
commit
84b98da259
6 changed files with 6 additions and 7 deletions
|
@ -74,9 +74,6 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
|
||||||
auto& top_line = *widget.find_descendant_of_type_named<GUI::HorizontalSeparator>("top_line");
|
auto& top_line = *widget.find_descendant_of_type_named<GUI::HorizontalSeparator>("top_line");
|
||||||
|
|
||||||
m_tab_widget = *widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
m_tab_widget = *widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||||
m_tab_widget->set_reorder_allowed(true);
|
|
||||||
m_tab_widget->set_close_button_enabled(true);
|
|
||||||
|
|
||||||
m_tab_widget->on_tab_count_change = [&top_line](size_t tab_count) {
|
m_tab_widget->on_tab_count_change = [&top_line](size_t tab_count) {
|
||||||
top_line.set_visible(tab_count > 1);
|
top_line.set_visible(tab_count > 1);
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
name: "tab_widget"
|
name: "tab_widget"
|
||||||
container_margins: [0]
|
container_margins: [0]
|
||||||
uniform_tabs: true
|
uniform_tabs: true
|
||||||
|
reorder_allowed: true
|
||||||
|
show_close_buttons: true
|
||||||
text_alignment: "CenterLeft"
|
text_alignment: "CenterLeft"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,6 @@ MainWidget::MainWidget()
|
||||||
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar");
|
||||||
|
|
||||||
m_tab_widget = find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
m_tab_widget = find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||||
m_tab_widget->set_container_margins({ 4, 5, 5, 4 });
|
|
||||||
m_tab_widget->set_reorder_allowed(true);
|
|
||||||
m_tab_widget->set_close_button_enabled(true);
|
|
||||||
|
|
||||||
m_palette_widget = *find_descendant_of_type_named<PixelPaint::PaletteWidget>("palette_widget");
|
m_palette_widget = *find_descendant_of_type_named<PixelPaint::PaletteWidget>("palette_widget");
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,9 @@
|
||||||
|
|
||||||
@GUI::TabWidget {
|
@GUI::TabWidget {
|
||||||
name: "tab_widget"
|
name: "tab_widget"
|
||||||
|
container_margins: [4, 5, 5, 4]
|
||||||
|
reorder_allowed: true
|
||||||
|
show_close_buttons: true
|
||||||
}
|
}
|
||||||
|
|
||||||
@PixelPaint::PaletteWidget {
|
@PixelPaint::PaletteWidget {
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
|
|
||||||
@GUI::TabWidget {
|
@GUI::TabWidget {
|
||||||
name: "tab_widget"
|
name: "tab_widget"
|
||||||
|
reorder_allowed: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ GalleryWidget::GalleryWidget()
|
||||||
load_from_gml(window_gml);
|
load_from_gml(window_gml);
|
||||||
|
|
||||||
auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
auto& tab_widget = *find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
|
||||||
tab_widget.set_reorder_allowed(true);
|
|
||||||
|
|
||||||
auto basics_tab = tab_widget.try_add_tab<GUI::Widget>("Basics").release_value_but_fixme_should_propagate_errors();
|
auto basics_tab = tab_widget.try_add_tab<GUI::Widget>("Basics").release_value_but_fixme_should_propagate_errors();
|
||||||
basics_tab->load_from_gml(basics_tab_gml);
|
basics_tab->load_from_gml(basics_tab_gml);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue