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