Re: Source list group item indentation
Re: Source list group item indentation
- Subject: Re: Source list group item indentation
- From: "Hamish Allan" <email@hidden>
- Date: Wed, 16 Jan 2008 19:52:58 +0000
NB to avoid compiler warnings, you can create a category on NSObject:
@interface NSObject (DisclosureTriangleAdditions)
- (BOOL)outlineView:(NSOutlineView *) shouldShowDisclosureTriangleForItem:(id);
@end
Then your method becomes:
- (NSRect)frameOfOutlineCellAtRow:(NSInteger)row
{
// Default to show triangle
BOOL showTriangle = YES;
if ([[self delegate] respondsToSelector:
@selector(outlineView:shouldShowDisclosureTriangleForItem:)])
{
showTriangle = [[self delegate] outlineView:self
shouldShowDisclosureTriangleForItem:item];
}
if (!showTriangle)
{
// If not showing triangle, return empty rect
return NSZeroRect;
}
else
{
// else return default value
return [super frameOfOutlineCellAtRow:row];
}
}
> Then, replace your outline views in IB with your custom one, and the
> delegate can implement:
>
> - (void)outlineView:(NSOutlineView *)
> shouldShowDisclosureTriangleForItem:(id)item
Don't forget to declare this with a non-void return type :)
Hamish
_______________________________________________
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