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 gtkc.gtk;
32 public  import gtkc.gtktypes;
33 
34 
35 /**
36  * GtkIMContextSimple is a simple input method context supporting table-based
37  * input methods. It has a built-in table of compose sequences that is derived
38  * from the X11 Compose files.
39  * 
40  * GtkIMContextSimple reads additional compose sequences from the first of the
41  * following files that is found: ~/.config/gtk-3.0/Compose, ~/.XCompose,
42  * /usr/share/X11/locale/$locale/Compose (for locales that have a nontrivial
43  * Compose file). The syntax of these files is described in the Compose(5)
44  * manual page.
45  * 
46  * GtkIMContextSimple also supports numeric entry of Unicode characters
47  * by typing Ctrl-Shift-u, followed by a hexadecimal Unicode codepoint.
48  * For example, Ctrl-Shift-u 1 2 3 Enter yields U+0123 LATIN SMALL LETTER
49  * G WITH CEDILLA, i.e. ģ.
50  */
51 public class IMContextSimple : IMContext
52 {
53 	/** the main Gtk struct */
54 	protected GtkIMContextSimple* gtkIMContextSimple;
55 
56 	/** Get the main Gtk struct */
57 	public GtkIMContextSimple* getIMContextSimpleStruct()
58 	{
59 		return gtkIMContextSimple;
60 	}
61 
62 	/** the main Gtk struct as a void* */
63 	protected override void* getStruct()
64 	{
65 		return cast(void*)gtkIMContextSimple;
66 	}
67 
68 	protected override void setStruct(GObject* obj)
69 	{
70 		gtkIMContextSimple = cast(GtkIMContextSimple*)obj;
71 		super.setStruct(obj);
72 	}
73 
74 	/**
75 	 * Sets our main struct and passes it to the parent class.
76 	 */
77 	public this (GtkIMContextSimple* gtkIMContextSimple, bool ownedRef = false)
78 	{
79 		this.gtkIMContextSimple = gtkIMContextSimple;
80 		super(cast(GtkIMContext*)gtkIMContextSimple, ownedRef);
81 	}
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return gtk_im_context_simple_get_type();
88 	}
89 
90 	/**
91 	 * Creates a new #GtkIMContextSimple.
92 	 *
93 	 * Return: a new #GtkIMContextSimple.
94 	 *
95 	 * Throws: ConstructionException GTK+ fails to create the object.
96 	 */
97 	public this()
98 	{
99 		auto p = gtk_im_context_simple_new();
100 		
101 		if(p is null)
102 		{
103 			throw new ConstructionException("null returned by new");
104 		}
105 		
106 		this(cast(GtkIMContextSimple*) p, true);
107 	}
108 
109 	/** */
110 	public void addComposeFile(string composeFile)
111 	{
112 		gtk_im_context_simple_add_compose_file(gtkIMContextSimple, Str.toStringz(composeFile));
113 	}
114 
115 	/**
116 	 * Adds an additional table to search to the input context.
117 	 * Each row of the table consists of @max_seq_len key symbols
118 	 * followed by two #guint16 interpreted as the high and low
119 	 * words of a #gunicode value. Tables are searched starting
120 	 * from the last added.
121 	 *
122 	 * The table must be sorted in dictionary order on the
123 	 * numeric value of the key symbol fields. (Values beyond
124 	 * the length of the sequence should be zero.)
125 	 *
126 	 * Params:
127 	 *     data = the table
128 	 *     maxSeqLen = Maximum length of a sequence in the table
129 	 *         (cannot be greater than #GTK_MAX_COMPOSE_LEN)
130 	 *     nSeqs = number of sequences in the table
131 	 */
132 	public void addTable(ushort[] data, int maxSeqLen, int nSeqs)
133 	{
134 		gtk_im_context_simple_add_table(gtkIMContextSimple, data.ptr, maxSeqLen, nSeqs);
135 	}
136 }