Changeset 2055


Ignore:
Timestamp:
Jun 13, 2007, 12:42:31 AM (15 years ago)
Author:
livings124
Message:

add a colored circle for selected rows in the file table

Location:
branches/file_selection/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/file_selection/macosx/FileOutlineView.h

    r2026 r2055  
    2727@interface FileOutlineView : NSOutlineView
    2828{
    29     NSColor * normalColor, * highPriorityColor, * lowPriorityColor;
     29    NSColor * fNormalColor, * fHighPriorityColor, * fLowPriorityColor;
    3030}
    3131
  • branches/file_selection/macosx/FileOutlineView.m

    r2039 r2055  
    3737    [self setIndentationPerLevel: 14.0];
    3838   
    39     normalColor = [self backgroundColor];
    40     highPriorityColor = [[NSColor colorWithCalibratedRed: 1.0 green: 208.0/255.0 blue: 208.0/255.0 alpha: 1.0] retain];
    41     lowPriorityColor = [[NSColor colorWithCalibratedRed: 1.0 green: 1.0 blue: 224.0/255.0 alpha: 1.0] retain];
     39    fNormalColor = [self backgroundColor];
     40    fHighPriorityColor = [[NSColor colorWithCalibratedRed: 1.0 green: 208.0/255.0 blue: 208.0/255.0 alpha: 1.0] retain];
     41    fLowPriorityColor = [[NSColor colorWithCalibratedRed: 1.0 green: 1.0 blue: 224.0/255.0 alpha: 1.0] retain];
    4242}
    4343
    4444- (void) dealloc
    4545{
    46     [highPriorityColor release];
    47     [lowPriorityColor release];
     46    [fHighPriorityColor release];
     47    [fLowPriorityColor release];
    4848   
    4949    [super dealloc];
    50 }
    51 
    52 - (void) drawRow: (int) row clipRect: (NSRect) clipRect
    53 {
    54     if (![self isRowSelected: row])
    55     {
    56         NSDictionary * item = [self itemAtRow: row];
    57         if ([[item objectForKey: @"IsFolder"] boolValue])
    58             [normalColor set];
    59         else
    60         {
    61             int priority = [[item objectForKey: @"Priority"] intValue];
    62             if (priority == PRIORITY_HIGH)
    63                 [highPriorityColor set];
    64             else if (priority == PRIORITY_LOW)
    65                 [lowPriorityColor set];
    66             else
    67                 [normalColor set];
    68         }
    69         NSRectFill([self rectOfRow: row]);
    70     }
    71    
    72     [super drawRow: row clipRect: clipRect];
    7350}
    7451
     
    9471}
    9572
     73- (void) drawRow: (int) row clipRect: (NSRect) clipRect
     74{
     75    if (![self isRowSelected: row])
     76    {
     77        NSDictionary * item = [self itemAtRow: row];
     78        if ([[item objectForKey: @"IsFolder"] boolValue])
     79            [fNormalColor set];
     80        else
     81        {
     82            int priority = [[item objectForKey: @"Priority"] intValue];
     83            if (priority == PRIORITY_HIGH)
     84                [fHighPriorityColor set];
     85            else if (priority == PRIORITY_LOW)
     86                [fLowPriorityColor set];
     87            else
     88                [fNormalColor set];
     89        }
     90       
     91        NSRectFill([self rectOfRow: row]);
     92    }
     93   
     94    [super drawRow: row clipRect: clipRect];
     95}
     96
     97- (void) drawRect: (NSRect) r
     98{
     99    [super drawRect: r];
     100
     101    NSDictionary * item;
     102    int i, priority;
     103    for (i = 0; i < [self numberOfRows]; i++)
     104    {
     105        if ([self isRowSelected: i])
     106        {
     107            item = [self itemAtRow: i];
     108            if (![[item objectForKey: @"IsFolder"] boolValue])
     109            {
     110                priority = [[item objectForKey: @"Priority"] intValue];
     111                if (priority == PRIORITY_HIGH)
     112                    [fHighPriorityColor set];
     113                else if (priority == PRIORITY_LOW)
     114                    [fLowPriorityColor set];
     115                else
     116                    continue;
     117               
     118                NSRect rect = [self rectOfRow: i];
     119                float width = 14.0;
     120                rect.origin.y += (rect.size.height - width) * 0.5;
     121                rect.origin.x = 3.0;
     122                rect.size.width = width;
     123                rect.size.height = width;
     124               
     125                NSBezierPath * circle = [NSBezierPath bezierPathWithOvalInRect: rect];
     126                [circle fill];
     127            }
     128        }
     129    }
     130}
     131
    96132@end
Note: See TracChangeset for help on using the changeset viewer.