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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // Returns true if a system screen reader is active for the NativeWidget. | 70 // Returns true if a system screen reader is active for the NativeWidget. |
70 virtual bool IsScreenReaderActive() const = 0; | 71 virtual bool IsScreenReaderActive() const = 0; |
71 | 72 |
72 // Sets or releases event capturing for this native widget. | 73 // Sets or releases event capturing for this native widget. |
73 virtual void SetNativeCapture() = 0; | 74 virtual void SetNativeCapture() = 0; |
74 virtual void ReleaseNativeCapture() = 0; | 75 virtual void ReleaseNativeCapture() = 0; |
75 | 76 |
76 // Returns true if this native widget is capturing all events. | 77 // Returns true if this native widget is capturing all events. |
77 virtual bool HasNativeCapture() const = 0; | 78 virtual bool HasNativeCapture() const = 0; |
78 | 79 |
| 80 // Returns the InputMethod for this native widget. |
| 81 // Note that all widgets in a widget hierarchy share the same input method. |
| 82 // TODO(suzhe): rename to GetInputMethod() when NativeWidget implementation |
| 83 // class doesn't inherit Widget anymore. |
| 84 virtual InputMethod* GetInputMethodNative() = 0; |
| 85 |
| 86 // Sets a different InputMethod instance to this native widget. The instance |
| 87 // must not be initialized, the ownership will be assumed by the native |
| 88 // widget. It's only for testing purpose. |
| 89 virtual void ReplaceInputMethod(InputMethod* input_method) = 0; |
| 90 |
79 protected: | 91 protected: |
80 friend class Widget; | 92 friend class Widget; |
81 | 93 |
82 // Returns a handle for the underlying native widget that can be used for | 94 // Returns a handle for the underlying native widget that can be used for |
83 // accelerated drawing. | 95 // accelerated drawing. |
84 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; | 96 virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0; |
85 | 97 |
86 // Widget pass-thrus, private to Views. -------------------------------------- | 98 // Widget pass-thrus, private to Views. -------------------------------------- |
87 // See method documentation in Widget. | 99 // See method documentation in Widget. |
88 virtual gfx::Rect GetWindowScreenBounds() const = 0; | 100 virtual gfx::Rect GetWindowScreenBounds() const = 0; |
(...skipping 14 matching lines...) Expand all Loading... |
103 virtual void RunShellDrag(View* view, | 115 virtual void RunShellDrag(View* view, |
104 const ui::OSExchangeData& data, | 116 const ui::OSExchangeData& data, |
105 int operation) = 0; | 117 int operation) = 0; |
106 virtual void SchedulePaintInRect(const gfx::Rect& rect) = 0; | 118 virtual void SchedulePaintInRect(const gfx::Rect& rect) = 0; |
107 virtual void SetCursor(gfx::NativeCursor cursor) = 0; | 119 virtual void SetCursor(gfx::NativeCursor cursor) = 0; |
108 }; | 120 }; |
109 | 121 |
110 } // namespace views | 122 } // namespace views |
111 | 123 |
112 #endif // VIEWS_WIDGET_NATIVE_WIDGET_H_ | 124 #endif // VIEWS_WIDGET_NATIVE_WIDGET_H_ |
OLD | NEW |