Sfoglia il codice sorgente

Merge branch 'master' of https://github.com/blitz-research/blitzmax

blitz-research 10 anni fa
parent
commit
c50bc183e6
1 ha cambiato i file con 34 aggiunte e 2 eliminazioni
  1. 34 2
      mod/maxgui.mod/cocoamaxgui.mod/cocoa.macos_tiger.m

+ 34 - 2
mod/maxgui.mod/cocoamaxgui.mod/cocoa.macos_tiger.m

@@ -131,6 +131,29 @@ struct nsgadget{
 	int 			intFontStyle;
 };
 
+// From S.O. for vertically text in cells...
+//
+@interface TreeViewCell : NSBrowserCell {
+}
+
+@end
+
+@implementation TreeViewCell
+
+- (NSRect)titleRectForBounds:(NSRect)theRect {
+    NSRect titleFrame = [super titleRectForBounds:theRect];
+    NSSize titleSize = [[self attributedStringValue] size];
+    titleFrame.origin.y = theRect.origin.y - .5 + (theRect.size.height - titleSize.height) / 2.0;
+    titleFrame.origin.x += (theRect.size.height - titleSize.height) / 2.0;
+    return titleFrame;
+}
+
+- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
+    NSRect titleRect = [self titleRectForBounds:cellFrame];
+    [[self attributedStringValue] drawInRect:titleRect];
+}
+
+@end
 // prototypes
 
 void NSClearItems(nsgadget *gadget);
@@ -1205,13 +1228,22 @@ tableColumn:(NSTableColumn *)aTableColumn row:(int)row mouseLocation:(NSPoint)mo
 	column=[[NSTableColumn alloc] init];
 	[outline addTableColumn:column];
 	[outline setOutlineTableColumn:column];
-	cell=[[NSBrowserCell alloc] init];
+	
+//	cell=[[NSBrowserCell alloc] init];
+//	[cell setLeaf:YES];
+//	[cell setScrollable:YES];
+//	[column setDataCell:cell];
+
+	cell=[[TreeViewCell alloc] init];
 	[cell setLeaf:YES];
 	[cell setScrollable:YES];
-	[column setDataCell:cell];		
+	[column setDataCell:cell];
+	
 	[self setDocumentView:outline];
 	[outline sizeLastColumnToFit];
 	
+	
+	
 	return self;
 }
 -(void)dealloc{