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 PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ |
6 #define PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ | 6 #define PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ |
7 | 7 |
8 #include <string> | |
yzshen1
2012/03/08 07:51:43
A blank line below it, please.
kinaba
2012/03/14 04:28:54
Done.
| |
8 #include "ppapi/c/dev/ppb_text_input_dev.h" | 9 #include "ppapi/c/dev/ppb_text_input_dev.h" |
9 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
10 | 11 |
11 /// @file | |
12 /// This file defines the API for controlling text input methods. | |
13 namespace pp { | 12 namespace pp { |
14 | 13 |
15 class Rect; | 14 class Rect; |
15 class Instance; | |
16 | 16 |
17 // This class allows you to associate the PPP_TextInput_Dev and | |
18 // PPB_TextInput_Dev C-based interfaces with an object. It associates itself | |
19 // with the given instance, and registers as the global handler for handling the | |
20 // PPP_TextInput_Dev interface that the browser calls. | |
21 // | |
22 // You would typically use this either via inheritance on your instance: | |
23 // class MyInstance : public pp::Instance, public pp::TextInput_Dev { | |
24 // class MyInstance() : pp::TextInput_Dev(this) { | |
yzshen1
2012/03/08 07:51:43
class should be removed.
kinaba
2012/03/14 04:28:54
Done.
| |
25 // } | |
26 // ... | |
27 // }; | |
28 // | |
29 // or by composition: | |
30 // class MyTextInput : public pp::TextInput_Dev { | |
31 // ... | |
32 // }; | |
33 // | |
34 // class MyInstance : public pp::Instance { | |
35 // MyInstance() : text_input_(this) { | |
36 // } | |
37 // | |
38 // MyTextInput text_input_; | |
39 // }; | |
17 class TextInput_Dev { | 40 class TextInput_Dev { |
18 public: | 41 public: |
19 explicit TextInput_Dev(const InstanceHandle& instance); | 42 explicit TextInput_Dev(Instance* instance); |
20 virtual ~TextInput_Dev(); | 43 virtual ~TextInput_Dev(); |
21 | 44 |
45 virtual void RequestSurroundingText(uint32_t desired_number_of_characters); | |
46 | |
22 void SetTextInputType(PP_TextInput_Type type); | 47 void SetTextInputType(PP_TextInput_Type type); |
23 void UpdateCaretPosition(const Rect& caret, const Rect& bounding_box); | 48 void UpdateCaretPosition(const Rect& caret, const Rect& bounding_box); |
24 void CancelCompositionText(); | 49 void CancelCompositionText(); |
50 void SelectionChanged(); | |
51 void UpdateSurroundingText(const std::string& text, | |
52 uint32_t caret, uint32_t anchor); | |
25 | 53 |
26 private: | 54 private: |
27 InstanceHandle instance_; | 55 InstanceHandle instance_; |
28 }; | 56 }; |
29 | 57 |
30 } // namespace pp | 58 } // namespace pp |
31 | 59 |
32 #endif // PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ | 60 #endif // PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ |
OLD | NEW |