Double clicking beside the tabs opens a new tab.
git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@264 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
parent
ea77068a8e
commit
39274de5a3
@ -127,6 +127,7 @@ public:
|
||||
virtual void TabSelected(int32 tabIndex) = 0;
|
||||
virtual bool HasFrames() = 0;
|
||||
virtual TabView* CreateTabView() = 0;
|
||||
virtual void DoubleClickOutsideTabs() = 0;
|
||||
};
|
||||
|
||||
public:
|
||||
@ -252,10 +253,15 @@ TabContainerView::MouseDown(BPoint where)
|
||||
uint32 buttons;
|
||||
if (Window()->CurrentMessage()->FindInt32("buttons", (int32*)&buttons) != B_OK)
|
||||
buttons = B_PRIMARY_MOUSE_BUTTON;
|
||||
uint32 clicks;
|
||||
if (Window()->CurrentMessage()->FindInt32("clicks", (int32*)&clicks) != B_OK)
|
||||
clicks = 1;
|
||||
fMouseDown = true;
|
||||
SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
|
||||
if (fLastMouseEventTab)
|
||||
fLastMouseEventTab->MouseDown(where, buttons);
|
||||
else if (clicks > 1)
|
||||
fController->DoubleClickOutsideTabs();
|
||||
}
|
||||
|
||||
|
||||
@ -715,6 +721,8 @@ class TabManagerController : public TabContainerView::Controller {
|
||||
public:
|
||||
TabManagerController(TabManager* manager);
|
||||
|
||||
virtual ~TabManagerController();
|
||||
|
||||
virtual void TabSelected(int32 index)
|
||||
{
|
||||
fManager->SelectTab(index);
|
||||
@ -727,6 +735,8 @@ public:
|
||||
|
||||
virtual TabView* CreateTabView();
|
||||
|
||||
virtual void DoubleClickOutsideTabs();
|
||||
|
||||
void CloseTab(int32 index);
|
||||
|
||||
void SetCloseButtonsAvailable(bool available)
|
||||
@ -739,9 +749,14 @@ public:
|
||||
return fCloseButtonsAvailable;
|
||||
}
|
||||
|
||||
void SetDoubleClickOutsideTabsMessage(const BMessage& message,
|
||||
const BMessenger& target);
|
||||
|
||||
private:
|
||||
TabManager* fManager;
|
||||
bool fCloseButtonsAvailable;
|
||||
BMessage* fDoubleClickOutsideTabsMessage;
|
||||
BMessenger fTarget;
|
||||
};
|
||||
|
||||
|
||||
@ -955,11 +970,18 @@ void WebTabView::_DrawCloseButton(BView* owner, BRect& frame,
|
||||
TabManagerController::TabManagerController(TabManager* manager)
|
||||
:
|
||||
fManager(manager),
|
||||
fCloseButtonsAvailable(false)
|
||||
fCloseButtonsAvailable(false),
|
||||
fDoubleClickOutsideTabsMessage(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TabManagerController::~TabManagerController()
|
||||
{
|
||||
delete fDoubleClickOutsideTabsMessage;
|
||||
}
|
||||
|
||||
|
||||
TabView*
|
||||
TabManagerController::CreateTabView()
|
||||
{
|
||||
@ -967,6 +989,13 @@ TabManagerController::CreateTabView()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TabManagerController::DoubleClickOutsideTabs()
|
||||
{
|
||||
fTarget.SendMessage(fDoubleClickOutsideTabsMessage);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TabManagerController::CloseTab(int32 index)
|
||||
{
|
||||
@ -974,6 +1003,16 @@ TabManagerController::CloseTab(int32 index)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TabManagerController::SetDoubleClickOutsideTabsMessage(const BMessage& message,
|
||||
const BMessenger& target)
|
||||
{
|
||||
delete fDoubleClickOutsideTabsMessage;
|
||||
fDoubleClickOutsideTabsMessage = new BMessage(message);
|
||||
fTarget = target;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - TabButtonContainer
|
||||
|
||||
|
||||
@ -1145,6 +1184,9 @@ TabManager::TabManager(const BMessenger& target, BMessage* newTabMessage)
|
||||
fController(new TabManagerController(this)),
|
||||
fTarget(target)
|
||||
{
|
||||
fController->SetDoubleClickOutsideTabsMessage(*newTabMessage,
|
||||
be_app_messenger);
|
||||
|
||||
fContainerView = new BView("web view container", 0);
|
||||
fCardLayout = new BCardLayout();
|
||||
fContainerView->SetLayout(fCardLayout);
|
||||
|
Loading…
Reference in New Issue
Block a user