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 gtk.ListBox; 26 27 private import gio.ListModelIF; 28 private import glib.ConstructionException; 29 private import glib.ListG; 30 private import gobject.ObjectG; 31 private import gobject.Signals; 32 private import gtk.Adjustment; 33 private import gtk.Container; 34 private import gtk.ListBoxRow; 35 private import gtk.Widget; 36 public import gtkc.gdktypes; 37 private import gtkc.gtk; 38 public import gtkc.gtktypes; 39 40 41 /** 42 * A GtkListBox is a vertical container that contains GtkListBoxRow 43 * children. These rows can by dynamically sorted and filtered, and 44 * headers can be added dynamically depending on the row content. 45 * It also allows keyboard and mouse navigation and selection like 46 * a typical list. 47 * 48 * Using GtkListBox is often an alternative to #GtkTreeView, especially 49 * when the list contents has a more complicated layout than what is allowed 50 * by a #GtkCellRenderer, or when the contents is interactive (i.e. has a 51 * button in it). 52 * 53 * Although a #GtkListBox must have only #GtkListBoxRow children you can 54 * add any kind of widget to it via gtk_container_add(), and a #GtkListBoxRow 55 * widget will automatically be inserted between the list and the widget. 56 * 57 * #GtkListBoxRows can be marked as activatable or selectable. If a row 58 * is activatable, #GtkListBox::row-activated will be emitted for it when 59 * the user tries to activate it. If it is selectable, the row will be marked 60 * as selected when the user tries to select it. 61 * 62 * The GtkListBox widget was added in GTK+ 3.10. 63 */ 64 public class ListBox : Container 65 { 66 /** the main Gtk struct */ 67 protected GtkListBox* gtkListBox; 68 69 /** Get the main Gtk struct */ 70 public GtkListBox* getListBoxStruct() 71 { 72 return gtkListBox; 73 } 74 75 /** the main Gtk struct as a void* */ 76 protected override void* getStruct() 77 { 78 return cast(void*)gtkListBox; 79 } 80 81 protected override void setStruct(GObject* obj) 82 { 83 gtkListBox = cast(GtkListBox*)obj; 84 super.setStruct(obj); 85 } 86 87 /** 88 * Sets our main struct and passes it to the parent class. 89 */ 90 public this (GtkListBox* gtkListBox, bool ownedRef = false) 91 { 92 this.gtkListBox = gtkListBox; 93 super(cast(GtkContainer*)gtkListBox, ownedRef); 94 } 95 96 97 /** */ 98 public static GType getType() 99 { 100 return gtk_list_box_get_type(); 101 } 102 103 /** 104 * Creates a new #GtkListBox container. 105 * 106 * Return: a new #GtkListBox 107 * 108 * Since: 3.10 109 * 110 * Throws: ConstructionException GTK+ fails to create the object. 111 */ 112 public this() 113 { 114 auto p = gtk_list_box_new(); 115 116 if(p is null) 117 { 118 throw new ConstructionException("null returned by new"); 119 } 120 121 this(cast(GtkListBox*) p); 122 } 123 124 /** 125 * Binds @model to @box. 126 * 127 * If @box was already bound to a model, that previous binding is 128 * destroyed. 129 * 130 * The contents of @box are cleared and then filled with widgets that 131 * represent items from @model. @box is updated whenever @model changes. 132 * If @model is %NULL, @box is left empty. 133 * 134 * It is undefined to add or remove widgets directly (for example, with 135 * gtk_list_box_insert() or gtk_container_add()) while @box is bound to a 136 * model. 137 * 138 * Note that using a model is incompatible with the filtering and sorting 139 * functionality in GtkListBox. When using a model, filtering and sorting 140 * should be implemented by the model. 141 * 142 * Params: 143 * model = the #GListModel to be bound to @box 144 * createWidgetFunc = a function that creates widgets for items 145 * or %NULL in case you also passed %NULL as @model 146 * userData = user data passed to @create_widget_func 147 * userDataFreeFunc = function for freeing @user_data 148 * 149 * Since: 3.16 150 */ 151 public void bindModel(ListModelIF model, GtkListBoxCreateWidgetFunc createWidgetFunc, void* userData, GDestroyNotify userDataFreeFunc) 152 { 153 gtk_list_box_bind_model(gtkListBox, (model is null) ? null : model.getListModelStruct(), createWidgetFunc, userData, userDataFreeFunc); 154 } 155 156 /** 157 * This is a helper function for implementing DnD onto a #GtkListBox. 158 * The passed in @row will be highlighted via gtk_drag_highlight(), 159 * and any previously highlighted row will be unhighlighted. 160 * 161 * The row will also be unhighlighted when the widget gets 162 * a drag leave event. 163 * 164 * Params: 165 * row = a #GtkListBoxRow 166 * 167 * Since: 3.10 168 */ 169 public void dragHighlightRow(ListBoxRow row) 170 { 171 gtk_list_box_drag_highlight_row(gtkListBox, (row is null) ? null : row.getListBoxRowStruct()); 172 } 173 174 /** 175 * If a row has previously been highlighted via gtk_list_box_drag_highlight_row() 176 * it will have the highlight removed. 177 * 178 * Since: 3.10 179 */ 180 public void dragUnhighlightRow() 181 { 182 gtk_list_box_drag_unhighlight_row(gtkListBox); 183 } 184 185 /** 186 * Returns whether rows activate on single clicks. 187 * 188 * Return: %TRUE if rows are activated on single click, %FALSE otherwise 189 * 190 * Since: 3.10 191 */ 192 public bool getActivateOnSingleClick() 193 { 194 return gtk_list_box_get_activate_on_single_click(gtkListBox) != 0; 195 } 196 197 /** 198 * Gets the adjustment (if any) that the widget uses to 199 * for vertical scrolling. 200 * 201 * Return: the adjustment 202 * 203 * Since: 3.10 204 */ 205 public Adjustment getAdjustment() 206 { 207 auto p = gtk_list_box_get_adjustment(gtkListBox); 208 209 if(p is null) 210 { 211 return null; 212 } 213 214 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 215 } 216 217 /** 218 * Gets the n-th child in the list (not counting headers). 219 * If @_index is negative or larger than the number of items in the 220 * list, %NULL is returned. 221 * 222 * Params: 223 * index = the index of the row 224 * 225 * Return: the child #GtkWidget or %NULL 226 * 227 * Since: 3.10 228 */ 229 public ListBoxRow getRowAtIndex(int index) 230 { 231 auto p = gtk_list_box_get_row_at_index(gtkListBox, index); 232 233 if(p is null) 234 { 235 return null; 236 } 237 238 return ObjectG.getDObject!(ListBoxRow)(cast(GtkListBoxRow*) p); 239 } 240 241 /** 242 * Gets the row at the @y position. 243 * 244 * Params: 245 * y = position 246 * 247 * Return: the row 248 * 249 * Since: 3.10 250 */ 251 public ListBoxRow getRowAtY(int y) 252 { 253 auto p = gtk_list_box_get_row_at_y(gtkListBox, y); 254 255 if(p is null) 256 { 257 return null; 258 } 259 260 return ObjectG.getDObject!(ListBoxRow)(cast(GtkListBoxRow*) p); 261 } 262 263 /** 264 * Gets the selected row. 265 * 266 * Note that the box may allow multiple selection, in which 267 * case you should use gtk_list_box_selected_foreach() to 268 * find all selected rows. 269 * 270 * Return: the selected row 271 * 272 * Since: 3.10 273 */ 274 public ListBoxRow getSelectedRow() 275 { 276 auto p = gtk_list_box_get_selected_row(gtkListBox); 277 278 if(p is null) 279 { 280 return null; 281 } 282 283 return ObjectG.getDObject!(ListBoxRow)(cast(GtkListBoxRow*) p); 284 } 285 286 /** 287 * Creates a list of all selected children. 288 * 289 * Return: A #GList containing the #GtkWidget for each selected child. 290 * Free with g_list_free() when done. 291 * 292 * Since: 3.14 293 */ 294 public ListG getSelectedRows() 295 { 296 auto p = gtk_list_box_get_selected_rows(gtkListBox); 297 298 if(p is null) 299 { 300 return null; 301 } 302 303 return new ListG(cast(GList*) p); 304 } 305 306 /** 307 * Gets the selection mode of the listbox. 308 * 309 * Return: a #GtkSelectionMode 310 * 311 * Since: 3.10 312 */ 313 public GtkSelectionMode getSelectionMode() 314 { 315 return gtk_list_box_get_selection_mode(gtkListBox); 316 } 317 318 /** 319 * Insert the @child into the @box at @position. If a sort function is 320 * set, the widget will actually be inserted at the calculated position and 321 * this function has the same effect of gtk_container_add(). 322 * 323 * If @position is -1, or larger than the total number of items in the 324 * @box, then the @child will be appended to the end. 325 * 326 * Params: 327 * child = the #GtkWidget to add 328 * position = the position to insert @child in 329 * 330 * Since: 3.10 331 */ 332 public void insert(Widget child, int position) 333 { 334 gtk_list_box_insert(gtkListBox, (child is null) ? null : child.getWidgetStruct(), position); 335 } 336 337 /** 338 * Update the filtering for all rows. Call this when result 339 * of the filter function on the @box is changed due 340 * to an external factor. For instance, this would be used 341 * if the filter function just looked for a specific search 342 * string and the entry with the search string has changed. 343 * 344 * Since: 3.10 345 */ 346 public void invalidateFilter() 347 { 348 gtk_list_box_invalidate_filter(gtkListBox); 349 } 350 351 /** 352 * Update the separators for all rows. Call this when result 353 * of the header function on the @box is changed due 354 * to an external factor. 355 * 356 * Since: 3.10 357 */ 358 public void invalidateHeaders() 359 { 360 gtk_list_box_invalidate_headers(gtkListBox); 361 } 362 363 /** 364 * Update the sorting for all rows. Call this when result 365 * of the sort function on the @box is changed due 366 * to an external factor. 367 * 368 * Since: 3.10 369 */ 370 public void invalidateSort() 371 { 372 gtk_list_box_invalidate_sort(gtkListBox); 373 } 374 375 /** 376 * Prepend a widget to the list. If a sort function is set, the widget will 377 * actually be inserted at the calculated position and this function has the 378 * same effect of gtk_container_add(). 379 * 380 * Params: 381 * child = the #GtkWidget to add 382 * 383 * Since: 3.10 384 */ 385 public void prepend(Widget child) 386 { 387 gtk_list_box_prepend(gtkListBox, (child is null) ? null : child.getWidgetStruct()); 388 } 389 390 /** 391 * Select all children of @box, if the selection mode allows it. 392 * 393 * Since: 3.14 394 */ 395 public void selectAll() 396 { 397 gtk_list_box_select_all(gtkListBox); 398 } 399 400 /** 401 * Make @row the currently selected row. 402 * 403 * Params: 404 * row = The row to select or %NULL 405 * 406 * Since: 3.10 407 */ 408 public void selectRow(ListBoxRow row) 409 { 410 gtk_list_box_select_row(gtkListBox, (row is null) ? null : row.getListBoxRowStruct()); 411 } 412 413 /** 414 * Calls a function for each selected child. 415 * 416 * Note that the selection cannot be modified from within this function. 417 * 418 * Params: 419 * func = the function to call for each selected child 420 * data = user data to pass to the function 421 * 422 * Since: 3.14 423 */ 424 public void selectedForeach(GtkListBoxForeachFunc func, void* data) 425 { 426 gtk_list_box_selected_foreach(gtkListBox, func, data); 427 } 428 429 /** 430 * If @single is %TRUE, rows will be activated when you click on them, 431 * otherwise you need to double-click. 432 * 433 * Params: 434 * single = a boolean 435 * 436 * Since: 3.10 437 */ 438 public void setActivateOnSingleClick(bool single) 439 { 440 gtk_list_box_set_activate_on_single_click(gtkListBox, single); 441 } 442 443 /** 444 * Sets the adjustment (if any) that the widget uses to 445 * for vertical scrolling. For instance, this is used 446 * to get the page size for PageUp/Down key handling. 447 * 448 * In the normal case when the @box is packed inside 449 * a #GtkScrolledWindow the adjustment from that will 450 * be picked up automatically, so there is no need 451 * to manually do that. 452 * 453 * Params: 454 * adjustment = the adjustment, or %NULL 455 * 456 * Since: 3.10 457 */ 458 public void setAdjustment(Adjustment adjustment) 459 { 460 gtk_list_box_set_adjustment(gtkListBox, (adjustment is null) ? null : adjustment.getAdjustmentStruct()); 461 } 462 463 /** 464 * By setting a filter function on the @box one can decide dynamically which 465 * of the rows to show. For instance, to implement a search function on a list that 466 * filters the original list to only show the matching rows. 467 * 468 * The @filter_func will be called for each row after the call, and it will 469 * continue to be called each time a row changes (via gtk_list_box_row_changed()) or 470 * when gtk_list_box_invalidate_filter() is called. 471 * 472 * Note that using a filter function is incompatible with using a model 473 * (see gtk_list_box_bind_model()). 474 * 475 * Params: 476 * filterFunc = callback that lets you filter which rows to show 477 * userData = user data passed to @filter_func 478 * destroy = destroy notifier for @user_data 479 * 480 * Since: 3.10 481 */ 482 public void setFilterFunc(GtkListBoxFilterFunc filterFunc, void* userData, GDestroyNotify destroy) 483 { 484 gtk_list_box_set_filter_func(gtkListBox, filterFunc, userData, destroy); 485 } 486 487 /** 488 * By setting a header function on the @box one can dynamically add headers 489 * in front of rows, depending on the contents of the row and its position in the list. 490 * For instance, one could use it to add headers in front of the first item of a 491 * new kind, in a list sorted by the kind. 492 * 493 * The @update_header can look at the current header widget using gtk_list_box_row_get_header() 494 * and either update the state of the widget as needed, or set a new one using 495 * gtk_list_box_row_set_header(). If no header is needed, set the header to %NULL. 496 * 497 * Note that you may get many calls @update_header to this for a particular row when e.g. 498 * changing things that don’t affect the header. In this case it is important for performance 499 * to not blindly replace an existing header with an identical one. 500 * 501 * The @update_header function will be called for each row after the call, and it will 502 * continue to be called each time a row changes (via gtk_list_box_row_changed()) and when 503 * the row before changes (either by gtk_list_box_row_changed() on the previous row, or when 504 * the previous row becomes a different row). It is also called for all rows when 505 * gtk_list_box_invalidate_headers() is called. 506 * 507 * Params: 508 * updateHeader = callback that lets you add row headers 509 * userData = user data passed to @update_header 510 * destroy = destroy notifier for @user_data 511 * 512 * Since: 3.10 513 */ 514 public void setHeaderFunc(GtkListBoxUpdateHeaderFunc updateHeader, void* userData, GDestroyNotify destroy) 515 { 516 gtk_list_box_set_header_func(gtkListBox, updateHeader, userData, destroy); 517 } 518 519 /** 520 * Sets the placeholder widget that is shown in the list when 521 * it doesn't display any visible children. 522 * 523 * Params: 524 * placeholder = a #GtkWidget or %NULL 525 * 526 * Since: 3.10 527 */ 528 public void setPlaceholder(Widget placeholder) 529 { 530 gtk_list_box_set_placeholder(gtkListBox, (placeholder is null) ? null : placeholder.getWidgetStruct()); 531 } 532 533 /** 534 * Sets how selection works in the listbox. 535 * See #GtkSelectionMode for details. 536 * 537 * Params: 538 * mode = The #GtkSelectionMode 539 * 540 * Since: 3.10 541 */ 542 public void setSelectionMode(GtkSelectionMode mode) 543 { 544 gtk_list_box_set_selection_mode(gtkListBox, mode); 545 } 546 547 /** 548 * By setting a sort function on the @box one can dynamically reorder the rows 549 * of the list, based on the contents of the rows. 550 * 551 * The @sort_func will be called for each row after the call, and will continue to 552 * be called each time a row changes (via gtk_list_box_row_changed()) and when 553 * gtk_list_box_invalidate_sort() is called. 554 * 555 * Note that using a sort function is incompatible with using a model 556 * (see gtk_list_box_bind_model()). 557 * 558 * Params: 559 * sortFunc = the sort function 560 * userData = user data passed to @sort_func 561 * destroy = destroy notifier for @user_data 562 * 563 * Since: 3.10 564 */ 565 public void setSortFunc(GtkListBoxSortFunc sortFunc, void* userData, GDestroyNotify destroy) 566 { 567 gtk_list_box_set_sort_func(gtkListBox, sortFunc, userData, destroy); 568 } 569 570 /** 571 * Unselect all children of @box, if the selection mode allows it. 572 * 573 * Since: 3.14 574 */ 575 public void unselectAll() 576 { 577 gtk_list_box_unselect_all(gtkListBox); 578 } 579 580 /** 581 * Unselects a single row of @box, if the selection mode allows it. 582 * 583 * Params: 584 * row = the row to unselected 585 * 586 * Since: 3.14 587 */ 588 public void unselectRow(ListBoxRow row) 589 { 590 gtk_list_box_unselect_row(gtkListBox, (row is null) ? null : row.getListBoxRowStruct()); 591 } 592 593 int[string] connectedSignals; 594 595 void delegate(ListBox)[] onActivateCursorRowListeners; 596 /** */ 597 void addOnActivateCursorRow(void delegate(ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 598 { 599 if ( "activate-cursor-row" !in connectedSignals ) 600 { 601 Signals.connectData( 602 this, 603 "activate-cursor-row", 604 cast(GCallback)&callBackActivateCursorRow, 605 cast(void*)this, 606 null, 607 connectFlags); 608 connectedSignals["activate-cursor-row"] = 1; 609 } 610 onActivateCursorRowListeners ~= dlg; 611 } 612 extern(C) static void callBackActivateCursorRow(GtkListBox* listboxStruct, ListBox _listbox) 613 { 614 foreach ( void delegate(ListBox) dlg; _listbox.onActivateCursorRowListeners ) 615 { 616 dlg(_listbox); 617 } 618 } 619 620 void delegate(GtkMovementStep, int, ListBox)[] onMoveCursorListeners; 621 /** */ 622 void addOnMoveCursor(void delegate(GtkMovementStep, int, ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 623 { 624 if ( "move-cursor" !in connectedSignals ) 625 { 626 Signals.connectData( 627 this, 628 "move-cursor", 629 cast(GCallback)&callBackMoveCursor, 630 cast(void*)this, 631 null, 632 connectFlags); 633 connectedSignals["move-cursor"] = 1; 634 } 635 onMoveCursorListeners ~= dlg; 636 } 637 extern(C) static void callBackMoveCursor(GtkListBox* listboxStruct, GtkMovementStep object, int p0, ListBox _listbox) 638 { 639 foreach ( void delegate(GtkMovementStep, int, ListBox) dlg; _listbox.onMoveCursorListeners ) 640 { 641 dlg(object, p0, _listbox); 642 } 643 } 644 645 void delegate(ListBoxRow, ListBox)[] onRowActivatedListeners; 646 /** 647 * The ::row-activated signal is emitted when a row has been activated by the user. 648 * 649 * Params: 650 * row = the activated row 651 * 652 * Since: 3.10 653 */ 654 void addOnRowActivated(void delegate(ListBoxRow, ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 655 { 656 if ( "row-activated" !in connectedSignals ) 657 { 658 Signals.connectData( 659 this, 660 "row-activated", 661 cast(GCallback)&callBackRowActivated, 662 cast(void*)this, 663 null, 664 connectFlags); 665 connectedSignals["row-activated"] = 1; 666 } 667 onRowActivatedListeners ~= dlg; 668 } 669 extern(C) static void callBackRowActivated(GtkListBox* listboxStruct, GtkListBoxRow* row, ListBox _listbox) 670 { 671 foreach ( void delegate(ListBoxRow, ListBox) dlg; _listbox.onRowActivatedListeners ) 672 { 673 dlg(ObjectG.getDObject!(ListBoxRow)(row), _listbox); 674 } 675 } 676 677 void delegate(ListBoxRow, ListBox)[] onRowSelectedListeners; 678 /** 679 * The ::row-selected signal is emitted when a new row is selected, or 680 * (with a %NULL @row) when the selection is cleared. 681 * 682 * When the @box is using #GTK_SELECTION_MULTIPLE, this signal will not 683 * give you the full picture of selection changes, and you should use 684 * the #GtkListBox::selected-rows-changed signal instead. 685 * 686 * Params: 687 * row = the selected row 688 * 689 * Since: 3.10 690 */ 691 void addOnRowSelected(void delegate(ListBoxRow, ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 692 { 693 if ( "row-selected" !in connectedSignals ) 694 { 695 Signals.connectData( 696 this, 697 "row-selected", 698 cast(GCallback)&callBackRowSelected, 699 cast(void*)this, 700 null, 701 connectFlags); 702 connectedSignals["row-selected"] = 1; 703 } 704 onRowSelectedListeners ~= dlg; 705 } 706 extern(C) static void callBackRowSelected(GtkListBox* listboxStruct, GtkListBoxRow* row, ListBox _listbox) 707 { 708 foreach ( void delegate(ListBoxRow, ListBox) dlg; _listbox.onRowSelectedListeners ) 709 { 710 dlg(ObjectG.getDObject!(ListBoxRow)(row), _listbox); 711 } 712 } 713 714 void delegate(ListBox)[] onSelectAllListeners; 715 /** 716 * The ::select-all signal is a [keybinding signal][GtkBindingSignal] 717 * which gets emitted to select all children of the box, if the selection 718 * mode permits it. 719 * 720 * The default bindings for this signal is Ctrl-a. 721 * 722 * Since: 3.14 723 */ 724 void addOnSelectAll(void delegate(ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 725 { 726 if ( "select-all" !in connectedSignals ) 727 { 728 Signals.connectData( 729 this, 730 "select-all", 731 cast(GCallback)&callBackSelectAll, 732 cast(void*)this, 733 null, 734 connectFlags); 735 connectedSignals["select-all"] = 1; 736 } 737 onSelectAllListeners ~= dlg; 738 } 739 extern(C) static void callBackSelectAll(GtkListBox* listboxStruct, ListBox _listbox) 740 { 741 foreach ( void delegate(ListBox) dlg; _listbox.onSelectAllListeners ) 742 { 743 dlg(_listbox); 744 } 745 } 746 747 void delegate(ListBox)[] onSelectedRowsChangedListeners; 748 /** 749 * The ::selected-rows-changed signal is emitted when the 750 * set of selected rows changes. 751 * 752 * Since: 3.14 753 */ 754 void addOnSelectedRowsChanged(void delegate(ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 755 { 756 if ( "selected-rows-changed" !in connectedSignals ) 757 { 758 Signals.connectData( 759 this, 760 "selected-rows-changed", 761 cast(GCallback)&callBackSelectedRowsChanged, 762 cast(void*)this, 763 null, 764 connectFlags); 765 connectedSignals["selected-rows-changed"] = 1; 766 } 767 onSelectedRowsChangedListeners ~= dlg; 768 } 769 extern(C) static void callBackSelectedRowsChanged(GtkListBox* listboxStruct, ListBox _listbox) 770 { 771 foreach ( void delegate(ListBox) dlg; _listbox.onSelectedRowsChangedListeners ) 772 { 773 dlg(_listbox); 774 } 775 } 776 777 void delegate(ListBox)[] onToggleCursorRowListeners; 778 /** */ 779 void addOnToggleCursorRow(void delegate(ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 780 { 781 if ( "toggle-cursor-row" !in connectedSignals ) 782 { 783 Signals.connectData( 784 this, 785 "toggle-cursor-row", 786 cast(GCallback)&callBackToggleCursorRow, 787 cast(void*)this, 788 null, 789 connectFlags); 790 connectedSignals["toggle-cursor-row"] = 1; 791 } 792 onToggleCursorRowListeners ~= dlg; 793 } 794 extern(C) static void callBackToggleCursorRow(GtkListBox* listboxStruct, ListBox _listbox) 795 { 796 foreach ( void delegate(ListBox) dlg; _listbox.onToggleCursorRowListeners ) 797 { 798 dlg(_listbox); 799 } 800 } 801 802 void delegate(ListBox)[] onUnselectAllListeners; 803 /** 804 * The ::unselect-all signal is a [keybinding signal][GtkBindingSignal] 805 * which gets emitted to unselect all children of the box, if the selection 806 * mode permits it. 807 * 808 * The default bindings for this signal is Ctrl-Shift-a. 809 * 810 * Since: 3.14 811 */ 812 void addOnUnselectAll(void delegate(ListBox) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 813 { 814 if ( "unselect-all" !in connectedSignals ) 815 { 816 Signals.connectData( 817 this, 818 "unselect-all", 819 cast(GCallback)&callBackUnselectAll, 820 cast(void*)this, 821 null, 822 connectFlags); 823 connectedSignals["unselect-all"] = 1; 824 } 825 onUnselectAllListeners ~= dlg; 826 } 827 extern(C) static void callBackUnselectAll(GtkListBox* listboxStruct, ListBox _listbox) 828 { 829 foreach ( void delegate(ListBox) dlg; _listbox.onUnselectAllListeners ) 830 { 831 dlg(_listbox); 832 } 833 } 834 }