help for NSMatrix -> action cell
help for NSMatrix -> action cell
- Subject: help for NSMatrix -> action cell
- From: shengjun_guan (管聲俊) <email@hidden>
- Date: Tue, 13 Nov 2007 14:02:13 +0800
- Thread-topic: help for NSMatrix -> action cell
Hi all,
I create one image browser application use NSMatrix .
I show the file's image and file's name inside the Cell. Of course i make the Class: myCell which base from NSCell .And overwrite the NSCell's method: drawWithFrame: inView: to show the image in up content ,and text in down content .
---FOLLOW IS THE CODE of drawWithFrame: inView: IN MY CELL CLASS-----
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
if ((title != nil) || (image != nil))
{
NSRect imageFrame,textFrame, tempFrame;
NSDivideRect(cellFrame, &imageFrame, &textFrame, cellFrame.size.height - 15, NSMinYEdge);
[image setFlipped:YES];
[image drawInRect:imageFrame fromRect:NSMakeRect(0,0,[image size].width,[image size].height) operation:NSCompositeSourceOver fraction:1.0];
if ((cellFrame.size.width - [[title string] length] * 4) / 2 >= 0)
{
textFrame.origin.x += (cellFrame.size.width - [title length] * 4) / 2;
}
textFrame.origin.y += 25;
[title drawInRect:textFrame];
}
[super drawWithFrame:cellFrame inView:controlView];
}
And , i have realizied that open the image file with Preview when double click the Cell.
Now, i want to realizied to rename. When click the down content of the Cell, like the TextFied, user can input the
new Text. How can i do. need I use NSView to replace NSMatrix ?
any reply is welcome . thanks a lot.
--Tom
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden