Skip navigation.
 
mlRe: Source list group item indentation
FROM : Hamish Allan
DATE : Wed Jan 16 20:52:58 2008

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

Related mailsAuthorDate
mlSource list group item indentation Kyle Sluder Jan 11, 15:16
mlRe: Source list group item indentation Jean-Daniel Dupas Jan 11, 15:24
mlRe: Source list group item indentation Jonathan Dann Jan 11, 16:12
mlRe: Source list group item indentation Corbin Dunn Jan 16, 00:15
mlRe: Source list group item indentation Kyle Sluder Jan 16, 11:23
mlRe: Source list group item indentation Corbin Dunn Jan 16, 19:08
mlRe: Source list group item indentation Ben Jan 16, 19:55
mlRe: Source list group item indentation Corbin Dunn Jan 16, 20:49
mlRe: Source list group item indentation Hamish Allan Jan 16, 20:52
mlRe: Source list group item indentation Pete Callaway Jan 17, 09:34