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 "ash/system/tray/tray_item_view.h" |
8 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
9 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
10 #include "ui/base/accessibility/accessible_view_state.h" | 11 #include "ui/base/accessibility/accessible_view_state.h" |
11 #include "ui/base/resource/resource_bundle.h" | 12 #include "ui/base/resource/resource_bundle.h" |
12 #include "ui/gfx/canvas.h" | 13 #include "ui/gfx/canvas.h" |
13 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
14 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
15 #include "ui/views/border.h" | 16 #include "ui/views/border.h" |
16 #include "ui/views/controls/button/image_button.h" | 17 #include "ui/views/controls/button/image_button.h" |
17 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 label->SetFont( | 518 label->SetFont( |
518 label->font().DeriveFont(2, gfx::Font::BOLD)); | 519 label->font().DeriveFont(2, gfx::Font::BOLD)); |
519 label->SetAutoColorReadabilityEnabled(false); | 520 label->SetAutoColorReadabilityEnabled(false); |
520 label->SetEnabledColor(SK_ColorWHITE); | 521 label->SetEnabledColor(SK_ColorWHITE); |
521 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 522 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
522 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 523 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), |
523 SkColorSetARGB(64, 0, 0, 0)); | 524 SkColorSetARGB(64, 0, 0, 0)); |
524 label->SetShadowOffset(0, 1); | 525 label->SetShadowOffset(0, 1); |
525 } | 526 } |
526 | 527 |
| 528 void SetTrayImageItemBorder(views::View* tray_view, |
| 529 ShelfAlignment alignment) { |
| 530 if (alignment == SHELF_ALIGNMENT_BOTTOM) { |
| 531 tray_view->set_border(views::Border::CreateEmptyBorder( |
| 532 0, kTrayImageItemHorizontalPaddingBottomAlignment, |
| 533 0, kTrayImageItemHorizontalPaddingBottomAlignment)); |
| 534 } else { |
| 535 tray_view->set_border(views::Border::CreateEmptyBorder( |
| 536 kTrayImageItemVerticalPaddingVerticalAlignment, |
| 537 kTrayImageItemHorizontalPaddingVerticalAlignment, |
| 538 kTrayImageItemVerticalPaddingVerticalAlignment, |
| 539 kTrayImageItemHorizontalPaddingVerticalAlignment)); |
| 540 } |
| 541 } |
| 542 |
| 543 void SetTrayLabelItemBorder(TrayItemView* tray_view, |
| 544 ShelfAlignment alignment) { |
| 545 if (alignment == SHELF_ALIGNMENT_BOTTOM) { |
| 546 tray_view->set_border(views::Border::CreateEmptyBorder( |
| 547 0, kTrayLabelItemHorizontalPaddingBottomAlignment, |
| 548 0, kTrayLabelItemHorizontalPaddingBottomAlignment)); |
| 549 } else { |
| 550 // Center the label for vertical launcher alignment. |
| 551 int horizontal_padding = (tray_view->GetPreferredSize().width() - |
| 552 tray_view->label()->GetPreferredSize().width()) / 2; |
| 553 tray_view->set_border(views::Border::CreateEmptyBorder( |
| 554 kTrayLabelItemVerticalPaddingVeriticalAlignment, |
| 555 horizontal_padding, |
| 556 kTrayLabelItemVerticalPaddingVeriticalAlignment, |
| 557 horizontal_padding)); |
| 558 } |
| 559 } |
| 560 |
527 } // namespace internal | 561 } // namespace internal |
528 } // namespace ash | 562 } // namespace ash |
OLD | NEW |