objective c - NSTextFieldCell or just NSCell with vertical text (and colored tinting) -


i'm struggling trying find elegant way of displaying column headers table view in vertical fashion (rotated 90 deg counter clockwise traditional). i'm not married doing actual nstableheadercell, figured might easier overriding nstextfieldcell or nscell.

the cells contain noneditable text, it's 2 lines of it, , it's tinted rest of column depending on context.

i can't seem find cocoa apps this, less open source example. thoughts?

#import "verticaltextcell.h"  @implementation verticaltextcell  - (void)drawinteriorwithframe:(nsrect)cellframe inview:(nsview *)controlview {      nsmutabledictionary *atr = [nsmutabledictionary dictionary];     nsfont *font = [nsfont fontwithname:@"lucida grande" size:12];     [atr setobject:font forkey:nsfontattributename];      [[[self backgroundcolor] colorwithalphacomponent:0.7] set];     nsrectfillusingoperation(cellframe, nscompositesourceover);      nsgraphicscontext *currentcontext = [nsgraphicscontext currentcontext];     [currentcontext savegraphicsstate];      nsaffinetransform *transform = [nsaffinetransform transform];     [transform translatexby:nsminx(cellframe) yby:nsminy(cellframe)];     [transform rotatebydegrees:-90];     [transform concat];      // vertical inset 5 pixels     [[self stringvalue] drawinrect:nsmakerect(-nsheight(cellframe),5,nsheight(cellframe),nswidth(cellframe)) withattributes:atr];       [currentcontext restoregraphicsstate];  }   @end 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -