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 <gtk/gtk.h> | 5 #include <gtk/gtk.h> |
6 | 6 |
7 #include "views/controls/textfield/native_textfield_gtk.h" | 7 #include "views/controls/textfield/native_textfield_gtk.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 gboolean NativeTextfieldGtk::OnKeyPressEventHandler( | 347 gboolean NativeTextfieldGtk::OnKeyPressEventHandler( |
348 GtkWidget* widget, | 348 GtkWidget* widget, |
349 GdkEventKey* event, | 349 GdkEventKey* event, |
350 NativeTextfieldGtk* textfield) { | 350 NativeTextfieldGtk* textfield) { |
351 return textfield->OnKeyPressEvent(event); | 351 return textfield->OnKeyPressEvent(event); |
352 } | 352 } |
353 | 353 |
354 gboolean NativeTextfieldGtk::OnKeyPressEvent(GdkEventKey* event) { | 354 gboolean NativeTextfieldGtk::OnKeyPressEvent(GdkEventKey* event) { |
355 Textfield::Controller* controller = textfield_->GetController(); | 355 Textfield::Controller* controller = textfield_->GetController(); |
356 if (controller) { | 356 if (controller) { |
357 Textfield::Keystroke ks(event); | 357 KeyEvent key_event(event); |
| 358 Textfield::Keystroke ks(&key_event); |
358 return controller->HandleKeystroke(textfield_, ks); | 359 return controller->HandleKeystroke(textfield_, ks); |
359 } | 360 } |
360 return false; | 361 return false; |
361 } | 362 } |
362 | 363 |
363 // static | 364 // static |
364 gboolean NativeTextfieldGtk::OnChangedHandler( | 365 gboolean NativeTextfieldGtk::OnChangedHandler( |
365 GtkWidget* widget, | 366 GtkWidget* widget, |
366 NativeTextfieldGtk* textfield) { | 367 NativeTextfieldGtk* textfield) { |
367 return textfield->OnChanged(); | 368 return textfield->OnChanged(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 g_signal_connect(text_buffer, "changed", | 405 g_signal_connect(text_buffer, "changed", |
405 G_CALLBACK(OnChangedHandler), this); | 406 G_CALLBACK(OnChangedHandler), this); |
406 } else { | 407 } else { |
407 g_signal_connect(widget, "changed", | 408 g_signal_connect(widget, "changed", |
408 G_CALLBACK(OnChangedHandler), this); | 409 G_CALLBACK(OnChangedHandler), this); |
409 } | 410 } |
410 g_signal_connect(widget, "key-press-event", | 411 g_signal_connect(widget, "key-press-event", |
411 G_CALLBACK(OnKeyPressEventHandler), this); | 412 G_CALLBACK(OnKeyPressEventHandler), this); |
412 } | 413 } |
413 | 414 |
414 //////////////////////////////////////////////////////////////////////////////// | |
415 // NativeTextfieldWrapper, public: | |
416 | |
417 // static | |
418 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | |
419 Textfield* field) { | |
420 return new NativeTextfieldGtk(field); | |
421 } | |
422 | |
423 } // namespace views | 415 } // namespace views |
OLD | NEW |