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.TableT; 26 27 public import atk.ObjectAtk; 28 public import glib.Str; 29 public import gobject.ObjectG; 30 public import gobject.Signals; 31 public import gtkc.atk; 32 public import gtkc.atktypes; 33 public import std.algorithm; 34 35 36 /** 37 * #AtkTable should be implemented by components which present 38 * elements ordered via rows and columns. It may also be used to 39 * present tree-structured information if the nodes of the trees can 40 * be said to contain multiple "columns". Individual elements of an 41 * #AtkTable are typically referred to as "cells". Those cells should 42 * implement the interface #AtkTableCell, but #Atk doesn't require 43 * them to be direct children of the current #AtkTable. They can be 44 * grand-children, grand-grand-children etc. #AtkTable provides the 45 * API needed to get a individual cell based on the row and column 46 * numbers. 47 * 48 * Children of #AtkTable are frequently "lightweight" objects, that 49 * is, they may not have backing widgets in the host UI toolkit. They 50 * are therefore often transient. 51 * 52 * Since tables are often very complex, #AtkTable includes provision 53 * for offering simplified summary information, as well as row and 54 * column headers and captions. Headers and captions are #AtkObjects 55 * which may implement other interfaces (#AtkText, #AtkImage, etc.) as 56 * appropriate. #AtkTable summaries may themselves be (simplified) 57 * #AtkTables, etc. 58 * 59 * Note for implementors: in the past, #AtkTable required that all the 60 * cells should be direct children of #AtkTable, and provided some 61 * index based methods to request the cells. The practice showed that 62 * that forcing made #AtkTable implementation complex, and hard to 63 * expose other kind of children, like rows or captions. Right now, 64 * index-based methods are deprecated. 65 */ 66 public template TableT(TStruct) 67 { 68 /** Get the main Gtk struct */ 69 public AtkTable* getTableStruct(bool transferOwnership = false) 70 { 71 if (transferOwnership) 72 ownedRef = false; 73 return cast(AtkTable*)getStruct(); 74 } 75 76 77 /** 78 * Adds the specified @column to the selection. 79 * 80 * Params: 81 * column = a #gint representing a column in @table 82 * 83 * Returns: a gboolean representing if the column was successfully added to 84 * the selection, or 0 if value does not implement this interface. 85 */ 86 public bool addColumnSelection(int column) 87 { 88 return atk_table_add_column_selection(getTableStruct(), column) != 0; 89 } 90 91 /** 92 * Adds the specified @row to the selection. 93 * 94 * Params: 95 * row = a #gint representing a row in @table 96 * 97 * Returns: a gboolean representing if row was successfully added to selection, 98 * or 0 if value does not implement this interface. 99 */ 100 public bool addRowSelection(int row) 101 { 102 return atk_table_add_row_selection(getTableStruct(), row) != 0; 103 } 104 105 /** 106 * Gets the caption for the @table. 107 * 108 * Returns: a AtkObject* representing the 109 * table caption, or %NULL if value does not implement this interface. 110 */ 111 public ObjectAtk getCaption() 112 { 113 auto p = atk_table_get_caption(getTableStruct()); 114 115 if(p is null) 116 { 117 return null; 118 } 119 120 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 121 } 122 123 /** 124 * Gets a #gint representing the column at the specified @index_. 125 * 126 * Deprecated: Since 2.12. 127 * 128 * Params: 129 * index = a #gint representing an index in @table 130 * 131 * Returns: a gint representing the column at the specified index, 132 * or -1 if the table does not implement this method. 133 */ 134 public int getColumnAtIndex(int index) 135 { 136 return atk_table_get_column_at_index(getTableStruct(), index); 137 } 138 139 /** 140 * Gets the description text of the specified @column in the table 141 * 142 * Params: 143 * column = a #gint representing a column in @table 144 * 145 * Returns: a gchar* representing the column description, or %NULL 146 * if value does not implement this interface. 147 */ 148 public string getColumnDescription(int column) 149 { 150 return Str.toString(atk_table_get_column_description(getTableStruct(), column)); 151 } 152 153 /** 154 * Gets the number of columns occupied by the accessible object 155 * at the specified @row and @column in the @table. 156 * 157 * Params: 158 * row = a #gint representing a row in @table 159 * column = a #gint representing a column in @table 160 * 161 * Returns: a gint representing the column extent at specified position, or 0 162 * if value does not implement this interface. 163 */ 164 public int getColumnExtentAt(int row, int column) 165 { 166 return atk_table_get_column_extent_at(getTableStruct(), row, column); 167 } 168 169 /** 170 * Gets the column header of a specified column in an accessible table. 171 * 172 * Params: 173 * column = a #gint representing a column in the table 174 * 175 * Returns: a AtkObject* representing the 176 * specified column header, or %NULL if value does not implement this 177 * interface. 178 */ 179 public ObjectAtk getColumnHeader(int column) 180 { 181 auto p = atk_table_get_column_header(getTableStruct(), column); 182 183 if(p is null) 184 { 185 return null; 186 } 187 188 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 189 } 190 191 /** 192 * Gets a #gint representing the index at the specified @row and 193 * @column. 194 * 195 * Deprecated: Since 2.12. Use atk_table_ref_at() in order to get the 196 * accessible that represents the cell at (@row, @column) 197 * 198 * Params: 199 * row = a #gint representing a row in @table 200 * column = a #gint representing a column in @table 201 * 202 * Returns: a #gint representing the index at specified position. 203 * The value -1 is returned if the object at row,column is not a child 204 * of table or table does not implement this interface. 205 */ 206 public int getIndexAt(int row, int column) 207 { 208 return atk_table_get_index_at(getTableStruct(), row, column); 209 } 210 211 /** 212 * Gets the number of columns in the table. 213 * 214 * Returns: a gint representing the number of columns, or 0 215 * if value does not implement this interface. 216 */ 217 public int getNColumns() 218 { 219 return atk_table_get_n_columns(getTableStruct()); 220 } 221 222 /** 223 * Gets the number of rows in the table. 224 * 225 * Returns: a gint representing the number of rows, or 0 226 * if value does not implement this interface. 227 */ 228 public int getNRows() 229 { 230 return atk_table_get_n_rows(getTableStruct()); 231 } 232 233 /** 234 * Gets a #gint representing the row at the specified @index_. 235 * 236 * Deprecated: since 2.12. 237 * 238 * Params: 239 * index = a #gint representing an index in @table 240 * 241 * Returns: a gint representing the row at the specified index, 242 * or -1 if the table does not implement this method. 243 */ 244 public int getRowAtIndex(int index) 245 { 246 return atk_table_get_row_at_index(getTableStruct(), index); 247 } 248 249 /** 250 * Gets the description text of the specified row in the table 251 * 252 * Params: 253 * row = a #gint representing a row in @table 254 * 255 * Returns: a gchar* representing the row description, or 256 * %NULL if value does not implement this interface. 257 */ 258 public string getRowDescription(int row) 259 { 260 return Str.toString(atk_table_get_row_description(getTableStruct(), row)); 261 } 262 263 /** 264 * Gets the number of rows occupied by the accessible object 265 * at a specified @row and @column in the @table. 266 * 267 * Params: 268 * row = a #gint representing a row in @table 269 * column = a #gint representing a column in @table 270 * 271 * Returns: a gint representing the row extent at specified position, or 0 272 * if value does not implement this interface. 273 */ 274 public int getRowExtentAt(int row, int column) 275 { 276 return atk_table_get_row_extent_at(getTableStruct(), row, column); 277 } 278 279 /** 280 * Gets the row header of a specified row in an accessible table. 281 * 282 * Params: 283 * row = a #gint representing a row in the table 284 * 285 * Returns: a AtkObject* representing the 286 * specified row header, or %NULL if value does not implement this 287 * interface. 288 */ 289 public ObjectAtk getRowHeader(int row) 290 { 291 auto p = atk_table_get_row_header(getTableStruct(), row); 292 293 if(p is null) 294 { 295 return null; 296 } 297 298 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p); 299 } 300 301 /** 302 * Gets the selected columns of the table by initializing **selected with 303 * the selected column numbers. This array should be freed by the caller. 304 * 305 * Params: 306 * selected = a #gint** that is to contain the selected columns numbers 307 * 308 * Returns: a gint representing the number of selected columns, 309 * or %0 if value does not implement this interface. 310 */ 311 public int getSelectedColumns(int** selected) 312 { 313 return atk_table_get_selected_columns(getTableStruct(), selected); 314 } 315 316 /** 317 * Gets the selected rows of the table by initializing **selected with 318 * the selected row numbers. This array should be freed by the caller. 319 * 320 * Params: 321 * selected = a #gint** that is to contain the selected row numbers 322 * 323 * Returns: a gint representing the number of selected rows, 324 * or zero if value does not implement this interface. 325 */ 326 public int getSelectedRows(int** selected) 327 { 328 return atk_table_get_selected_rows(getTableStruct(), selected); 329 } 330 331 /** 332 * Gets the summary description of the table. 333 * 334 * Returns: a AtkObject* representing a summary description 335 * of the table, or zero if value does not implement this interface. 336 */ 337 public ObjectAtk getSummary() 338 { 339 auto p = atk_table_get_summary(getTableStruct()); 340 341 if(p is null) 342 { 343 return null; 344 } 345 346 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p, true); 347 } 348 349 /** 350 * Gets a boolean value indicating whether the specified @column 351 * is selected 352 * 353 * Params: 354 * column = a #gint representing a column in @table 355 * 356 * Returns: a gboolean representing if the column is selected, or 0 357 * if value does not implement this interface. 358 */ 359 public bool isColumnSelected(int column) 360 { 361 return atk_table_is_column_selected(getTableStruct(), column) != 0; 362 } 363 364 /** 365 * Gets a boolean value indicating whether the specified @row 366 * is selected 367 * 368 * Params: 369 * row = a #gint representing a row in @table 370 * 371 * Returns: a gboolean representing if the row is selected, or 0 372 * if value does not implement this interface. 373 */ 374 public bool isRowSelected(int row) 375 { 376 return atk_table_is_row_selected(getTableStruct(), row) != 0; 377 } 378 379 /** 380 * Gets a boolean value indicating whether the accessible object 381 * at the specified @row and @column is selected 382 * 383 * Params: 384 * row = a #gint representing a row in @table 385 * column = a #gint representing a column in @table 386 * 387 * Returns: a gboolean representing if the cell is selected, or 0 388 * if value does not implement this interface. 389 */ 390 public bool isSelected(int row, int column) 391 { 392 return atk_table_is_selected(getTableStruct(), row, column) != 0; 393 } 394 395 /** 396 * Get a reference to the table cell at @row, @column. This cell 397 * should implement the interface #AtkTableCell 398 * 399 * Params: 400 * row = a #gint representing a row in @table 401 * column = a #gint representing a column in @table 402 * 403 * Returns: an #AtkObject representing the referred 404 * to accessible 405 */ 406 public ObjectAtk refAt(int row, int column) 407 { 408 auto p = atk_table_ref_at(getTableStruct(), row, column); 409 410 if(p is null) 411 { 412 return null; 413 } 414 415 return ObjectG.getDObject!(ObjectAtk)(cast(AtkObject*) p, true); 416 } 417 418 /** 419 * Adds the specified @column to the selection. 420 * 421 * Params: 422 * column = a #gint representing a column in @table 423 * 424 * Returns: a gboolean representing if the column was successfully removed from 425 * the selection, or 0 if value does not implement this interface. 426 */ 427 public bool removeColumnSelection(int column) 428 { 429 return atk_table_remove_column_selection(getTableStruct(), column) != 0; 430 } 431 432 /** 433 * Removes the specified @row from the selection. 434 * 435 * Params: 436 * row = a #gint representing a row in @table 437 * 438 * Returns: a gboolean representing if the row was successfully removed from 439 * the selection, or 0 if value does not implement this interface. 440 */ 441 public bool removeRowSelection(int row) 442 { 443 return atk_table_remove_row_selection(getTableStruct(), row) != 0; 444 } 445 446 /** 447 * Sets the caption for the table. 448 * 449 * Params: 450 * caption = a #AtkObject representing the caption to set for @table 451 */ 452 public void setCaption(ObjectAtk caption) 453 { 454 atk_table_set_caption(getTableStruct(), (caption is null) ? null : caption.getObjectAtkStruct()); 455 } 456 457 /** 458 * Sets the description text for the specified @column of the @table. 459 * 460 * Params: 461 * column = a #gint representing a column in @table 462 * description = a #gchar representing the description text 463 * to set for the specified @column of the @table 464 */ 465 public void setColumnDescription(int column, string description) 466 { 467 atk_table_set_column_description(getTableStruct(), column, Str.toStringz(description)); 468 } 469 470 /** 471 * Sets the specified column header to @header. 472 * 473 * Params: 474 * column = a #gint representing a column in @table 475 * header = an #AtkTable 476 */ 477 public void setColumnHeader(int column, ObjectAtk header) 478 { 479 atk_table_set_column_header(getTableStruct(), column, (header is null) ? null : header.getObjectAtkStruct()); 480 } 481 482 /** 483 * Sets the description text for the specified @row of @table. 484 * 485 * Params: 486 * row = a #gint representing a row in @table 487 * description = a #gchar representing the description text 488 * to set for the specified @row of @table 489 */ 490 public void setRowDescription(int row, string description) 491 { 492 atk_table_set_row_description(getTableStruct(), row, Str.toStringz(description)); 493 } 494 495 /** 496 * Sets the specified row header to @header. 497 * 498 * Params: 499 * row = a #gint representing a row in @table 500 * header = an #AtkTable 501 */ 502 public void setRowHeader(int row, ObjectAtk header) 503 { 504 atk_table_set_row_header(getTableStruct(), row, (header is null) ? null : header.getObjectAtkStruct()); 505 } 506 507 /** 508 * Sets the summary description of the table. 509 * 510 * Params: 511 * accessible = an #AtkObject representing the summary description 512 * to set for @table 513 */ 514 public void setSummary(ObjectAtk accessible) 515 { 516 atk_table_set_summary(getTableStruct(), (accessible is null) ? null : accessible.getObjectAtkStruct()); 517 } 518 519 protected class OnColumnDeletedDelegateWrapper 520 { 521 static OnColumnDeletedDelegateWrapper[] listeners; 522 void delegate(int, int, TableIF) dlg; 523 gulong handlerId; 524 525 this(void delegate(int, int, TableIF) dlg) 526 { 527 this.dlg = dlg; 528 this.listeners ~= this; 529 } 530 531 void remove(OnColumnDeletedDelegateWrapper source) 532 { 533 foreach(index, wrapper; listeners) 534 { 535 if (wrapper.handlerId == source.handlerId) 536 { 537 listeners[index] = null; 538 listeners = std.algorithm.remove(listeners, index); 539 break; 540 } 541 } 542 } 543 } 544 545 /** 546 * The "column-deleted" signal is emitted by an object which 547 * implements the AtkTable interface when a column is deleted. 548 * 549 * Params: 550 * arg1 = The index of the first column deleted. 551 * arg2 = The number of columns deleted. 552 */ 553 gulong addOnColumnDeleted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 554 { 555 auto wrapper = new OnColumnDeletedDelegateWrapper(dlg); 556 wrapper.handlerId = Signals.connectData( 557 this, 558 "column-deleted", 559 cast(GCallback)&callBackColumnDeleted, 560 cast(void*)wrapper, 561 cast(GClosureNotify)&callBackColumnDeletedDestroy, 562 connectFlags); 563 return wrapper.handlerId; 564 } 565 566 extern(C) static void callBackColumnDeleted(AtkTable* tableStruct, int arg1, int arg2, OnColumnDeletedDelegateWrapper wrapper) 567 { 568 wrapper.dlg(arg1, arg2, wrapper.outer); 569 } 570 571 extern(C) static void callBackColumnDeletedDestroy(OnColumnDeletedDelegateWrapper wrapper, GClosure* closure) 572 { 573 wrapper.remove(wrapper); 574 } 575 576 protected class OnColumnInsertedDelegateWrapper 577 { 578 static OnColumnInsertedDelegateWrapper[] listeners; 579 void delegate(int, int, TableIF) dlg; 580 gulong handlerId; 581 582 this(void delegate(int, int, TableIF) dlg) 583 { 584 this.dlg = dlg; 585 this.listeners ~= this; 586 } 587 588 void remove(OnColumnInsertedDelegateWrapper source) 589 { 590 foreach(index, wrapper; listeners) 591 { 592 if (wrapper.handlerId == source.handlerId) 593 { 594 listeners[index] = null; 595 listeners = std.algorithm.remove(listeners, index); 596 break; 597 } 598 } 599 } 600 } 601 602 /** 603 * The "column-inserted" signal is emitted by an object which 604 * implements the AtkTable interface when a column is inserted. 605 * 606 * Params: 607 * arg1 = The index of the column inserted. 608 * arg2 = The number of colums inserted. 609 */ 610 gulong addOnColumnInserted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 611 { 612 auto wrapper = new OnColumnInsertedDelegateWrapper(dlg); 613 wrapper.handlerId = Signals.connectData( 614 this, 615 "column-inserted", 616 cast(GCallback)&callBackColumnInserted, 617 cast(void*)wrapper, 618 cast(GClosureNotify)&callBackColumnInsertedDestroy, 619 connectFlags); 620 return wrapper.handlerId; 621 } 622 623 extern(C) static void callBackColumnInserted(AtkTable* tableStruct, int arg1, int arg2, OnColumnInsertedDelegateWrapper wrapper) 624 { 625 wrapper.dlg(arg1, arg2, wrapper.outer); 626 } 627 628 extern(C) static void callBackColumnInsertedDestroy(OnColumnInsertedDelegateWrapper wrapper, GClosure* closure) 629 { 630 wrapper.remove(wrapper); 631 } 632 633 protected class OnColumnReorderedDelegateWrapper 634 { 635 static OnColumnReorderedDelegateWrapper[] listeners; 636 void delegate(TableIF) dlg; 637 gulong handlerId; 638 639 this(void delegate(TableIF) dlg) 640 { 641 this.dlg = dlg; 642 this.listeners ~= this; 643 } 644 645 void remove(OnColumnReorderedDelegateWrapper source) 646 { 647 foreach(index, wrapper; listeners) 648 { 649 if (wrapper.handlerId == source.handlerId) 650 { 651 listeners[index] = null; 652 listeners = std.algorithm.remove(listeners, index); 653 break; 654 } 655 } 656 } 657 } 658 659 /** 660 * The "column-reordered" signal is emitted by an object which 661 * implements the AtkTable interface when the columns are 662 * reordered. 663 */ 664 gulong addOnColumnReordered(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 665 { 666 auto wrapper = new OnColumnReorderedDelegateWrapper(dlg); 667 wrapper.handlerId = Signals.connectData( 668 this, 669 "column-reordered", 670 cast(GCallback)&callBackColumnReordered, 671 cast(void*)wrapper, 672 cast(GClosureNotify)&callBackColumnReorderedDestroy, 673 connectFlags); 674 return wrapper.handlerId; 675 } 676 677 extern(C) static void callBackColumnReordered(AtkTable* tableStruct, OnColumnReorderedDelegateWrapper wrapper) 678 { 679 wrapper.dlg(wrapper.outer); 680 } 681 682 extern(C) static void callBackColumnReorderedDestroy(OnColumnReorderedDelegateWrapper wrapper, GClosure* closure) 683 { 684 wrapper.remove(wrapper); 685 } 686 687 protected class OnModelChangedDelegateWrapper 688 { 689 static OnModelChangedDelegateWrapper[] listeners; 690 void delegate(TableIF) dlg; 691 gulong handlerId; 692 693 this(void delegate(TableIF) dlg) 694 { 695 this.dlg = dlg; 696 this.listeners ~= this; 697 } 698 699 void remove(OnModelChangedDelegateWrapper source) 700 { 701 foreach(index, wrapper; listeners) 702 { 703 if (wrapper.handlerId == source.handlerId) 704 { 705 listeners[index] = null; 706 listeners = std.algorithm.remove(listeners, index); 707 break; 708 } 709 } 710 } 711 } 712 713 /** 714 * The "model-changed" signal is emitted by an object which 715 * implements the AtkTable interface when the model displayed by 716 * the table changes. 717 */ 718 gulong addOnModelChanged(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 719 { 720 auto wrapper = new OnModelChangedDelegateWrapper(dlg); 721 wrapper.handlerId = Signals.connectData( 722 this, 723 "model-changed", 724 cast(GCallback)&callBackModelChanged, 725 cast(void*)wrapper, 726 cast(GClosureNotify)&callBackModelChangedDestroy, 727 connectFlags); 728 return wrapper.handlerId; 729 } 730 731 extern(C) static void callBackModelChanged(AtkTable* tableStruct, OnModelChangedDelegateWrapper wrapper) 732 { 733 wrapper.dlg(wrapper.outer); 734 } 735 736 extern(C) static void callBackModelChangedDestroy(OnModelChangedDelegateWrapper wrapper, GClosure* closure) 737 { 738 wrapper.remove(wrapper); 739 } 740 741 protected class OnRowDeletedDelegateWrapper 742 { 743 static OnRowDeletedDelegateWrapper[] listeners; 744 void delegate(int, int, TableIF) dlg; 745 gulong handlerId; 746 747 this(void delegate(int, int, TableIF) dlg) 748 { 749 this.dlg = dlg; 750 this.listeners ~= this; 751 } 752 753 void remove(OnRowDeletedDelegateWrapper source) 754 { 755 foreach(index, wrapper; listeners) 756 { 757 if (wrapper.handlerId == source.handlerId) 758 { 759 listeners[index] = null; 760 listeners = std.algorithm.remove(listeners, index); 761 break; 762 } 763 } 764 } 765 } 766 767 /** 768 * The "row-deleted" signal is emitted by an object which 769 * implements the AtkTable interface when a row is deleted. 770 * 771 * Params: 772 * arg1 = The index of the first row deleted. 773 * arg2 = The number of rows deleted. 774 */ 775 gulong addOnRowDeleted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 776 { 777 auto wrapper = new OnRowDeletedDelegateWrapper(dlg); 778 wrapper.handlerId = Signals.connectData( 779 this, 780 "row-deleted", 781 cast(GCallback)&callBackRowDeleted, 782 cast(void*)wrapper, 783 cast(GClosureNotify)&callBackRowDeletedDestroy, 784 connectFlags); 785 return wrapper.handlerId; 786 } 787 788 extern(C) static void callBackRowDeleted(AtkTable* tableStruct, int arg1, int arg2, OnRowDeletedDelegateWrapper wrapper) 789 { 790 wrapper.dlg(arg1, arg2, wrapper.outer); 791 } 792 793 extern(C) static void callBackRowDeletedDestroy(OnRowDeletedDelegateWrapper wrapper, GClosure* closure) 794 { 795 wrapper.remove(wrapper); 796 } 797 798 protected class OnRowInsertedDelegateWrapper 799 { 800 static OnRowInsertedDelegateWrapper[] listeners; 801 void delegate(int, int, TableIF) dlg; 802 gulong handlerId; 803 804 this(void delegate(int, int, TableIF) dlg) 805 { 806 this.dlg = dlg; 807 this.listeners ~= this; 808 } 809 810 void remove(OnRowInsertedDelegateWrapper source) 811 { 812 foreach(index, wrapper; listeners) 813 { 814 if (wrapper.handlerId == source.handlerId) 815 { 816 listeners[index] = null; 817 listeners = std.algorithm.remove(listeners, index); 818 break; 819 } 820 } 821 } 822 } 823 824 /** 825 * The "row-inserted" signal is emitted by an object which 826 * implements the AtkTable interface when a row is inserted. 827 * 828 * Params: 829 * arg1 = The index of the first row inserted. 830 * arg2 = The number of rows inserted. 831 */ 832 gulong addOnRowInserted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 833 { 834 auto wrapper = new OnRowInsertedDelegateWrapper(dlg); 835 wrapper.handlerId = Signals.connectData( 836 this, 837 "row-inserted", 838 cast(GCallback)&callBackRowInserted, 839 cast(void*)wrapper, 840 cast(GClosureNotify)&callBackRowInsertedDestroy, 841 connectFlags); 842 return wrapper.handlerId; 843 } 844 845 extern(C) static void callBackRowInserted(AtkTable* tableStruct, int arg1, int arg2, OnRowInsertedDelegateWrapper wrapper) 846 { 847 wrapper.dlg(arg1, arg2, wrapper.outer); 848 } 849 850 extern(C) static void callBackRowInsertedDestroy(OnRowInsertedDelegateWrapper wrapper, GClosure* closure) 851 { 852 wrapper.remove(wrapper); 853 } 854 855 protected class OnRowReorderedDelegateWrapper 856 { 857 static OnRowReorderedDelegateWrapper[] listeners; 858 void delegate(TableIF) dlg; 859 gulong handlerId; 860 861 this(void delegate(TableIF) dlg) 862 { 863 this.dlg = dlg; 864 this.listeners ~= this; 865 } 866 867 void remove(OnRowReorderedDelegateWrapper source) 868 { 869 foreach(index, wrapper; listeners) 870 { 871 if (wrapper.handlerId == source.handlerId) 872 { 873 listeners[index] = null; 874 listeners = std.algorithm.remove(listeners, index); 875 break; 876 } 877 } 878 } 879 } 880 881 /** 882 * The "row-reordered" signal is emitted by an object which 883 * implements the AtkTable interface when the rows are 884 * reordered. 885 */ 886 gulong addOnRowReordered(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 887 { 888 auto wrapper = new OnRowReorderedDelegateWrapper(dlg); 889 wrapper.handlerId = Signals.connectData( 890 this, 891 "row-reordered", 892 cast(GCallback)&callBackRowReordered, 893 cast(void*)wrapper, 894 cast(GClosureNotify)&callBackRowReorderedDestroy, 895 connectFlags); 896 return wrapper.handlerId; 897 } 898 899 extern(C) static void callBackRowReordered(AtkTable* tableStruct, OnRowReorderedDelegateWrapper wrapper) 900 { 901 wrapper.dlg(wrapper.outer); 902 } 903 904 extern(C) static void callBackRowReorderedDestroy(OnRowReorderedDelegateWrapper wrapper, GClosure* closure) 905 { 906 wrapper.remove(wrapper); 907 } 908 }