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/native_textfield_win.h" | 5 #include "ui/views/controls/textfield/native_textfield_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 contains_mouse_(false), | 93 contains_mouse_(false), |
94 ime_discard_composition_(false), | 94 ime_discard_composition_(false), |
95 ime_composition_start_(0), | 95 ime_composition_start_(0), |
96 ime_composition_length_(0), | 96 ime_composition_length_(0), |
97 container_view_(new NativeViewHost), | 97 container_view_(new NativeViewHost), |
98 bg_color_(0) { | 98 bg_color_(0) { |
99 if (!did_load_library_) | 99 if (!did_load_library_) |
100 did_load_library_ = !!LoadLibrary(L"riched20.dll"); | 100 did_load_library_ = !!LoadLibrary(L"riched20.dll"); |
101 | 101 |
102 DWORD style = kDefaultEditStyle | ES_AUTOHSCROLL; | 102 DWORD style = kDefaultEditStyle | ES_AUTOHSCROLL; |
103 if (textfield_->style() & Textfield::STYLE_OBSCURED) | 103 if (textfield_->IsObscured()) |
104 style |= ES_PASSWORD; | 104 style |= ES_PASSWORD; |
105 | 105 |
106 if (textfield_->read_only()) | 106 if (textfield_->read_only()) |
107 style |= ES_READONLY; | 107 style |= ES_READONLY; |
108 | 108 |
109 // Make sure we apply RTL related extended window styles if necessary. | 109 // Make sure we apply RTL related extended window styles if necessary. |
110 DWORD ex_style = l10n_util::GetExtendedStyles(); | 110 DWORD ex_style = l10n_util::GetExtendedStyles(); |
111 | 111 |
112 RECT r = {0, 0, textfield_->width(), textfield_->height()}; | 112 RECT r = {0, 0, textfield_->width(), textfield_->height()}; |
113 Create(textfield_->GetWidget()->GetNativeView(), r, NULL, style, ex_style); | 113 Create(textfield_->GetWidget()->GetNativeView(), r, NULL, style, ex_style); |
114 | 114 |
115 if (textfield_->style() & Textfield::STYLE_LOWERCASE) { | 115 if (textfield_->style() & Textfield::STYLE_LOWERCASE) { |
116 DCHECK((textfield_->style() & Textfield::STYLE_OBSCURED) == 0); | 116 DCHECK(!textfield_->IsObscured()); |
117 SetEditStyle(SES_LOWERCASE, SES_LOWERCASE); | 117 SetEditStyle(SES_LOWERCASE, SES_LOWERCASE); |
118 } | 118 } |
119 | 119 |
120 // Set up the text_object_model_. | 120 // Set up the text_object_model_. |
121 base::win::ScopedComPtr<IRichEditOle, &IID_IRichEditOle> ole_interface; | 121 base::win::ScopedComPtr<IRichEditOle, &IID_IRichEditOle> ole_interface; |
122 ole_interface.Attach(GetOleInterface()); | 122 ole_interface.Attach(GetOleInterface()); |
123 if (ole_interface) | 123 if (ole_interface) |
124 text_object_model_.QueryFrom(ole_interface); | 124 text_object_model_.QueryFrom(ole_interface); |
125 | 125 |
126 InitializeAccessibilityInfo(); | 126 InitializeAccessibilityInfo(); |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 | 1157 |
1158 // static | 1158 // static |
1159 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1159 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1160 Textfield* field) { | 1160 Textfield* field) { |
1161 if (views::Widget::IsPureViews()) | 1161 if (views::Widget::IsPureViews()) |
1162 return new NativeTextfieldViews(field); | 1162 return new NativeTextfieldViews(field); |
1163 return new NativeTextfieldWin(field); | 1163 return new NativeTextfieldWin(field); |
1164 } | 1164 } |
1165 | 1165 |
1166 } // namespace views | 1166 } // namespace views |
OLD | NEW |