I hate NSMatrix...
I hate NSMatrix...
- Subject: I hate NSMatrix...
- From: "Michael B. Johnson" <email@hidden>
- Date: Tue, 20 May 2003 07:45:01 -0700
But I have some code that uses them, so I'm stuck for the moment. I
have a NSMatrix of NSCells (subclasses of NSImageCell) that I'm trying
to draw. I hate all the options I have available in the normal
NSMatrix of NSImageCells, so I'm trying to draw my own. The default
bother me for several reasons:
- only the one with the little picture frame around it shows any
selection color at all
- the selection color it shows is wrong (i.e. it's some wimpy grey,
it's not the system selection color)
- it draws its image with way too much whitespace
so the first two parts are easy to fix - I override
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
if (_cFlags.highlighted) {
NSColor* controlColor = [NSColor selectedControlColor];
[controlColor set];
NSRectFillUsingOperation(cellFrame, NSCompositeCopy);
}
[self drawInteriorWithFrame:cellFrame inView:controlView];
}
which is obviously the way it should be implemented anyway (I know, I
know, file a bug...), but then I need to override
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView;
Which would be fine, if all I needed to do was modify cellFrame to
inset it a bit and then composite my image in, but unfortunately, it
comes in flipped upside down.
urgh.
So I can go and figure out all the graphics state pushing and popping
to make this work right, I expect, but I'm hoping that someone has
dealt with this and can point out the painfully obvious four lines of
code that are eluding me right now (note:
if ([controlView isFlipped]) {
NSAffineTransform* t = [NSAffineTransform transform];
[t scaleXBy:1 yBy:-1];
[t concat];
}
are not them - since a Cell is not a View, which is getting really,
really tiresome...)
Thanks in advance.
--> Michael B. Johnson, PhD
-->
http://homepage.mac.com/drwave (personal)
-->
http://xenia.media.mit.edu/~wave (alum)
--> Film On Line Lead
--> Pixar Animation Studios
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.