OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_GTK_VIEW_ID_UTIL_H_ | 5 #ifndef CHROME_BROWSER_GTK_VIEW_ID_UTIL_H_ |
6 #define CHROME_BROWSER_GTK_VIEW_ID_UTIL_H_ | 6 #define CHROME_BROWSER_GTK_VIEW_ID_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
10 | 10 |
11 typedef struct _GtkWidget GtkWidget; | 11 typedef struct _GtkWidget GtkWidget; |
12 | 12 |
13 class ViewIDUtil { | 13 class ViewIDUtil { |
14 public: | 14 public: |
15 // Use this delegate to override default view id searches. | 15 // Use this delegate to override default view id searches. |
16 class Delegate { | 16 class Delegate { |
17 public: | 17 public: |
18 virtual GtkWidget* GetWidgetForViewID(ViewID id) = 0; | 18 virtual GtkWidget* GetWidgetForViewID(ViewID id) = 0; |
19 | 19 |
20 protected: | 20 protected: |
21 virtual ~Delegate() {} | 21 virtual ~Delegate() {} |
22 }; | 22 }; |
23 | 23 |
24 // If you set the ID via this function, it will also set the name of your | 24 // If you set the ID via this function, it will also set the name of your |
25 // widget to a human-readable value for debugging. | 25 // widget to a human-readable value for debugging. |
26 static void SetID(GtkWidget* widget, ViewID id); | 26 static void SetID(GtkWidget* widget, ViewID id); |
27 | 27 |
28 static GtkWidget* GetWidget(GtkWidget* root, ViewID id); | 28 static GtkWidget* GetWidget(GtkWidget* root, ViewID id); |
29 | 29 |
30 static void SetDelegateForWidget(GtkWidget* widget, Delegate* delegate); | 30 static void SetDelegateForWidget(GtkWidget* widget, Delegate* delegate); |
31 }; | 31 }; |
32 | 32 |
33 #endif // CHROME_BROWSER_GTK_VIEW_ID_UTIL_H_ | 33 #endif // CHROME_BROWSER_GTK_VIEW_ID_UTIL_H_ |
OLD | NEW |