OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gdk/gdkkeysyms.h> | 5 #include <gdk/gdkkeysyms.h> |
6 #include <gtk/gtk.h> | 6 #include <gtk/gtk.h> |
7 | 7 |
8 #include "views/controls/textfield/native_textfield_gtk.h" | 8 #include "views/controls/textfield/native_textfield_gtk.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 if (!event || event->type != GDK_KEY_PRESS) | 386 if (!event || event->type != GDK_KEY_PRESS) |
387 return; | 387 return; |
388 | 388 |
389 KeyEvent views_key_event(event); | 389 KeyEvent views_key_event(event); |
390 gboolean handled = false; | 390 gboolean handled = false; |
391 | 391 |
392 TextfieldController* controller = textfield_->GetController(); | 392 TextfieldController* controller = textfield_->GetController(); |
393 if (controller) | 393 if (controller) |
394 handled = controller->HandleKeyEvent(textfield_, views_key_event); | 394 handled = controller->HandleKeyEvent(textfield_, views_key_event); |
395 | 395 |
396 WidgetGtk* widget = static_cast<WidgetGtk*>(GetWidget()); | 396 WidgetGtk* widget = static_cast<WidgetGtk*>(GetWidget()->native_widget()); |
397 if (!handled && widget) | 397 if (!handled && widget) |
398 handled = widget->HandleKeyboardEvent(views_key_event); | 398 handled = widget->HandleKeyboardEvent(views_key_event); |
399 | 399 |
400 // Stop signal emission if the key event is handled by us. | 400 // Stop signal emission if the key event is handled by us. |
401 if (handled) { | 401 if (handled) { |
402 // Only GtkEntry has "activate" signal. | 402 // Only GtkEntry has "activate" signal. |
403 static guint signal_id = g_signal_lookup("activate", GTK_TYPE_ENTRY); | 403 static guint signal_id = g_signal_lookup("activate", GTK_TYPE_ENTRY); |
404 g_signal_stop_emission(native_widget, signal_id, 0); | 404 g_signal_stop_emission(native_widget, signal_id, 0); |
405 } | 405 } |
406 } | 406 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 // static | 520 // static |
521 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( | 521 NativeTextfieldWrapper* NativeTextfieldWrapper::CreateWrapper( |
522 Textfield* field) { | 522 Textfield* field) { |
523 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { | 523 if (NativeTextfieldViews::IsTextfieldViewsEnabled()) { |
524 return new NativeTextfieldViews(field); | 524 return new NativeTextfieldViews(field); |
525 } | 525 } |
526 return new NativeTextfieldGtk(field); | 526 return new NativeTextfieldGtk(field); |
527 } | 527 } |
528 | 528 |
529 } // namespace views | 529 } // namespace views |
OLD | NEW |