OLD | NEW |
(Empty) | |
| 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 UI_AURA_SHELL_APP_LIST_TILE_VIEW_H_ |
| 6 #define UI_AURA_SHELL_APP_LIST_TILE_VIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "ui/aura_shell/aura_shell_export.h" |
| 10 #include "ui/aura_shell/app_list/app_list_item_model_observer.h" |
| 11 #include "ui/views/view.h" |
| 12 |
| 13 class SkBitmap; |
| 14 |
| 15 namespace views { |
| 16 class ImageView; |
| 17 class Label; |
| 18 } |
| 19 |
| 20 namespace aura_shell { |
| 21 |
| 22 class AppListItemModel; |
| 23 |
| 24 // A tile view to display AppListItemModel. |
| 25 class AURA_SHELL_EXPORT TileView : public views::View, |
| 26 public AppListItemModelObserver { |
| 27 public: |
| 28 explicit TileView(AppListItemModel* model); |
| 29 virtual ~TileView(); |
| 30 |
| 31 // Tile size |
| 32 static const int kTileSize = 180; |
| 33 |
| 34 // Preferred icon size. |
| 35 static const int kIconSize = 128; |
| 36 |
| 37 protected: |
| 38 // Activates the tile. |
| 39 virtual void Activate(int event_flags); |
| 40 |
| 41 // AppListItemModelObserver overrides: |
| 42 virtual void ItemIconChanged() OVERRIDE; |
| 43 virtual void ItemTitleChanged() OVERRIDE; |
| 44 |
| 45 // views::View overrides: |
| 46 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 47 virtual void Layout() OVERRIDE; |
| 48 virtual void OnFocus() OVERRIDE; |
| 49 virtual void OnBlur() OVERRIDE; |
| 50 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 51 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 52 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 53 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 54 |
| 55 private: |
| 56 AppListItemModel* model_; |
| 57 views::ImageView* icon_; |
| 58 views::Label* label_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(TileView); |
| 61 }; |
| 62 |
| 63 } // namespace aura_shell |
| 64 |
| 65 #endif // UI_AURA_SHELL_APP_LIST_TILE_VIEW_H_ |
OLD | NEW |