OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_ | 5 #ifndef ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_ |
6 #define ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_ | 6 #define ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/app_list/app_list_item_model_observer.h" | 9 #include "ash/app_list/app_list_item_model_observer.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 class AppListItemView : public views::CustomButton, | 27 class AppListItemView : public views::CustomButton, |
28 public views::ContextMenuController, | 28 public views::ContextMenuController, |
29 public AppListItemModelObserver { | 29 public AppListItemModelObserver { |
30 public: | 30 public: |
31 AppListItemView(AppListModelView* list_model_view, | 31 AppListItemView(AppListModelView* list_model_view, |
32 AppListItemModel* model, | 32 AppListItemModel* model, |
33 views::ButtonListener* listener); | 33 views::ButtonListener* listener); |
34 virtual ~AppListItemView(); | 34 virtual ~AppListItemView(); |
35 | 35 |
| 36 static gfx::Size GetPreferredSizeForIconSize(const gfx::Size& icon_size); |
| 37 |
36 void SetSelected(bool selected); | 38 void SetSelected(bool selected); |
37 bool selected() const { | 39 bool selected() const { |
38 return selected_; | 40 return selected_; |
39 } | 41 } |
40 | 42 |
41 AppListItemModel* model() const { | 43 AppListItemModel* model() const { |
42 return model_; | 44 return model_; |
43 } | 45 } |
44 | 46 |
45 void set_icon_size(const gfx::Size& size) { | 47 void set_icon_size(const gfx::Size& size) { |
46 icon_size_ = size; | 48 icon_size_ = size; |
47 } | 49 } |
48 | 50 |
49 // Icon padding | |
50 static const int kPadding = 5; | |
51 | |
52 // Internal class name. | 51 // Internal class name. |
53 static const char kViewClassName[]; | 52 static const char kViewClassName[]; |
54 | 53 |
55 private: | 54 private: |
56 // AppListItemModelObserver overrides: | 55 // AppListItemModelObserver overrides: |
57 virtual void ItemIconChanged() OVERRIDE; | 56 virtual void ItemIconChanged() OVERRIDE; |
58 virtual void ItemTitleChanged() OVERRIDE; | 57 virtual void ItemTitleChanged() OVERRIDE; |
59 | 58 |
60 // views::View overrides: | 59 // views::View overrides: |
61 virtual std::string GetClassName() const OVERRIDE; | 60 virtual std::string GetClassName() const OVERRIDE; |
(...skipping 18 matching lines...) Expand all Loading... |
80 | 79 |
81 gfx::Size icon_size_; | 80 gfx::Size icon_size_; |
82 bool selected_; | 81 bool selected_; |
83 | 82 |
84 DISALLOW_COPY_AND_ASSIGN(AppListItemView); | 83 DISALLOW_COPY_AND_ASSIGN(AppListItemView); |
85 }; | 84 }; |
86 | 85 |
87 } // namespace ash | 86 } // namespace ash |
88 | 87 |
89 #endif // ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_ | 88 #endif // ASH_APP_LIST_APP_LIST_ITEM_VIEW_H_ |
OLD | NEW |