OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 "ash/system/tray/tray_item_more.h" |
| 6 |
| 7 #include "ash/system/tray/system_tray_item.h" |
| 8 #include "ash/system/tray/tray_constants.h" |
| 9 #include "grit/ui_resources.h" |
| 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/image/image.h" |
| 12 #include "ui/views/controls/image_view.h" |
| 13 |
| 14 namespace ash { |
| 15 namespace internal { |
| 16 |
| 17 TrayItemMore::TrayItemMore(SystemTrayItem* owner) |
| 18 : owner_(owner), |
| 19 more_(NULL) { |
| 20 } |
| 21 |
| 22 TrayItemMore::~TrayItemMore() { |
| 23 } |
| 24 |
| 25 void TrayItemMore::AddMore() { |
| 26 more_ = new views::ImageView; |
| 27 more_->SetImage(ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 28 IDR_AURA_UBER_TRAY_MORE).ToSkBitmap()); |
| 29 AddChildView(more_); |
| 30 } |
| 31 |
| 32 void TrayItemMore::Layout() { |
| 33 // Let the box-layout do the layout first. Then move the '>' arrow to right |
| 34 // align. |
| 35 views::View::Layout(); |
| 36 |
| 37 gfx::Rect bounds = more_->bounds(); |
| 38 bounds.set_x(width() - more_->width() - kTrayPopupPaddingBetweenItems); |
| 39 more_->SetBoundsRect(bounds); |
| 40 } |
| 41 |
| 42 bool TrayItemMore::OnMousePressed(const views::MouseEvent& event) OVERRIDE { |
| 43 owner_->PopupDetailedView(0, true); |
| 44 return true; |
| 45 } |
| 46 |
| 47 } // namespace internal |
| 48 } // namespace ash |
OLD | NEW |