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