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.
5 #ifndef UI_APP_LIST_APP_LIST_FOLDER_IMAGE_SOURCE_H_
6 #define UI_APP_LIST_APP_LIST_FOLDER_IMAGE_SOURCE_H_
10 #include "ui/gfx/image/canvas_image_source.h"
21 // Generates the folder icon with the top 4 child item icons laid in 2x2 tile.
22 class FolderImageSource
: public gfx::CanvasImageSource
{
24 typedef std::vector
<gfx::ImageSkia
> Icons
;
26 FolderImageSource(const Icons
& icons
, const gfx::Size
& size
);
27 ~FolderImageSource() override
;
29 // Gets the size of a small app icon inside the folder icon.
30 static gfx::Size
ItemIconSize();
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
);
39 void DrawIcon(gfx::Canvas
* canvas
,
40 const gfx::ImageSkia
& icon
,
41 const gfx::Size icon_size
,
45 // gfx::CanvasImageSource overrides:
46 void Draw(gfx::Canvas
* canvas
) override
;
51 DISALLOW_COPY_AND_ASSIGN(FolderImageSource
);
54 } // namespace app_list
56 #endif // UI_APP_LIST_APP_LIST_FOLDER_ITEM_H_