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 "third_party/skia/include/core/SkBitmap.h" | 8 #include "third_party/skia/include/core/SkBitmap.h" |
9 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 | 270 |
271 void TrayPopupTextButtonContainer::AddTextButton(TrayPopupTextButton* button) { | 271 void TrayPopupTextButtonContainer::AddTextButton(TrayPopupTextButton* button) { |
272 if (has_children() && !button->border()) { | 272 if (has_children() && !button->border()) { |
273 button->set_border(views::Border::CreateSolidSidedBorder(0, 1, 0, 0, | 273 button->set_border(views::Border::CreateSolidSidedBorder(0, 1, 0, 0, |
274 kButtonStrokeColor)); | 274 kButtonStrokeColor)); |
275 } | 275 } |
276 AddChildView(button); | 276 AddChildView(button); |
277 } | 277 } |
278 | 278 |
| 279 //////////////////////////////////////////////////////////////////////////////// |
| 280 // TrayPopupTextButtonContainer |
| 281 |
| 282 TrayPopupHeaderButton::TrayPopupHeaderButton(views::ButtonListener* listener, |
| 283 int enabled_resource_id, |
| 284 int disabled_resource_id) |
| 285 : views::ToggleImageButton(listener) { |
| 286 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 287 SetImage(views::CustomButton::BS_NORMAL, |
| 288 bundle.GetImageNamed(enabled_resource_id).ToSkBitmap()); |
| 289 SetToggledImage(views::CustomButton::BS_NORMAL, |
| 290 bundle.GetImageNamed(disabled_resource_id).ToSkBitmap()); |
| 291 SetImageAlignment(views::ImageButton::ALIGN_CENTER, |
| 292 views::ImageButton::ALIGN_MIDDLE); |
| 293 set_background(views::Background::CreateSolidBackground( |
| 294 ash::kHeaderBackgroundColor)); |
| 295 } |
| 296 |
| 297 TrayPopupHeaderButton::~TrayPopupHeaderButton() {} |
| 298 |
| 299 gfx::Size TrayPopupHeaderButton::GetPreferredSize() { |
| 300 return gfx::Size(ash::kTrayPopupItemHeight, ash::kTrayPopupItemHeight); |
| 301 } |
| 302 |
| 303 void TrayPopupHeaderButton::OnPaintBorder(gfx::Canvas* canvas) { |
| 304 // Left border. |
| 305 canvas->FillRect(gfx::Rect(0, 0, 1, height()), ash::kBorderDarkColor); |
| 306 } |
| 307 |
| 308 void TrayPopupHeaderButton::StateChanged() { |
| 309 set_background(views::Background::CreateSolidBackground( |
| 310 IsHotTracked() ? ash::kHeaderHoverBackgroundColor : |
| 311 ash::kHeaderBackgroundColor)); |
| 312 } |
279 | 313 |
280 views::View* CreateDetailedHeaderEntry(int string_id, | 314 views::View* CreateDetailedHeaderEntry(int string_id, |
281 ViewClickListener* listener) { | 315 ViewClickListener* listener) { |
282 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 316 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
283 HoverHighlightView* container = new HoverHighlightView(listener); | 317 HoverHighlightView* container = new HoverHighlightView(listener); |
284 container->set_fixed_height(kTrayPopupItemHeight); | 318 container->set_fixed_height(kTrayPopupItemHeight); |
285 container->SetLayoutManager(new | 319 container->SetLayoutManager(new |
286 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, kIconPaddingLeft)); | 320 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, kIconPaddingLeft)); |
287 views::ImageView* back = | 321 views::ImageView* back = |
288 new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); | 322 new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); |
(...skipping 17 matching lines...) Expand all Loading... |
306 label->SetAutoColorReadabilityEnabled(false); | 340 label->SetAutoColorReadabilityEnabled(false); |
307 label->SetEnabledColor(SK_ColorWHITE); | 341 label->SetEnabledColor(SK_ColorWHITE); |
308 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 342 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
309 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 343 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), |
310 SkColorSetARGB(64, 0, 0, 0)); | 344 SkColorSetARGB(64, 0, 0, 0)); |
311 label->SetShadowOffset(0, 1); | 345 label->SetShadowOffset(0, 1); |
312 } | 346 } |
313 | 347 |
314 } // namespace internal | 348 } // namespace internal |
315 } // namespace ash | 349 } // namespace ash |
OLD | NEW |