| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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 UI_APP_LIST_COCOA_APPS_GRID_VIEW_ITEM_H_ | |
| 6 #define UI_APP_LIST_COCOA_APPS_GRID_VIEW_ITEM_H_ | |
| 7 | |
| 8 #import <Cocoa/Cocoa.h> | |
| 9 | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/app_list/app_list_export.h" | |
| 12 #import "ui/base/cocoa/tracking_area.h" | |
| 13 | |
| 14 namespace app_list { | |
| 15 class AppListItem; | |
| 16 class ItemModelObserverBridge; | |
| 17 } | |
| 18 | |
| 19 // AppsGridViewItem is the controller for an NSButton representing an app item | |
| 20 // on an NSCollectionView controlled by an AppsGridController. | |
| 21 APP_LIST_EXPORT | |
| 22 @interface AppsGridViewItem : NSCollectionViewItem { | |
| 23 @private | |
| 24 scoped_ptr<app_list::ItemModelObserverBridge> observerBridge_; | |
| 25 base::scoped_nsobject<NSProgressIndicator> progressIndicator_; | |
| 26 | |
| 27 // Used to highlight the background on hover. | |
| 28 ui::ScopedCrTrackingArea trackingArea_; | |
| 29 } | |
| 30 | |
| 31 @property(readonly, nonatomic) NSProgressIndicator* progressIndicator; | |
| 32 | |
| 33 // Designated initializer. |tileSize| is the size of tiles in the grid. | |
| 34 - (id)initWithSize:(NSSize)tileSize; | |
| 35 | |
| 36 // Set the represented model, updating views. Clears if |itemModel| is NULL. | |
| 37 - (void)setModel:(app_list::AppListItem*)itemModel; | |
| 38 | |
| 39 // Set the frame that will be used the first time the NSCollectionView performs | |
| 40 // layout on the item. | |
| 41 // This is required because the first time an NSCollectionView becomes visible, | |
| 42 // it performs a layout, and it can attempt to set a frame that differs from the | |
| 43 // -[NSCollectionView frameForItemAtIndex:] reported when the cell was created. | |
| 44 // Worse, this frame can have a non-integral origin, leading to graphical | |
| 45 // glitches because the content is no longer pixel-aligned. | |
| 46 - (void)setInitialFrameRect:(NSRect)frameRect; | |
| 47 | |
| 48 // Model accessor, via the |observerBridge_|. | |
| 49 - (app_list::AppListItem*)model; | |
| 50 | |
| 51 // Return the button portion of the item, showing the icon and title. | |
| 52 - (NSButton*)button; | |
| 53 | |
| 54 // Generate and return a context menu, populated using the represented model. | |
| 55 - (NSMenu*)contextMenu; | |
| 56 | |
| 57 // Take a snapshot of the grid cell with correct layout, then hide the button. | |
| 58 // If |isRestore| is true, the snapshot includes the label and items hidden for | |
| 59 // the initial snapshot are restored. | |
| 60 - (NSBitmapImageRep*)dragRepresentationForRestore:(BOOL)isRestore; | |
| 61 | |
| 62 @end | |
| 63 | |
| 64 #endif // UI_APP_LIST_COCOA_APPS_GRID_VIEW_ITEM_H_ | |
| OLD | NEW |