1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
2 /* vim:set et sts=4: */
3 /* bus - The Input Bus
4  * Copyright (C) 2017-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
5  * Copyright (C) 2017 Red Hat, Inc.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
20  * USA
21  */
22 
23 #ifndef __IBUS_EMOJI_DIALOG_H_
24 #define __IBUS_EMOJI_DIALOG_H_
25 
26 #include <gtk/gtk.h>
27 
28 /**
29  * SECTION: ibusemojidialog
30  * @short_description: emoji dialog utility.
31  * @stability: Unstable
32  *
33  * miscellaneous emoji dialg APIs.
34  */
35 
36 G_BEGIN_DECLS
37 
38 typedef struct _IBusEmojier IBusEmojier;
39 typedef struct _IBusEmojierPrivate IBusEmojierPrivate;
40 typedef struct _IBusEmojierClass IBusEmojierClass;
41 
42 struct _IBusEmojier {
43     /*< private >*/
44     GtkWindow parent_instance;
45     IBusEmojierPrivate * priv;
46     /* instance members */
47     /*< public >*/
48 };
49 
50 struct _IBusEmojierClass {
51     /*< private >*/
52     GtkWindowClass parent_class;
53     /* class members */
54     /*< public >*/
55     /* signals */
56 };
57 
58 GType           ibus_emojier_get_type        (void);
59 
60 /**
61  * ibus_emojier_new:
62  *
63  * Creates a new #IBusEmojier.
64  *
65  * Returns: A newly allocated #IBusEmojiier.
66  */
67 IBusEmojier * ibus_emojier_new                    (void);
68 
69 /**
70  * ibus_emojier_run:
71  * @self: An #IBusEmojier
72  * @input_context_path: An input context path of #IBusInputContext
73  *                      of the focused application.
74  * @event: A #GdkEventKey for timestamp
75  *
76  * Runs emoji dialog to select emoji.
77  *
78  * Returns: A selected emoji character.
79  */
80 gchar *       ibus_emojier_run                    (IBusEmojier* self,
81                                                    const gchar*
82                                                            input_context_path,
83                                                    GdkEvent*    event);
84 
85 /**
86  * ibus_emojier_is_running:
87  * @self: An #IBusEmojier
88  *
89  * Returns: boolean if the emoji dialog is running
90  */
91 gboolean      ibus_emojier_is_running             (IBusEmojier* self);
92 
93 /**
94  * ibus_emojier_get_input_context_path:
95  * @self: An #IBusEmojier
96  *
97  * Returns: an input context path of #IBusInputContext
98  * which is saved in ibus_emojier_run().
99  */
100 gchar *       ibus_emojier_get_input_context_path (IBusEmojier* self);
101 
102 /**
103  * ibus_emojier_get_selected_string:
104  * @self: An #IBusEmojier
105  *
106  * Returns: an selected emoji character on the emoji dialog.
107  */
108 gchar *       ibus_emojier_get_selected_string    (IBusEmojier* self);
109 
110 /**
111  * ibus_emojier_reset:
112  * @self: An #IBusEmojier
113  *
114  * Reset the selected string and input context path.
115  */
116 void          ibus_emojier_reset                  (IBusEmojier* self);
117 
118 /**
119  * ibus_emojier_present_centralize:
120  * @self: An #IBusEmojier
121  * @event: A #GdkEventKey for timestamp
122  *
123  * Move the window to the toplevel on the screen and centralize it.
124  */
125 void          ibus_emojier_present_centralize     (IBusEmojier* self,
126                                                    GdkEvent*    event);
127 
128 /**
129  * ibus_emojier_has_loaded_emoji_dict:
130  *
131  * Returns: %TRUE if the emoji dict is loaded, otherwise %FALSE.
132  */
133 gboolean      ibus_emojier_has_loaded_emoji_dict  (void);
134 
135 /**
136  * ibus_emojier_set_annotation_lang:
137  * @lang: A langauge id for emoji annotations.
138  *
139  * Set a language id for emoji annotations. #IBusEmojier will load
140  * $PKGDATADIR/dicts/emoji-@lang.dict. The default is "en".
141  */
142 void          ibus_emojier_set_annotation_lang    (const gchar* lang);
143 
144 /**
145  * ibus_emojier_set_emoji_font:
146  * @emoji_font: font name for emoji characters
147  *
148  * Set emoji font on the emoji dialog
149  */
150 void          ibus_emojier_set_emoji_font         (const gchar* emoji_font);
151 
152 /**
153  * ibus_emojier_set_favorites:
154  * @favorites: (array length=favorites_length): A custom emoji list.
155  * @favorites_length: A length of @favorites
156  * @favorite_annotations: (array length=favorite_annotations_length):
157  *                        (nullable):
158  *                        A custom annotation listfor @favorites.
159  * @favorite_annotations_length: A length of @favorite_annotations
160  *
161  * Set custom emojis on the emoji dialog. @favorite_annotations
162  * can be null. If you don't assign an annotation for a specific emoji,
163  * you can pass the annotation as "", e.g.
164  * favorite_annotations = { "", "", "my annotation" };
165  */
166 void          ibus_emojier_set_favorites          (gchar**      favorites,
167                                                    int
168                                                    favorites_length,
169                                                    gchar**
170                                                    favorite_annotations,
171                                                    int
172                                                    favorite_annotations_length);
173 
174 /**
175  * ibus_emojier_set_partial_match:
176  * @has_partial_match: Enable the partial match if %TRUE. Otherwise if %FALSE.
177  *
178  * Set partial match for emoji annotations.
179  */
180 void          ibus_emojier_set_partial_match      (gboolean  has_partial_match);
181 
182 /**
183  * ibus_emojier_set_partial_match_length:
184  * @length: minimum length to match partially.
185  *
186  * Set the minimum length to match partially.
187  */
188 void          ibus_emojier_set_partial_match_length
189                                                   (gint         length);
190 
191 /**
192  * ibus_emojier_set_partial_match_condition:
193  * @condition: condition id between 0 and 2.
194  *
195  * Set the partial match condition with the integer.
196  */
197 void          ibus_emojier_set_partial_match_condition
198                                                   (gint         condition);
199 /**
200  * ibus_emojier_load_unicode_dict:
201  *
202  * Load the dictionary of #IBusUnicodeData.
203  */
204 void          ibus_emojier_load_unicode_dict      (void);
205 
206 G_END_DECLS
207 #endif
208