Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: ui/views/controls/slider.cc

Issue 10086005: ash: Show better focus rects for the tray. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« ui/views/controls/slider.h ('K') | « ui/views/controls/slider.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/views/controls/slider.h" 5 #include "ui/views/controls/slider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 namespace views { 25 namespace views {
26 26
27 Slider::Slider(SliderListener* listener, Orientation orientation) 27 Slider::Slider(SliderListener* listener, Orientation orientation)
28 : listener_(listener), 28 : listener_(listener),
29 orientation_(orientation), 29 orientation_(orientation),
30 value_(0.f), 30 value_(0.f),
31 keyboard_increment_(0.1f), 31 keyboard_increment_(0.1f),
32 animating_value_(0.f), 32 animating_value_(0.f),
33 value_is_valid_(false) { 33 value_is_valid_(false),
34 focus_color_(0) {
34 EnableCanvasFlippingForRTLUI(true); 35 EnableCanvasFlippingForRTLUI(true);
35 set_focusable(true); 36 set_focusable(true);
36 } 37 }
37 38
38 Slider::~Slider() { 39 Slider::~Slider() {
39 } 40 }
40 41
41 void Slider::SetValue(float value) { 42 void Slider::SetValue(float value) {
42 SetValueInternal(value, VALUE_CHANGED_BY_API); 43 SetValueInternal(value, VALUE_CHANGED_BY_API);
43 } 44 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 SchedulePaint(); 194 SchedulePaint();
194 } 195 }
195 196
196 void Slider::GetAccessibleState(ui::AccessibleViewState* state) { 197 void Slider::GetAccessibleState(ui::AccessibleViewState* state) {
197 state->role = ui::AccessibilityTypes::ROLE_SLIDER; 198 state->role = ui::AccessibilityTypes::ROLE_SLIDER;
198 state->name = accessible_name_; 199 state->name = accessible_name_;
199 state->value = UTF8ToUTF16( 200 state->value = UTF8ToUTF16(
200 base::StringPrintf("%d%%", (int)(value_ * 100 + 0.5))); 201 base::StringPrintf("%d%%", (int)(value_ * 100 + 0.5)));
201 } 202 }
202 203
204 void Slider::OnPaintFocusBorder(gfx::Canvas* canvas) {
205 if (!focus_color_) {
206 View::OnPaintFocusBorder(canvas);
207 } else if (HasFocus() && (focusable() || IsAccessibilityFocusable())) {
208 canvas->DrawRect(gfx::Rect(1, 1, width() - 3, height() - 3),
209 focus_color_);
210 }
211 }
212
203 } // namespace views 213 } // namespace views
OLDNEW
« ui/views/controls/slider.h ('K') | « ui/views/controls/slider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698