OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_APP_LIST_FOLDER_IMAGE_SOURCE_H_ |
| 6 #define UI_APP_LIST_APP_LIST_FOLDER_IMAGE_SOURCE_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "ui/gfx/image/canvas_image_source.h" |
| 11 |
| 12 namespace gfx { |
| 13 class Canvas; |
| 14 class ImageSkia; |
| 15 class Rect; |
| 16 class Size; |
| 17 } |
| 18 |
| 19 namespace app_list { |
| 20 |
| 21 // Generates the folder icon with the top 4 child item icons laid in 2x2 tile. |
| 22 class FolderImageSource : public gfx::CanvasImageSource { |
| 23 public: |
| 24 typedef std::vector<gfx::ImageSkia> Icons; |
| 25 |
| 26 FolderImageSource(const Icons& icons, const gfx::Size& size); |
| 27 ~FolderImageSource() override; |
| 28 |
| 29 // Gets the size of a small app icon inside the folder icon. |
| 30 static gfx::Size ItemIconSize(); |
| 31 |
| 32 // Calculates the top item icons' bounds inside |folder_icon_bounds|. |
| 33 // Returns the bounds of top item icons in sequence of top left, top right, |
| 34 // bottom left, bottom right. |
| 35 static std::vector<gfx::Rect> GetTopIconsBounds( |
| 36 const gfx::Rect& folder_icon_bounds); |
| 37 |
| 38 private: |
| 39 void DrawIcon(gfx::Canvas* canvas, |
| 40 const gfx::ImageSkia& icon, |
| 41 const gfx::Size icon_size, |
| 42 int x, |
| 43 int y); |
| 44 |
| 45 // gfx::CanvasImageSource overrides: |
| 46 void Draw(gfx::Canvas* canvas) override; |
| 47 |
| 48 Icons icons_; |
| 49 gfx::Size size_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(FolderImageSource); |
| 52 }; |
| 53 |
| 54 } // namespace app_list |
| 55 |
| 56 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ |
OLD | NEW |