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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 event.key_code() == ui::VKEY_RETURN) { | 58 event.key_code() == ui::VKEY_RETURN) { |
59 return PerformAction(event); | 59 return PerformAction(event); |
60 } | 60 } |
61 return false; | 61 return false; |
62 } | 62 } |
63 | 63 |
64 bool ActionableView::OnMousePressed(const views::MouseEvent& event) { | 64 bool ActionableView::OnMousePressed(const views::MouseEvent& event) { |
65 return PerformAction(event); | 65 return PerformAction(event); |
66 } | 66 } |
67 | 67 |
68 void ActionableView::OnPaintFocusBorder(gfx::Canvas* canvas) { | |
69 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | |
70 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), | |
71 kFocusBorderColor); | |
72 } | |
73 } | |
74 | |
68 //////////////////////////////////////////////////////////////////////////////// | 75 //////////////////////////////////////////////////////////////////////////////// |
69 // HoverHighlightView | 76 // HoverHighlightView |
70 | 77 |
71 HoverHighlightView::HoverHighlightView(ViewClickListener* listener) | 78 HoverHighlightView::HoverHighlightView(ViewClickListener* listener) |
72 : listener_(listener), | 79 : listener_(listener), |
73 highlight_color_(kHoverBackgroundColor), | 80 highlight_color_(kHoverBackgroundColor), |
74 default_color_(0), | 81 default_color_(0), |
75 hover_(false) { | 82 hover_(false) { |
76 set_notify_enter_exit_on_child(true); | 83 set_notify_enter_exit_on_child(true); |
77 } | 84 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 // TODO(sad): This is done to make sure that the scroll view scrolls on | 176 // TODO(sad): This is done to make sure that the scroll view scrolls on |
170 // mouse-wheel events. This is ugly, and Ben thinks this is weird. There | 177 // mouse-wheel events. This is ugly, and Ben thinks this is weird. There |
171 // should be a better fix for this. | 178 // should be a better fix for this. |
172 RequestFocus(); | 179 RequestFocus(); |
173 } | 180 } |
174 | 181 |
175 void FixedSizedScrollView::OnPaintFocusBorder(gfx::Canvas* canvas) { | 182 void FixedSizedScrollView::OnPaintFocusBorder(gfx::Canvas* canvas) { |
176 // Do not paint the focus border. | 183 // Do not paint the focus border. |
177 } | 184 } |
178 | 185 |
186 //////////////////////////////////////////////////////////////////////////////// | |
187 // AccessibleSlider | |
188 | |
189 AccessibleSlider::AccessibleSlider(views::SliderListener* listener, | |
190 views::Slider::Orientation orientation) | |
191 : views::Slider(listener, orientation) { | |
192 // Add enough padding on all sides to make sure the focus border does not | |
193 // overlap the slider. | |
194 set_border(views::Border::CreateEmptyBorder(3, 3, 3, 3)); | |
195 } | |
196 | |
197 AccessibleSlider::~AccessibleSlider() { | |
198 } | |
199 | |
200 void AccessibleSlider::OnPaintFocusBorder(gfx::Canvas* canvas) { | |
201 if (HasFocus() && (focusable() || IsAccessibilityFocusable())) { | |
Ben Goodger (Google)
2012/04/13 15:26:29
Can you just add this to views::Slider?
sadrul
2012/04/13 15:48:36
Done (add Slider::set_focus_color so it can easily
| |
202 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3), | |
203 kFocusBorderColor); | |
204 } | |
205 } | |
206 | |
179 views::View* CreateDetailedHeaderEntry(int string_id, | 207 views::View* CreateDetailedHeaderEntry(int string_id, |
180 ViewClickListener* listener) { | 208 ViewClickListener* listener) { |
181 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 209 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
182 HoverHighlightView* container = new HoverHighlightView(listener); | 210 HoverHighlightView* container = new HoverHighlightView(listener); |
183 container->SetLayoutManager(new | 211 container->SetLayoutManager(new |
184 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, kIconPaddingLeft)); | 212 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, kIconPaddingLeft)); |
185 views::ImageView* back = | 213 views::ImageView* back = |
186 new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); | 214 new FixedSizedImageView(kTrayPopupDetailsIconWidth, 0); |
187 back->EnableCanvasFlippingForRTLUI(true); | 215 back->EnableCanvasFlippingForRTLUI(true); |
188 back->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap()); | 216 back->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap()); |
(...skipping 15 matching lines...) Expand all Loading... | |
204 label->SetAutoColorReadabilityEnabled(false); | 232 label->SetAutoColorReadabilityEnabled(false); |
205 label->SetEnabledColor(SK_ColorWHITE); | 233 label->SetEnabledColor(SK_ColorWHITE); |
206 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 234 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
207 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 235 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), |
208 SkColorSetARGB(64, 0, 0, 0)); | 236 SkColorSetARGB(64, 0, 0, 0)); |
209 label->SetShadowOffset(0, 1); | 237 label->SetShadowOffset(0, 1); |
210 } | 238 } |
211 | 239 |
212 } // namespace internal | 240 } // namespace internal |
213 } // namespace ash | 241 } // namespace ash |
OLD | NEW |