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(bool transferOwnership = false) 58 { 59 if (transferOwnership) 60 ownedRef = false; 61 return gtkIMContextSimple; 62 } 63 64 /** the main Gtk struct as a void* */ 65 protected override void* getStruct() 66 { 67 return cast(void*)gtkIMContextSimple; 68 } 69 70 protected override void setStruct(GObject* obj) 71 { 72 gtkIMContextSimple = cast(GtkIMContextSimple*)obj; 73 super.setStruct(obj); 74 } 75 76 /** 77 * Sets our main struct and passes it to the parent class. 78 */ 79 public this (GtkIMContextSimple* gtkIMContextSimple, bool ownedRef = false) 80 { 81 this.gtkIMContextSimple = gtkIMContextSimple; 82 super(cast(GtkIMContext*)gtkIMContextSimple, ownedRef); 83 } 84 85 86 /** */ 87 public static GType getType() 88 { 89 return gtk_im_context_simple_get_type(); 90 } 91 92 /** 93 * Creates a new #GtkIMContextSimple. 94 * 95 * Returns: a new #GtkIMContextSimple. 96 * 97 * Throws: ConstructionException GTK+ fails to create the object. 98 */ 99 public this() 100 { 101 auto p = gtk_im_context_simple_new(); 102 103 if(p is null) 104 { 105 throw new ConstructionException("null returned by new"); 106 } 107 108 this(cast(GtkIMContextSimple*) p, true); 109 } 110 111 /** */ 112 public void addComposeFile(string composeFile) 113 { 114 gtk_im_context_simple_add_compose_file(gtkIMContextSimple, Str.toStringz(composeFile)); 115 } 116 117 /** 118 * Adds an additional table to search to the input context. 119 * Each row of the table consists of @max_seq_len key symbols 120 * followed by two #guint16 interpreted as the high and low 121 * words of a #gunicode value. Tables are searched starting 122 * from the last added. 123 * 124 * The table must be sorted in dictionary order on the 125 * numeric value of the key symbol fields. (Values beyond 126 * the length of the sequence should be zero.) 127 * 128 * Params: 129 * data = the table 130 * maxSeqLen = Maximum length of a sequence in the table 131 * (cannot be greater than #GTK_MAX_COMPOSE_LEN) 132 * nSeqs = number of sequences in the table 133 */ 134 public void addTable(ushort[] data, int maxSeqLen, int nSeqs) 135 { 136 gtk_im_context_simple_add_table(gtkIMContextSimple, data.ptr, maxSeqLen, nSeqs); 137 } 138 }