typedef struct _HangulBuffer HangulBuffer;
typedef struct _HangulInputContext HangulInputContext;
-typedef bool (*HangulOnTransition) (HangulInputContext*,
- ucschar,
- const ucschar*,
- void*);
-typedef void (*HangulOnTranslate) (HangulInputContext*,
- int,
- ucschar*,
- void*);
-
enum {
HANGUL_OUTPUT_SYLLABLE,
HANGUL_OUTPUT_JAMO
const char* id);
void hangul_ic_set_combination(HangulInputContext *hic,
const HangulCombination *combination);
-
-void hangul_ic_connect_translate (HangulInputContext* hic,
- HangulOnTranslate callback,
- void* user_data);
-void hangul_ic_connect_transition(HangulInputContext* hic,
- HangulOnTransition callback,
- void* user_data);
+void hangul_ic_connect_callback(HangulInputContext* hic, const char* event,
+ void* callback, void* user_data);
const ucschar* hangul_ic_get_preedit_string(HangulInputContext *hic);
const ucschar* hangul_ic_get_commit_string(HangulInputContext *hic);
#define N_ELEMENTS(array) (sizeof(array) / sizeof(array[0]))
#define HANGUL_KEYBOARD_TABLE_SIZE 0x80
+typedef void (*HangulOnTranslate) (HangulInputContext*,
+ int,
+ ucschar*,
+ void*);
+typedef bool (*HangulOnTransition) (HangulInputContext*,
+ ucschar,
+ const ucschar*,
+ void*);
+
typedef struct _HangulCombinationItem HangulCombinationItem;
struct _HangulKeyboard {
}
}
+void hangul_ic_connect_callback(HangulInputContext* hic, const char* event,
+ void* callback, void* user_data)
+{
+ if (hic == NULL || event == NULL)
+ return;
+
+ if (strcasecmp(event, "translate") == 0) {
+ hic->on_translate = (HangulOnTranslate)callback;
+ hic->on_translate_data = user_data;
+ } else if (strcasecmp(event, "transition") == 0) {
+ hic->on_transition = (HangulOnTransition)callback;
+ hic->on_transition_data = user_data;
+ }
+}
+
void hangul_ic_set_filter(HangulInputContext *hic,
HangulICFilter func, void *user_data)
{