[haiku-webkit-commits] r264 - webkit/trunk/WebKit/haiku/WebPositive

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Tue, 02 Mar 2010 01:27:14 +0000

Author: stippi
Date: Tue Mar  2 01:27:14 2010
New Revision: 264
URL: http://mmlr.dyndns.org/changeset/264

Log:
Double clicking beside the tabs opens a new tab.

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp

Modified: webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp        Tue Mar  2 
00:49:48 2010        (r263)
+++ webkit/trunk/WebKit/haiku/WebPositive/WebTabView.cpp        Tue Mar  2 
01:27:14 2010        (r264)
@@ -127,6 +127,7 @@
                virtual void TabSelected(int32 tabIndex) = 0;
                virtual bool HasFrames() = 0;
                virtual TabView* CreateTabView() = 0;
+               virtual void DoubleClickOutsideTabs() = 0;
        };
 
 public:
@@ -252,10 +253,15 @@
        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 @@
 public:
        TabManagerController(TabManager* manager);
 
+       virtual ~TabManagerController();
+
        virtual void TabSelected(int32 index)
        {
                fManager->SelectTab(index);
@@ -727,6 +735,8 @@
 
        virtual TabView* CreateTabView();
 
+       virtual void DoubleClickOutsideTabs();
+
        void CloseTab(int32 index);
 
        void SetCloseButtonsAvailable(bool available)
@@ -739,9 +749,14 @@
                return fCloseButtonsAvailable;
        }
 
+       void SetDoubleClickOutsideTabsMessage(const BMessage& message,
+               const BMessenger& target);
+
 private:
        TabManager* fManager;
        bool fCloseButtonsAvailable;
+       BMessage* fDoubleClickOutsideTabsMessage;
+       BMessenger fTarget;
 };
 
 
@@ -955,11 +970,18 @@
 TabManagerController::TabManagerController(TabManager* manager)
        :
        fManager(manager),
-       fCloseButtonsAvailable(false)
+       fCloseButtonsAvailable(false),
+       fDoubleClickOutsideTabsMessage(NULL)
 {
 }
 
 
+TabManagerController::~TabManagerController()
+{
+       delete fDoubleClickOutsideTabsMessage;
+}
+
+
 TabView*
 TabManagerController::CreateTabView()
 {
@@ -968,12 +990,29 @@
 
 
 void
+TabManagerController::DoubleClickOutsideTabs()
+{
+       fTarget.SendMessage(fDoubleClickOutsideTabsMessage);
+}
+
+
+void
 TabManagerController::CloseTab(int32 index)
 {
        fManager->CloseTab(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 @@
     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);

Other related posts:

  • » [haiku-webkit-commits] r264 - webkit/trunk/WebKit/haiku/WebPositive - webkit