Changeset 648


Ignore:
Timestamp:
Jul 19, 2006, 11:30:05 AM (16 years ago)
Author:
livings124
Message:

different style for filter bar buttons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/BarButton.m

    r640 r648  
    117117                            [NSFont fontWithName: @"Lucida Grande" size: 12.0] toHaveTrait: NSBoldFontMask];
    118118   
     119    NSSize shadowOffset = NSMakeSize(0.0, -1.0);
     120   
     121    NSShadow * shadowNormal = [NSShadow alloc];
     122    [shadowNormal setShadowOffset: shadowOffset];
     123    [shadowNormal setShadowBlurRadius: 1.0];
     124    [shadowNormal setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.4]];
     125
     126    NSShadow * shadowNormalDim = [NSShadow alloc];
     127    [shadowNormalDim setShadowOffset: shadowOffset];
     128    [shadowNormalDim setShadowBlurRadius: 1.0];
     129    [shadowNormalDim setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.2]];
     130
     131    NSShadow * shadowHighlighted = [NSShadow alloc];
     132    [shadowHighlighted setShadowOffset: shadowOffset];
     133    [shadowHighlighted setShadowBlurRadius: 1.0];
     134    [shadowHighlighted setShadowColor: [NSColor colorWithDeviceWhite: 0.0 alpha: 0.4]];
     135   
    119136    NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
    120                 [NSColor controlTextColor], NSForegroundColorAttributeName,
    121                 [NSFont fontWithName: @"Lucida Grande" size: 12.0], NSFontAttributeName, nil],
     137                [NSColor colorWithCalibratedRed: 0.259 green: 0.259 blue: 0.259 alpha: 1.0],
     138                NSForegroundColorAttributeName,
     139                boldFont, NSFontAttributeName,
     140                shadowNormal, NSShadowAttributeName, nil],
    122141        * normalDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
    123142                [NSColor disabledControlTextColor], NSForegroundColorAttributeName,
    124                 [NSFont fontWithName: @"Lucida Grande" size: 12.0], NSFontAttributeName, nil],
     143                boldFont, NSFontAttributeName,
     144                shadowNormalDim, NSShadowAttributeName, nil],
    125145        * highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
    126146                [NSColor whiteColor], NSForegroundColorAttributeName,
    127                 boldFont, NSFontAttributeName, nil],
     147                boldFont, NSFontAttributeName,
     148                shadowHighlighted, NSShadowAttributeName, nil],
    128149        * highlightedDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
    129150                [NSColor colorWithCalibratedRed: 0.9 green: 0.9 blue: 0.9 alpha: 1.0], NSForegroundColorAttributeName,
    130                 boldFont, NSFontAttributeName, nil];
     151                boldFont, NSFontAttributeName,
     152                shadowHighlighted, NSShadowAttributeName, nil];
    131153   
    132154    NSSize textSizeNormal = [text sizeWithAttributes: normalAttributes],
     
    134156            buttonSize = [self frame].size;
    135157   
    136     NSRect textRectNormal = NSMakeRect((buttonSize.width - textSizeNormal.width) * 0.5,
    137             (buttonSize.height - textSizeNormal.height) * 0.5 + 1.5, textSizeNormal.width, textSizeNormal.height),
    138         textRectBold = NSMakeRect((buttonSize.width - textSizeBold.width) * 0.5,
    139             (buttonSize.height - textSizeBold.height) * 0.5 + 1.5, textSizeBold.width, textSizeBold.height);
     158    NSRect textRect = NSMakeRect((buttonSize.width - textSizeNormal.width) * 0.5,
     159            (buttonSize.height - textSizeNormal.height) * 0.5 + 1.5, textSizeNormal.width, textSizeNormal.height);
     160   
     161    [shadowNormal release];
     162    [shadowNormalDim release];
     163    [shadowHighlighted release];
    140164   
    141165    //normal button
    142166    [fButtonNormal lockFocus];
    143     [text drawInRect: textRectNormal withAttributes: normalAttributes];
     167    [text drawInRect: textRect withAttributes: normalAttributes];
    144168    [fButtonNormal unlockFocus];
    145169   
    146170    //normal and dim button
    147171    [fButtonNormalDim lockFocus];
    148     [text drawInRect: textRectNormal withAttributes: normalDimAttributes];
     172    [text drawInRect: textRect withAttributes: normalDimAttributes];
    149173    [fButtonNormalDim unlockFocus];
    150174   
    151175    //rolled over button
    152176    [fButtonOver lockFocus];
    153     [text drawInRect: textRectBold withAttributes: highlightedAttributes];
     177    [text drawInRect: textRect withAttributes: highlightedAttributes];
    154178    [fButtonOver unlockFocus];
    155179   
    156180    //pressed button
    157181    [fButtonPressed lockFocus];
    158     [text drawInRect: textRectBold withAttributes: highlightedAttributes];
     182    [text drawInRect: textRect withAttributes: highlightedAttributes];
    159183    [fButtonPressed unlockFocus];
    160184   
    161185    //selected button
    162186    [fButtonSelected lockFocus];
    163     [text drawInRect: textRectBold withAttributes: highlightedAttributes];
     187    [text drawInRect: textRect withAttributes: highlightedAttributes];
    164188    [fButtonSelected unlockFocus];
    165189   
    166190    //selected and dim button
    167191    [fButtonSelectedDim lockFocus];
    168     [text drawInRect: textRectBold withAttributes: highlightedDimAttributes];
     192    [text drawInRect: textRect withAttributes: highlightedDimAttributes];
    169193    [fButtonSelectedDim unlockFocus];
    170194   
     
    176200    [highlightedDimAttributes release];
    177201   
    178     //NSLog(@"%@ %f", text, textSizeBold.width);
     202    //NSLog(@"%@ %f", text, textRect.width);
    179203}
    180204
Note: See TracChangeset for help on using the changeset viewer.