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.IMMulticontext;
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.MenuShell;
32 private import gtkc.gtk;
33 public  import gtkc.gtktypes;
34 
35 
36 /** */
37 public class IMMulticontext : IMContext
38 {
39 	/** the main Gtk struct */
40 	protected GtkIMMulticontext* gtkIMMulticontext;
41 
42 	/** Get the main Gtk struct */
43 	public GtkIMMulticontext* getIMMulticontextStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return gtkIMMulticontext;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected override void* getStruct()
52 	{
53 		return cast(void*)gtkIMMulticontext;
54 	}
55 
56 	protected override void setStruct(GObject* obj)
57 	{
58 		gtkIMMulticontext = cast(GtkIMMulticontext*)obj;
59 		super.setStruct(obj);
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GtkIMMulticontext* gtkIMMulticontext, bool ownedRef = false)
66 	{
67 		this.gtkIMMulticontext = gtkIMMulticontext;
68 		super(cast(GtkIMContext*)gtkIMMulticontext, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return gtk_im_multicontext_get_type();
76 	}
77 
78 	/**
79 	 * Creates a new #GtkIMMulticontext.
80 	 *
81 	 * Returns: a new #GtkIMMulticontext.
82 	 *
83 	 * Throws: ConstructionException GTK+ fails to create the object.
84 	 */
85 	public this()
86 	{
87 		auto p = gtk_im_multicontext_new();
88 		
89 		if(p is null)
90 		{
91 			throw new ConstructionException("null returned by new");
92 		}
93 		
94 		this(cast(GtkIMMulticontext*) p, true);
95 	}
96 
97 	/**
98 	 * Add menuitems for various available input methods to a menu;
99 	 * the menuitems, when selected, will switch the input method
100 	 * for the context and the global default input method.
101 	 *
102 	 * Deprecated: It is better to use the system-wide input
103 	 * method framework for changing input methods. Modern
104 	 * desktop shells offer on-screen displays for this that
105 	 * can triggered with a keyboard shortcut, e.g. Super-Space.
106 	 *
107 	 * Params:
108 	 *     menushell = a #GtkMenuShell
109 	 */
110 	public void appendMenuitems(MenuShell menushell)
111 	{
112 		gtk_im_multicontext_append_menuitems(gtkIMMulticontext, (menushell is null) ? null : menushell.getMenuShellStruct());
113 	}
114 
115 	/**
116 	 * Gets the id of the currently active slave of the @context.
117 	 *
118 	 * Returns: the id of the currently active slave
119 	 *
120 	 * Since: 2.16
121 	 */
122 	public string getContextId()
123 	{
124 		return Str.toString(gtk_im_multicontext_get_context_id(gtkIMMulticontext));
125 	}
126 
127 	/**
128 	 * Sets the context id for @context.
129 	 *
130 	 * This causes the currently active slave of @context to be
131 	 * replaced by the slave corresponding to the new context id.
132 	 *
133 	 * Params:
134 	 *     contextId = the id to use
135 	 *
136 	 * Since: 2.16
137 	 */
138 	public void setContextId(string contextId)
139 	{
140 		gtk_im_multicontext_set_context_id(gtkIMMulticontext, Str.toStringz(contextId));
141 	}
142 }