Tizen 2.1 base
[framework/uifw/ecore.git] / src / modules / immodules / scim / scim_module.cpp
1 #include <stdio.h>
2 #include "scim_imcontext.h"
3
4 #ifdef __cplusplus
5 extern "C"
6 {
7 #endif /* __cplusplus */
8
9    static const Ecore_IMF_Context_Info isf_imf_info = {
10         "scim",                                 /* ID */
11         "SCIM immodule for Ecore",              /* Description */
12         "*",                                    /* Default locales */
13         NULL,                                   /* Canvas type */
14         0                                       /* Canvas required */
15    };
16
17    static Ecore_IMF_Context_Class isf_imf_class = {
18         isf_imf_context_add,                    /* add */
19         isf_imf_context_del,                    /* del */
20         isf_imf_context_client_window_set,      /* client_window_set */
21         isf_imf_context_client_canvas_set,      /* client_canvas_set */
22         isf_imf_context_input_panel_show,       /* input_panel_show, - show */
23         isf_imf_context_input_panel_hide,       /* input_panel_hide, - hide */
24         isf_imf_context_preedit_string_get,     /* get_preedit_string */
25         isf_imf_context_focus_in,               /* focus_in */
26         isf_imf_context_focus_out,              /* focus_out */
27         isf_imf_context_reset,                  /* reset */
28         isf_imf_context_cursor_position_set,    /* cursor_position_set */
29         isf_imf_context_use_preedit_set,        /* use_preedit_set */
30         isf_imf_context_input_mode_set,         /* input_mode_set */
31         isf_imf_context_filter_event,           /* filter_event */
32         isf_imf_context_preedit_string_with_attributes_get,  /* preedit_string_with_attribute_get */
33         isf_imf_context_prediction_allow_set,   /* prediction_allow_set */
34         isf_imf_context_autocapital_type_set,   /* autocapital_type_set */
35         NULL,                                   /* control panel show */
36         NULL,                                   /* control panel hide */
37         NULL,                                   /* input_panel_layout_set */
38         NULL,                                   /* isf_imf_context_input_panel_layout_get, */
39         NULL,                                   /* isf_imf_context_input_panel_language_set, */
40         NULL,                                   /* isf_imf_context_input_panel_language_get, */
41         isf_imf_context_cursor_location_set,    /* cursor_location_set */
42         NULL,                                   /* input_panel_imdata_set */
43         NULL,                                   /* input_panel_imdata_get */
44         NULL,                                   /* input_panel_return_key_type_set */
45         NULL,                                   /* input_panel_return_key_disabled_set */
46         NULL,                                   /* input_panel_caps_lock_mode_set */
47         NULL,
48         NULL,
49         NULL,
50         NULL,
51         NULL,
52         NULL
53    };
54
55    static Ecore_IMF_Context *imf_module_create (void);
56    static Ecore_IMF_Context *imf_module_exit (void);
57
58    static Eina_Bool imf_module_init (void)
59      {
60         ecore_imf_module_register (&isf_imf_info, imf_module_create, imf_module_exit);
61         return EINA_TRUE;
62      }
63
64    static void imf_module_shutdown (void)
65      {
66         isf_imf_context_shutdown ();
67      }
68
69    static Ecore_IMF_Context *imf_module_create (void)
70      {
71         Ecore_IMF_Context  *ctx = NULL;
72         EcoreIMFContextISF *ctxd = NULL;
73
74         ctxd = isf_imf_context_new ();
75         if (!ctxd)
76           {
77              printf ("isf_imf_context_new () failed!!!\n");
78              return NULL;
79           }
80
81         ctx = ecore_imf_context_new (&isf_imf_class);
82         if (!ctx)
83           {
84              delete ctxd;
85              return NULL;
86           }
87
88         ecore_imf_context_data_set (ctx, ctxd);
89
90         return ctx;
91      }
92
93    static Ecore_IMF_Context *imf_module_exit (void)
94      {
95         return NULL;
96      }
97
98    EINA_MODULE_INIT(imf_module_init);
99    EINA_MODULE_SHUTDOWN(imf_module_shutdown);
100
101 #ifdef __cplusplus
102 }
103 #endif /* __cplusplus */
104