LibGUI: Allow overriding the padding inside a TabWidget

This commit is contained in:
Andreas Kling 2020-04-24 20:30:32 +02:00
parent 9d8620f956
commit 1587b53001
Notes: sideshowbarker 2024-07-19 07:19:43 +09:00
2 changed files with 6 additions and 2 deletions

View file

@ -156,7 +156,8 @@ void TabWidget::paint_event(PaintEvent& event)
padding_rect.shrink(2, 2);
}
Gfx::StylePainter::paint_frame(painter, container_rect, palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Raised, 2);
if (container_padding() > 0)
Gfx::StylePainter::paint_frame(painter, container_rect, palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Raised, 2);
for (size_t i = 0; i < m_tabs.size(); ++i) {
if (m_tabs[i].widget == m_active_widget)

View file

@ -50,7 +50,9 @@ public:
void set_active_widget(Widget*);
int bar_height() const { return 21; }
int container_padding() const { return 2; }
int container_padding() const { return m_container_padding; }
void set_container_padding(int padding) { m_container_padding = padding; }
void add_widget(const StringView&, Widget&);
void remove_widget(Widget&);
@ -100,6 +102,7 @@ private:
Vector<TabData> m_tabs;
TabPosition m_tab_position { TabPosition::Top };
int m_hovered_tab_index { -1 };
int m_container_padding { 2 };
};
}