From ea64d486a2a339a2560959c5fa179aabe00dff60 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 12 Aug 2024 17:56:58 +0300 Subject: [PATCH] implement tab close public method --- src/app/browser/main/tab.cpp | 11 ++++++++--- src/app/browser/main/tab.hpp | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/app/browser/main/tab.cpp b/src/app/browser/main/tab.cpp index 7afe429a..ef273600 100644 --- a/src/app/browser/main/tab.cpp +++ b/src/app/browser/main/tab.cpp @@ -63,6 +63,13 @@ void Tab::append( } }; +void Tab::close() +{ + remove_page( + get_current_page() + ); +} + void Tab::on_label_click( int n, double x, @@ -70,8 +77,6 @@ void Tab::on_label_click( ) { if (n == 2) // double click { - remove_page( - get_current_page() - ); + Tab::close(); } } \ No newline at end of file diff --git a/src/app/browser/main/tab.hpp b/src/app/browser/main/tab.hpp index f2bfd731..331c4875 100644 --- a/src/app/browser/main/tab.hpp +++ b/src/app/browser/main/tab.hpp @@ -49,6 +49,8 @@ namespace app::browser::main bool focus ); + void close(); + void update(); }; }