1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD 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
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.IMContextSimple;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtk.IMContext;
31 private import gtk.c.functions;
32 public  import gtk.c.types;
33 public  import gtkc.gtktypes;
34 
35 
36 /**
37  * GtkIMContextSimple is a simple input method context supporting table-based
38  * input methods. It has a built-in table of compose sequences that is derived
39  * from the X11 Compose files.
40  * 
41  * GtkIMContextSimple reads additional compose sequences from the first of the
42  * following files that is found: ~/.config/gtk-3.0/Compose, ~/.XCompose,
43  * /usr/share/X11/locale/$locale/Compose (for locales that have a nontrivial
44  * Compose file). The syntax of these files is described in the Compose(5)
45  * manual page.
46  * 
47  * GtkIMContextSimple also supports numeric entry of Unicode characters
48  * by typing Ctrl-Shift-u, followed by a hexadecimal Unicode codepoint.
49  * For example, Ctrl-Shift-u 1 2 3 Enter yields U+0123 LATIN SMALL LETTER
50  * G WITH CEDILLA, i.e. ģ.
51  */
52 public class IMContextSimple : IMContext
53 {
54 	/** the main Gtk struct */
55 	protected GtkIMContextSimple* gtkIMContextSimple;
56 
57 	/** Get the main Gtk struct */
58 	public GtkIMContextSimple* getIMContextSimpleStruct(bool transferOwnership = false)
59 	{
60 		if (transferOwnership)
61 			ownedRef = false;
62 		return gtkIMContextSimple;
63 	}
64 
65 	/** the main Gtk struct as a void* */
66 	protected override void* getStruct()
67 	{
68 		return cast(void*)gtkIMContextSimple;
69 	}
70 
71 	/**
72 	 * Sets our main struct and passes it to the parent class.
73 	 */
74 	public this (GtkIMContextSimple* gtkIMContextSimple, bool ownedRef = false)
75 	{
76 		this.gtkIMContextSimple = gtkIMContextSimple;
77 		super(cast(GtkIMContext*)gtkIMContextSimple, ownedRef);
78 	}
79 
80 
81 	/** */
82 	public static GType getType()
83 	{
84 		return gtk_im_context_simple_get_type();
85 	}
86 
87 	/**
88 	 * Creates a new #GtkIMContextSimple.
89 	 *
90 	 * Returns: a new #GtkIMContextSimple.
91 	 *
92 	 * Throws: ConstructionException GTK+ fails to create the object.
93 	 */
94 	public this()
95 	{
96 		auto p = gtk_im_context_simple_new();
97 
98 		if(p is null)
99 		{
100 			throw new ConstructionException("null returned by new");
101 		}
102 
103 		this(cast(GtkIMContextSimple*) p, true);
104 	}
105 
106 	/** */
107 	public void addComposeFile(string composeFile)
108 	{
109 		gtk_im_context_simple_add_compose_file(gtkIMContextSimple, Str.toStringz(composeFile));
110 	}
111 
112 	/**
113 	 * Adds an additional table to search to the input context.
114 	 * Each row of the table consists of @max_seq_len key symbols
115 	 * followed by two #guint16 interpreted as the high and low
116 	 * words of a #gunicode value. Tables are searched starting
117 	 * from the last added.
118 	 *
119 	 * The table must be sorted in dictionary order on the
120 	 * numeric value of the key symbol fields. (Values beyond
121 	 * the length of the sequence should be zero.)
122 	 *
123 	 * Params:
124 	 *     data = the table
125 	 *     maxSeqLen = Maximum length of a sequence in the table
126 	 *         (cannot be greater than #GTK_MAX_COMPOSE_LEN)
127 	 *     nSeqs = number of sequences in the table
128 	 */
129 	public void addTable(ushort[] data, int maxSeqLen, int nSeqs)
130 	{
131 		gtk_im_context_simple_add_table(gtkIMContextSimple, data.ptr, maxSeqLen, nSeqs);
132 	}
133 }