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 VIEWS_WIDGET_NATIVE_WIDGET_H_ | 5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_H_ |
6 #define VIEWS_WIDGET_NATIVE_WIDGET_H_ | 6 #define VIEWS_WIDGET_NATIVE_WIDGET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Rect; | 14 class Rect; |
15 } | 15 } |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 class OSExchangeData; | 18 class OSExchangeData; |
19 } | 19 } |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 | 22 |
| 23 class InputMethod; |
23 class TooltipManager; | 24 class TooltipManager; |
24 class Widget; | 25 class Widget; |
25 | 26 |
26 //////////////////////////////////////////////////////////////////////////////// | 27 //////////////////////////////////////////////////////////////////////////////// |
27 // NativeWidget interface | 28 // NativeWidget interface |
28 // | 29 // |
29 // An interface implemented by an object that encapsulates rendering, event | 30 // An interface implemented by an object that encapsulates rendering, event |
30 // handling and widget management provided by an underlying native toolkit. | 31 // handling and widget management provided by an underlying native toolkit. |
31 // | 32 // |
32 class NativeWidget { | 33 class NativeWidget { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // Returns true if a system screen reader is active for the NativeWidget. | 75 // Returns true if a system screen reader is active for the NativeWidget. |
75 virtual bool IsScreenReaderActive() const = 0; | 76 virtual bool IsScreenReaderActive() const = 0; |
76 | 77 |
77 // Sets or releases event capturing for this native widget. | 78 // Sets or releases event capturing for this native widget. |
78 virtual void SetMouseCapture() = 0; | 79 virtual void SetMouseCapture() = 0; |
79 virtual void ReleaseMouseCapture() = 0; | 80 virtual void ReleaseMouseCapture() = 0; |
80 | 81 |
81 // Returns true if this native widget is capturing all events. | 82 // Returns true if this native widget is capturing all events. |
82 virtual bool HasMouseCapture() const = 0; | 83 virtual bool HasMouseCapture() const = 0; |
83 | 84 |
| 85 // Returns the InputMethod for this native widget. |
| 86 // Note that all widgets in a widget hierarchy share the same input method. |
| 87 // TODO(suzhe): rename to GetInputMethod() when NativeWidget implementation |
| 88 // class doesn't inherit Widget anymore. |
| 89 virtual InputMethod* GetInputMethodNative() = 0; |
| 90 |
| 91 // Sets a different InputMethod instance to this native widget. The instance |
| 92 // must not be initialized, the ownership will be assumed by the native |
| 93 // widget. It's only for testing purpose. |
| 94 virtual void ReplaceInputMethod(InputMethod* input_method) = 0; |
| 95 |
84 protected: | 96 protected: |
85 friend class Widget; | 97 friend class Widget; |
86 | 98 |
87 // Returns a handle for the underlying native widget that can be used for | 99 // Returns a handle for the underlying native widget that can be used for |
88 // accelerated drawing. | 100 // accelerated drawing. |
89 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 101 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
90 | 102 |
91 // Widget pass-thrus, private to Views. -------------------------------------- | 103 // Widget pass-thrus, private to Views. -------------------------------------- |
92 // See method documentation in Widget. | 104 // See method documentation in Widget. |
93 virtual gfx::Rect GetWindowScreenBounds() const = 0; | 105 virtual gfx::Rect GetWindowScreenBounds() const = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
108 virtual void RunShellDrag(View* view, | 120 virtual void RunShellDrag(View* view, |
109 const ui::OSExchangeData& data, | 121 const ui::OSExchangeData& data, |
110 int operation) = 0; | 122 int operation) = 0; |
111 virtual void SchedulePaintInRect(const gfx::Rect& rect) = 0; | 123 virtual void SchedulePaintInRect(const gfx::Rect& rect) = 0; |
112 virtual void SetCursor(gfx::NativeCursor cursor) = 0; | 124 virtual void SetCursor(gfx::NativeCursor cursor) = 0; |
113 }; | 125 }; |
114 | 126 |
115 } // namespace views | 127 } // namespace views |
116 | 128 |
117 #endif // VIEWS_WIDGET_NATIVE_WIDGET_H_ | 129 #endif // VIEWS_WIDGET_NATIVE_WIDGET_H_ |
OLD | NEW |