Camino only - Bug 401312: Give the status bar the correct look on Leopard. r=froodian sr=mento
git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@238423 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#import "NSSplitView+Utils.h"
|
||||
#import "NSMenu+Utils.h"
|
||||
#import "NSPasteboard+Utils.h"
|
||||
#import "NSWorkspace+Utils.h"
|
||||
|
||||
#import "BrowserWindowController.h"
|
||||
#import "BrowserWindow.h"
|
||||
@@ -132,6 +133,12 @@
|
||||
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
|
||||
@interface NSWindow(LeopardSDKDeclarations)
|
||||
- (void)setContentBorderThickness:(float)borderThickness forEdge:(NSRectEdge)edge;
|
||||
@end
|
||||
#endif
|
||||
|
||||
static NSString* const BrowserToolbarIdentifier = @"Browser Window Toolbar Combined";
|
||||
static NSString* const BackToolbarItemIdentifier = @"Back Toolbar Item";
|
||||
static NSString* const ForwardToolbarItemIdentifier = @"Forward Toolbar Item";
|
||||
@@ -864,11 +871,16 @@ enum BWCOpenDest {
|
||||
[mStatusBar setHidden:YES];
|
||||
mustResizeChrome = YES;
|
||||
}
|
||||
// due to a cocoa issue with it updating the bounding box of two rects
|
||||
// that both needing updating instead of just the two individual rects
|
||||
// (radar 2194819), we need to make the text area opaque.
|
||||
[mStatus setBackgroundColor:[NSColor windowBackgroundColor]];
|
||||
[mStatus setDrawsBackground:YES];
|
||||
if ([NSWorkspace isLeopardOrHigher]) {
|
||||
[[self window] setContentBorderThickness:NSHeight([mStatusBar bounds]) forEdge:NSMinYEdge];
|
||||
}
|
||||
else {
|
||||
// due to a cocoa issue with it updating the bounding box of two rects
|
||||
// that both needing updating instead of just the two individual rects
|
||||
// (radar 2194819), we need to make the text area opaque.
|
||||
[mStatus setBackgroundColor:[NSColor windowBackgroundColor]];
|
||||
[mStatus setDrawsBackground:YES];
|
||||
}
|
||||
|
||||
// Set up the menus in the search fields
|
||||
[self setUpSearchFields];
|
||||
@@ -1846,8 +1858,25 @@ enum BWCOpenDest {
|
||||
|
||||
- (void)updateStatus:(NSString*)status
|
||||
{
|
||||
if (![[mStatus stringValue] isEqualToString:status])
|
||||
if ([[mStatus stringValue] isEqualToString:status])
|
||||
return;
|
||||
|
||||
if ([NSWorkspace isLeopardOrHigher]) {
|
||||
// On 10.5+, give the text an etched look for the textured status bar.
|
||||
static NSDictionary* shadowAttributes = nil;
|
||||
if (!shadowAttributes) {
|
||||
NSShadow* shadow = [[[NSShadow alloc] init] autorelease];
|
||||
[shadow setShadowOffset:NSMakeSize(0.0, -2.0)];
|
||||
[shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:0.6]];
|
||||
shadowAttributes = [[NSDictionary dictionaryWithObject:shadow forKey:NSShadowAttributeName] retain];
|
||||
}
|
||||
NSAttributedString* shadowedStatus = [[[NSAttributedString alloc] initWithString:status
|
||||
attributes:shadowAttributes] autorelease];
|
||||
[mStatus setAttributedStringValue:shadowedStatus];
|
||||
}
|
||||
else {
|
||||
[mStatus setStringValue:status];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateLocationFields:(NSString*)url ignoreTyping:(BOOL)ignoreTyping
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
|
||||
#import "StatusBarView.h"
|
||||
|
||||
#import "NSWorkspace+Utils.h"
|
||||
|
||||
@implementation StatusBarView
|
||||
|
||||
//
|
||||
@@ -49,13 +51,15 @@
|
||||
{
|
||||
[super drawRect:aRect];
|
||||
|
||||
// optimize drawing a bit so we're not *always* redrawing our top header. Only
|
||||
// draw if the area we're asked to draw overlaps with the top line.
|
||||
NSRect frame = [self frame];
|
||||
if (NSMaxY(frame) <= NSMaxY(aRect)) {
|
||||
NSPoint leftPoint = NSMakePoint(frame.origin.x, frame.origin.y + frame.size.height);
|
||||
NSPoint rightPoint = NSMakePoint(frame.origin.x + frame.size.width, frame.origin.y + frame.size.height);
|
||||
[NSBezierPath strokeLineFromPoint:leftPoint toPoint:rightPoint];
|
||||
if (![NSWorkspace isLeopardOrHigher]) {
|
||||
// optimize drawing a bit so we're not *always* redrawing our top header. Only
|
||||
// draw if the area we're asked to draw overlaps with the top line.
|
||||
NSRect frame = [self frame];
|
||||
if (NSMaxY(frame) <= NSMaxY(aRect)) {
|
||||
NSPoint leftPoint = NSMakePoint(frame.origin.x, frame.origin.y + frame.size.height);
|
||||
NSPoint rightPoint = NSMakePoint(frame.origin.x + frame.size.width, frame.origin.y + frame.size.height);
|
||||
[NSBezierPath strokeLineFromPoint:leftPoint toPoint:rightPoint];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
- (NSString*)displayNameForFile:(NSURL*)inFileURL;
|
||||
|
||||
// OS feature checks
|
||||
+ (BOOL)isLeopardOrHigher;
|
||||
+ (BOOL)isTigerOrHigher;
|
||||
+ (BOOL)supportsSpotlight;
|
||||
+ (BOOL)supportsUnifiedToolbar;
|
||||
|
||||
@@ -186,6 +186,20 @@
|
||||
return sSystemVersion;
|
||||
}
|
||||
|
||||
//
|
||||
// +isLeopardOrHigher
|
||||
//
|
||||
// returns YES if we're on 10.5 or better
|
||||
//
|
||||
+ (BOOL)isLeopardOrHigher
|
||||
{
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4
|
||||
return YES;
|
||||
#else
|
||||
return [self systemVersion] >= 0x1050;
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// +isTigerOrHigher
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user