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 protected override void setStruct(GObject* obj) 115 { 116 gtkIMContextSimple = cast(GtkIMContextSimple*)obj; 117 super.setStruct(obj); 118 } 119 120 /** 121 * Sets our main struct and passes it to the parent class. 122 */ 123 public this (GtkIMContextSimple* gtkIMContextSimple, bool ownedRef = false) 124 { 125 this.gtkIMContextSimple = gtkIMContextSimple; 126 super(cast(GtkIMContext*)gtkIMContextSimple, ownedRef); 127 } 128 129 130 /** */ 131 public static GType getType() 132 { 133 return gtk_im_context_simple_get_type(); 134 } 135 136 /** 137 * Creates a new #GtkIMContextSimple. 138 * 139 * Returns: a new #GtkIMContextSimple. 140 * 141 * Throws: ConstructionException GTK+ fails to create the object. 142 */ 143 public this() 144 { 145 auto p = gtk_im_context_simple_new(); 146 147 if(p is null) 148 { 149 throw new ConstructionException("null returned by new"); 150 } 151 152 this(cast(GtkIMContextSimple*) p, true); 153 } 154 155 /** */ 156 public void addComposeFile(string composeFile) 157 { 158 gtk_im_context_simple_add_compose_file(gtkIMContextSimple, Str.toStringz(composeFile)); 159 } 160 161 /** 162 * Adds an additional table to search to the input context. 163 * Each row of the table consists of @max_seq_len key symbols 164 * followed by two #guint16 interpreted as the high and low 165 * words of a #gunicode value. Tables are searched starting 166 * from the last added. 167 * 168 * The table must be sorted in dictionary order on the 169 * numeric value of the key symbol fields. (Values beyond 170 * the length of the sequence should be zero.) 171 * 172 * Params: 173 * data = the table 174 * maxSeqLen = Maximum length of a sequence in the table 175 * (cannot be greater than #GTK_MAX_COMPOSE_LEN) 176 * nSeqs = number of sequences in the table 177 */ 178 public void addTable(ushort[] data, int maxSeqLen, int nSeqs) 179 { 180 gtk_im_context_simple_add_table(gtkIMContextSimple, data.ptr, maxSeqLen, nSeqs); 181 } 182 }