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