Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Source list group item indentation



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Source list group item indentation (From: Jonathan Dann <email@hidden>)
 >Re: Source list group item indentation (From: Corbin Dunn <email@hidden>)
 >Re: Source list group item indentation (From: "Kyle Sluder" <email@hidden>)
 >Re: Source list group item indentation (From: Corbin Dunn <email@hidden>)
 >Re: Source list group item indentation (From: Ben <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.