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 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 77 /** 78 * Adds the specified @column to the selection. 79 * 80 * Params: 81 * column = a #gint representing a column in @table 82 * 83 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 * Return: 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 int[string] connectedSignals; 520 521 void delegate(int, int, TableIF)[] _onColumnDeletedListeners; 522 @property void delegate(int, int, TableIF)[] onColumnDeletedListeners() 523 { 524 return _onColumnDeletedListeners; 525 } 526 /** 527 * The "column-deleted" signal is emitted by an object which 528 * implements the AtkTable interface when a column is deleted. 529 * 530 * Params: 531 * arg1 = The index of the first column deleted. 532 * arg2 = The number of columns deleted. 533 */ 534 void addOnColumnDeleted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 535 { 536 if ( "column-deleted" !in connectedSignals ) 537 { 538 Signals.connectData( 539 this, 540 "column-deleted", 541 cast(GCallback)&callBackColumnDeleted, 542 cast(void*)cast(TableIF)this, 543 null, 544 connectFlags); 545 connectedSignals["column-deleted"] = 1; 546 } 547 _onColumnDeletedListeners ~= dlg; 548 } 549 extern(C) static void callBackColumnDeleted(AtkTable* tableStruct, int arg1, int arg2, TableIF _table) 550 { 551 foreach ( void delegate(int, int, TableIF) dlg; _table.onColumnDeletedListeners ) 552 { 553 dlg(arg1, arg2, _table); 554 } 555 } 556 557 void delegate(int, int, TableIF)[] _onColumnInsertedListeners; 558 @property void delegate(int, int, TableIF)[] onColumnInsertedListeners() 559 { 560 return _onColumnInsertedListeners; 561 } 562 /** 563 * The "column-inserted" signal is emitted by an object which 564 * implements the AtkTable interface when a column is inserted. 565 * 566 * Params: 567 * arg1 = The index of the column inserted. 568 * arg2 = The number of colums inserted. 569 */ 570 void addOnColumnInserted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 571 { 572 if ( "column-inserted" !in connectedSignals ) 573 { 574 Signals.connectData( 575 this, 576 "column-inserted", 577 cast(GCallback)&callBackColumnInserted, 578 cast(void*)cast(TableIF)this, 579 null, 580 connectFlags); 581 connectedSignals["column-inserted"] = 1; 582 } 583 _onColumnInsertedListeners ~= dlg; 584 } 585 extern(C) static void callBackColumnInserted(AtkTable* tableStruct, int arg1, int arg2, TableIF _table) 586 { 587 foreach ( void delegate(int, int, TableIF) dlg; _table.onColumnInsertedListeners ) 588 { 589 dlg(arg1, arg2, _table); 590 } 591 } 592 593 void delegate(TableIF)[] _onColumnReorderedListeners; 594 @property void delegate(TableIF)[] onColumnReorderedListeners() 595 { 596 return _onColumnReorderedListeners; 597 } 598 /** 599 * The "column-reordered" signal is emitted by an object which 600 * implements the AtkTable interface when the columns are 601 * reordered. 602 */ 603 void addOnColumnReordered(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 604 { 605 if ( "column-reordered" !in connectedSignals ) 606 { 607 Signals.connectData( 608 this, 609 "column-reordered", 610 cast(GCallback)&callBackColumnReordered, 611 cast(void*)cast(TableIF)this, 612 null, 613 connectFlags); 614 connectedSignals["column-reordered"] = 1; 615 } 616 _onColumnReorderedListeners ~= dlg; 617 } 618 extern(C) static void callBackColumnReordered(AtkTable* tableStruct, TableIF _table) 619 { 620 foreach ( void delegate(TableIF) dlg; _table.onColumnReorderedListeners ) 621 { 622 dlg(_table); 623 } 624 } 625 626 void delegate(TableIF)[] _onModelChangedListeners; 627 @property void delegate(TableIF)[] onModelChangedListeners() 628 { 629 return _onModelChangedListeners; 630 } 631 /** 632 * The "model-changed" signal is emitted by an object which 633 * implements the AtkTable interface when the model displayed by 634 * the table changes. 635 */ 636 void addOnModelChanged(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 637 { 638 if ( "model-changed" !in connectedSignals ) 639 { 640 Signals.connectData( 641 this, 642 "model-changed", 643 cast(GCallback)&callBackModelChanged, 644 cast(void*)cast(TableIF)this, 645 null, 646 connectFlags); 647 connectedSignals["model-changed"] = 1; 648 } 649 _onModelChangedListeners ~= dlg; 650 } 651 extern(C) static void callBackModelChanged(AtkTable* tableStruct, TableIF _table) 652 { 653 foreach ( void delegate(TableIF) dlg; _table.onModelChangedListeners ) 654 { 655 dlg(_table); 656 } 657 } 658 659 void delegate(int, int, TableIF)[] _onRowDeletedListeners; 660 @property void delegate(int, int, TableIF)[] onRowDeletedListeners() 661 { 662 return _onRowDeletedListeners; 663 } 664 /** 665 * The "row-deleted" signal is emitted by an object which 666 * implements the AtkTable interface when a row is deleted. 667 * 668 * Params: 669 * arg1 = The index of the first row deleted. 670 * arg2 = The number of rows deleted. 671 */ 672 void addOnRowDeleted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 673 { 674 if ( "row-deleted" !in connectedSignals ) 675 { 676 Signals.connectData( 677 this, 678 "row-deleted", 679 cast(GCallback)&callBackRowDeleted, 680 cast(void*)cast(TableIF)this, 681 null, 682 connectFlags); 683 connectedSignals["row-deleted"] = 1; 684 } 685 _onRowDeletedListeners ~= dlg; 686 } 687 extern(C) static void callBackRowDeleted(AtkTable* tableStruct, int arg1, int arg2, TableIF _table) 688 { 689 foreach ( void delegate(int, int, TableIF) dlg; _table.onRowDeletedListeners ) 690 { 691 dlg(arg1, arg2, _table); 692 } 693 } 694 695 void delegate(int, int, TableIF)[] _onRowInsertedListeners; 696 @property void delegate(int, int, TableIF)[] onRowInsertedListeners() 697 { 698 return _onRowInsertedListeners; 699 } 700 /** 701 * The "row-inserted" signal is emitted by an object which 702 * implements the AtkTable interface when a row is inserted. 703 * 704 * Params: 705 * arg1 = The index of the first row inserted. 706 * arg2 = The number of rows inserted. 707 */ 708 void addOnRowInserted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 709 { 710 if ( "row-inserted" !in connectedSignals ) 711 { 712 Signals.connectData( 713 this, 714 "row-inserted", 715 cast(GCallback)&callBackRowInserted, 716 cast(void*)cast(TableIF)this, 717 null, 718 connectFlags); 719 connectedSignals["row-inserted"] = 1; 720 } 721 _onRowInsertedListeners ~= dlg; 722 } 723 extern(C) static void callBackRowInserted(AtkTable* tableStruct, int arg1, int arg2, TableIF _table) 724 { 725 foreach ( void delegate(int, int, TableIF) dlg; _table.onRowInsertedListeners ) 726 { 727 dlg(arg1, arg2, _table); 728 } 729 } 730 731 void delegate(TableIF)[] _onRowReorderedListeners; 732 @property void delegate(TableIF)[] onRowReorderedListeners() 733 { 734 return _onRowReorderedListeners; 735 } 736 /** 737 * The "row-reordered" signal is emitted by an object which 738 * implements the AtkTable interface when the rows are 739 * reordered. 740 */ 741 void addOnRowReordered(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 742 { 743 if ( "row-reordered" !in connectedSignals ) 744 { 745 Signals.connectData( 746 this, 747 "row-reordered", 748 cast(GCallback)&callBackRowReordered, 749 cast(void*)cast(TableIF)this, 750 null, 751 connectFlags); 752 connectedSignals["row-reordered"] = 1; 753 } 754 _onRowReorderedListeners ~= dlg; 755 } 756 extern(C) static void callBackRowReordered(AtkTable* tableStruct, TableIF _table) 757 { 758 foreach ( void delegate(TableIF) dlg; _table.onRowReorderedListeners ) 759 { 760 dlg(_table); 761 } 762 } 763 }