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