OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_VIEWS_WIDGET_H_ | 5 #ifndef CHROME_VIEWS_WIDGET_H_ |
6 #define CHROME_VIEWS_WIDGET_H_ | 6 #define CHROME_VIEWS_WIDGET_H_ |
7 | 7 |
8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 // TODO(maruel): Remove once HWND is abstracted. | 9 // TODO(maruel): Remove once HWND is abstracted. |
10 #include <windows.h> | 10 #include <windows.h> |
11 #endif | 11 #endif |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Rect; | 14 class Rect; |
15 } | 15 } |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 | 18 |
| 19 class Accelerator; |
19 class RootView; | 20 class RootView; |
20 class TooltipManager; | 21 class TooltipManager; |
21 class Accelerator; | 22 class Window; |
22 | 23 |
23 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
24 // | 25 // |
25 // Widget interface | 26 // Widget interface |
26 // | 27 // |
27 // Widget is an abstract class that defines the API that should be implemented | 28 // Widget is an abstract class that defines the API that should be implemented |
28 // by a native window in order to host a view hierarchy. | 29 // by a native window in order to host a view hierarchy. |
29 // | 30 // |
30 // Widget wraps a hierarchy of View objects (see view.h) that implement | 31 // Widget wraps a hierarchy of View objects (see view.h) that implement |
31 // painting and flexible layout within the bounds of the Widget's window. | 32 // painting and flexible layout within the bounds of the Widget's window. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // Returns the TooltipManager for this Widget. If this Widget does not support | 71 // Returns the TooltipManager for this Widget. If this Widget does not support |
71 // tooltips, NULL is returned. | 72 // tooltips, NULL is returned. |
72 virtual TooltipManager* GetTooltipManager() { | 73 virtual TooltipManager* GetTooltipManager() { |
73 return NULL; | 74 return NULL; |
74 } | 75 } |
75 | 76 |
76 // Returns the accelerator given a command id. Returns false if there is | 77 // Returns the accelerator given a command id. Returns false if there is |
77 // no accelerator associated with a given id, which is a common condition. | 78 // no accelerator associated with a given id, which is a common condition. |
78 virtual bool GetAccelerator(int cmd_id, | 79 virtual bool GetAccelerator(int cmd_id, |
79 Accelerator* accelerator) = 0; | 80 Accelerator* accelerator) = 0; |
| 81 |
| 82 // Returns the Widget as a Window, if such a conversion is possible, or NULL |
| 83 // if it is not. |
| 84 virtual Window* AsWindow() { return NULL; } |
| 85 virtual const Window* AsWindow() const { return NULL; } |
80 }; | 86 }; |
81 | 87 |
82 } // namespace views | 88 } // namespace views |
83 | 89 |
84 #endif // CHROME_VIEWS_WIDGET_H_ | 90 #endif // CHROME_VIEWS_WIDGET_H_ |
85 | 91 |
OLD | NEW |