aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PSMTabBar/PSMTabBarControl.m
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2010-09-15 15:02:20 +0000
committeravenjamin <avenjamin@gmail.com>2010-09-15 15:02:20 +0000
commit0909c91b7f986dfe45600bbb6340c79401ccce47 (patch)
tree1f69435a59c49b7ce9ce675e8737e293fab4e70b /Frameworks/PSMTabBar/PSMTabBarControl.m
parent00ac602d8ca381ce2086b3aa10ca21861e61aa6a (diff)
downloadsequelpro-0909c91b7f986dfe45600bbb6340c79401ccce47.tar.gz
sequelpro-0909c91b7f986dfe45600bbb6340c79401ccce47.tar.bz2
sequelpro-0909c91b7f986dfe45600bbb6340c79401ccce47.zip
Add ability to double click the empty area of the tab bar to create a new tab.
- Slightly limited in that the addTabButton's target and action must be set for it to work.
Diffstat (limited to 'Frameworks/PSMTabBar/PSMTabBarControl.m')
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.m20
1 files changed, 19 insertions, 1 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m
index 53e48729..4c92624e 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.m
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.m
@@ -567,6 +567,16 @@
_selectsTabsOnMouseDown = value;
}
+- (BOOL)doubleClickCreatesTab
+{
+ return _createsTabOnDoubleClick;
+}
+
+- (void)setDoubleClickCreatesTab:(BOOL)value
+{
+ _createsTabOnDoubleClick = value;
+}
+
- (BOOL)automaticallyAnimates
{
return _automaticallyAnimates;
@@ -1298,7 +1308,15 @@
}
}
[self setNeedsDisplay:YES];
- }
+ } else {
+ if ([theEvent clickCount] == 2) {
+ // fire create new tab
+ if ([self doubleClickCreatesTab] && [[self addTabButton] target] != nil && [[self addTabButton] action] != nil) {
+ [[[self addTabButton] target] performSelector:[[self addTabButton] action]];
+ }
+ return;
+ }
+ }
}
- (void)mouseDragged:(NSEvent *)theEvent