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