mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Minor MacOS-0X comnpatibility tweak.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25169 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0b148d2db8
commit
59cc6718c4
2 changed files with 64 additions and 54 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-05-16 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSTextAttachment.m: For MacOS-X compatibility, don't call
|
||||
([-setAttachment:]) on the cell if the cell class doesn't implement
|
||||
it.
|
||||
|
||||
2007-05-10 Riccardo Mottola <rmottola@users.sf.net>
|
||||
|
||||
* Source/NSAnimation.m: removed some C99-isms
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
||||
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include "AppKit/NSCell.h"
|
||||
|
@ -45,18 +46,18 @@
|
|||
|
||||
@implementation NSTextAttachmentCell
|
||||
|
||||
- (void)drawWithFrame:(NSRect)cellFrame
|
||||
inView:(NSView *)controlView
|
||||
characterIndex:(unsigned)charIndex
|
||||
- (void)drawWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
characterIndex: (unsigned)charIndex
|
||||
{
|
||||
[self drawWithFrame: cellFrame
|
||||
inView: controlView];
|
||||
}
|
||||
|
||||
- (void)drawWithFrame:(NSRect)cellFrame
|
||||
inView:(NSView *)controlView
|
||||
characterIndex:(unsigned)charIndex
|
||||
layoutManager:(NSLayoutManager *)layoutManager
|
||||
- (void)drawWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
characterIndex: (unsigned)charIndex
|
||||
layoutManager: (NSLayoutManager *)layoutManager
|
||||
{
|
||||
[self drawWithFrame: cellFrame
|
||||
inView: controlView
|
||||
|
@ -68,10 +69,10 @@
|
|||
return NSZeroPoint;
|
||||
}
|
||||
|
||||
- (NSRect)cellFrameForTextContainer:(NSTextContainer *)textContainer
|
||||
proposedLineFragment:(NSRect)lineFrag
|
||||
glyphPosition:(NSPoint)position
|
||||
characterIndex:(unsigned)charIndex
|
||||
- (NSRect)cellFrameForTextContainer: (NSTextContainer *)textContainer
|
||||
proposedLineFragment: (NSRect)lineFrag
|
||||
glyphPosition: (NSPoint)position
|
||||
characterIndex: (unsigned)charIndex
|
||||
{
|
||||
NSRect aRect;
|
||||
|
||||
|
@ -85,18 +86,18 @@
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)wantsToTrackMouseForEvent:(NSEvent *)theEvent
|
||||
inRect:(NSRect)cellFrame
|
||||
ofView:(NSView *)controlView
|
||||
atCharacterIndex:(unsigned)charIndex
|
||||
- (BOOL)wantsToTrackMouseForEvent: (NSEvent *)theEvent
|
||||
inRect: (NSRect)cellFrame
|
||||
ofView: (NSView *)controlView
|
||||
atCharacterIndex: (unsigned)charIndex
|
||||
{
|
||||
return [self wantsToTrackMouse];
|
||||
}
|
||||
|
||||
- (BOOL)trackMouse:(NSEvent *)theEvent
|
||||
inRect:(NSRect)cellFrame
|
||||
ofView:(NSView *)controlView
|
||||
untilMouseUp:(BOOL)flag
|
||||
- (BOOL)trackMouse: (NSEvent *)theEvent
|
||||
inRect: (NSRect)cellFrame
|
||||
ofView: (NSView *)controlView
|
||||
untilMouseUp: (BOOL)flag
|
||||
{
|
||||
if ([controlView respondsToSelector: @selector(delegate)])
|
||||
{
|
||||
|
@ -108,9 +109,8 @@
|
|||
{
|
||||
if ([theEvent clickCount] == 2)
|
||||
{
|
||||
if (delegate != nil &&
|
||||
[delegate respondsToSelector:
|
||||
@selector(textView:doubleClickedOnCell:inRect:)])
|
||||
if (delegate != nil && [delegate respondsToSelector:
|
||||
@selector(textView:doubleClickedOnCell:inRect:)])
|
||||
{
|
||||
[delegate textView: textView
|
||||
doubleClickedOnCell: self
|
||||
|
@ -120,9 +120,8 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
if (delegate != nil &&
|
||||
[delegate respondsToSelector:
|
||||
@selector(textView:clickedOnCell:inRect:)])
|
||||
if (delegate != nil && [delegate respondsToSelector:
|
||||
@selector(textView:clickedOnCell:inRect:)])
|
||||
{
|
||||
[delegate textView: textView
|
||||
clickedOnCell: self
|
||||
|
@ -133,9 +132,8 @@
|
|||
}
|
||||
else if (type == NSLeftMouseDragged)
|
||||
{
|
||||
if (delegate != nil &&
|
||||
[delegate respondsToSelector:
|
||||
@selector(textView:draggedCell:inRect:event:)])
|
||||
if (delegate != nil && [delegate respondsToSelector:
|
||||
@selector(textView:draggedCell:inRect:event:)])
|
||||
{
|
||||
[delegate textView: textView
|
||||
draggedCell: self
|
||||
|
@ -152,11 +150,11 @@
|
|||
untilMouseUp: flag];
|
||||
}
|
||||
|
||||
- (BOOL)trackMouse:(NSEvent *)theEvent
|
||||
inRect:(NSRect)cellFrame
|
||||
ofView:(NSView *)controlView
|
||||
atCharacterIndex:(unsigned)charIndex
|
||||
untilMouseUp:(BOOL)flag
|
||||
- (BOOL)trackMouse: (NSEvent *)theEvent
|
||||
inRect: (NSRect)cellFrame
|
||||
ofView: (NSView *)controlView
|
||||
atCharacterIndex: (unsigned)charIndex
|
||||
untilMouseUp: (BOOL)flag
|
||||
{
|
||||
if ([controlView respondsToSelector: @selector(delegate)])
|
||||
{
|
||||
|
@ -168,9 +166,8 @@
|
|||
{
|
||||
if ([theEvent clickCount] == 2)
|
||||
{
|
||||
if (delegate != nil &&
|
||||
[delegate respondsToSelector:
|
||||
@selector(textView:doubleClickedOnCell:inRect:atIndex:)])
|
||||
if (delegate != nil && [delegate respondsToSelector:
|
||||
@selector(textView:doubleClickedOnCell:inRect:atIndex:)])
|
||||
{
|
||||
[delegate textView: textView
|
||||
doubleClickedOnCell: self
|
||||
|
@ -181,9 +178,8 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
if (delegate != nil &&
|
||||
[delegate respondsToSelector:
|
||||
@selector(textView:clickedOnCell:inRect:atIndex:)])
|
||||
if (delegate != nil && [delegate respondsToSelector:
|
||||
@selector(textView:clickedOnCell:inRect:atIndex:)])
|
||||
{
|
||||
[delegate textView: textView
|
||||
clickedOnCell: self
|
||||
|
@ -195,9 +191,8 @@
|
|||
}
|
||||
else if (type == NSLeftMouseDragged)
|
||||
{
|
||||
if (delegate != nil &&
|
||||
[delegate respondsToSelector:
|
||||
@selector(textView:draggedCell:inRect:event:atIndex:)])
|
||||
if (delegate != nil && [delegate respondsToSelector:
|
||||
@selector(textView:draggedCell:inRect:event:atIndex:)])
|
||||
{
|
||||
[delegate textView: textView
|
||||
draggedCell: self
|
||||
|
@ -215,7 +210,7 @@
|
|||
untilMouseUp: flag];
|
||||
}
|
||||
|
||||
- (void)setAttachment:(NSTextAttachment *)anObject
|
||||
- (void)setAttachment: (NSTextAttachment *)anObject
|
||||
{
|
||||
NSFileWrapper *fileWrap = [anObject fileWrapper];
|
||||
|
||||
|
@ -252,16 +247,16 @@
|
|||
return [super cellSize];
|
||||
}
|
||||
|
||||
- (void)highlight:(BOOL)flag
|
||||
withFrame:(NSRect)cellFrame
|
||||
inView:(NSView *)controlView
|
||||
- (void)highlight: (BOOL)flag
|
||||
withFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
{
|
||||
[super highlight: flag
|
||||
withFrame: cellFrame
|
||||
inView: controlView];
|
||||
}
|
||||
|
||||
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
|
||||
- (void)drawWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
|
||||
{
|
||||
[super drawWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
|
@ -283,7 +278,7 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) initWithFileWrapper:(NSFileWrapper *)fileWrapper
|
||||
- (id) initWithFileWrapper: (NSFileWrapper *)fileWrapper
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
|
@ -295,11 +290,14 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void)setFileWrapper:(NSFileWrapper *)fileWrapper
|
||||
- (void)setFileWrapper: (NSFileWrapper *)fileWrapper
|
||||
{
|
||||
ASSIGN(_fileWrapper, fileWrapper);
|
||||
// Reset the cell, so it shows the new attachment
|
||||
[_cell setAttachment: self];
|
||||
if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
|
||||
{
|
||||
[_cell setAttachment: self];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSFileWrapper *)fileWrapper
|
||||
|
@ -312,10 +310,13 @@
|
|||
return _cell;
|
||||
}
|
||||
|
||||
- (void)setAttachmentCell:(id <NSTextAttachmentCell>)cell
|
||||
- (void)setAttachmentCell: (id <NSTextAttachmentCell>)cell
|
||||
{
|
||||
ASSIGN(_cell, cell);
|
||||
[_cell setAttachment: self];
|
||||
if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
|
||||
{
|
||||
[_cell setAttachment: self];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -346,7 +347,10 @@
|
|||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cell];
|
||||
|
||||
// Reconnect the cell, so the cell does not have to store the attachment
|
||||
[_cell setAttachment: self];
|
||||
if ([_cell respondsToSelector: @selector(setAttachment:)] == YES)
|
||||
{
|
||||
[_cell setAttachment: self];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue