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 glib.c.functions; 32 public import gobject.ObjectG; 33 public import gobject.Signals; 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 /** 521 * The "column-deleted" signal is emitted by an object which 522 * implements the AtkTable interface when a column is deleted. 523 * 524 * Params: 525 * arg1 = The index of the first column deleted. 526 * arg2 = The number of columns deleted. 527 */ 528 gulong addOnColumnDeleted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 529 { 530 return Signals.connect(this, "column-deleted", dlg, connectFlags ^ ConnectFlags.SWAPPED); 531 } 532 533 /** 534 * The "column-inserted" signal is emitted by an object which 535 * implements the AtkTable interface when a column is inserted. 536 * 537 * Params: 538 * arg1 = The index of the column inserted. 539 * arg2 = The number of colums inserted. 540 */ 541 gulong addOnColumnInserted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 542 { 543 return Signals.connect(this, "column-inserted", dlg, connectFlags ^ ConnectFlags.SWAPPED); 544 } 545 546 /** 547 * The "column-reordered" signal is emitted by an object which 548 * implements the AtkTable interface when the columns are 549 * reordered. 550 */ 551 gulong addOnColumnReordered(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 552 { 553 return Signals.connect(this, "column-reordered", dlg, connectFlags ^ ConnectFlags.SWAPPED); 554 } 555 556 /** 557 * The "model-changed" signal is emitted by an object which 558 * implements the AtkTable interface when the model displayed by 559 * the table changes. 560 */ 561 gulong addOnModelChanged(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 562 { 563 return Signals.connect(this, "model-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 564 } 565 566 /** 567 * The "row-deleted" signal is emitted by an object which 568 * implements the AtkTable interface when a row is deleted. 569 * 570 * Params: 571 * arg1 = The index of the first row deleted. 572 * arg2 = The number of rows deleted. 573 */ 574 gulong addOnRowDeleted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 575 { 576 return Signals.connect(this, "row-deleted", dlg, connectFlags ^ ConnectFlags.SWAPPED); 577 } 578 579 /** 580 * The "row-inserted" signal is emitted by an object which 581 * implements the AtkTable interface when a row is inserted. 582 * 583 * Params: 584 * arg1 = The index of the first row inserted. 585 * arg2 = The number of rows inserted. 586 */ 587 gulong addOnRowInserted(void delegate(int, int, TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 588 { 589 return Signals.connect(this, "row-inserted", dlg, connectFlags ^ ConnectFlags.SWAPPED); 590 } 591 592 /** 593 * The "row-reordered" signal is emitted by an object which 594 * implements the AtkTable interface when the rows are 595 * reordered. 596 */ 597 gulong addOnRowReordered(void delegate(TableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 598 { 599 return Signals.connect(this, "row-reordered", dlg, connectFlags ^ ConnectFlags.SWAPPED); 600 } 601 }