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