| 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 const SkColor kBorderGradientDark = SkColorSetRGB(0xae, 0xae, 0xae); |
| 41 const SkColor kBorderGradientLight = SkColorSetRGB(0xe8, 0xe8, 0xe8); |
| 42 |
| 43 class SpecialPopupRowBorder : public views::Border { |
| 44 public: |
| 45 SpecialPopupRowBorder() |
| 46 : painter_(views::Painter::CreateVerticalGradient(kBorderGradientDark, |
| 47 kBorderGradientLight)) { |
| 48 } |
| 49 |
| 50 virtual ~SpecialPopupRowBorder() {} |
| 51 |
| 52 private: |
| 53 virtual void Paint(const views::View& view, |
| 54 gfx::Canvas* canvas) const OVERRIDE { |
| 55 views::Painter::PaintPainterAt(canvas, painter_.get(), |
| 56 gfx::Rect(gfx::Size(view.width(), kBorderHeight))); |
| 57 } |
| 58 |
| 59 virtual void GetInsets(gfx::Insets* insets) const OVERRIDE { |
| 60 insets->Set(kBorderHeight, 0, 0, 0); |
| 61 } |
| 62 |
| 63 scoped_ptr<views::Painter> painter_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRowBorder); |
| 66 }; |
| 67 |
| 39 } | 68 } |
| 40 | 69 |
| 41 //////////////////////////////////////////////////////////////////////////////// | 70 //////////////////////////////////////////////////////////////////////////////// |
| 42 // FixedSizedImageView | 71 // FixedSizedImageView |
| 43 | 72 |
| 44 FixedSizedImageView::FixedSizedImageView(int width, int height) | 73 FixedSizedImageView::FixedSizedImageView(int width, int height) |
| 45 : width_(width), | 74 : width_(width), |
| 46 height_(height) { | 75 height_(height) { |
| 47 SetHorizontalAlignment(views::ImageView::CENTER); | 76 SetHorizontalAlignment(views::ImageView::CENTER); |
| 48 SetVerticalAlignment(views::ImageView::CENTER); | 77 SetVerticalAlignment(views::ImageView::CENTER); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 //////////////////////////////////////////////////////////////////////////////// | 421 //////////////////////////////////////////////////////////////////////////////// |
| 393 // SpecialPopupRow | 422 // SpecialPopupRow |
| 394 | 423 |
| 395 SpecialPopupRow::SpecialPopupRow() | 424 SpecialPopupRow::SpecialPopupRow() |
| 396 : content_(NULL), | 425 : content_(NULL), |
| 397 button_container_(NULL) { | 426 button_container_(NULL) { |
| 398 set_background(views::Background::CreateBackgroundPainter(true, | 427 set_background(views::Background::CreateBackgroundPainter(true, |
| 399 views::Painter::CreateVerticalGradient( | 428 views::Painter::CreateVerticalGradient( |
| 400 kHeaderBackgroundColorLight, | 429 kHeaderBackgroundColorLight, |
| 401 kHeaderBackgroundColorDark))); | 430 kHeaderBackgroundColorDark))); |
| 402 set_border(views::Border::CreateSolidSidedBorder(2, 0, 0, 0, | 431 set_border(new SpecialPopupRowBorder); |
| 403 ash::kBorderDarkColor)); | |
| 404 SetLayoutManager( | 432 SetLayoutManager( |
| 405 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 433 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
| 406 } | 434 } |
| 407 | 435 |
| 408 SpecialPopupRow::~SpecialPopupRow() { | 436 SpecialPopupRow::~SpecialPopupRow() { |
| 409 } | 437 } |
| 410 | 438 |
| 411 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { | 439 void SpecialPopupRow::SetTextLabel(int string_id, ViewClickListener* listener) { |
| 412 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 440 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 413 HoverHighlightView* container = new HoverHighlightView(listener); | 441 HoverHighlightView* container = new HoverHighlightView(listener); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 label->SetAutoColorReadabilityEnabled(false); | 599 label->SetAutoColorReadabilityEnabled(false); |
| 572 label->SetEnabledColor(SK_ColorWHITE); | 600 label->SetEnabledColor(SK_ColorWHITE); |
| 573 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 601 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
| 574 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 602 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), |
| 575 SkColorSetARGB(64, 0, 0, 0)); | 603 SkColorSetARGB(64, 0, 0, 0)); |
| 576 label->SetShadowOffset(0, 1); | 604 label->SetShadowOffset(0, 1); |
| 577 } | 605 } |
| 578 | 606 |
| 579 } // namespace internal | 607 } // namespace internal |
| 580 } // namespace ash | 608 } // namespace ash |
| OLD | NEW |