diff --git a/src/apps/webpositive/LauncherWindow.cpp b/src/apps/webpositive/LauncherWindow.cpp index 9e2e3f5e72..e1ff5e2ba4 100644 --- a/src/apps/webpositive/LauncherWindow.cpp +++ b/src/apps/webpositive/LauncherWindow.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2009 Maxime Simon * Copyright (C) 2010 Stephan Aßmus * Copyright (C) 2010 Michael Lotz + * Copyright (C) 2010 Rene Gollent * * All rights reserved. * @@ -72,6 +73,9 @@ enum { TEXT_HIDE_FIND_GROUP = 'hfnd', TEXT_FIND_NEXT = 'fndn', TEXT_FIND_PREVIOUS = 'fndp', + + NEW_TAB = 'ntab', + CLOSE_TAB = 'ctab' }; using namespace WebCore; @@ -109,7 +113,10 @@ LauncherWindow::LauncherWindow(BRect frame, const BMessenger& downloadListener, newMenu->AddItem(newItem); newItem->SetTarget(this); menu->AddItem(newMenu); - menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W')); + BMenu *closeMenu = new BMenu("Close"); + closeMenu->AddItem(new BMenuItem("Window", new BMessage(B_QUIT_REQUESTED), 'W')); + closeMenu->AddItem(new BMenuItem("Tab", new BMessage(CLOSE_TAB), 'W', B_SHIFT_KEY)); + menu->AddItem(closeMenu); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("Show Downloads", new BMessage(SHOW_DOWNLOAD_WINDOW), 'D')); menu->AddSeparatorItem(); @@ -324,11 +331,18 @@ void LauncherWindow::MessageReceived(BMessage* message) { m_tabView->AddTab(new WebView("web_view")); m_tabView->TabAt(m_tabView->CountTabs() - 1)->SetLabel("New Tab"); - m_tabView->DrawTabs(); m_tabView->Select(m_tabView->CountTabs() - 1); break; } + case CLOSE_TAB: + { + if (m_tabView->CountTabs() > 0) { + delete m_tabView->RemoveTab(m_tabView->FocusTab()); + } + break; + } + case TAB_CHANGED: { int32 index = message->FindInt32("index"); diff --git a/src/apps/webpositive/LauncherWindow.h b/src/apps/webpositive/LauncherWindow.h index ca325b4bc5..803b7f2517 100644 --- a/src/apps/webpositive/LauncherWindow.h +++ b/src/apps/webpositive/LauncherWindow.h @@ -50,7 +50,6 @@ enum ToolbarPolicy { enum { NEW_WINDOW = 'nwnd', - NEW_TAB = 'ntab', WINDOW_OPENED = 'wndo', WINDOW_CLOSED = 'wndc', SHOW_DOWNLOAD_WINDOW = 'sdwd'