| 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 #ifndef CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ | 5 #ifndef UI_BASE_GTK_FOCUS_STORE_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ | 6 #define UI_BASE_GTK_FOCUS_STORE_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "ui/base/ui_export.h" |
| 10 | 11 |
| 11 typedef struct _GtkWidget GtkWidget; | 12 typedef struct _GtkWidget GtkWidget; |
| 12 | 13 |
| 13 class FocusStoreGtk { | 14 namespace ui { |
| 15 |
| 16 class UI_EXPORT FocusStoreGtk { |
| 14 public: | 17 public: |
| 15 FocusStoreGtk(); | 18 FocusStoreGtk(); |
| 16 | 19 ~FocusStoreGtk(); |
| 17 virtual ~FocusStoreGtk(); | |
| 18 | 20 |
| 19 GtkWidget* widget() const { return widget_; } | 21 GtkWidget* widget() const { return widget_; } |
| 20 | 22 |
| 21 // Save the widget that is currently focused for |widget|'s toplevel (NOT | 23 // Save the widget that is currently focused for |widget|'s toplevel (NOT |
| 22 // |widget|). | 24 // |widget|). |
| 23 void Store(GtkWidget* widget); | 25 void Store(GtkWidget* widget); |
| 24 | 26 |
| 25 // Save |widget| as the focus widget. Call with NULL to clear |widget_|. | 27 // Save |widget| as the focus widget. Call with NULL to clear |widget_|. |
| 26 void SetWidget(GtkWidget* widget); | 28 void SetWidget(GtkWidget* widget); |
| 27 | 29 |
| 28 private: | 30 private: |
| 29 // Disconnect the previous destroy handler (if any). | 31 // Disconnect the previous destroy handler (if any). |
| 30 void DisconnectDestroyHandler(); | 32 void DisconnectDestroyHandler(); |
| 31 | 33 |
| 32 // The widget which last had focus. | 34 // The widget which last had focus. |
| 33 GtkWidget* widget_; | 35 GtkWidget* widget_; |
| 34 | 36 |
| 35 // The widget for which we've stored focus might be destroyed by the time we | 37 // The widget for which we've stored focus might be destroyed by the time we |
| 36 // want to restore focus. Thus we connect to the "destroy" signal on that | 38 // want to restore focus. Thus we connect to the "destroy" signal on that |
| 37 // widget. This is the ID for the destroy handler. | 39 // widget. This is the ID for the destroy handler. |
| 38 unsigned int destroy_handler_id_; | 40 unsigned int destroy_handler_id_; |
| 39 | 41 |
| 40 DISALLOW_COPY_AND_ASSIGN(FocusStoreGtk); | 42 DISALLOW_COPY_AND_ASSIGN(FocusStoreGtk); |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 #endif // CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ | 45 } // namespace ui |
| 46 |
| 47 #endif // UI_BASE_GTK_FOCUS_STORE_GTK_H_ |
| OLD | NEW |