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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 return; | 268 return; |
269 | 269 |
270 if (top == 0 && bottom == 0) { | 270 if (top == 0 && bottom == 0) { |
271 // Do nothing, default margins are 0 already. | 271 // Do nothing, default margins are 0 already. |
272 return; | 272 return; |
273 } | 273 } |
274 // Non-zero margins case. | 274 // Non-zero margins case. |
275 NOTIMPLEMENTED(); | 275 NOTIMPLEMENTED(); |
276 } | 276 } |
277 | 277 |
278 void NativeTextfieldWin::SetFocus() { | 278 bool NativeTextfieldWin::SetFocus() { |
279 // Focus the associated HWND. | 279 // Focus the associated HWND. |
280 //container_view_->Focus(); | 280 //container_view_->Focus(); |
281 ::SetFocus(m_hWnd); | 281 ::SetFocus(m_hWnd); |
| 282 return true; |
282 } | 283 } |
283 | 284 |
284 View* NativeTextfieldWin::GetView() { | 285 View* NativeTextfieldWin::GetView() { |
285 return container_view_; | 286 return container_view_; |
286 } | 287 } |
287 | 288 |
288 gfx::NativeView NativeTextfieldWin::GetTestingHandle() const { | 289 gfx::NativeView NativeTextfieldWin::GetTestingHandle() const { |
289 return m_hWnd; | 290 return m_hWnd; |
290 } | 291 } |
291 | 292 |
292 bool NativeTextfieldWin::IsIMEComposing() const { | 293 bool NativeTextfieldWin::IsIMEComposing() const { |
293 // Retrieve the length of the composition string to check if an IME is | 294 // Retrieve the length of the composition string to check if an IME is |
294 // composing text. (If this length is > 0 then an IME is being used to compose | 295 // composing text. (If this length is > 0 then an IME is being used to compose |
295 // text.) | 296 // text.) |
296 HIMC imm_context = ImmGetContext(m_hWnd); | 297 HIMC imm_context = ImmGetContext(m_hWnd); |
297 if (!imm_context) | 298 if (!imm_context) |
298 return false; | 299 return false; |
299 | 300 |
300 const int composition_size = ImmGetCompositionString(imm_context, GCS_COMPSTR, | 301 const int composition_size = ImmGetCompositionString(imm_context, GCS_COMPSTR, |
301 NULL, 0); | 302 NULL, 0); |
302 ImmReleaseContext(m_hWnd, imm_context); | 303 ImmReleaseContext(m_hWnd, imm_context); |
303 return composition_size > 0; | 304 return composition_size > 0; |
304 } | 305 } |
305 | 306 |
| 307 bool NativeTextfieldWin::HandleKeyPressed(const views::KeyEvent& e) { |
| 308 return false; |
| 309 } |
| 310 |
| 311 bool NativeTextfieldWin::HandleKeyReleased(const views::KeyEvent& e) { |
| 312 return false; |
| 313 } |
| 314 |
| 315 void NativeTextfieldWin::HandleWillGainFocus() { |
| 316 } |
| 317 |
| 318 void NativeTextfieldWin::HandleDidGainFocus() { |
| 319 } |
| 320 |
| 321 void NativeTextfieldWin::HandleWillLoseFocus() { |
| 322 } |
| 323 |
306 //////////////////////////////////////////////////////////////////////////////// | 324 //////////////////////////////////////////////////////////////////////////////// |
307 // NativeTextfieldWin, menus::SimpleMenuModel::Delegate implementation: | 325 // NativeTextfieldWin, menus::SimpleMenuModel::Delegate implementation: |
308 | 326 |
309 bool NativeTextfieldWin::IsCommandIdChecked(int command_id) const { | 327 bool NativeTextfieldWin::IsCommandIdChecked(int command_id) const { |
310 return false; | 328 return false; |
311 } | 329 } |
312 | 330 |
313 bool NativeTextfieldWin::IsCommandIdEnabled(int command_id) const { | 331 bool NativeTextfieldWin::IsCommandIdEnabled(int command_id) const { |
314 switch (command_id) { | 332 switch (command_id) { |
315 case IDS_APP_UNDO: return !textfield_->read_only() && !!CanUndo(); | 333 case IDS_APP_UNDO: return !textfield_->read_only() && !!CanUndo(); |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 //////////////////////////////////////////////////////////////////////////////// | 1110 //////////////////////////////////////////////////////////////////////////////// |
1093 // NativeTextfieldWrapper, public: | 1111 // NativeTextfieldWrapper, public: |
1094 | 1112 |
1095 // static | 1113 // static |
1096 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 1114 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
1097 Textfield* field) { | 1115 Textfield* field) { |
1098 return new NativeTextfieldWin(field); | 1116 return new NativeTextfieldWin(field); |
1099 } | 1117 } |
1100 | 1118 |
1101 } // namespace views | 1119 } // namespace views |
OLD | NEW |