OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_ | 5 #ifndef WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_ |
6 #define WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_ | 6 #define WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
| 11 #include <stdint.h> |
11 | 12 |
12 #include "base/basictypes.h" | |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 | 14 |
15 namespace metro_viewer { | 15 namespace metro_viewer { |
16 struct UnderlineInfo; | 16 struct UnderlineInfo; |
17 } | 17 } |
18 | 18 |
19 namespace metro_driver { | 19 namespace metro_driver { |
20 | 20 |
21 // A delegate which works together with virtual text stores. | 21 // A delegate which works together with virtual text stores. |
22 // Objects that implement this delegate will receive notifications from a | 22 // Objects that implement this delegate will receive notifications from a |
23 // virtual text store whenever an IME updates the composition or commits text. | 23 // virtual text store whenever an IME updates the composition or commits text. |
24 // Objects that implement this delegate are also responsible for calculating | 24 // Objects that implement this delegate are also responsible for calculating |
25 // the character position of composition and caret position upon request. | 25 // the character position of composition and caret position upon request. |
26 class TextStoreDelegate { | 26 class TextStoreDelegate { |
27 public: | 27 public: |
28 virtual ~TextStoreDelegate() {} | 28 virtual ~TextStoreDelegate() {} |
29 | 29 |
30 // Called when on-going composition is updated. An empty |text| represents | 30 // Called when on-going composition is updated. An empty |text| represents |
31 // that the composition is canceled. | 31 // that the composition is canceled. |
32 virtual void OnCompositionChanged( | 32 virtual void OnCompositionChanged( |
33 const base::string16& text, | 33 const base::string16& text, |
34 int32 selection_start, | 34 int32_t selection_start, |
35 int32 selection_end, | 35 int32_t selection_end, |
36 const std::vector<metro_viewer::UnderlineInfo>& underlines) = 0; | 36 const std::vector<metro_viewer::UnderlineInfo>& underlines) = 0; |
37 | 37 |
38 // Called when |text| is committed. | 38 // Called when |text| is committed. |
39 virtual void OnTextCommitted(const base::string16& text) = 0; | 39 virtual void OnTextCommitted(const base::string16& text) = 0; |
40 | 40 |
41 // Called when an IME requests the caret position. Objects that implement | 41 // Called when an IME requests the caret position. Objects that implement |
42 // this method must return the caret position in screen coordinates. | 42 // this method must return the caret position in screen coordinates. |
43 virtual RECT GetCaretBounds() = 0; | 43 virtual RECT GetCaretBounds() = 0; |
44 | 44 |
45 // Called when an IME requests the bounding box of an character whose | 45 // Called when an IME requests the bounding box of an character whose |
46 // index is |index| in the on-going composition. position. Objects that | 46 // index is |index| in the on-going composition. position. Objects that |
47 // implement this method must return true and fill the character bounds into | 47 // implement this method must return true and fill the character bounds into |
48 // |rect| in screen coordinates. | 48 // |rect| in screen coordinates. |
49 // Should return false if |index| is invalid. | 49 // Should return false if |index| is invalid. |
50 virtual bool GetCompositionCharacterBounds(uint32 index, RECT* rect) = 0; | 50 virtual bool GetCompositionCharacterBounds(uint32_t index, RECT* rect) = 0; |
51 }; | 51 }; |
52 | 52 |
53 } // namespace metro_driver | 53 } // namespace metro_driver |
54 | 54 |
55 #endif // WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_ | 55 #endif // WIN8_METRO_DRIVER_IME_TEXT_STORE_DELEGATE_H_ |
OLD | NEW |