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 "ui/views/controls/textfield/textfield.h" | 5 #include "ui/views/controls/textfield/textfield.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 void Textfield::SetController(TextfieldController* controller) { | 122 void Textfield::SetController(TextfieldController* controller) { |
123 controller_ = controller; | 123 controller_ = controller; |
124 } | 124 } |
125 | 125 |
126 TextfieldController* Textfield::GetController() const { | 126 TextfieldController* Textfield::GetController() const { |
127 return controller_; | 127 return controller_; |
128 } | 128 } |
129 | 129 |
130 void Textfield::SetReadOnly(bool read_only) { | 130 void Textfield::SetReadOnly(bool read_only) { |
| 131 // Update read-only without changing the focusable state (or active, etc.). |
131 read_only_ = read_only; | 132 read_only_ = read_only; |
132 set_focusable(!read_only); | |
133 if (native_wrapper_) { | 133 if (native_wrapper_) { |
134 native_wrapper_->UpdateReadOnly(); | 134 native_wrapper_->UpdateReadOnly(); |
135 native_wrapper_->UpdateTextColor(); | 135 native_wrapper_->UpdateTextColor(); |
136 native_wrapper_->UpdateBackgroundColor(); | 136 native_wrapper_->UpdateBackgroundColor(); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 bool Textfield::IsObscured() const { | 140 bool Textfield::IsObscured() const { |
141 return style_ & STYLE_OBSCURED; | 141 return style_ & STYLE_OBSCURED; |
142 } | 142 } |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 601 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
602 Textfield* field) { | 602 Textfield* field) { |
603 #if defined(OS_WIN) && !defined(USE_AURA) | 603 #if defined(OS_WIN) && !defined(USE_AURA) |
604 if (!Textfield::IsViewsTextfieldEnabled()) | 604 if (!Textfield::IsViewsTextfieldEnabled()) |
605 return new NativeTextfieldWin(field); | 605 return new NativeTextfieldWin(field); |
606 #endif | 606 #endif |
607 return new NativeTextfieldViews(field); | 607 return new NativeTextfieldViews(field); |
608 } | 608 } |
609 | 609 |
610 } // namespace views | 610 } // namespace views |
OLD | NEW |