| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/system/tray/tray_views.h" | 5 #include "ash/system/tray/tray_views.h" |
| 6 | 6 |
| 7 #include "ash/system/tray/tray_constants.h" | 7 #include "ash/system/tray/tray_constants.h" |
| 8 #include "grit/ash_strings.h" | 8 #include "grit/ash_strings.h" |
| 9 #include "grit/ui_resources_standard.h" | 9 #include "grit/ui_resources_standard.h" |
| 10 #include "grit/ui_resources_standard.h" | 10 #include "grit/ui_resources_standard.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 const int kPaddingAroundButtons = 5; | 29 const int kPaddingAroundButtons = 5; |
| 30 | 30 |
| 31 views::View* CreatePopupHeaderButtonsContainer() { | 31 views::View* CreatePopupHeaderButtonsContainer() { |
| 32 views::View* view = new views::View; | 32 views::View* view = new views::View; |
| 33 view->SetLayoutManager(new | 33 view->SetLayoutManager(new |
| 34 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, -1)); | 34 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, -1)); |
| 35 view->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 5)); | 35 view->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 5)); |
| 36 return view; | 36 return view; |
| 37 } | 37 } |
| 38 | 38 |
| 39 const int kBorderHeight = 3; |
| 40 class SpecialPopupRowBorder : public views::Border { |
| 41 public: |
| 42 SpecialPopupRowBorder() |
| 43 : painter_(views::Painter::CreateVerticalGradient( |
| 44 kBorderDarkColor, |
| 45 kHeaderBackgroundColorDark)) { |
| 46 } |
| 47 |
| 48 virtual ~SpecialPopupRowBorder() {} |
| 49 |
| 50 private: |
| 51 virtual void Paint(const views::View& view, |
| 52 gfx::Canvas* canvas) const OVERRIDE { |
| 53 views::Painter::PaintPainterAt(canvas, painter_.get(), |
| 54 gfx::Rect(gfx::Size(view.width(), kBorderHeight))); |
| 55 } |
| 56 |
| 57 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE { |
| 58 insets->Set(kBorderHeight, 0, 0, 0); |
| 59 } |
| 60 |
| 61 scoped_ptr<views::Painter> painter_; |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRowBorder); |
| 64 }; |
| 65 |
| 39 } | 66 } |
| 40 | 67 |
| 41 //////////////////////////////////////////////////////////////////////////////// | 68 //////////////////////////////////////////////////////////////////////////////// |
| 42 // FixedSizedImageView | 69 // FixedSizedImageView |
| 43 | 70 |
| 44 FixedSizedImageView::FixedSizedImageView(int width, int height) | 71 FixedSizedImageView::FixedSizedImageView(int width, int height) |
| 45 : width_(width), | 72 : width_(width), |
| 46 height_(height) { | 73 height_(height) { |
| 47 SetHorizontalAlignment(views::ImageView::CENTER); | 74 SetHorizontalAlignment(views::ImageView::CENTER); |
| 48 SetVerticalAlignment(views::ImageView::CENTER); | 75 SetVerticalAlignment(views::ImageView::CENTER); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 //////////////////////////////////////////////////////////////////////////////// | 419 //////////////////////////////////////////////////////////////////////////////// |
| 393 // SpecialPopupRow | 420 // SpecialPopupRow |
| 394 | 421 |
| 395 SpecialPopupRow::SpecialPopupRow() | 422 SpecialPopupRow::SpecialPopupRow() |
| 396 : content_(NULL), | 423 : content_(NULL), |
| 397 button_container_(NULL) { | 424 button_container_(NULL) { |
| 398 set_background(views::Background::CreateBackgroundPainter(true, | 425 set_background(views::Background::CreateBackgroundPainter(true, |
| 399 views::Painter::CreateVerticalGradient( | 426 views::Painter::CreateVerticalGradient( |
| 400 kHeaderBackgroundColorLight, | 427 kHeaderBackgroundColorLight, |
| 401 kHeaderBackgroundColorDark))); | 428 kHeaderBackgroundColorDark))); |
| 402 set_border(views::Border::CreateSolidSidedBorder(2, 0, 0, 0, | 429 set_border(new SpecialPopupRowBorder); |
| 403 ash::kBorderDarkColor)); | |
| 404 SetLayoutManager( | 430 SetLayoutManager( |
| 405 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 431 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
| 406 } | 432 } |
| 407 | 433 |
| 408 SpecialPopupRow::~SpecialPopupRow() { | 434 SpecialPopupRow::~SpecialPopupRow() { |
| 409 } | 435 } |
| 410 | 436 |
| 411 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { | 437 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { |
| 412 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 438 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 413 HoverHighlightView* container = new HoverHighlightView(listener); | 439 HoverHighlightView* container = new HoverHighlightView(listener); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 label->SetAutoColorReadabilityEnabled(false); | 597 label->SetAutoColorReadabilityEnabled(false); |
| 572 label->SetEnabledColor(SK_ColorWHITE); | 598 label->SetEnabledColor(SK_ColorWHITE); |
| 573 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 599 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
| 574 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 600 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), |
| 575 SkColorSetARGB(64, 0, 0, 0)); | 601 SkColorSetARGB(64, 0, 0, 0)); |
| 576 label->SetShadowOffset(0, 1); | 602 label->SetShadowOffset(0, 1); |
| 577 } | 603 } |
| 578 | 604 |
| 579 } // namespace internal | 605 } // namespace internal |
| 580 } // namespace ash | 606 } // namespace ash |
| OLD | NEW |