Index: athena/home/bottom_home_view.cc |
diff --git a/athena/home/bottom_home_view.cc b/athena/home/bottom_home_view.cc |
index 98cbc13042fef8ef6c6ada2c6b9d9730454dcf55..8170761c885699de428bb8d5b899625cdc114996 100644 |
--- a/athena/home/bottom_home_view.cc |
+++ b/athena/home/bottom_home_view.cc |
@@ -9,18 +9,51 @@ |
#include "ui/app_list/app_list_view_delegate.h" |
#include "ui/app_list/views/search_box_view.h" |
#include "ui/app_list/views/tile_item_view.h" |
+#include "ui/gfx/canvas.h" |
#include "ui/views/background.h" |
#include "ui/views/border.h" |
#include "ui/views/layout/box_layout.h" |
+#include "ui/views/painter.h" |
+#include "ui/views/shadow_border.h" |
+ |
+namespace { |
+ |
+class BottomHomeBackground : public views::Background { |
+ public: |
+ explicit BottomHomeBackground(views::View* search_box) |
+ : search_box_(search_box), |
+ painter_(views::Painter::CreateVerticalGradient( |
+ SkColorSetA(SK_ColorWHITE, 0x7f), |
+ SK_ColorWHITE)) {} |
+ virtual ~BottomHomeBackground() {} |
+ |
+ private: |
+ // views::Background: |
+ virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { |
+ CHECK_EQ(view, search_box_->parent()); |
+ views::Painter::PaintPainterAt( |
+ canvas, |
+ painter_.get(), |
+ gfx::Rect(0, 0, view->width(), search_box_->y())); |
+ canvas->FillRect(gfx::Rect(0, |
+ search_box_->y(), |
+ view->width(), |
+ view->height() - search_box_->y()), |
+ SK_ColorWHITE); |
+ } |
+ |
+ views::View* search_box_; |
+ scoped_ptr<views::Painter> painter_; |
+ DISALLOW_COPY_AND_ASSIGN(BottomHomeBackground); |
+}; |
+ |
+} // namespace |
namespace athena { |
BottomHomeView::BottomHomeView(app_list::AppListViewDelegate* view_delegate) |
: view_delegate_(view_delegate) { |
- set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); |
- SetBorder(views::Border::CreateSolidBorder(1, SK_ColorBLACK)); |
- SetLayoutManager(new views::BoxLayout( |
- views::BoxLayout::kVertical, 0, 0, 0)); |
+ SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
app_list::AppListModel* model = view_delegate->GetModel(); |
app_list::AppListItemList* top_level = model->top_level_item_list(); |
@@ -36,11 +69,16 @@ BottomHomeView::BottomHomeView(app_list::AppListViewDelegate* view_delegate) |
app_list::TileItemView* tile_item_view = new app_list::TileItemView(); |
tile_item_view->SetAppListItem(top_level->item_at(i)); |
items_container->AddChildView(tile_item_view); |
+ tile_item_view->set_background(NULL); |
} |
app_list::SearchBoxView* search_box = new app_list::SearchBoxView( |
this, view_delegate); |
AddChildView(search_box); |
+ search_box->SetBorder( |
+ views::Border::CreateSolidSidedBorder(1, 0, 0, 0, SK_ColorGRAY)); |
+ |
+ set_background(new BottomHomeBackground(search_box)); |
} |
BottomHomeView::~BottomHomeView() {} |