aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2010-09-15 15:48:29 +0000
committeravenjamin <avenjamin@gmail.com>2010-09-15 15:48:29 +0000
commit42b58dcdda0c82473bfed4df8211c6f0f343c6fc (patch)
tree41305c83699d6c5f66de9050c1b28aea12590701
parent0909c91b7f986dfe45600bbb6340c79401ccce47 (diff)
downloadsequelpro-42b58dcdda0c82473bfed4df8211c6f0f343c6fc.tar.gz
sequelpro-42b58dcdda0c82473bfed4df8211c6f0f343c6fc.tar.bz2
sequelpro-42b58dcdda0c82473bfed4df8211c6f0f343c6fc.zip
More work on tab creation target and action
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.h12
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarControl.m34
-rw-r--r--Source/SPWindowController.m6
3 files changed, 43 insertions, 9 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.h b/Frameworks/PSMTabBar/PSMTabBarControl.h
index d734f3c8..2ac8474a 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.h
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.h
@@ -89,6 +89,8 @@ enum {
BOOL _allowsBackgroundTabClosing;
BOOL _selectsTabsOnMouseDown;
BOOL _createsTabOnDoubleClick;
+ id _createNewTabTarget;
+ SEL _createNewTabAction;
// vertical tab resizing
BOOL _allowsResizing;
@@ -136,6 +138,12 @@ enum {
- (void)setHideForSingleTab:(BOOL)value;
- (BOOL)showAddTabButton;
- (void)setShowAddTabButton:(BOOL)value;
+
+- (id)createNewTabTarget;
+- (void)setCreateNewTabTarget:(id)object;
+- (SEL)createNewTabAction;
+- (void)setCreateNewTabAction:(SEL)selector;
+
- (NSInteger)cellMinWidth;
- (void)setCellMinWidth:(NSInteger)value;
- (NSInteger)cellMaxWidth;
@@ -152,8 +160,8 @@ enum {
- (void)setAllowsResizing:(BOOL)value;
- (BOOL)selectsTabsOnMouseDown;
- (void)setSelectsTabsOnMouseDown:(BOOL)value;
-- (BOOL)doubleClickCreatesTab;
-- (void)setDoubleClickCreatesTab:(BOOL)value;
+- (BOOL)createsTabOnDoubleClick;
+- (void)setCreatesTabOnDoubleClick:(BOOL)value;
- (BOOL)automaticallyAnimates;
- (void)setAutomaticallyAnimates:(BOOL)value;
- (BOOL)alwaysShowActiveTab;
diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m
index 4c92624e..a9268a78 100644
--- a/Frameworks/PSMTabBar/PSMTabBarControl.m
+++ b/Frameworks/PSMTabBar/PSMTabBarControl.m
@@ -472,6 +472,32 @@
[self update];
}
+
+
+- (id)createNewTabTarget
+{
+ return _createNewTabTarget;
+}
+
+- (void)setCreateNewTabTarget:(id)object
+{
+ _createNewTabTarget = object;
+ [[self addTabButton] setTarget:object];
+}
+
+- (SEL)createNewTabAction
+{
+ return _createNewTabAction;
+}
+
+- (void)setCreateNewTabAction:(SEL)selector
+{
+ _createNewTabAction = selector;
+ [[self addTabButton] setAction:selector];
+}
+
+
+
- (NSInteger)cellMinWidth
{
return _cellMinWidth;
@@ -567,12 +593,12 @@
_selectsTabsOnMouseDown = value;
}
-- (BOOL)doubleClickCreatesTab
+- (BOOL)createsTabOnDoubleClick;
{
return _createsTabOnDoubleClick;
}
-- (void)setDoubleClickCreatesTab:(BOOL)value
+- (void)setCreatesTabOnDoubleClick:(BOOL)value
{
_createsTabOnDoubleClick = value;
}
@@ -1311,8 +1337,8 @@
} 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]];
+ if ([self createsTabOnDoubleClick] && [self createNewTabTarget] != nil && [self createNewTabAction] != nil) {
+ [[self createNewTabTarget] performSelector:[self createNewTabAction]];
}
return;
}
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index 341d8afa..23346af3 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -61,13 +61,13 @@
[tabBar setCellMaxWidth:250];
[tabBar setCellOptimumWidth:250];
[tabBar setSelectsTabsOnMouseDown:YES];
- [tabBar setDoubleClickCreatesTab:YES];
+ [tabBar setCreatesTabOnDoubleClick:YES];
[tabBar setTearOffStyle:PSMTabBarTearOffAlphaWindow];
[tabBar setUsesSafariStyleDragging:YES];
// hook up add tab button
- [[tabBar addTabButton] setTarget:self];
- [[tabBar addTabButton] setAction:@selector(addNewConnection:)];
+ [tabBar setCreateNewTabTarget:self];
+ [tabBar setCreateNewTabAction:@selector(addNewConnection:)];
// Retrieve references to the 'Close Window' and 'Close Tab' menus. These are updated as window focus changes.
closeWindowMenuItem = [[[[NSApp mainMenu] itemWithTag:SPMainMenuFile] submenu] itemWithTag:1003];