• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CELL_H_
6 #define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CELL_H_
7 #pragma once
8 
9 #import "base/mac/cocoa_protocols.h"
10 #include "base/memory/scoped_ptr.h"
11 #import "chrome/browser/ui/cocoa/gradient_button_cell.h"
12 
13 #include "base/file_path.h"
14 
15 class BaseDownloadItemModel;
16 
17 // A button cell that implements the weird button/popup button hybrid that is
18 // used by the download items.
19 
20 // The button represented by this cell consists of a button part on the left
21 // and a dropdown-menu part on the right. This enum describes which part the
22 // mouse cursor is over currently.
23 enum DownloadItemMousePosition {
24   kDownloadItemMouseOutside,
25   kDownloadItemMouseOverButtonPart,
26   kDownloadItemMouseOverDropdownPart
27 };
28 
29 @interface DownloadItemCell : GradientButtonCell<NSAnimationDelegate> {
30  @private
31   // Track which part of the button the mouse is over
32   DownloadItemMousePosition mousePosition_;
33   int mouseInsideCount_;
34   scoped_nsobject<NSTrackingArea> trackingAreaButton_;
35   scoped_nsobject<NSTrackingArea> trackingAreaDropdown_;
36 
37   FilePath downloadPath_;  // stored unelided
38   NSString* secondaryTitle_;
39   NSFont* secondaryFont_;
40   int percentDone_;
41   scoped_nsobject<NSAnimation> completionAnimation_;
42 
43   BOOL isStatusTextVisible_;
44   CGFloat titleY_;
45   CGFloat statusAlpha_;
46   scoped_nsobject<NSAnimation> hideStatusAnimation_;
47 
48   scoped_ptr<ui::ThemeProvider> themeProvider_;
49 }
50 
51 @property(nonatomic, copy) NSString* secondaryTitle;
52 @property(nonatomic, retain) NSFont* secondaryFont;
53 
54 - (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel;
55 
56 // Returns if the mouse is over the button part of the cell.
57 - (BOOL)isMouseOverButtonPart;
58 
59 @end
60 
61 #endif  // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CELL_H_
62