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

Side by Side Diff: chrome/browser/ui/gtk/find_bar_gtk.cc

Issue 8607003: gtk: Convert OnFocusIn and OnFocusOut to CHROMEGTK macro in FindBarGtk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/gtk/find_bar_gtk.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/gtk/find_bar_gtk.h" 5 #include "chrome/browser/ui/gtk/find_bar_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 g_signal_connect(text_entry_, "focus", 199 g_signal_connect(text_entry_, "focus",
200 G_CALLBACK(OnFocus), this); 200 G_CALLBACK(OnFocus), this);
201 gtk_widget_add_events(text_entry_, GDK_BUTTON_PRESS_MASK); 201 gtk_widget_add_events(text_entry_, GDK_BUTTON_PRESS_MASK);
202 g_signal_connect(text_entry_, "button-press-event", 202 g_signal_connect(text_entry_, "button-press-event",
203 G_CALLBACK(OnButtonPress), this); 203 G_CALLBACK(OnButtonPress), this);
204 g_signal_connect(text_entry_, "move-cursor", G_CALLBACK(OnMoveCursor), this); 204 g_signal_connect(text_entry_, "move-cursor", G_CALLBACK(OnMoveCursor), this);
205 g_signal_connect(text_entry_, "activate", G_CALLBACK(OnActivateThunk), this); 205 g_signal_connect(text_entry_, "activate", G_CALLBACK(OnActivateThunk), this);
206 g_signal_connect(text_entry_, "direction-changed", 206 g_signal_connect(text_entry_, "direction-changed",
207 G_CALLBACK(OnWidgetDirectionChanged), this); 207 G_CALLBACK(OnWidgetDirectionChanged), this);
208 g_signal_connect(text_entry_, "focus-in-event", 208 g_signal_connect(text_entry_, "focus-in-event",
209 G_CALLBACK(OnFocusIn), this); 209 G_CALLBACK(OnFocusInThunk), this);
210 g_signal_connect(text_entry_, "focus-out-event", 210 g_signal_connect(text_entry_, "focus-out-event",
211 G_CALLBACK(OnFocusOut), this); 211 G_CALLBACK(OnFocusOutThunk), this);
212 g_signal_connect(container_, "expose-event", 212 g_signal_connect(container_, "expose-event",
213 G_CALLBACK(OnExpose), this); 213 G_CALLBACK(OnExpose), this);
214 } 214 }
215 215
216 FindBarGtk::~FindBarGtk() { 216 FindBarGtk::~FindBarGtk() {
217 } 217 }
218 218
219 void FindBarGtk::InitWidgets() { 219 void FindBarGtk::InitWidgets() {
220 // The find bar is basically an hbox with a gtkentry (text box) followed by 3 220 // The find bar is basically an hbox with a gtkentry (text box) followed by 3
221 // buttons (previous result, next result, close). We wrap the hbox in a gtk 221 // buttons (previous result, next result, close). We wrap the hbox in a gtk
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 void FindBarGtk::OnParentSet(GtkWidget* widget, GtkObject* old_parent, 725 void FindBarGtk::OnParentSet(GtkWidget* widget, GtkObject* old_parent,
726 FindBarGtk* find_bar) { 726 FindBarGtk* find_bar) {
727 if (!widget->parent) 727 if (!widget->parent)
728 return; 728 return;
729 729
730 g_signal_connect(widget->parent, "set-floating-position", 730 g_signal_connect(widget->parent, "set-floating-position",
731 G_CALLBACK(OnSetFloatingPosition), find_bar); 731 G_CALLBACK(OnSetFloatingPosition), find_bar);
732 } 732 }
733 733
734 // static 734 // static
735 void FindBarGtk::OnSetFloatingPosition( 735 void FindBarGtk::OnSetFloatingPosition(GtkFloatingContainer* floating_container,
736 GtkFloatingContainer* floating_container, 736 GtkAllocation* allocation,
737 GtkAllocation* allocation, 737 FindBarGtk* find_bar) {
738 FindBarGtk* find_bar) {
739 GtkWidget* findbar = find_bar->widget(); 738 GtkWidget* findbar = find_bar->widget();
740 739
741 int xposition = find_bar->GetDialogPosition(find_bar->selection_rect_).x(); 740 int xposition = find_bar->GetDialogPosition(find_bar->selection_rect_).x();
742 741
743 GValue value = { 0, }; 742 GValue value = { 0, };
744 g_value_init(&value, G_TYPE_INT); 743 g_value_init(&value, G_TYPE_INT);
745 g_value_set_int(&value, xposition); 744 g_value_set_int(&value, xposition);
746 gtk_container_child_set_property(GTK_CONTAINER(floating_container), 745 gtk_container_child_set_property(GTK_CONTAINER(floating_container),
747 findbar, "x", &value); 746 findbar, "x", &value);
748 747
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 } 955 }
957 956
958 gdk_event_free(event); 957 gdk_event_free(event);
959 } 958 }
960 } 959 }
961 960
962 void FindBarGtk::OnActivate(GtkWidget* entry) { 961 void FindBarGtk::OnActivate(GtkWidget* entry) {
963 FindEntryTextInContents(true); 962 FindEntryTextInContents(true);
964 } 963 }
965 964
966 // static 965 gboolean FindBarGtk::OnFocusIn(GtkWidget* entry, GdkEventFocus* event) {
967 gboolean FindBarGtk::OnFocusIn(GtkWidget* entry, GdkEventFocus* event, 966 g_signal_connect(gdk_keymap_get_for_display(gtk_widget_get_display(entry)),
968 FindBarGtk* find_bar) { 967 "direction-changed",
969 g_signal_connect( 968 G_CALLBACK(&OnKeymapDirectionChanged), this);
970 gdk_keymap_get_for_display(gtk_widget_get_display(entry)),
971 "direction-changed",
972 G_CALLBACK(&OnKeymapDirectionChanged), find_bar);
973 969
974 find_bar->AdjustTextAlignment(); 970 AdjustTextAlignment();
975 971
976 return FALSE; // Continue propagation. 972 return FALSE; // Continue propagation.
977 } 973 }
978 974
979 // static 975 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event) {
980 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event,
981 FindBarGtk* find_bar) {
982 g_signal_handlers_disconnect_by_func( 976 g_signal_handlers_disconnect_by_func(
983 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), 977 gdk_keymap_get_for_display(gtk_widget_get_display(entry)),
984 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); 978 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), this);
985 979
986 return FALSE; // Continue propagation. 980 return FALSE; // Continue propagation.
987 } 981 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/find_bar_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698