Dali 3D User Interface Engine
toolkit-imf-manager.h
Go to the documentation of this file.
1 #ifndef __DALI_TOOLKIT_TOOLKIT_IMF_MANAGER_H__
2 #define __DALI_TOOLKIT_TOOLKIT_IMF_MANAGER_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #define __DALI_IMF_MANAGER_H__
25 
26 namespace Dali DALI_IMPORT_API
27 {
28 
29 namespace Internal DALI_INTERNAL
30 {
31 namespace Adaptor
32 {
33 class ImfManager;
34 }
35 }
36 
42 class ImfManager : public BaseHandle
43 {
44 public:
45 
49  enum ImfEvent
50  {
51  VOID,
55  GETSURROUNDING
56  };
57 
61  struct ImfEventData
62  {
67  : predictiveString(),
68  eventName( VOID ),
69  cursorOffset( 0 ),
70  numberOfChars ( 0 )
71  {
72  };
73 
82  ImfEventData( ImfEvent aEventName, const std::string& aPredictiveString, int aCursorOffset, int aNumberOfChars )
83  : predictiveString( aPredictiveString ),
84  eventName( aEventName ),
85  cursorOffset( aCursorOffset ),
86  numberOfChars( aNumberOfChars )
87  {
88  }
89 
90  // Data
91  std::string predictiveString;
95  };
96 
101  {
106  : currentText(),
107  cursorPosition( 0 ),
108  update( false ),
109  preeditResetRequired( false )
110  {
111  }
112 
120  ImfCallbackData( bool aUpdate, int aCursorPosition, const std::string& aCurrentText, bool aPreeditResetRequired )
121  : currentText( aCurrentText ),
122  cursorPosition( aCursorPosition ),
123  update( aUpdate ),
124  preeditResetRequired( aPreeditResetRequired )
125  {
126  }
127 
128  std::string currentText;
130  bool update :1;
131  bool preeditResetRequired :1;
132  };
133 
134  typedef Signal< void (ImfManager&) > ImfManagerSignalType;
135  typedef Signal< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalType;
136 
137 public:
138 
143  static ImfManager Get();
144 
151  void Activate();
152 
158  void Deactivate();
159 
166  bool RestoreAfterFocusLost() const;
167 
173  void SetRestoreAfterFocusLost( bool toggle );
174 
180  void Reset();
181 
185  void NotifyCursorPosition();
186 
192  void SetCursorPosition( unsigned int cursorPosition );
193 
199  unsigned int GetCursorPosition() const;
200 
206  void SetSurroundingText( const std::string& text );
207 
213  const std::string& GetSurroundingText() const;
214 
215 public:
216 
217  // Signals
218 
224  ImfManagerSignalType& ActivatedSignal();
225 
231  ImfEventSignalType& EventReceivedSignal();
232 
233  // Construction & Destruction
234 
238  ImfManager();
239 
245  ~ImfManager();
246 
252  explicit ImfManager( Internal::Adaptor::ImfManager* imfManager );
253 };
254 
255 } // namespace Dali
256 
257 #endif // __DALI_TOOLKIT_TOOLKIT_IMF_MANAGER_H__
Dali Docs Home
Read more about Dali