1 /* Copyright (C) 2011 Edward Der-Hua Liu, Hsin-Chu, Taiwan
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation version 2.1
6  * of the License.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
16  */
17 
18 #ifndef HIME_MODULE_H
19 #define HIME_MODULE_H
20 
21 #include "pho.h"
22 #include "win1.h"
23 
24 // optional functions/data for hime module to use, please refer to anthy.cpp
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 typedef struct {
29     void (*mf_show_win_sym) ();
30     void (*mf_hide_win_sym) ();
31     void (*mf_move_win_sym) ();
32     void (*mf_toggle_win_sym) ();
33 
34     // display in tsin's selection window
35     void (*mf_init_tsin_selection_win) ();
36     void (*mf_clear_sele) ();
37     void (*mf_disp_selections) (int x, int y);
38     void (*mf_hide_selections_win) ();
39     void (*mf_disp_arrow_up) ();
40     void (*mf_disp_arrow_down) ();
41     void (*mf_set_sele_text) (int selN, int sel_idx, char *text, int len);
42     void (*mf_set_win1_cb) (cb_selec_by_idx_t selc_by_idx, cb_page_ud_t cb_page_up, cb_page_ud_t cb_page_down);
43 
44     void (*mf_tsin_set_eng_ch) (int nmod);
45     void (*mf_set_tsin_pho_mode) ();
46     gboolean (*mf_tsin_pho_mode) ();
47 
48     int (*mf_get_widget_xy) (GtkWidget *win, GtkWidget *widget, int *rx, int *ry);
49     void (*mf_get_win_size) (GtkWidget *win, int *width, int *height);
50     void (*mf_change_win_bg) (GtkWidget *win);
51     void (*mf_set_label_font_size) (GtkWidget *label, int size);
52     void (*mf_set_no_focus) (GtkWidget *win);
53 
54     gint64 (*mf_current_time) ();
55     int (*mf_current_shape_mode) ();
56 
57     void (*mf_exec_hime_setup) ();
58     gboolean (*mf_hime_edit_display_ap_only) ();
59     gboolean (*mf_hime_display_on_the_spot_key) ();
60     gint (*mf_inmd_switch_popup_handler) (GtkWidget *widget, GdkEvent *event);
61     void (*mf_load_tab_pho_file) ();
62     int (*mf_utf8_str_N) (char *str);
63 
64     // call this function to return the string
65     void (*mf_send_text) (char *str);
66     void (*mf_send_utf8_ch) (char *str);
67 
68     PHOKBM *mf_phkbm;
69     TSIN_ST *mf_tss;
70     int *mf_tsin_chinese_english_toggle_key;
71     char **mf_pho_chars;
72 
73     int *mf_hime_pop_up_win;
74     int *mf_hime_font_size, *mf_hime_win_color_use;
75     char **mf_hime_win_color_fg, **mf_pho_selkey, **mf_tsin_cursor_color;
76     gboolean *mf_force_show;
77     int *mf_win_x, *mf_win_y, *mf_win_xl, *mf_win_yl, *mf_dpy_xl, *mf_dpy_yl;
78 } HIME_module_main_functions;
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 void init_HIME_module_main_functions (HIME_module_main_functions *func);
84 
85 #endif /* HIME_MODULE_H */
86