Added API for flushing keyboard ise
[platform/core/uifw/libscl-core.git] / src / sclconnection-isf.h
1 /*
2  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #ifndef __SCL_CONNECTION_ISF_H__
19 #define __SCL_CONNECTION_ISF_H__
20
21 #define Uses_SCIM_UTILITY
22 #define Uses_SCIM_OBJECT
23 #define Uses_SCIM_POINTER
24 #define Uses_SCIM_EVENT
25 #define Uses_SCIM_HELPER
26 #define Uses_SCIM_CONFIG_BASE
27
28 #include <Ecore.h>
29 #include <scim.h>
30 #include <string>
31 #include "sclconnection.h"
32
33 //SCL_BEGIN_DECLS
34
35 namespace scl
36 {
37
38 class CSCLConnectionISF : public CSCLConnection
39 {
40 public:
41     CSCLConnectionISF();
42     ~CSCLConnectionISF();
43
44     virtual sclboolean init();
45     virtual void fini();
46
47     virtual void open_connection(const sclchar *display);
48     virtual void close_connection();
49
50     void config_reload();
51     sclboolean config_read_int(const sclchar *name, sclint &value);
52     sclboolean config_read_string(const sclchar *name, std::string &value);
53     sclboolean config_write_int(const sclchar *name, sclint value);
54     sclboolean config_write_string(const sclchar *name, const std::string value);
55     sclboolean config_erase(const sclchar *name);
56     sclboolean config_flush(void);
57
58     void send_imengine_event(sclint ic, const sclchar *ic_uuid, const sclint command, const sclu32 value);
59     void reset_keyboard_ise();
60     void flush_keyboard_ise();
61     void send_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask);
62     void forward_key_event(sclint ic, const sclchar *ic_uuid, sclu32 keycode, sclu16 keymask);
63     void commit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str);
64     void select_candidate(int index);
65     void show_preedit_string(sclint ic, const sclchar *ic_uuid);
66     void show_aux_string(void);
67     void show_candidate_string(void);
68     void show_associate_string(void);
69     void hide_preedit_string(sclint ic, const sclchar *ic_uuid);
70     void hide_aux_string(void);
71     void hide_candidate_string(void);
72     void hide_associate_string(void);
73     void update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str);
74     void update_preedit_string(sclint ic, const sclchar *ic_uuid, const sclchar *str, const scim::AttributeList &attrs);
75     void update_aux_string(const sclchar *str);
76     void update_input_context(sclu32 type, sclu32 value);
77     void update_geometry(sclint x, sclint y, sclint width, sclint height);
78     void get_surrounding_text(const sclchar *ic_uuid, sclint maxlen_before, sclint maxlen_after) const;
79     void delete_surrounding_text(sclint offset, sclint len) const;
80     void set_candidate_position(sclint left, sclint top);
81     void enable_soft_candidate(sclboolean enable);
82     void candidate_hide(void);
83     void set_keyboard_ise_by_uuid(const sclchar *uuid);
84     void get_keyboard_ise(const sclchar *uuid);
85     void set_selection(sclint start, sclint end);
86     void send_private_command(const char *command);
87     sclint get_surrounding_text(sclint maxlen_before, sclint maxlen_after, sclchar **text, int &cursor);
88     void get_selection_text(sclchar **text);
89     void request_ise_hide();
90 private:
91     sclboolean m_initialized;
92
93     scim::HelperInfo m_helper_info;
94     scim::HelperAgent m_helper_agent;
95
96     Ecore_Fd_Handler *m_fd_handler;
97 };
98
99 }
100
101 //SCL_END_DECLS
102
103 #endif //__SCL_CONNECTION_ISF_H__