aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTextAndLinkCell.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2013-08-27 23:52:01 +0000
committerrowanbeentje <rowan@beent.je>2013-08-27 23:52:01 +0000
commit110ffbf58c596add5dfd1d71e7777f90b2a84c00 (patch)
tree233f47fab5bf74b53d24bdf3014699e73339feaa /Source/SPTextAndLinkCell.m
parent64eb9b76d33d6cd28a3ad7caee8e792e4a2cffd3 (diff)
downloadsequelpro-110ffbf58c596add5dfd1d71e7777f90b2a84c00.tar.gz
sequelpro-110ffbf58c596add5dfd1d71e7777f90b2a84c00.tar.bz2
sequelpro-110ffbf58c596add5dfd1d71e7777f90b2a84c00.zip
- Add the ability for SPTextAndLinkCell arrows to be selectively disabled on a per-cell rather than a per-column basis
- Use this ability in SPTableContentDelegate to disable link arrows if the cell is showing a NULL or (not loaded) value, and also if the current row is being edited and so might be unvalidated. This addresses Issue #1790 and http://spbug.com/l/2306 .
Diffstat (limited to 'Source/SPTextAndLinkCell.m')
-rw-r--r--Source/SPTextAndLinkCell.m9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/SPTextAndLinkCell.m b/Source/SPTextAndLinkCell.m
index 249c5261..3e91914a 100644
--- a/Source/SPTextAndLinkCell.m
+++ b/Source/SPTextAndLinkCell.m
@@ -34,6 +34,8 @@
@implementation SPTextAndLinkCell
+@synthesize linkActive;
+
/**
* Provide a method to derive the link rect from a cell rect.
*/
@@ -53,6 +55,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
self = [super initWithCoder:coder];
if (self) {
hasLink = NO;
+ linkActive = YES;
linkButton = nil;
linkTarget = nil;
drawState = SPLinkDrawStateNormal;
@@ -131,7 +134,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
{
// Fast case for no arrow
- if (!hasLink) {
+ if (!hasLink || !linkActive) {
[super drawInteriorWithFrame:aRect inView:controlView];
return;
}
@@ -179,7 +182,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
{
// Fast case for no link - make entire cell editable click area
- if (!hasLink) return NSCellHitContentArea | NSCellHitEditableTextArea;
+ if (!hasLink || !linkActive) return NSCellHitContentArea | NSCellHitEditableTextArea;
NSPoint p = [[[NSApp mainWindow] contentView] convertPoint:[event locationInWindow] toView:controlView];
NSRect linkRect = SPTextLinkRectFromCellRect(cellFrame);
@@ -204,7 +207,7 @@ static inline NSRect SPTextLinkRectFromCellRect(NSRect inRect)
{
// Fast case for no link
- if (!hasLink) return [super trackMouse:theEvent inRect:cellFrame ofView:controlView untilMouseUp:untilMouseUp];
+ if (!hasLink || !linkActive) return [super trackMouse:theEvent inRect:cellFrame ofView:controlView untilMouseUp:untilMouseUp];
NSPoint p = [controlView convertPoint:[theEvent locationInWindow] fromView:nil];
NSRect linkRect = SPTextLinkRectFromCellRect(cellFrame);