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 atk.WindowT;
26 
27 public  import atk.c.functions;
28 public  import atk.c.types;
29 public  import gobject.Signals;
30 public  import gtkc.atktypes;
31 public  import std.algorithm;
32 
33 
34 /**
35  * #AtkWindow should be implemented by the UI elements that represent
36  * a top-level window, such as the main window of an application or
37  * dialog.
38  */
39 public template WindowT(TStruct)
40 {
41 	/** Get the main Gtk struct */
42 	public AtkWindow* getWindowStruct(bool transferOwnership = false)
43 	{
44 		if (transferOwnership)
45 			ownedRef = false;
46 		return cast(AtkWindow*)getStruct();
47 	}
48 
49 
50 	protected class OnActivateDelegateWrapper
51 	{
52 		void delegate(WindowIF) dlg;
53 		gulong handlerId;
54 
55 		this(void delegate(WindowIF) dlg)
56 		{
57 			this.dlg = dlg;
58 			onActivateListeners ~= this;
59 		}
60 
61 		void remove(OnActivateDelegateWrapper source)
62 		{
63 			foreach(index, wrapper; onActivateListeners)
64 			{
65 				if (wrapper.handlerId == source.handlerId)
66 				{
67 					onActivateListeners[index] = null;
68 					onActivateListeners = std.algorithm.remove(onActivateListeners, index);
69 					break;
70 				}
71 			}
72 		}
73 	}
74 	OnActivateDelegateWrapper[] onActivateListeners;
75 
76 	/**
77 	 * The signal #AtkWindow::activate is emitted when a window
78 	 * becomes the active window of the application or session.
79 	 *
80 	 * Since: 2.2
81 	 */
82 	gulong addOnActivate(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
83 	{
84 		auto wrapper = new OnActivateDelegateWrapper(dlg);
85 		wrapper.handlerId = Signals.connectData(
86 			this,
87 			"activate",
88 			cast(GCallback)&callBackActivate,
89 			cast(void*)wrapper,
90 			cast(GClosureNotify)&callBackActivateDestroy,
91 			connectFlags);
92 		return wrapper.handlerId;
93 	}
94 
95 	extern(C) static void callBackActivate(AtkWindow* windowStruct, OnActivateDelegateWrapper wrapper)
96 	{
97 		wrapper.dlg(wrapper.outer);
98 	}
99 
100 	extern(C) static void callBackActivateDestroy(OnActivateDelegateWrapper wrapper, GClosure* closure)
101 	{
102 		wrapper.remove(wrapper);
103 	}
104 
105 	protected class OnCreateDelegateWrapper
106 	{
107 		void delegate(WindowIF) dlg;
108 		gulong handlerId;
109 
110 		this(void delegate(WindowIF) dlg)
111 		{
112 			this.dlg = dlg;
113 			onCreateListeners ~= this;
114 		}
115 
116 		void remove(OnCreateDelegateWrapper source)
117 		{
118 			foreach(index, wrapper; onCreateListeners)
119 			{
120 				if (wrapper.handlerId == source.handlerId)
121 				{
122 					onCreateListeners[index] = null;
123 					onCreateListeners = std.algorithm.remove(onCreateListeners, index);
124 					break;
125 				}
126 			}
127 		}
128 	}
129 	OnCreateDelegateWrapper[] onCreateListeners;
130 
131 	/**
132 	 * The signal #AtkWindow::create is emitted when a new window
133 	 * is created.
134 	 *
135 	 * Since: 2.2
136 	 */
137 	gulong addOnCreate(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
138 	{
139 		auto wrapper = new OnCreateDelegateWrapper(dlg);
140 		wrapper.handlerId = Signals.connectData(
141 			this,
142 			"create",
143 			cast(GCallback)&callBackCreate,
144 			cast(void*)wrapper,
145 			cast(GClosureNotify)&callBackCreateDestroy,
146 			connectFlags);
147 		return wrapper.handlerId;
148 	}
149 
150 	extern(C) static void callBackCreate(AtkWindow* windowStruct, OnCreateDelegateWrapper wrapper)
151 	{
152 		wrapper.dlg(wrapper.outer);
153 	}
154 
155 	extern(C) static void callBackCreateDestroy(OnCreateDelegateWrapper wrapper, GClosure* closure)
156 	{
157 		wrapper.remove(wrapper);
158 	}
159 
160 	protected class OnDeactivateDelegateWrapper
161 	{
162 		void delegate(WindowIF) dlg;
163 		gulong handlerId;
164 
165 		this(void delegate(WindowIF) dlg)
166 		{
167 			this.dlg = dlg;
168 			onDeactivateListeners ~= this;
169 		}
170 
171 		void remove(OnDeactivateDelegateWrapper source)
172 		{
173 			foreach(index, wrapper; onDeactivateListeners)
174 			{
175 				if (wrapper.handlerId == source.handlerId)
176 				{
177 					onDeactivateListeners[index] = null;
178 					onDeactivateListeners = std.algorithm.remove(onDeactivateListeners, index);
179 					break;
180 				}
181 			}
182 		}
183 	}
184 	OnDeactivateDelegateWrapper[] onDeactivateListeners;
185 
186 	/**
187 	 * The signal #AtkWindow::deactivate is emitted when a window is
188 	 * no longer the active window of the application or session.
189 	 *
190 	 * Since: 2.2
191 	 */
192 	gulong addOnDeactivate(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
193 	{
194 		auto wrapper = new OnDeactivateDelegateWrapper(dlg);
195 		wrapper.handlerId = Signals.connectData(
196 			this,
197 			"deactivate",
198 			cast(GCallback)&callBackDeactivate,
199 			cast(void*)wrapper,
200 			cast(GClosureNotify)&callBackDeactivateDestroy,
201 			connectFlags);
202 		return wrapper.handlerId;
203 	}
204 
205 	extern(C) static void callBackDeactivate(AtkWindow* windowStruct, OnDeactivateDelegateWrapper wrapper)
206 	{
207 		wrapper.dlg(wrapper.outer);
208 	}
209 
210 	extern(C) static void callBackDeactivateDestroy(OnDeactivateDelegateWrapper wrapper, GClosure* closure)
211 	{
212 		wrapper.remove(wrapper);
213 	}
214 
215 	protected class OnDestroyDelegateWrapper
216 	{
217 		void delegate(WindowIF) dlg;
218 		gulong handlerId;
219 
220 		this(void delegate(WindowIF) dlg)
221 		{
222 			this.dlg = dlg;
223 			onDestroyListeners ~= this;
224 		}
225 
226 		void remove(OnDestroyDelegateWrapper source)
227 		{
228 			foreach(index, wrapper; onDestroyListeners)
229 			{
230 				if (wrapper.handlerId == source.handlerId)
231 				{
232 					onDestroyListeners[index] = null;
233 					onDestroyListeners = std.algorithm.remove(onDestroyListeners, index);
234 					break;
235 				}
236 			}
237 		}
238 	}
239 	OnDestroyDelegateWrapper[] onDestroyListeners;
240 
241 	/**
242 	 * The signal #AtkWindow::destroy is emitted when a window is
243 	 * destroyed.
244 	 *
245 	 * Since: 2.2
246 	 */
247 	gulong addOnDestroy(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
248 	{
249 		auto wrapper = new OnDestroyDelegateWrapper(dlg);
250 		wrapper.handlerId = Signals.connectData(
251 			this,
252 			"destroy",
253 			cast(GCallback)&callBackDestroy,
254 			cast(void*)wrapper,
255 			cast(GClosureNotify)&callBackDestroyDestroy,
256 			connectFlags);
257 		return wrapper.handlerId;
258 	}
259 
260 	extern(C) static void callBackDestroy(AtkWindow* windowStruct, OnDestroyDelegateWrapper wrapper)
261 	{
262 		wrapper.dlg(wrapper.outer);
263 	}
264 
265 	extern(C) static void callBackDestroyDestroy(OnDestroyDelegateWrapper wrapper, GClosure* closure)
266 	{
267 		wrapper.remove(wrapper);
268 	}
269 
270 	protected class OnMaximizeDelegateWrapper
271 	{
272 		void delegate(WindowIF) dlg;
273 		gulong handlerId;
274 
275 		this(void delegate(WindowIF) dlg)
276 		{
277 			this.dlg = dlg;
278 			onMaximizeListeners ~= this;
279 		}
280 
281 		void remove(OnMaximizeDelegateWrapper source)
282 		{
283 			foreach(index, wrapper; onMaximizeListeners)
284 			{
285 				if (wrapper.handlerId == source.handlerId)
286 				{
287 					onMaximizeListeners[index] = null;
288 					onMaximizeListeners = std.algorithm.remove(onMaximizeListeners, index);
289 					break;
290 				}
291 			}
292 		}
293 	}
294 	OnMaximizeDelegateWrapper[] onMaximizeListeners;
295 
296 	/**
297 	 * The signal #AtkWindow::maximize is emitted when a window
298 	 * is maximized.
299 	 *
300 	 * Since: 2.2
301 	 */
302 	gulong addOnMaximize(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
303 	{
304 		auto wrapper = new OnMaximizeDelegateWrapper(dlg);
305 		wrapper.handlerId = Signals.connectData(
306 			this,
307 			"maximize",
308 			cast(GCallback)&callBackMaximize,
309 			cast(void*)wrapper,
310 			cast(GClosureNotify)&callBackMaximizeDestroy,
311 			connectFlags);
312 		return wrapper.handlerId;
313 	}
314 
315 	extern(C) static void callBackMaximize(AtkWindow* windowStruct, OnMaximizeDelegateWrapper wrapper)
316 	{
317 		wrapper.dlg(wrapper.outer);
318 	}
319 
320 	extern(C) static void callBackMaximizeDestroy(OnMaximizeDelegateWrapper wrapper, GClosure* closure)
321 	{
322 		wrapper.remove(wrapper);
323 	}
324 
325 	protected class OnMinimizeDelegateWrapper
326 	{
327 		void delegate(WindowIF) dlg;
328 		gulong handlerId;
329 
330 		this(void delegate(WindowIF) dlg)
331 		{
332 			this.dlg = dlg;
333 			onMinimizeListeners ~= this;
334 		}
335 
336 		void remove(OnMinimizeDelegateWrapper source)
337 		{
338 			foreach(index, wrapper; onMinimizeListeners)
339 			{
340 				if (wrapper.handlerId == source.handlerId)
341 				{
342 					onMinimizeListeners[index] = null;
343 					onMinimizeListeners = std.algorithm.remove(onMinimizeListeners, index);
344 					break;
345 				}
346 			}
347 		}
348 	}
349 	OnMinimizeDelegateWrapper[] onMinimizeListeners;
350 
351 	/**
352 	 * The signal #AtkWindow::minimize is emitted when a window
353 	 * is minimized.
354 	 *
355 	 * Since: 2.2
356 	 */
357 	gulong addOnMinimize(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
358 	{
359 		auto wrapper = new OnMinimizeDelegateWrapper(dlg);
360 		wrapper.handlerId = Signals.connectData(
361 			this,
362 			"minimize",
363 			cast(GCallback)&callBackMinimize,
364 			cast(void*)wrapper,
365 			cast(GClosureNotify)&callBackMinimizeDestroy,
366 			connectFlags);
367 		return wrapper.handlerId;
368 	}
369 
370 	extern(C) static void callBackMinimize(AtkWindow* windowStruct, OnMinimizeDelegateWrapper wrapper)
371 	{
372 		wrapper.dlg(wrapper.outer);
373 	}
374 
375 	extern(C) static void callBackMinimizeDestroy(OnMinimizeDelegateWrapper wrapper, GClosure* closure)
376 	{
377 		wrapper.remove(wrapper);
378 	}
379 
380 	protected class OnMoveDelegateWrapper
381 	{
382 		void delegate(WindowIF) dlg;
383 		gulong handlerId;
384 
385 		this(void delegate(WindowIF) dlg)
386 		{
387 			this.dlg = dlg;
388 			onMoveListeners ~= this;
389 		}
390 
391 		void remove(OnMoveDelegateWrapper source)
392 		{
393 			foreach(index, wrapper; onMoveListeners)
394 			{
395 				if (wrapper.handlerId == source.handlerId)
396 				{
397 					onMoveListeners[index] = null;
398 					onMoveListeners = std.algorithm.remove(onMoveListeners, index);
399 					break;
400 				}
401 			}
402 		}
403 	}
404 	OnMoveDelegateWrapper[] onMoveListeners;
405 
406 	/**
407 	 * The signal #AtkWindow::move is emitted when a window
408 	 * is moved.
409 	 *
410 	 * Since: 2.2
411 	 */
412 	gulong addOnMove(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
413 	{
414 		auto wrapper = new OnMoveDelegateWrapper(dlg);
415 		wrapper.handlerId = Signals.connectData(
416 			this,
417 			"move",
418 			cast(GCallback)&callBackMove,
419 			cast(void*)wrapper,
420 			cast(GClosureNotify)&callBackMoveDestroy,
421 			connectFlags);
422 		return wrapper.handlerId;
423 	}
424 
425 	extern(C) static void callBackMove(AtkWindow* windowStruct, OnMoveDelegateWrapper wrapper)
426 	{
427 		wrapper.dlg(wrapper.outer);
428 	}
429 
430 	extern(C) static void callBackMoveDestroy(OnMoveDelegateWrapper wrapper, GClosure* closure)
431 	{
432 		wrapper.remove(wrapper);
433 	}
434 
435 	protected class OnResizeDelegateWrapper
436 	{
437 		void delegate(WindowIF) dlg;
438 		gulong handlerId;
439 
440 		this(void delegate(WindowIF) dlg)
441 		{
442 			this.dlg = dlg;
443 			onResizeListeners ~= this;
444 		}
445 
446 		void remove(OnResizeDelegateWrapper source)
447 		{
448 			foreach(index, wrapper; onResizeListeners)
449 			{
450 				if (wrapper.handlerId == source.handlerId)
451 				{
452 					onResizeListeners[index] = null;
453 					onResizeListeners = std.algorithm.remove(onResizeListeners, index);
454 					break;
455 				}
456 			}
457 		}
458 	}
459 	OnResizeDelegateWrapper[] onResizeListeners;
460 
461 	/**
462 	 * The signal #AtkWindow::resize is emitted when a window
463 	 * is resized.
464 	 *
465 	 * Since: 2.2
466 	 */
467 	gulong addOnResize(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
468 	{
469 		auto wrapper = new OnResizeDelegateWrapper(dlg);
470 		wrapper.handlerId = Signals.connectData(
471 			this,
472 			"resize",
473 			cast(GCallback)&callBackResize,
474 			cast(void*)wrapper,
475 			cast(GClosureNotify)&callBackResizeDestroy,
476 			connectFlags);
477 		return wrapper.handlerId;
478 	}
479 
480 	extern(C) static void callBackResize(AtkWindow* windowStruct, OnResizeDelegateWrapper wrapper)
481 	{
482 		wrapper.dlg(wrapper.outer);
483 	}
484 
485 	extern(C) static void callBackResizeDestroy(OnResizeDelegateWrapper wrapper, GClosure* closure)
486 	{
487 		wrapper.remove(wrapper);
488 	}
489 
490 	protected class OnRestoreDelegateWrapper
491 	{
492 		void delegate(WindowIF) dlg;
493 		gulong handlerId;
494 
495 		this(void delegate(WindowIF) dlg)
496 		{
497 			this.dlg = dlg;
498 			onRestoreListeners ~= this;
499 		}
500 
501 		void remove(OnRestoreDelegateWrapper source)
502 		{
503 			foreach(index, wrapper; onRestoreListeners)
504 			{
505 				if (wrapper.handlerId == source.handlerId)
506 				{
507 					onRestoreListeners[index] = null;
508 					onRestoreListeners = std.algorithm.remove(onRestoreListeners, index);
509 					break;
510 				}
511 			}
512 		}
513 	}
514 	OnRestoreDelegateWrapper[] onRestoreListeners;
515 
516 	/**
517 	 * The signal #AtkWindow::restore is emitted when a window
518 	 * is restored.
519 	 *
520 	 * Since: 2.2
521 	 */
522 	gulong addOnRestore(void delegate(WindowIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
523 	{
524 		auto wrapper = new OnRestoreDelegateWrapper(dlg);
525 		wrapper.handlerId = Signals.connectData(
526 			this,
527 			"restore",
528 			cast(GCallback)&callBackRestore,
529 			cast(void*)wrapper,
530 			cast(GClosureNotify)&callBackRestoreDestroy,
531 			connectFlags);
532 		return wrapper.handlerId;
533 	}
534 
535 	extern(C) static void callBackRestore(AtkWindow* windowStruct, OnRestoreDelegateWrapper wrapper)
536 	{
537 		wrapper.dlg(wrapper.outer);
538 	}
539 
540 	extern(C) static void callBackRestoreDestroy(OnRestoreDelegateWrapper wrapper, GClosure* closure)
541 	{
542 		wrapper.remove(wrapper);
543 	}
544 }