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 #include "athena/home/bottom_home_view.h" |
| 6 |
| 7 #include "ui/app_list/app_list_item_list.h" |
| 8 #include "ui/app_list/app_list_model.h" |
| 9 #include "ui/app_list/app_list_view_delegate.h" |
| 10 #include "ui/app_list/views/search_box_view.h" |
| 11 #include "ui/app_list/views/tile_item_view.h" |
| 12 #include "ui/views/background.h" |
| 13 #include "ui/views/border.h" |
| 14 #include "ui/views/layout/box_layout.h" |
| 15 |
| 16 namespace athena { |
| 17 |
| 18 BottomHomeView::BottomHomeView(app_list::AppListViewDelegate* view_delegate) |
| 19 : view_delegate_(view_delegate) { |
| 20 set_background(views::Background::CreateSolidBackground(SK_ColorWHITE)); |
| 21 SetBorder(views::Border::CreateSolidBorder(1, SK_ColorBLACK)); |
| 22 SetLayoutManager(new views::BoxLayout( |
| 23 views::BoxLayout::kVertical, 0, 0, 0)); |
| 24 |
| 25 app_list::AppListModel* model = view_delegate->GetModel(); |
| 26 app_list::AppListItemList* top_level = model->top_level_item_list(); |
| 27 |
| 28 views::View* items_container = new views::View(); |
| 29 AddChildView(items_container); |
| 30 |
| 31 views::BoxLayout* items_layout = new views::BoxLayout( |
| 32 views::BoxLayout::kHorizontal, 0, 0, 0); |
| 33 items_layout->set_main_axis_alignment( |
| 34 views::BoxLayout::MAIN_AXIS_ALIGNMENT_FILL); |
| 35 items_container->SetLayoutManager(items_layout); |
| 36 for (size_t i = 0; i < top_level->item_count(); ++i) { |
| 37 app_list::TileItemView* tile_item_view = new app_list::TileItemView(); |
| 38 tile_item_view->SetAppListItem(top_level->item_at(i)); |
| 39 items_container->AddChildView(tile_item_view); |
| 40 } |
| 41 |
| 42 app_list::SearchBoxView* search_box = new app_list::SearchBoxView( |
| 43 this, view_delegate); |
| 44 AddChildView(search_box); |
| 45 } |
| 46 |
| 47 BottomHomeView::~BottomHomeView() {} |
| 48 |
| 49 void BottomHomeView::QueryChanged(app_list::SearchBoxView* sender) { |
| 50 // Nothing needs to be done. |
| 51 } |
| 52 |
| 53 } // namespace athena |
OLD | NEW |