summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/download_shelf_view.mm
blob: f1c9fb1f803f65769587a71731e4bbc5a7a4e813 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "chrome/browser/cocoa/download_shelf_view.h"

#include "base/scoped_nsobject.h"

@implementation DownloadShelfView

- (void)drawRect:(NSRect)rect {
  rect = [self bounds];

  // TODO(thakis): Once this has its final look, it also needs an
  // "inactive" state.

#if 0
  // Grey Finder/iCal-like bottom bar with dark gradient, dark/light lines
  NSColor* start =
      [NSColor colorWithCalibratedWhite: 0.75 alpha:1.0];
  NSColor* end = [NSColor colorWithCalibratedWhite:0.59 alpha:1.0];
  scoped_nsobject<NSGradient> gradient(
      [[NSGradient alloc] initWithStartingColor:start endingColor:end]);
  [gradient drawInRect:[self bounds] angle:270.0];

  NSRect borderRect, contentRect;
  NSDivideRect(rect, &borderRect, &contentRect, 1, NSMaxYEdge);
  [[NSColor colorWithDeviceWhite:0.25 alpha:1.0] set];
  NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);

  NSDivideRect(contentRect, &borderRect, &contentRect, 1, NSMaxYEdge);
  [[NSColor colorWithDeviceWhite:0.85 alpha:1.0] set];
  NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);
#else
  // Glossy two-color bar with only light line at top (Mail.app/HitList-style)
  // Doesn't mesh with the matte look of the toolbar.

  NSRect topRect, bottomRect;
  NSDivideRect(rect, &topRect, &bottomRect, rect.size.height/2, NSMaxYEdge);

  // 1px line at top
  NSRect borderRect, contentRect;
  NSDivideRect(topRect, &borderRect, &contentRect, 1, NSMaxYEdge);
  [[NSColor colorWithDeviceWhite:0.69 alpha:1.0] set];
  NSRectFillUsingOperation(borderRect, NSCompositeSourceOver);

  // Gradient for upper half
  NSColor* start =
      [NSColor colorWithCalibratedWhite: 1.0 alpha:1.0];
  NSColor* end = [NSColor colorWithCalibratedWhite:0.94 alpha:1.0];
  scoped_nsobject<NSGradient> gradient(
      [[NSGradient alloc] initWithStartingColor:start endingColor:end]);
  [gradient drawInRect:contentRect angle:270.0];

  // Fill lower half with solid color
  [[NSColor colorWithDeviceWhite:0.9 alpha:1.0] set];
  NSRectFillUsingOperation(bottomRect, NSCompositeSourceOver);
#endif
}

@end