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

Side by Side Diff: ui/views/controls/textfield/native_textfield_win.cc

Issue 11421204: Use native theme colors for textfields; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nix cursor color; adjust textfield functions; add read-only theme colors. Created 8 years 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
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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 void NativeTextfieldWin::UpdateBorder() { 243 void NativeTextfieldWin::UpdateBorder() {
244 SetWindowPos(NULL, 0, 0, 0, 0, 244 SetWindowPos(NULL, 0, 0, 0, 0,
245 SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE | 245 SWP_NOMOVE | SWP_FRAMECHANGED | SWP_NOACTIVATE |
246 SWP_NOOWNERZORDER | SWP_NOSIZE); 246 SWP_NOOWNERZORDER | SWP_NOSIZE);
247 } 247 }
248 248
249 void NativeTextfieldWin::UpdateTextColor() { 249 void NativeTextfieldWin::UpdateTextColor() {
250 CHARFORMAT cf = {0}; 250 CHARFORMAT cf = {0};
251 cf.dwMask = CFM_COLOR; 251 cf.dwMask = CFM_COLOR;
252 cf.crTextColor = textfield_->use_default_text_color() ? 252 cf.crTextColor = skia::SkColorToCOLORREF(textfield_->GetTextColor());
253 GetSysColor(textfield_->read_only() ? COLOR_GRAYTEXT : COLOR_WINDOWTEXT) :
254 skia::SkColorToCOLORREF(textfield_->text_color());
255 CRichEditCtrl::SetDefaultCharFormat(cf); 253 CRichEditCtrl::SetDefaultCharFormat(cf);
256 } 254 }
257 255
258 void NativeTextfieldWin::UpdateBackgroundColor() { 256 void NativeTextfieldWin::UpdateBackgroundColor() {
259 if (!textfield_->use_default_background_color()) { 257 CRichEditCtrl::SetBackgroundColor(
260 bg_color_ = skia::SkColorToCOLORREF(textfield_->background_color()); 258 skia::SkColorToCOLORREF(textfield_->GetBackgroundColor()));
261 } else {
262 bg_color_ = GetSysColor(textfield_->read_only() ? COLOR_3DFACE
263 : COLOR_WINDOW);
264 }
265 CRichEditCtrl::SetBackgroundColor(bg_color_);
266 }
267
268 void NativeTextfieldWin::UpdateCursorColor() {
269 if (!textfield_->use_default_cursor_color())
270 NOTIMPLEMENTED();
271 } 259 }
272 260
273 void NativeTextfieldWin::UpdateReadOnly() { 261 void NativeTextfieldWin::UpdateReadOnly() {
274 SendMessage(m_hWnd, EM_SETREADONLY, textfield_->read_only(), 0); 262 SendMessage(m_hWnd, EM_SETREADONLY, textfield_->read_only(), 0);
275 UpdateAccessibleState(STATE_SYSTEM_READONLY, textfield_->read_only()); 263 UpdateAccessibleState(STATE_SYSTEM_READONLY, textfield_->read_only());
276 } 264 }
277 265
278 void NativeTextfieldWin::UpdateFont() { 266 void NativeTextfieldWin::UpdateFont() {
279 SendMessage(m_hWnd, WM_SETFONT, 267 SendMessage(m_hWnd, WM_SETFONT,
280 reinterpret_cast<WPARAM>(textfield_->font().GetNativeFont()), 268 reinterpret_cast<WPARAM>(textfield_->font().GetNativeFont()),
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); 1260 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1273 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT); 1261 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT);
1274 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); 1262 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY);
1275 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE); 1263 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE);
1276 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); 1264 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1277 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL, 1265 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL,
1278 IDS_APP_SELECT_ALL); 1266 IDS_APP_SELECT_ALL);
1279 } 1267 }
1280 1268
1281 } // namespace views 1269 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698