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.ATContext;
26 
27 private import gdk.Display;
28 private import glib.ConstructionException;
29 private import gobject.ObjectG;
30 private import gobject.Signals;
31 private import gtk.AccessibleIF;
32 private import gtk.c.functions;
33 public  import gtk.c.types;
34 private import std.algorithm;
35 
36 
37 /**
38  * `GtkATContext` is an abstract class provided by GTK to communicate to
39  * platform-specific assistive technologies API.
40  * 
41  * Each platform supported by GTK implements a `GtkATContext` subclass, and
42  * is responsible for updating the accessible state in response to state
43  * changes in `GtkAccessible`.
44  */
45 public class ATContext : ObjectG
46 {
47 	/** the main Gtk struct */
48 	protected GtkATContext* gtkATContext;
49 
50 	/** Get the main Gtk struct */
51 	public GtkATContext* getATContextStruct(bool transferOwnership = false)
52 	{
53 		if (transferOwnership)
54 			ownedRef = false;
55 		return gtkATContext;
56 	}
57 
58 	/** the main Gtk struct as a void* */
59 	protected override void* getStruct()
60 	{
61 		return cast(void*)gtkATContext;
62 	}
63 
64 	/**
65 	 * Sets our main struct and passes it to the parent class.
66 	 */
67 	public this (GtkATContext* gtkATContext, bool ownedRef = false)
68 	{
69 		this.gtkATContext = gtkATContext;
70 		super(cast(GObject*)gtkATContext, ownedRef);
71 	}
72 
73 
74 	/** */
75 	public static GType getType()
76 	{
77 		return gtk_at_context_get_type();
78 	}
79 
80 	/**
81 	 * Creates a new `GtkATContext` instance for the given accessible role,
82 	 * accessible instance, and display connection.
83 	 *
84 	 * The `GtkATContext` implementation being instantiated will depend on the
85 	 * platform.
86 	 *
87 	 * Params:
88 	 *     accessibleRole = the accessible role used by the `GtkATContext`
89 	 *     accessible = the `GtkAccessible` implementation using the `GtkATContext`
90 	 *     display = the `GdkDisplay` used by the `GtkATContext`
91 	 *
92 	 * Returns: the `GtkATContext`
93 	 *
94 	 * Throws: ConstructionException GTK+ fails to create the object.
95 	 */
96 	public this(GtkAccessibleRole accessibleRole, AccessibleIF accessible, Display display)
97 	{
98 		auto __p = gtk_at_context_create(accessibleRole, (accessible is null) ? null : accessible.getAccessibleStruct(), (display is null) ? null : display.getDisplayStruct());
99 
100 		if(__p is null)
101 		{
102 			throw new ConstructionException("null returned by create");
103 		}
104 
105 		this(cast(GtkATContext*) __p, true);
106 	}
107 
108 	/**
109 	 * Retrieves the `GtkAccessible` using this context.
110 	 *
111 	 * Returns: a `GtkAccessible`
112 	 */
113 	public AccessibleIF getAccessible()
114 	{
115 		auto __p = gtk_at_context_get_accessible(gtkATContext);
116 
117 		if(__p is null)
118 		{
119 			return null;
120 		}
121 
122 		return ObjectG.getDObject!(AccessibleIF)(cast(GtkAccessible*) __p);
123 	}
124 
125 	/**
126 	 * Retrieves the accessible role of this context.
127 	 *
128 	 * Returns: a `GtkAccessibleRole`
129 	 */
130 	public GtkAccessibleRole getAccessibleRole()
131 	{
132 		return gtk_at_context_get_accessible_role(gtkATContext);
133 	}
134 
135 	/**
136 	 * Emitted when the attributes of the accessible for the
137 	 * `GtkATContext` instance change.
138 	 */
139 	gulong addOnStateChange(void delegate(ATContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
140 	{
141 		return Signals.connect(this, "state-change", dlg, connectFlags ^ ConnectFlags.SWAPPED);
142 	}
143 }