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