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

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: Sync and rebase, add a blank line between includes. 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // TODO(tommi): Implement. 368 // TODO(tommi): Implement.
381 NOTIMPLEMENTED(); 369 NOTIMPLEMENTED();
382 } 370 }
383 371
384 size_t NativeTextfieldWin::GetCursorPosition() const { 372 size_t NativeTextfieldWin::GetCursorPosition() const {
385 // TODO(tommi): Implement. 373 // TODO(tommi): Implement.
386 NOTIMPLEMENTED(); 374 NOTIMPLEMENTED();
387 return 0U; 375 return 0U;
388 } 376 }
389 377
378 bool NativeTextfieldWin::GetCursorEnabled() const {
379 // TODO(msw): Implement.
380 NOTIMPLEMENTED();
381 return true;
382 }
383
384 void NativeTextfieldWin::SetCursorEnabled(bool enabled) {
385 // TODO(msw): Implement.
386 NOTIMPLEMENTED();
387 }
388
390 bool NativeTextfieldWin::HandleKeyPressed(const ui::KeyEvent& event) { 389 bool NativeTextfieldWin::HandleKeyPressed(const ui::KeyEvent& event) {
391 return false; 390 return false;
392 } 391 }
393 392
394 bool NativeTextfieldWin::HandleKeyReleased(const ui::KeyEvent& event) { 393 bool NativeTextfieldWin::HandleKeyReleased(const ui::KeyEvent& event) {
395 return false; 394 return false;
396 } 395 }
397 396
398 void NativeTextfieldWin::HandleFocus() { 397 void NativeTextfieldWin::HandleFocus() {
399 } 398 }
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); 1271 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1273 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT); 1272 context_menu_contents_->AddItemWithStringId(IDS_APP_CUT, IDS_APP_CUT);
1274 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY); 1273 context_menu_contents_->AddItemWithStringId(IDS_APP_COPY, IDS_APP_COPY);
1275 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE); 1274 context_menu_contents_->AddItemWithStringId(IDS_APP_PASTE, IDS_APP_PASTE);
1276 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR); 1275 context_menu_contents_->AddSeparator(ui::NORMAL_SEPARATOR);
1277 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL, 1276 context_menu_contents_->AddItemWithStringId(IDS_APP_SELECT_ALL,
1278 IDS_APP_SELECT_ALL); 1277 IDS_APP_SELECT_ALL);
1279 } 1278 }
1280 1279
1281 } // namespace views 1280 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/native_textfield_win.h ('k') | ui/views/controls/textfield/native_textfield_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698