diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 21:33:31 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-15 21:33:31 +0000 |
commit | 24316bc454a892383ca1db4c3a9af79993b8a413 (patch) | |
tree | ec2f5d3c08b64ab676908eb3b855522f2f0b29bc /chrome/browser/gtk/find_bar_gtk.h | |
parent | f77348368cac4d8d230156533311d4ae0f2cc3d2 (diff) | |
download | chromium_src-24316bc454a892383ca1db4c3a9af79993b8a413.zip chromium_src-24316bc454a892383ca1db4c3a9af79993b8a413.tar.gz chromium_src-24316bc454a892383ca1db4c3a9af79993b8a413.tar.bz2 |
Linux: Make findbar restore focus to last focused widget on close.
Factor out some common code to FocusStoreGtk so it can be shared by anyone who cares about remembering which widget last had focus. Currently used in FindBarGtk and TabContentsViewGtk.
Review URL: http://codereview.chromium.org/115391
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16189 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/find_bar_gtk.h')
-rw-r--r-- | chrome/browser/gtk/find_bar_gtk.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/chrome/browser/gtk/find_bar_gtk.h b/chrome/browser/gtk/find_bar_gtk.h index 571d763..07171ed 100644 --- a/chrome/browser/gtk/find_bar_gtk.h +++ b/chrome/browser/gtk/find_bar_gtk.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "chrome/browser/find_bar.h" +#include "chrome/browser/gtk/focus_store_gtk.h" #include "chrome/common/owned_widget_gtk.h" class BrowserWindowGtk; @@ -59,6 +60,10 @@ class FindBarGtk : public FindBar, private: void InitWidgets(); + // Store the currently focused widget if it is not in the find bar. + // This should always be called before we claim focus. + void StoreOutsideFocus(); + // Returns the child of |fixed_| that holds what the user perceives as the // findbar. GtkWidget* slide_widget(); @@ -75,7 +80,7 @@ class FindBarGtk : public FindBar, FindBarGtk* find_bar); // Callback for previous, next, and close button. - static void OnButtonPressed(GtkWidget* button, FindBarGtk* find_bar); + static void OnClicked(GtkWidget* button, FindBarGtk* find_bar); // Called when |fixed_| changes sizes. Used to position the dialog (the // "dialog" is the widget hierarchy rooted at |slide_widget_|). @@ -88,6 +93,12 @@ class FindBarGtk : public FindBar, GtkAllocation* allocation, FindBarGtk* findbar); + // These are both used for focus management. + static gboolean OnFocus(GtkWidget* text_entry, GtkDirectionType focus, + FindBarGtk* find_bar); + static gboolean OnButtonPress(GtkWidget* text_entry, GdkEventButton* e, + FindBarGtk* find_bar); + // GtkFixed containing the find bar widgets. OwnedWidgetGtk fixed_; @@ -125,6 +136,9 @@ class FindBarGtk : public FindBar, // Pointer back to the owning controller. FindBarController* find_bar_controller_; + // Saves where the focus used to be whenever we get it. + FocusStoreGtk focus_store_; + DISALLOW_COPY_AND_ASSIGN(FindBarGtk); }; |