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 void delegate(WindowIF) dlg; 52 gulong handlerId; 53 54 this(void delegate(WindowIF) dlg) 55 { 56 this.dlg = dlg; 57 onActivateListeners ~= this; 58 } 59 60 void remove(OnActivateDelegateWrapper source) 61 { 62 foreach(index, wrapper; onActivateListeners) 63 { 64 if (wrapper.handlerId == source.handlerId) 65 { 66 onActivateListeners[index] = null; 67 onActivateListeners = std.algorithm.remove(onActivateListeners, index); 68 break; 69 } 70 } 71 } 72 } 73 OnActivateDelegateWrapper[] onActivateListeners; 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 void delegate(WindowIF) dlg; 107 gulong handlerId; 108 109 this(void delegate(WindowIF) dlg) 110 { 111 this.dlg = dlg; 112 onCreateListeners ~= this; 113 } 114 115 void remove(OnCreateDelegateWrapper source) 116 { 117 foreach(index, wrapper; onCreateListeners) 118 { 119 if (wrapper.handlerId == source.handlerId) 120 { 121 onCreateListeners[index] = null; 122 onCreateListeners = std.algorithm.remove(onCreateListeners, index); 123 break; 124 } 125 } 126 } 127 } 128 OnCreateDelegateWrapper[] onCreateListeners; 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 void delegate(WindowIF) dlg; 162 gulong handlerId; 163 164 this(void delegate(WindowIF) dlg) 165 { 166 this.dlg = dlg; 167 onDeactivateListeners ~= this; 168 } 169 170 void remove(OnDeactivateDelegateWrapper source) 171 { 172 foreach(index, wrapper; onDeactivateListeners) 173 { 174 if (wrapper.handlerId == source.handlerId) 175 { 176 onDeactivateListeners[index] = null; 177 onDeactivateListeners = std.algorithm.remove(onDeactivateListeners, index); 178 break; 179 } 180 } 181 } 182 } 183 OnDeactivateDelegateWrapper[] onDeactivateListeners; 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 void delegate(WindowIF) dlg; 217 gulong handlerId; 218 219 this(void delegate(WindowIF) dlg) 220 { 221 this.dlg = dlg; 222 onDestroyListeners ~= this; 223 } 224 225 void remove(OnDestroyDelegateWrapper source) 226 { 227 foreach(index, wrapper; onDestroyListeners) 228 { 229 if (wrapper.handlerId == source.handlerId) 230 { 231 onDestroyListeners[index] = null; 232 onDestroyListeners = std.algorithm.remove(onDestroyListeners, index); 233 break; 234 } 235 } 236 } 237 } 238 OnDestroyDelegateWrapper[] onDestroyListeners; 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 void delegate(WindowIF) dlg; 272 gulong handlerId; 273 274 this(void delegate(WindowIF) dlg) 275 { 276 this.dlg = dlg; 277 onMaximizeListeners ~= this; 278 } 279 280 void remove(OnMaximizeDelegateWrapper source) 281 { 282 foreach(index, wrapper; onMaximizeListeners) 283 { 284 if (wrapper.handlerId == source.handlerId) 285 { 286 onMaximizeListeners[index] = null; 287 onMaximizeListeners = std.algorithm.remove(onMaximizeListeners, index); 288 break; 289 } 290 } 291 } 292 } 293 OnMaximizeDelegateWrapper[] onMaximizeListeners; 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 void delegate(WindowIF) dlg; 327 gulong handlerId; 328 329 this(void delegate(WindowIF) dlg) 330 { 331 this.dlg = dlg; 332 onMinimizeListeners ~= this; 333 } 334 335 void remove(OnMinimizeDelegateWrapper source) 336 { 337 foreach(index, wrapper; onMinimizeListeners) 338 { 339 if (wrapper.handlerId == source.handlerId) 340 { 341 onMinimizeListeners[index] = null; 342 onMinimizeListeners = std.algorithm.remove(onMinimizeListeners, index); 343 break; 344 } 345 } 346 } 347 } 348 OnMinimizeDelegateWrapper[] onMinimizeListeners; 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 void delegate(WindowIF) dlg; 382 gulong handlerId; 383 384 this(void delegate(WindowIF) dlg) 385 { 386 this.dlg = dlg; 387 onMoveListeners ~= this; 388 } 389 390 void remove(OnMoveDelegateWrapper source) 391 { 392 foreach(index, wrapper; onMoveListeners) 393 { 394 if (wrapper.handlerId == source.handlerId) 395 { 396 onMoveListeners[index] = null; 397 onMoveListeners = std.algorithm.remove(onMoveListeners, index); 398 break; 399 } 400 } 401 } 402 } 403 OnMoveDelegateWrapper[] onMoveListeners; 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 void delegate(WindowIF) dlg; 437 gulong handlerId; 438 439 this(void delegate(WindowIF) dlg) 440 { 441 this.dlg = dlg; 442 onResizeListeners ~= this; 443 } 444 445 void remove(OnResizeDelegateWrapper source) 446 { 447 foreach(index, wrapper; onResizeListeners) 448 { 449 if (wrapper.handlerId == source.handlerId) 450 { 451 onResizeListeners[index] = null; 452 onResizeListeners = std.algorithm.remove(onResizeListeners, index); 453 break; 454 } 455 } 456 } 457 } 458 OnResizeDelegateWrapper[] onResizeListeners; 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 void delegate(WindowIF) dlg; 492 gulong handlerId; 493 494 this(void delegate(WindowIF) dlg) 495 { 496 this.dlg = dlg; 497 onRestoreListeners ~= this; 498 } 499 500 void remove(OnRestoreDelegateWrapper source) 501 { 502 foreach(index, wrapper; onRestoreListeners) 503 { 504 if (wrapper.handlerId == source.handlerId) 505 { 506 onRestoreListeners[index] = null; 507 onRestoreListeners = std.algorithm.remove(onRestoreListeners, index); 508 break; 509 } 510 } 511 } 512 } 513 OnRestoreDelegateWrapper[] onRestoreListeners; 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 }