ソースを参照

Browser: Enable close button on tabs

Marcus Nilsson 4 年 前
コミット
32fc8da917
1 ファイル変更6 行追加0 行削除
  1. 6 0
      Userland/Applications/Browser/BrowserWindow.cpp

+ 6 - 0
Userland/Applications/Browser/BrowserWindow.cpp

@@ -60,6 +60,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
     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->set_close_button_enabled(true);
 
     m_tab_widget->on_tab_count_change = [&top_line](size_t tab_count) {
         top_line.set_visible(tab_count > 1);
@@ -76,6 +77,11 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
         tab.on_tab_close_request(tab);
     };
 
+    m_tab_widget->on_tab_close_click = [](auto& clicked_widget) {
+        auto& tab = static_cast<Browser::Tab&>(clicked_widget);
+        tab.on_tab_close_request(tab);
+    };
+
     m_tab_widget->on_context_menu_request = [](auto& clicked_widget, const GUI::ContextMenuEvent& context_menu_event) {
         auto& tab = static_cast<Browser::Tab&>(clicked_widget);
         tab.context_menu_requested(context_menu_event.screen_position());