OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/basictypes.h" |
| 10 |
| 11 typedef struct _GtkWidget GtkWidget; |
| 12 |
| 13 class FocusStoreGtk { |
| 14 public: |
| 15 FocusStoreGtk(); |
| 16 |
| 17 virtual ~FocusStoreGtk(); |
| 18 |
| 19 GtkWidget* widget() const { return widget_; } |
| 20 |
| 21 // Save the widget that is currently focused for |widget|'s toplevel (NOT |
| 22 // |widget|). |
| 23 void Store(GtkWidget* widget); |
| 24 |
| 25 // Save |widget| as the focus widget. Call with NULL to clear |widget_|. |
| 26 void SetWidget(GtkWidget* widget); |
| 27 |
| 28 private: |
| 29 // Disconnect the previous destroy handler (if any). |
| 30 void DisconnectDestroyHandler(); |
| 31 |
| 32 // The widget which last had focus. |
| 33 GtkWidget* widget_; |
| 34 |
| 35 // 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 |
| 37 // widget. This is the ID for the destroy handler. |
| 38 unsigned int destroy_handler_id_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(FocusStoreGtk); |
| 41 }; |
| 42 |
| 43 #endif // CHROME_BROWSER_UI_GTK_FOCUS_STORE_GTK_H_ |
OLD | NEW |