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_VIEWS_TILE_ITEM_VIEW_H_
6 #define UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_
8 #include "base/strings/string16.h"
9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/app_list/app_list_export.h"
11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/controls/button/custom_button.h"
25 // The view for a tile in the app list on the start/search page.
26 class APP_LIST_EXPORT TileItemView
: public views::CustomButton
,
27 public views::ButtonListener
{
30 ~TileItemView() override
;
32 bool selected() { return selected_
; }
33 void SetSelected(bool selected
);
35 // Informs the TileItemView of its parent's background color. The controls
36 // within the TileItemView will adapt to suit the given color.
37 void SetParentBackgroundColor(SkColor color
);
38 SkColor
parent_background_color() { return parent_background_color_
; }
40 // Overridden from views::CustomButton:
41 void StateChanged() override
;
44 void SetIcon(const gfx::ImageSkia
& icon
);
46 void SetTitle(const base::string16
& title
);
49 void UpdateBackgroundColor();
51 // Overridden from views::View:
52 gfx::Size
GetPreferredSize() const override
;
53 bool GetTooltipText(const gfx::Point
& p
,
54 base::string16
* tooltip
) const override
;
56 SkColor parent_background_color_
;
58 views::ImageView
* icon_
; // Owned by views hierarchy.
59 views::Label
* title_
; // Owned by views hierarchy.
63 DISALLOW_COPY_AND_ASSIGN(TileItemView
);
66 } // namespace app_list
68 #endif // UI_APP_LIST_VIEWS_TILE_ITEM_VIEW_H_