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  * Conversion parameters:
26  * inFile  = GtkItem.html
27  * outPack = gtk
28  * outFile = Item
29  * strct   = GtkItem
30  * realStrct=
31  * ctorStrct=
32  * clss    = Item
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_item_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * structWrap:
48  * module aliases:
49  * local aliases:
50  * overrides:
51  */
52 
53 module gtk.Item;
54 
55 public  import gtkc.gtktypes;
56 
57 private import gtkc.gtk;
58 private import glib.ConstructionException;
59 private import gobject.ObjectG;
60 
61 private import gobject.Signals;
62 public  import gtkc.gdktypes;
63 
64 
65 
66 
67 private import gtk.Bin;
68 
69 /**
70  * Description
71  * The GtkItem widget is an abstract base class for GtkMenuItem, GtkListItem
72  * and GtkTreeItem.
73  * GtkItem is deprecated and will be removed in GTK+ 3.
74  */
75 public class Item : Bin
76 {
77 	
78 	/** the main Gtk struct */
79 	protected GtkItem* gtkItem;
80 	
81 	
82 	public GtkItem* getItemStruct()
83 	{
84 		return gtkItem;
85 	}
86 	
87 	
88 	/** the main Gtk struct as a void* */
89 	protected override void* getStruct()
90 	{
91 		return cast(void*)gtkItem;
92 	}
93 	
94 	/**
95 	 * Sets our main struct and passes it to the parent class
96 	 */
97 	public this (GtkItem* gtkItem)
98 	{
99 		super(cast(GtkBin*)gtkItem);
100 		this.gtkItem = gtkItem;
101 	}
102 	
103 	protected override void setStruct(GObject* obj)
104 	{
105 		super.setStruct(obj);
106 		gtkItem = cast(GtkItem*)obj;
107 	}
108 	
109 	/**
110 	 */
111 	int[string] connectedSignals;
112 	
113 	void delegate(Item)[] onDeselectListeners;
114 	/**
115 	 * Emitted when the item is deselected.
116 	 */
117 	void addOnDeselect(void delegate(Item) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
118 	{
119 		if ( !("deselect" in connectedSignals) )
120 		{
121 			Signals.connectData(
122 			getStruct(),
123 			"deselect",
124 			cast(GCallback)&callBackDeselect,
125 			cast(void*)this,
126 			null,
127 			connectFlags);
128 			connectedSignals["deselect"] = 1;
129 		}
130 		onDeselectListeners ~= dlg;
131 	}
132 	extern(C) static void callBackDeselect(GtkItem* itemStruct, Item _item)
133 	{
134 		foreach ( void delegate(Item) dlg ; _item.onDeselectListeners )
135 		{
136 			dlg(_item);
137 		}
138 	}
139 	
140 	void delegate(Item)[] onSelectListeners;
141 	/**
142 	 * Emitted when the item is selected.
143 	 */
144 	void addOnSelect(void delegate(Item) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
145 	{
146 		if ( !("select" in connectedSignals) )
147 		{
148 			Signals.connectData(
149 			getStruct(),
150 			"select",
151 			cast(GCallback)&callBackSelect,
152 			cast(void*)this,
153 			null,
154 			connectFlags);
155 			connectedSignals["select"] = 1;
156 		}
157 		onSelectListeners ~= dlg;
158 	}
159 	extern(C) static void callBackSelect(GtkItem* itemStruct, Item _item)
160 	{
161 		foreach ( void delegate(Item) dlg ; _item.onSelectListeners )
162 		{
163 			dlg(_item);
164 		}
165 	}
166 	
167 	void delegate(Item)[] onToggleListeners;
168 	/**
169 	 * Emitted when the item is toggled.
170 	 */
171 	void addOnToggle(void delegate(Item) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
172 	{
173 		if ( !("toggle" in connectedSignals) )
174 		{
175 			Signals.connectData(
176 			getStruct(),
177 			"toggle",
178 			cast(GCallback)&callBackToggle,
179 			cast(void*)this,
180 			null,
181 			connectFlags);
182 			connectedSignals["toggle"] = 1;
183 		}
184 		onToggleListeners ~= dlg;
185 	}
186 	extern(C) static void callBackToggle(GtkItem* itemStruct, Item _item)
187 	{
188 		foreach ( void delegate(Item) dlg ; _item.onToggleListeners )
189 		{
190 			dlg(_item);
191 		}
192 	}
193 	
194 	
195 	/**
196 	 * Warning
197 	 * gtk_item_select has been deprecated since version 2.22 and should not be used in newly-written code. Use gtk_menu_item_select() instead
198 	 * Emits the "select" signal on the given item.
199 	 */
200 	public void select()
201 	{
202 		// void gtk_item_select (GtkItem *item);
203 		gtk_item_select(gtkItem);
204 	}
205 	
206 	/**
207 	 * Warning
208 	 * gtk_item_deselect has been deprecated since version 2.22 and should not be used in newly-written code. Use gtk_menu_item_deselect() instead
209 	 * Emits the "deselect" signal on the given item.
210 	 */
211 	public void deselect()
212 	{
213 		// void gtk_item_deselect (GtkItem *item);
214 		gtk_item_deselect(gtkItem);
215 	}
216 	
217 	/**
218 	 * Warning
219 	 * gtk_item_toggle has been deprecated since version 2.22 and should not be used in newly-written code. This function will be removed in GTK+ 3
220 	 * Emits the "toggle" signal on the given item.
221 	 */
222 	public void toggle()
223 	{
224 		// void gtk_item_toggle (GtkItem *item);
225 		gtk_item_toggle(gtkItem);
226 	}
227 }