mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 11:10:38 +00:00
Implemented some basic handling for mouse down on attachment cell.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10072 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f2074e78b6
commit
d63c81bdea
1 changed files with 31 additions and 3 deletions
|
@ -2036,14 +2036,43 @@ afterString in order over charRange. */
|
|||
possible) */
|
||||
|
||||
startPoint = [self convertPoint: [theEvent locationInWindow] fromView: nil];
|
||||
|
||||
startIndex = [self characterIndexForPoint: startPoint];
|
||||
|
||||
if (_tf.imports_graphics == YES)
|
||||
{
|
||||
NSTextAttachment *attachment;
|
||||
|
||||
// Check if the click was on an attachment cell
|
||||
attachment = [_textStorage attribute: NSAttachmentAttributeName
|
||||
atIndex: startIndex
|
||||
effectiveRange: NULL];
|
||||
|
||||
if (attachment != nil)
|
||||
{
|
||||
id <NSTextAttachmentCell> cell = [attachment attachmentCell];
|
||||
// FIXME: Where to get the cellFrame?
|
||||
NSRect cellFrame = NSMakeRect(0, 0, 0, 0);
|
||||
|
||||
if ((cell != nil) &&
|
||||
([cell wantsToTrackMouseForEvent: theEvent
|
||||
inRect: cellFrame
|
||||
ofView: self
|
||||
atCharacterIndex: startIndex] == YES) &&
|
||||
([cell trackMouse: theEvent
|
||||
inRect: cellFrame
|
||||
ofView: self
|
||||
atCharacterIndex: startIndex
|
||||
untilMouseUp: NO] == YES))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ([theEvent modifierFlags] & NSShiftKeyMask)
|
||||
{
|
||||
/* Shift-click is for extending an existing selection using
|
||||
the existing granularity */
|
||||
granularity = _selectionGranularity;
|
||||
/* Compute the new selection */
|
||||
startIndex = [self characterIndexForPoint: startPoint];
|
||||
proposedRange = NSMakeRange (startIndex, 0);
|
||||
proposedRange = NSUnionRange (_selected_range, proposedRange);
|
||||
proposedRange = [self selectionRangeForProposedRange: proposedRange
|
||||
|
@ -2072,7 +2101,6 @@ afterString in order over charRange. */
|
|||
case 3: granularity = NSSelectByParagraph;
|
||||
break;
|
||||
}
|
||||
startIndex = [self characterIndexForPoint: startPoint];
|
||||
proposedRange = NSMakeRange (startIndex, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue