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