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