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 * ## Unicode characters 48 * 49 * GtkIMContextSimple also supports numeric entry of Unicode characters 50 * by typing Ctrl-Shift-u, followed by a hexadecimal Unicode codepoint. 51 * For example, Ctrl-Shift-u 1 2 3 Enter yields U+0123 LATIN SMALL LETTER 52 * G WITH CEDILLA, i.e. ģ. 53 * 54 * ## Emoji 55 * 56 * GtkIMContextSimple also supports entry of Emoji by their name. 57 * This works by first typing Ctrl-Shift-e, followed by an Emoji name. 58 * 59 * The following names are supported: 60 * - :-) 🙂 61 * - 8-) 😍 62 * - <3 ❤ 63 * - kiss 💋 64 * - grin 😁 65 * - joy 😂 66 * - :-* 😚 67 * - xD 😆 68 * - like 👍 69 * - dislike 👎 70 * - up 👆 71 * - v ✌ 72 * - ok 👌 73 * - B-) 😎 74 * - ;-) 😉 75 * - ;-P 😜 76 * - :-p 😋 77 * - 3( 😔 78 * - :-( 😞 79 * - :] 😏 80 * - :'( 😢 81 * - :_( 😭 82 * - :(( 😩 83 * - :o 😨 84 * - :| 😐 85 * - 3-) 😌 86 * - >( 😠 87 * - >(( 😡 88 * - O:) 😇 89 * - ;o 😰 90 * - 8| 😳 91 * - 8o 😲 92 * - :X 😷 93 * - }:) 😈 94 */ 95 public class IMContextSimple : IMContext 96 { 97 /** the main Gtk struct */ 98 protected GtkIMContextSimple* gtkIMContextSimple; 99 100 /** Get the main Gtk struct */ 101 public GtkIMContextSimple* getIMContextSimpleStruct(bool transferOwnership = false) 102 { 103 if (transferOwnership) 104 ownedRef = false; 105 return gtkIMContextSimple; 106 } 107 108 /** the main Gtk struct as a void* */ 109 protected override void* getStruct() 110 { 111 return cast(void*)gtkIMContextSimple; 112 } 113 114 /** 115 * Sets our main struct and passes it to the parent class. 116 */ 117 public this (GtkIMContextSimple* gtkIMContextSimple, bool ownedRef = false) 118 { 119 this.gtkIMContextSimple = gtkIMContextSimple; 120 super(cast(GtkIMContext*)gtkIMContextSimple, ownedRef); 121 } 122 123 124 /** */ 125 public static GType getType() 126 { 127 return gtk_im_context_simple_get_type(); 128 } 129 130 /** 131 * Creates a new #GtkIMContextSimple. 132 * 133 * Returns: a new #GtkIMContextSimple. 134 * 135 * Throws: ConstructionException GTK+ fails to create the object. 136 */ 137 public this() 138 { 139 auto p = gtk_im_context_simple_new(); 140 141 if(p is null) 142 { 143 throw new ConstructionException("null returned by new"); 144 } 145 146 this(cast(GtkIMContextSimple*) p, true); 147 } 148 149 /** */ 150 public void addComposeFile(string composeFile) 151 { 152 gtk_im_context_simple_add_compose_file(gtkIMContextSimple, Str.toStringz(composeFile)); 153 } 154 155 /** 156 * Adds an additional table to search to the input context. 157 * Each row of the table consists of @max_seq_len key symbols 158 * followed by two #guint16 interpreted as the high and low 159 * words of a #gunicode value. Tables are searched starting 160 * from the last added. 161 * 162 * The table must be sorted in dictionary order on the 163 * numeric value of the key symbol fields. (Values beyond 164 * the length of the sequence should be zero.) 165 * 166 * Params: 167 * data = the table 168 * maxSeqLen = Maximum length of a sequence in the table 169 * (cannot be greater than #GTK_MAX_COMPOSE_LEN) 170 * nSeqs = number of sequences in the table 171 */ 172 public void addTable(ushort[] data, int maxSeqLen, int nSeqs) 173 { 174 gtk_im_context_simple_add_table(gtkIMContextSimple, data.ptr, maxSeqLen, nSeqs); 175 } 176 }