aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableView.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-05-14 17:26:18 +0000
committerstuconnolly <stuart02@gmail.com>2011-05-14 17:26:18 +0000
commit2dbae24c7735ead0524bd9847af6ea99d8654ec6 (patch)
tree87dbed4317214da2aa9e2aed493fd7b798b3e2bc /Source/SPTableView.m
parent160728cd29519794b47b3a09b139ce9d604883f0 (diff)
downloadsequelpro-2dbae24c7735ead0524bd9847af6ea99d8654ec6.tar.gz
sequelpro-2dbae24c7735ead0524bd9847af6ea99d8654ec6.tar.bz2
sequelpro-2dbae24c7735ead0524bd9847af6ea99d8654ec6.zip
Bring outline view branch up to date with trunk (r3279:r3306).
Diffstat (limited to 'Source/SPTableView.m')
-rw-r--r--Source/SPTableView.m45
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index d678fef3..9139bb79 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -34,10 +34,34 @@
@end
+@interface SPTableView (PrivateAPI)
+
+- (void)_doubleClickAction;
+
+@end
+
+
@implementation SPTableView
@synthesize tabEditingDisabled;
+- (id) init
+{
+ if ((self = [super init])) {
+ emptyDoubleClickAction = NULL;
+ }
+ return self;
+}
+
+- (void) awakeFromNib
+{
+ [super setDoubleAction:@selector(_doubleClickAction)];
+ if ([NSTableView instancesRespondToSelector:@selector(awakeFromNib)])
+ [super awakeFromNib];
+}
+
+#pragma mark -
+
/**
* Right-click at row will select that row before ordering out the contextual menu
* if not more than one row is selected.
@@ -193,4 +217,25 @@
}
}
+- (void)setEmptyDoubleClickAction:(SEL)aSelector
+{
+ emptyDoubleClickAction = aSelector;
+}
+
+@end
+
+
+@implementation SPTableView (PrivateAPI)
+
+/**
+ * On a double click, determine whether the action was in the empty area
+ * of the current table; if so, perform the assigned emptyDoubleClick action.
+ */
+- (void)_doubleClickAction
+{
+ if ([super clickedRow] == -1 && [super clickedColumn] == -1 && emptyDoubleClickAction) {
+ [[self delegate] performSelector:emptyDoubleClickAction];
+ }
+}
+
@end