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