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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 void HoverHighlightView::AddLabel(const string16& text, | 99 void HoverHighlightView::AddLabel(const string16& text, |
100 gfx::Font::FontStyle style) { | 100 gfx::Font::FontStyle style) { |
101 SetLayoutManager(new views::FillLayout()); | 101 SetLayoutManager(new views::FillLayout()); |
102 views::Label* label = new views::Label(text); | 102 views::Label* label = new views::Label(text); |
103 label->set_border(views::Border::CreateEmptyBorder( | 103 label->set_border(views::Border::CreateEmptyBorder( |
104 5, kTrayPopupDetailsIconWidth + kIconPaddingLeft, 5, 0)); | 104 5, kTrayPopupDetailsIconWidth + kIconPaddingLeft, 5, 0)); |
105 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 105 label->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
106 label->SetFont(label->font().DeriveFont(0, style)); | 106 label->SetFont(label->font().DeriveFont(0, style)); |
| 107 label->SetDisabledColor(SkColorSetARGB(127, 0, 0, 0)); |
107 AddChildView(label); | 108 AddChildView(label); |
108 | 109 |
109 accessible_name_ = text; | 110 accessible_name_ = text; |
110 } | 111 } |
111 | 112 |
112 void HoverHighlightView::SetAccessibleName(const string16& name) { | 113 void HoverHighlightView::SetAccessibleName(const string16& name) { |
113 accessible_name_ = name; | 114 accessible_name_ = name; |
114 } | 115 } |
115 | 116 |
116 bool HoverHighlightView::PerformAction(const views::Event& event) { | 117 bool HoverHighlightView::PerformAction(const views::Event& event) { |
(...skipping 11 matching lines...) Expand all Loading... |
128 void HoverHighlightView::OnMouseExited(const views::MouseEvent& event) { | 129 void HoverHighlightView::OnMouseExited(const views::MouseEvent& event) { |
129 hover_ = false; | 130 hover_ = false; |
130 SchedulePaint(); | 131 SchedulePaint(); |
131 } | 132 } |
132 | 133 |
133 void HoverHighlightView::GetAccessibleState(ui::AccessibleViewState* state) { | 134 void HoverHighlightView::GetAccessibleState(ui::AccessibleViewState* state) { |
134 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; | 135 state->role = ui::AccessibilityTypes::ROLE_PUSHBUTTON; |
135 state->name = accessible_name_; | 136 state->name = accessible_name_; |
136 } | 137 } |
137 | 138 |
| 139 void HoverHighlightView::OnEnabledChanged() { |
| 140 for (int i = 0; i < child_count(); ++i) |
| 141 child_at(i)->SetEnabled(enabled()); |
| 142 } |
| 143 |
138 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { | 144 void HoverHighlightView::OnPaintBackground(gfx::Canvas* canvas) { |
139 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); | 145 canvas->DrawColor(hover_ ? highlight_color_ : default_color_); |
140 } | 146 } |
141 | 147 |
142 //////////////////////////////////////////////////////////////////////////////// | 148 //////////////////////////////////////////////////////////////////////////////// |
143 // FixedSizedScrollView | 149 // FixedSizedScrollView |
144 | 150 |
145 FixedSizedScrollView::FixedSizedScrollView() { | 151 FixedSizedScrollView::FixedSizedScrollView() { |
146 set_focusable(true); | 152 set_focusable(true); |
147 set_notify_enter_exit_on_child(true); | 153 set_notify_enter_exit_on_child(true); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 label->SetAutoColorReadabilityEnabled(false); | 210 label->SetAutoColorReadabilityEnabled(false); |
205 label->SetEnabledColor(SK_ColorWHITE); | 211 label->SetEnabledColor(SK_ColorWHITE); |
206 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 212 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
207 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 213 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), |
208 SkColorSetARGB(64, 0, 0, 0)); | 214 SkColorSetARGB(64, 0, 0, 0)); |
209 label->SetShadowOffset(0, 1); | 215 label->SetShadowOffset(0, 1); |
210 } | 216 } |
211 | 217 |
212 } // namespace internal | 218 } // namespace internal |
213 } // namespace ash | 219 } // namespace ash |
OLD | NEW |