1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

LibGUI: Add ability to hide GUI::TabWidget's tab bar

This commit is contained in:
Linus Groh 2020-05-18 22:44:08 +01:00 committed by Andreas Kling
parent 082cd7048e
commit 4ab4de7810
2 changed files with 17 additions and 2 deletions

View file

@ -147,6 +147,9 @@ Gfx::Rect TabWidget::container_rect() const
void TabWidget::paint_event(PaintEvent& event)
{
if (!m_bar_visible)
return;
Painter painter(*this);
painter.add_clip_rect(event.rect());
@ -206,6 +209,14 @@ int TabWidget::uniform_tab_width() const
return max(tab_width, minimum_tab_width);
}
void TabWidget::set_bar_visible(bool bar_visible)
{
m_bar_visible = bar_visible;
if (m_active_widget)
m_active_widget->set_relative_rect(child_rect_for_size(size()));
update_bar();
}
Gfx::Rect TabWidget::button_rect(int index) const
{
int x_offset = 2;
@ -346,7 +357,7 @@ void TabWidget::activate_previous_tab()
set_active_widget(m_tabs.at(index).widget);
}
void TabWidget::keydown_event(KeyEvent & event)
void TabWidget::keydown_event(KeyEvent& event)
{
if (event.ctrl() && event.key() == Key_Tab) {
if (event.shift())