1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat Software
3 * Copyright (C) 2002 Yusuke Tabata
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Authors: Owen Taylor <otaylor@redhat.com>
21 * Yusuke Tabata <tee@kuis.kyoto-u.ac.jp>
23 * This module is a port of the korean-hangul module from Emacs.
28 #include <gdk/gdkkeysyms.h>
30 #include "gtk/gtkintl.h"
31 #include "gtk/gtkimcontextsimple.h"
32 #include "gtk/gtkimmodule.h"
34 GType type_hangul = 0;
36 static void hangul_class_init (GtkIMContextSimpleClass *class);
37 static void hangul_init (GtkIMContextSimple *im_context);
40 hangul_register_type (GTypeModule *module)
42 static const GTypeInfo object_info =
44 sizeof (GtkIMContextSimpleClass),
46 (GBaseFinalizeFunc) NULL,
47 (GClassInitFunc) hangul_class_init,
48 NULL, /* class_finalize */
49 NULL, /* class_data */
50 sizeof (GtkIMContextSimple),
52 (GInstanceInitFunc) hangul_init,
56 g_type_module_register_type (module,
57 GTK_TYPE_IM_CONTEXT_SIMPLE,
62 static guint16 hangul_compose_seqs[] = {
63 #include "imhangul-defs.h"
67 hangul_class_init (GtkIMContextSimpleClass *class)
72 hangul_init (GtkIMContextSimple *im_context)
74 gtk_im_context_simple_add_table (im_context,
77 G_N_ELEMENTS (hangul_compose_seqs) / (4 + 2));
80 static const GtkIMContextInfo hangul_info = {
83 "Hangul (KSC 5601)", /* Human readable name */
84 "gtk+", /* Translation domain */
86 "", /* Dir for bindtextdomain (not strictly needed for "gtk+") */
87 "" /* Languages for which this module is the default */
90 static const GtkIMContextInfo *info_list[] = {
95 im_module_init (GTypeModule *module)
97 hangul_register_type (module);
101 im_module_exit (void)
106 im_module_list (const GtkIMContextInfo ***contexts,
109 *contexts = info_list;
110 *n_contexts = G_N_ELEMENTS (info_list);
114 im_module_create (const gchar *context_id)
116 if (strcmp (context_id, "hangul") == 0)
117 return GTK_IM_CONTEXT (g_object_new (type_hangul, NULL));