NSOutlineView Changing disclosure Image

前端 未结 5 2173
青春惊慌失措
青春惊慌失措 2020-12-30 16:56

I my outline view, i am adding Custom cell, To drawing custom cell, i am referring example code , present in the Cocoa documentation

http://www.martinkahr.com/2007/0

5条回答
  •  春和景丽
    2020-12-30 17:20

    This is what i have tried and working so far,

    /* because we are showing our own disclose and expand button */

    - (NSRect)frameOfOutlineCellAtRow:(NSInteger)row {
    
        return NSZeroRect;
    }
    - (NSRect)frameOfCellAtColumn:(NSInteger)column row:(NSInteger)row {
        NSRect superFrame = [super frameOfCellAtColumn:column row:row];
    
        if ((column == 0) && ([self isGroupItem:[self itemAtRow:row]])) {
            return NSMakeRect(0, superFrame.origin.y, [self bounds].size.width, superFrame.size.height);
        }
        return superFrame;
    }
    

    I have subclassed NSOutlineView class and override these methods,

    [self isGroupItem] is to check whether its group or not. but got one problem, now looks like mousehandling i need to do :( , on double clicking group row is not toggling

提交回复
热议问题