LibGUI: Add TabWidget::activate_last_tab()

This commit is contained in:
Olivier De Cannière 2022-03-16 20:06:27 +01:00 committed by Andreas Kling
parent 04b6a060ca
commit 1b7850f511
Notes: sideshowbarker 2024-07-17 16:18:19 +09:00
2 changed files with 9 additions and 0 deletions

View File

@ -592,6 +592,14 @@ void TabWidget::activate_previous_tab()
set_active_widget(m_tabs.at(previous_index).widget);
}
void TabWidget::activate_last_tab()
{
size_t number_of_tabs = m_tabs.size();
if (number_of_tabs == 0)
return;
set_active_widget(m_tabs.at(number_of_tabs - 1).widget);
}
void TabWidget::keydown_event(KeyEvent& event)
{
if (event.ctrl() && event.key() == Key_Tab) {

View File

@ -66,6 +66,7 @@ public:
void activate_next_tab();
void activate_previous_tab();
void activate_last_tab();
void set_text_alignment(Gfx::TextAlignment alignment) { m_text_alignment = alignment; }
Gfx::TextAlignment text_alignment() const { return m_text_alignment; }