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 | |
calamity
2014/10/23 05:41:18
nit: remove newline.
Matt Giuca
2014/10/23 06:32:38
Done.
| |
28 virtual ~FolderImageSource(); | |
29 | |
30 // Gets the size of a small app icon inside the folder icon. | |
31 static gfx::Size ItemIconSize(); | |
32 | |
33 // Calculates the top item icons' bounds inside |folder_icon_bounds|. | |
34 // Returns the bounds of top item icons in sequence of top left, top right, | |
35 // bottom left, bottom right. | |
36 static std::vector<gfx::Rect> GetTopIconsBounds( | |
37 const gfx::Rect& folder_icon_bounds); | |
38 | |
39 private: | |
40 void DrawIcon(gfx::Canvas* canvas, | |
41 const gfx::ImageSkia& icon, | |
42 const gfx::Size icon_size, | |
43 int x, | |
44 int y); | |
45 | |
46 // gfx::CanvasImageSource overrides: | |
47 virtual void Draw(gfx::Canvas* canvas) override; | |
48 | |
49 Icons icons_; | |
50 gfx::Size size_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(FolderImageSource); | |
53 }; | |
54 | |
55 } // namespace app_list | |
56 | |
57 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_ | |
OLD | NEW |