summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 21:38:44 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 21:38:44 +0000
commitf0dfb8223d5a73cacd2dbaafdd890adec101d5c7 (patch)
tree640236f98c50fa61b7ea6e6424c59b04b207f5eb /chrome/browser
parentd43002e2c5da97a28eecbd552e4f4ec027a19179 (diff)
downloadchromium_src-f0dfb8223d5a73cacd2dbaafdd890adec101d5c7.zip
chromium_src-f0dfb8223d5a73cacd2dbaafdd890adec101d5c7.tar.gz
chromium_src-f0dfb8223d5a73cacd2dbaafdd890adec101d5c7.tar.bz2
GTK: add more general gtk_signal macros.
Convert ACEViewGtk to use the macros. BUG=none TEST=compile + click around Review URL: http://codereview.chromium.org/1591021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43883 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc53
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.h229
2 files changed, 79 insertions, 203 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 0afafd2..35144963 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -264,9 +264,9 @@ void AutocompleteEditViewGtk::Init() {
g_signal_connect(text_view_, "backspace",
G_CALLBACK(&HandleBackSpaceThunk), this);
g_signal_connect(text_view_, "copy-clipboard",
- G_CALLBACK(&HandleCopyClipboardThunk), this);
+ G_CALLBACK(&HandleCopyOrCutClipboardThunk), this);
g_signal_connect(text_view_, "cut-clipboard",
- G_CALLBACK(&HandleCutClipboardThunk), this);
+ G_CALLBACK(&HandleCopyOrCutClipboardThunk), this);
g_signal_connect(text_view_, "paste-clipboard",
G_CALLBACK(&HandlePasteClipboardThunk), this);
g_signal_connect_after(text_view_, "expose-event",
@@ -614,11 +614,11 @@ void AutocompleteEditViewGtk::SetBaseColor() {
}
}
-void AutocompleteEditViewGtk::HandleBeginUserAction() {
+void AutocompleteEditViewGtk::HandleBeginUserAction(GtkTextBuffer* sender) {
OnBeforePossibleChange();
}
-void AutocompleteEditViewGtk::HandleEndUserAction() {
+void AutocompleteEditViewGtk::HandleEndUserAction(GtkTextBuffer* sender) {
OnAfterPossibleChange();
}
@@ -773,7 +773,8 @@ gboolean AutocompleteEditViewGtk::HandleKeyRelease(GtkWidget* widget,
return FALSE; // Propagate into GtkTextView.
}
-gboolean AutocompleteEditViewGtk::HandleViewButtonPress(GdkEventButton* event) {
+gboolean AutocompleteEditViewGtk::HandleViewButtonPress(GtkWidget* sender,
+ GdkEventButton* event) {
// We don't need to care about double and triple clicks.
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
@@ -801,7 +802,7 @@ gboolean AutocompleteEditViewGtk::HandleViewButtonPress(GdkEventButton* event) {
}
gboolean AutocompleteEditViewGtk::HandleViewButtonRelease(
- GdkEventButton* event) {
+ GtkWidget* sender, GdkEventButton* event) {
if (event->button != 1)
return FALSE;
@@ -836,7 +837,8 @@ gboolean AutocompleteEditViewGtk::HandleViewButtonRelease(
return TRUE; // Don't continue, we called the default handler already.
}
-gboolean AutocompleteEditViewGtk::HandleViewFocusIn() {
+gboolean AutocompleteEditViewGtk::HandleViewFocusIn(GtkWidget* sender,
+ GdkEventFocus* event) {
GdkModifierType modifiers;
gdk_window_get_pointer(text_view_->window, NULL, NULL, &modifiers);
model_->OnSetFocus((modifiers & GDK_CONTROL_MASK) != 0);
@@ -853,7 +855,8 @@ gboolean AutocompleteEditViewGtk::HandleViewFocusIn() {
return FALSE; // Continue propagation.
}
-gboolean AutocompleteEditViewGtk::HandleViewFocusOut() {
+gboolean AutocompleteEditViewGtk::HandleViewFocusOut(GtkWidget* sender,
+ GdkEventFocus* event) {
// Close the popup.
ClosePopup();
// Tell the model to reset itself.
@@ -868,6 +871,7 @@ gboolean AutocompleteEditViewGtk::HandleViewFocusOut() {
}
void AutocompleteEditViewGtk::HandleViewMoveCursor(
+ GtkWidget* sender,
GtkMovementStep step,
gint count,
gboolean extend_selection) {
@@ -913,13 +917,15 @@ void AutocompleteEditViewGtk::HandleViewMoveCursor(
g_signal_stop_emission(text_view_, signal_id, 0);
}
-void AutocompleteEditViewGtk::HandleViewSizeRequest(GtkRequisition* req) {
+void AutocompleteEditViewGtk::HandleViewSizeRequest(GtkWidget* sender,
+ GtkRequisition* req) {
// Don't force a minimum width, but use the font-relative height. This is a
// run-first handler, so the default handler was already called.
req->width = 1;
}
-void AutocompleteEditViewGtk::HandlePopulatePopup(GtkMenu* menu) {
+void AutocompleteEditViewGtk::HandlePopulatePopup(GtkWidget* sender,
+ GtkMenu* menu) {
GtkWidget* separator = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), separator);
gtk_widget_show(separator);
@@ -957,11 +963,11 @@ void AutocompleteEditViewGtk::HandlePopulatePopup(GtkMenu* menu) {
gtk_widget_show(paste_go_menuitem);
}
-void AutocompleteEditViewGtk::HandleEditSearchEngines() {
+void AutocompleteEditViewGtk::HandleEditSearchEngines(GtkWidget* sender) {
command_updater_->ExecuteCommand(IDC_EDIT_SEARCH_ENGINES);
}
-void AutocompleteEditViewGtk::HandlePasteAndGo() {
+void AutocompleteEditViewGtk::HandlePasteAndGo(GtkWidget* sender) {
model_->PasteAndGo();
}
@@ -1016,7 +1022,7 @@ void AutocompleteEditViewGtk::HandleMarkSet(GtkTextBuffer* buffer,
// Just use the default behavior for DnD, except if the drop can be a PasteAndGo
// then override.
void AutocompleteEditViewGtk::HandleDragDataReceived(
- GdkDragContext* context, gint x, gint y,
+ GtkWidget* sender, GdkDragContext* context, gint x, gint y,
GtkSelectionData* selection_data, guint target_type, guint time) {
// Reset |paste_clipboard_requested_| to make sure we won't misinterpret this
// drop action as a paste action.
@@ -1080,7 +1086,7 @@ void AutocompleteEditViewGtk::HandleInsertText(
g_signal_stop_emission(buffer, signal_id, 0);
}
-void AutocompleteEditViewGtk::HandleBackSpace() {
+void AutocompleteEditViewGtk::HandleBackSpace(GtkWidget* sender) {
// Checks if it's currently in keyword search mode.
if (model_->is_keyword_hint() || model_->keyword().empty())
return; // Propgate into GtkTextView.
@@ -1105,7 +1111,8 @@ void AutocompleteEditViewGtk::HandleBackSpace() {
g_signal_stop_emission(text_view_, signal_id, 0);
}
-void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget) {
+void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget,
+ GtkDirectionType direction) {
// Trigger Tab to search behavior only when Tab key is pressed.
if (tab_was_pressed_ && enable_tab_to_search_ &&
model_->is_keyword_hint() && !model_->keyword().empty()) {
@@ -1120,7 +1127,7 @@ void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget) {
// Propagate the signal so that focus can be moved as normal.
}
-void AutocompleteEditViewGtk::HandleCopyOrCutClipboard() {
+void AutocompleteEditViewGtk::HandleCopyOrCutClipboard(GtkWidget* sender) {
// On copy or cut, we manually update the PRIMARY selection to contain the
// highlighted text. This matches Firefox -- we highlight the URL but don't
// update PRIMARY on Ctrl-L, so Ctrl-L, Ctrl-C and then middle-click is a
@@ -1179,7 +1186,7 @@ void AutocompleteEditViewGtk::HandleCopyOrCutClipboard() {
gtk_text_buffer_copy_clipboard(text_buffer_, clipboard);
}
-void AutocompleteEditViewGtk::HandlePasteClipboard() {
+void AutocompleteEditViewGtk::HandlePasteClipboard(GtkWidget* sender) {
// We can't call model_->on_paste_replacing_all() here, because the actual
// paste clipboard action may not be performed if the clipboard is empty.
paste_clipboard_requested_ = true;
@@ -1204,7 +1211,8 @@ gfx::Rect AutocompleteEditViewGtk::WindowBoundsFromIters(
return gfx::Rect(x1, y1, x2 - x1, y2 - y1);
}
-gboolean AutocompleteEditViewGtk::HandleExposeEvent(GdkEventExpose* expose) {
+gboolean AutocompleteEditViewGtk::HandleExposeEvent(GtkWidget* sender,
+ GdkEventExpose* expose) {
if (strikethrough_.cp_min >= strikethrough_.cp_max)
return FALSE;
@@ -1430,3 +1438,12 @@ PangoDirection AutocompleteEditViewGtk::GetContentDirection() {
return dir;
}
+
+void AutocompleteEditViewGtk::HandleWidgetDirectionChanged(
+ GtkWidget* sender, GtkTextDirection previous_direction) {
+ AdjustTextJustification();
+}
+
+void AutocompleteEditViewGtk::HandleKeymapDirectionChanged(GdkKeymap* sender) {
+ AdjustTextJustification();
+}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index 7065a8e..978f3d7 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -9,6 +9,7 @@
#include <string>
+#include "app/gtk_signal.h"
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
@@ -127,191 +128,49 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
}
private:
- // TODO(deanm): Would be nice to insulate the thunkers better, etc.
- static void HandleBeginUserActionThunk(GtkTextBuffer* unused, gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleBeginUserAction();
- }
- void HandleBeginUserAction();
-
- static void HandleEndUserActionThunk(GtkTextBuffer* unused, gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleEndUserAction();
- }
- void HandleEndUserAction();
-
- static gboolean HandleKeyPressThunk(GtkWidget* widget,
- GdkEventKey* event,
- gpointer self) {
- return reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleKeyPress(
- widget, event);
- }
- gboolean HandleKeyPress(GtkWidget* widget, GdkEventKey* event);
-
- static gboolean HandleKeyReleaseThunk(GtkWidget* widget,
- GdkEventKey* event,
- gpointer self) {
- return reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleKeyRelease(
- widget, event);
- }
- gboolean HandleKeyRelease(GtkWidget* widget, GdkEventKey* event);
-
- static gboolean HandleViewButtonPressThunk(GtkWidget* view,
- GdkEventButton* event,
- gpointer self) {
- return reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleViewButtonPress(event);
- }
- gboolean HandleViewButtonPress(GdkEventButton* event);
-
- static gboolean HandleViewButtonReleaseThunk(GtkWidget* view,
- GdkEventButton* event,
- gpointer self) {
- return reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleViewButtonRelease(event);
- }
- gboolean HandleViewButtonRelease(GdkEventButton* event);
-
- static gboolean HandleViewFocusInThunk(GtkWidget* view,
- GdkEventFocus* event,
- gpointer self) {
- return reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleViewFocusIn();
- }
- gboolean HandleViewFocusIn();
-
- static gboolean HandleViewFocusOutThunk(GtkWidget* view,
- GdkEventFocus* event,
- gpointer self) {
- return reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleViewFocusOut();
- }
- gboolean HandleViewFocusOut();
-
- static void HandleViewMoveCursorThunk(GtkWidget* view,
- GtkMovementStep step,
- gint count,
- gboolean extend_selection,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleViewMoveCursor(step, count, extend_selection);
- }
- void HandleViewMoveCursor(GtkMovementStep step,
- gint count,
- gboolean extend_selection);
-
- static void HandleViewSizeRequestThunk(GtkWidget* view,
- GtkRequisition* req,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleViewSizeRequest(req);
- }
- void HandleViewSizeRequest(GtkRequisition* req);
-
- static void HandlePopulatePopupThunk(GtkEntry* entry,
- GtkMenu* menu,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandlePopulatePopup(menu);
- }
- void HandlePopulatePopup(GtkMenu* menu);
-
- static void HandleEditSearchEnginesThunk(GtkMenuItem* menuitem,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleEditSearchEngines();
- }
- void HandleEditSearchEngines();
-
- static void HandlePasteAndGoThunk(GtkMenuItem* menuitem,
- AutocompleteEditViewGtk* self) {
- self->HandlePasteAndGo();
- }
- void HandlePasteAndGo();
-
- static void HandleMarkSetThunk(GtkTextBuffer* buffer,
- GtkTextIter* location,
- GtkTextMark* mark,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleMarkSet(buffer, location, mark);
- }
- void HandleMarkSet(GtkTextBuffer* buffer,
- GtkTextIter* location,
- GtkTextMark* mark);
-
- static void HandleDragDataReceivedThunk(GtkWidget* widget,
- GdkDragContext* context,
- gint x, gint y,
- GtkSelectionData* selection_data,
- guint target_type,
- guint time,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleDragDataReceived(context, x, y, selection_data, target_type,
- time);
- }
- void HandleDragDataReceived(GdkDragContext* context, gint x, gint y,
- GtkSelectionData* selection_data,
- guint target_type, guint time);
-
- static void HandleInsertTextThunk(GtkTextBuffer* buffer,
- GtkTextIter* location,
- const gchar* text,
- gint len,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleInsertText(buffer, location, text, len);
- }
- void HandleInsertText(GtkTextBuffer* buffer,
- GtkTextIter* location,
- const gchar* text,
- gint len);
-
- static void HandleBackSpaceThunk(GtkTextView* text_view, gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleBackSpace();
- }
- void HandleBackSpace();
-
- static void HandleViewMoveFocusThunk(GtkWidget* widget, GtkDirectionType dir,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleViewMoveFocus(widget);
- }
- void HandleViewMoveFocus(GtkWidget* widget);
-
- static void HandleCopyClipboardThunk(GtkTextView* text_view, gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleCopyOrCutClipboard();
- }
- static void HandleCutClipboardThunk(GtkTextView* text_view, gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleCopyOrCutClipboard();
- }
- void HandleCopyOrCutClipboard();
-
- static void HandlePasteClipboardThunk(GtkTextView* text_view, gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandlePasteClipboard();
- }
- void HandlePasteClipboard();
-
- static gboolean HandleExposeEventThunk(GtkTextView* text_view,
- GdkEventExpose* expose,
- gpointer self) {
- return reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- HandleExposeEvent(expose);
- }
- gboolean HandleExposeEvent(GdkEventExpose* expose);
-
- static void HandleWidgetDirectionChangedThunk(
- GtkWidget* widget, GtkTextDirection previous_direction, gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- AdjustTextJustification();
- }
-
- static void HandleKeymapDirectionChangedThunk(GdkKeymap* keymap,
- gpointer self) {
- reinterpret_cast<AutocompleteEditViewGtk*>(self)->
- AdjustTextJustification();
- }
+ CHROMEG_CALLBACK_0(AutocompleteEditViewGtk, void, HandleBeginUserAction,
+ GtkTextBuffer*);
+ CHROMEG_CALLBACK_0(AutocompleteEditViewGtk, void, HandleEndUserAction,
+ GtkTextBuffer*);
+ CHROMEG_CALLBACK_2(AutocompleteEditViewGtk, void, HandleMarkSet,
+ GtkTextBuffer*, GtkTextIter*, GtkTextMark*);
+ CHROMEG_CALLBACK_3(AutocompleteEditViewGtk, void, HandleInsertText,
+ GtkTextBuffer*, GtkTextIter*, const gchar*, gint);
+ CHROMEG_CALLBACK_0(AutocompleteEditViewGtk, void,
+ HandleKeymapDirectionChanged, GdkKeymap*);
+
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleKeyPress,
+ GdkEventKey*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleKeyRelease,
+ GdkEventKey*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleViewButtonPress,
+ GdkEventButton*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean,
+ HandleViewButtonRelease, GdkEventButton*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleViewFocusIn,
+ GdkEventFocus*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleViewFocusOut,
+ GdkEventFocus*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void, HandleViewMoveFocus,
+ GtkDirectionType);
+ CHROMEGTK_CALLBACK_3(AutocompleteEditViewGtk, void, HandleViewMoveCursor,
+ GtkMovementStep, gint, gboolean);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void, HandleViewSizeRequest,
+ GtkRequisition*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void, HandlePopulatePopup,
+ GtkMenu*);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleEditSearchEngines);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandlePasteAndGo);
+ CHROMEGTK_CALLBACK_6(AutocompleteEditViewGtk, void, HandleDragDataReceived,
+ GdkDragContext*, gint, gint, GtkSelectionData*,
+ guint, guint);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleBackSpace);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandleCopyOrCutClipboard);
+ CHROMEGTK_CALLBACK_0(AutocompleteEditViewGtk, void, HandlePasteClipboard);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, gboolean, HandleExposeEvent,
+ GdkEventExpose*);
+ CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void,
+ HandleWidgetDirectionChanged, GtkTextDirection);
// Gets the GTK_TEXT_WINDOW_WIDGET coordinates for |text_view_| that bound the
// given iters.