OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "views/controls/textfield/native_textfield_win.h" | 5 #include "views/controls/textfield/native_textfield_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
10 #include "app/clipboard/scoped_clipboard_writer.h" | 10 #include "app/clipboard/scoped_clipboard_writer.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 return; | 267 return; |
268 | 268 |
269 if (top == 0 && bottom == 0) { | 269 if (top == 0 && bottom == 0) { |
270 // Do nothing, default margins are 0 already. | 270 // Do nothing, default margins are 0 already. |
271 return; | 271 return; |
272 } | 272 } |
273 // Non-zero margins case. | 273 // Non-zero margins case. |
274 NOTIMPLEMENTED(); | 274 NOTIMPLEMENTED(); |
275 } | 275 } |
276 | 276 |
277 void NativeTextfieldWin::SetFocus() { | 277 bool NativeTextfieldWin::SetFocus() { |
278 // Focus the associated HWND. | 278 // Focus the associated HWND. |
279 //container_view_->Focus(); | 279 //container_view_->Focus(); |
280 ::SetFocus(m_hWnd); | 280 ::SetFocus(m_hWnd); |
| 281 return true; |
281 } | 282 } |
282 | 283 |
283 View* NativeTextfieldWin::GetView() { | 284 View* NativeTextfieldWin::GetView() { |
284 return container_view_; | 285 return container_view_; |
285 } | 286 } |
286 | 287 |
287 gfx::NativeView NativeTextfieldWin::GetTestingHandle() const { | 288 gfx::NativeView NativeTextfieldWin::GetTestingHandle() const { |
288 return m_hWnd; | 289 return m_hWnd; |
289 } | 290 } |
290 | 291 |
291 bool NativeTextfieldWin::IsIMEComposing() const { | 292 bool NativeTextfieldWin::IsIMEComposing() const { |
292 // Retrieve the length of the composition string to check if an IME is | 293 // Retrieve the length of the composition string to check if an IME is |
293 // composing text. (If this length is > 0 then an IME is being used to compose | 294 // composing text. (If this length is > 0 then an IME is being used to compose |
294 // text.) | 295 // text.) |
295 HIMC imm_context = ImmGetContext(m_hWnd); | 296 HIMC imm_context = ImmGetContext(m_hWnd); |
296 if (!imm_context) | 297 if (!imm_context) |
297 return false; | 298 return false; |
298 | 299 |
299 const int composition_size = ImmGetCompositionString(imm_context, GCS_COMPSTR, | 300 const int composition_size = ImmGetCompositionString(imm_context, GCS_COMPSTR, |
300 NULL, 0); | 301 NULL, 0); |
301 ImmReleaseContext(m_hWnd, imm_context); | 302 ImmReleaseContext(m_hWnd, imm_context); |
302 return composition_size > 0; | 303 return composition_size > 0; |
303 } | 304 } |
304 | 305 |
| 306 bool NativeTextfieldWin::HandleKeyPressed(const views::KeyEvent& e) { |
| 307 return false; |
| 308 } |
| 309 |
| 310 bool NativeTextfieldWin::HandleKeyReleased(const views::KeyEvent& e) { |
| 311 return false; |
| 312 } |
| 313 |
| 314 void NativeTextfieldWin::HandleWillGainFocus() { |
| 315 } |
| 316 |
| 317 void NativeTextfieldWin::HandleDidGainFocus() { |
| 318 } |
| 319 |
| 320 void NativeTextfieldWin::HandleWillLoseFocus() { |
| 321 } |
| 322 |
305 //////////////////////////////////////////////////////////////////////////////// | 323 //////////////////////////////////////////////////////////////////////////////// |
306 // NativeTextfieldWin, menus::SimpleMenuModel::Delegate implementation: | 324 // NativeTextfieldWin, menus::SimpleMenuModel::Delegate implementation: |
307 | 325 |
308 bool NativeTextfieldWin::IsCommandIdChecked(int command_id) const { | 326 bool NativeTextfieldWin::IsCommandIdChecked(int command_id) const { |
309 return false; | 327 return false; |
310 } | 328 } |
311 | 329 |
312 bool NativeTextfieldWin::IsCommandIdEnabled(int command_id) const { | 330 bool NativeTextfieldWin::IsCommandIdEnabled(int command_id) const { |
313 switch (command_id) { | 331 switch (command_id) { |
314 case IDS_APP_UNDO: return !textfield_->read_only() && !!CanUndo(); | 332 case IDS_APP_UNDO: return !textfield_->read_only() && !!CanUndo(); |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 //////////////////////////////////////////////////////////////////////////////// | 1090 //////////////////////////////////////////////////////////////////////////////// |
1073 // NativeTextfieldWrapper, public: | 1091 // NativeTextfieldWrapper, public: |
1074 | 1092 |
1075 // static | 1093 // static |
1076 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1094 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1077 Textfield* field) { | 1095 Textfield* field) { |
1078 return new NativeTextfieldWin(field); | 1096 return new NativeTextfieldWin(field); |
1079 } | 1097 } |
1080 | 1098 |
1081 } // namespace views | 1099 } // namespace views |
OLD | NEW |