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.ScrolledWindow; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gobject.Signals; 30 private import gtk.Adjustment; 31 private import gtk.Bin; 32 private import gtk.Widget; 33 public import gtkc.gdktypes; 34 private import gtkc.gtk; 35 public import gtkc.gtktypes; 36 37 38 /** 39 * GtkScrolledWindow is a #GtkBin subclass: it’s a container 40 * the accepts a single child widget. GtkScrolledWindow adds scrollbars 41 * to the child widget and optionally draws a beveled frame around the 42 * child widget. 43 * 44 * The scrolled window can work in two ways. Some widgets have native 45 * scrolling support; these widgets implement the #GtkScrollable interface. 46 * Widgets with native scroll support include #GtkTreeView, #GtkTextView, 47 * and #GtkLayout. 48 * 49 * For widgets that lack native scrolling support, the #GtkViewport 50 * widget acts as an adaptor class, implementing scrollability for child 51 * widgets that lack their own scrolling capabilities. Use #GtkViewport 52 * to scroll child widgets such as #GtkGrid, #GtkBox, and so on. 53 * 54 * If a widget has native scrolling abilities, it can be added to the 55 * GtkScrolledWindow with gtk_container_add(). If a widget does not, you 56 * must first add the widget to a #GtkViewport, then add the #GtkViewport 57 * to the scrolled window. gtk_container_add() will do this for you for 58 * widgets that don’t implement #GtkScrollable natively, so you can 59 * ignore the presence of the viewport. 60 * 61 * The position of the scrollbars is controlled by the scroll adjustments. 62 * See #GtkAdjustment for the fields in an adjustment — for 63 * #GtkScrollbar, used by GtkScrolledWindow, the “value” field 64 * represents the position of the scrollbar, which must be between the 65 * “lower” field and “upper - page_size.” The “page_size” field 66 * represents the size of the visible scrollable area. The 67 * “step_increment” and “page_increment” fields are used when the user 68 * asks to step down (using the small stepper arrows) or page down (using 69 * for example the PageDown key). 70 * 71 * If a GtkScrolledWindow doesn’t behave quite as you would like, or 72 * doesn’t have exactly the right layout, it’s very possible to set up 73 * your own scrolling with #GtkScrollbar and for example a #GtkGrid. 74 * 75 * # Touch support 76 * 77 * GtkScrolledWindow has built-in support for touch devices. When a 78 * touchscreen is used, swiping will move the scrolled window, and will 79 * expose 'kinetic' behavior. This can be turned off with the 80 * #GtkScrolledWindow:kinetic-scrolling property if it is undesired. 81 * 82 * GtkScrolledWindow also displays visual 'overshoot' indication when 83 * the content is pulled beyond the end, and this situation can be 84 * captured with the #GtkScrolledWindow::edge-overshot signal. 85 * 86 * If no mouse device is present, the scrollbars will overlayed as 87 * narrow, auto-hiding indicators over the content. If traditional 88 * scrollbars are desired although no mouse is present, this behaviour 89 * can be turned off with the #GtkScrolledWindow:overlay-scrolling 90 * property. 91 * 92 * # CSS nodes 93 * 94 * GtkScrolledWindow has a main CSS node with name scrolledwindow. 95 * 96 * It uses subnodes with names overshoot and undershoot to 97 * draw the overflow and underflow indications. These nodes get 98 * the .left, .right, .top or .bottom style class added depending 99 * on where the indication is drawn. 100 * 101 * GtkScrolledWindow also sets the positional style classes (.left, 102 * .right, .top, .bottom) and style classes related to overlay 103 * scrolling (.overlay-indicator, .dragging, .hovering) on its scrollbars. 104 * 105 * If both scrollbars are visible, the area where they meet is drawn 106 * with a subnode named junction. 107 */ 108 public class ScrolledWindow : Bin 109 { 110 /** the main Gtk struct */ 111 protected GtkScrolledWindow* gtkScrolledWindow; 112 113 /** Get the main Gtk struct */ 114 public GtkScrolledWindow* getScrolledWindowStruct() 115 { 116 return gtkScrolledWindow; 117 } 118 119 /** the main Gtk struct as a void* */ 120 protected override void* getStruct() 121 { 122 return cast(void*)gtkScrolledWindow; 123 } 124 125 protected override void setStruct(GObject* obj) 126 { 127 gtkScrolledWindow = cast(GtkScrolledWindow*)obj; 128 super.setStruct(obj); 129 } 130 131 /** 132 * Sets our main struct and passes it to the parent class. 133 */ 134 public this (GtkScrolledWindow* gtkScrolledWindow, bool ownedRef = false) 135 { 136 this.gtkScrolledWindow = gtkScrolledWindow; 137 super(cast(GtkBin*)gtkScrolledWindow, ownedRef); 138 } 139 140 /** */ 141 public this() 142 { 143 this(null, null); 144 } 145 146 /** */ 147 public this(Widget widget) 148 { 149 this(); 150 add(widget); 151 } 152 153 /** 154 * Creates a new Scrolled window and set the policy type 155 * Params: 156 * hPolicy = the horizontal policy 157 * vPolicy = the vertical policy 158 */ 159 this(PolicyType hPolicy, PolicyType vPolicy) 160 { 161 this(); 162 setPolicy(hPolicy, vPolicy); 163 } 164 165 /** 166 */ 167 168 /** */ 169 public static GType getType() 170 { 171 return gtk_scrolled_window_get_type(); 172 } 173 174 /** 175 * Creates a new scrolled window. 176 * 177 * The two arguments are the scrolled window’s adjustments; these will be 178 * shared with the scrollbars and the child widget to keep the bars in sync 179 * with the child. Usually you want to pass %NULL for the adjustments, which 180 * will cause the scrolled window to create them for you. 181 * 182 * Params: 183 * hadjustment = horizontal adjustment 184 * vadjustment = vertical adjustment 185 * 186 * Return: a new scrolled window 187 * 188 * Throws: ConstructionException GTK+ fails to create the object. 189 */ 190 public this(Adjustment hadjustment, Adjustment vadjustment) 191 { 192 auto p = gtk_scrolled_window_new((hadjustment is null) ? null : hadjustment.getAdjustmentStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 193 194 if(p is null) 195 { 196 throw new ConstructionException("null returned by new"); 197 } 198 199 this(cast(GtkScrolledWindow*) p); 200 } 201 202 /** 203 * Used to add children without native scrolling capabilities. This 204 * is simply a convenience function; it is equivalent to adding the 205 * unscrollable child to a viewport, then adding the viewport to the 206 * scrolled window. If a child has native scrolling, use 207 * gtk_container_add() instead of this function. 208 * 209 * The viewport scrolls the child by moving its #GdkWindow, and takes 210 * the size of the child to be the size of its toplevel #GdkWindow. 211 * This will be very wrong for most widgets that support native scrolling; 212 * for example, if you add a widget such as #GtkTreeView with a viewport, 213 * the whole widget will scroll, including the column headings. Thus, 214 * widgets with native scrolling support should not be used with the 215 * #GtkViewport proxy. 216 * 217 * A widget supports scrolling natively if it implements the 218 * #GtkScrollable interface. 219 * 220 * Deprecated: gtk_container_add() will automatically add 221 * a #GtkViewport if the child doesn’t implement #GtkScrollable. 222 * 223 * Params: 224 * child = the widget you want to scroll 225 */ 226 public void addWithViewport(Widget child) 227 { 228 gtk_scrolled_window_add_with_viewport(gtkScrolledWindow, (child is null) ? null : child.getWidgetStruct()); 229 } 230 231 /** 232 * Return whether button presses are captured during kinetic 233 * scrolling. See gtk_scrolled_window_set_capture_button_press(). 234 * 235 * Return: %TRUE if button presses are captured during kinetic scrolling 236 * 237 * Since: 3.4 238 */ 239 public bool getCaptureButtonPress() 240 { 241 return gtk_scrolled_window_get_capture_button_press(gtkScrolledWindow) != 0; 242 } 243 244 /** 245 * Returns the horizontal scrollbar’s adjustment, used to connect the 246 * horizontal scrollbar to the child widget’s horizontal scroll 247 * functionality. 248 * 249 * Return: the horizontal #GtkAdjustment 250 */ 251 public Adjustment getHadjustment() 252 { 253 auto p = gtk_scrolled_window_get_hadjustment(gtkScrolledWindow); 254 255 if(p is null) 256 { 257 return null; 258 } 259 260 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 261 } 262 263 /** 264 * Returns the horizontal scrollbar of @scrolled_window. 265 * 266 * Return: the horizontal scrollbar of the scrolled window. 267 * 268 * Since: 2.8 269 */ 270 public Widget getHscrollbar() 271 { 272 auto p = gtk_scrolled_window_get_hscrollbar(gtkScrolledWindow); 273 274 if(p is null) 275 { 276 return null; 277 } 278 279 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 280 } 281 282 /** 283 * Returns the specified kinetic scrolling behavior. 284 * 285 * Return: the scrolling behavior flags. 286 * 287 * Since: 3.4 288 */ 289 public bool getKineticScrolling() 290 { 291 return gtk_scrolled_window_get_kinetic_scrolling(gtkScrolledWindow) != 0; 292 } 293 294 /** 295 * Gets the minimal content height of @scrolled_window, or -1 if not set. 296 * 297 * Return: the minimal content height 298 * 299 * Since: 3.0 300 */ 301 public int getMinContentHeight() 302 { 303 return gtk_scrolled_window_get_min_content_height(gtkScrolledWindow); 304 } 305 306 /** 307 * Gets the minimum content width of @scrolled_window, or -1 if not set. 308 * 309 * Return: the minimum content width 310 * 311 * Since: 3.0 312 */ 313 public int getMinContentWidth() 314 { 315 return gtk_scrolled_window_get_min_content_width(gtkScrolledWindow); 316 } 317 318 /** 319 * Returns whether overlay scrolling is enabled for this scrolled window. 320 * 321 * Return: %TRUE if overlay scrolling is enabled 322 * 323 * Since: 3.16 324 */ 325 public bool getOverlayScrolling() 326 { 327 return gtk_scrolled_window_get_overlay_scrolling(gtkScrolledWindow) != 0; 328 } 329 330 /** 331 * Gets the placement of the contents with respect to the scrollbars 332 * for the scrolled window. See gtk_scrolled_window_set_placement(). 333 * 334 * Return: the current placement value. 335 * 336 * See also gtk_scrolled_window_set_placement() and 337 * gtk_scrolled_window_unset_placement(). 338 */ 339 public GtkCornerType getPlacement() 340 { 341 return gtk_scrolled_window_get_placement(gtkScrolledWindow); 342 } 343 344 /** 345 * Retrieves the current policy values for the horizontal and vertical 346 * scrollbars. See gtk_scrolled_window_set_policy(). 347 * 348 * Params: 349 * hscrollbarPolicy = location to store the policy 350 * for the horizontal scrollbar, or %NULL 351 * vscrollbarPolicy = location to store the policy 352 * for the vertical scrollbar, or %NULL 353 */ 354 public void getPolicy(out GtkPolicyType hscrollbarPolicy, out GtkPolicyType vscrollbarPolicy) 355 { 356 gtk_scrolled_window_get_policy(gtkScrolledWindow, &hscrollbarPolicy, &vscrollbarPolicy); 357 } 358 359 /** 360 * Gets the shadow type of the scrolled window. See 361 * gtk_scrolled_window_set_shadow_type(). 362 * 363 * Return: the current shadow type 364 */ 365 public GtkShadowType getShadowType() 366 { 367 return gtk_scrolled_window_get_shadow_type(gtkScrolledWindow); 368 } 369 370 /** 371 * Returns the vertical scrollbar’s adjustment, used to connect the 372 * vertical scrollbar to the child widget’s vertical scroll functionality. 373 * 374 * Return: the vertical #GtkAdjustment 375 */ 376 public Adjustment getVadjustment() 377 { 378 auto p = gtk_scrolled_window_get_vadjustment(gtkScrolledWindow); 379 380 if(p is null) 381 { 382 return null; 383 } 384 385 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p); 386 } 387 388 /** 389 * Returns the vertical scrollbar of @scrolled_window. 390 * 391 * Return: the vertical scrollbar of the scrolled window. 392 * 393 * Since: 2.8 394 */ 395 public Widget getVscrollbar() 396 { 397 auto p = gtk_scrolled_window_get_vscrollbar(gtkScrolledWindow); 398 399 if(p is null) 400 { 401 return null; 402 } 403 404 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 405 } 406 407 /** 408 * Changes the behaviour of @scrolled_window wrt. to the initial 409 * event that possibly starts kinetic scrolling. When @capture_button_press 410 * is set to %TRUE, the event is captured by the scrolled window, and 411 * then later replayed if it is meant to go to the child widget. 412 * 413 * This should be enabled if any child widgets perform non-reversible 414 * actions on #GtkWidget::button-press-event. If they don't, and handle 415 * additionally handle #GtkWidget::grab-broken-event, it might be better 416 * to set @capture_button_press to %FALSE. 417 * 418 * This setting only has an effect if kinetic scrolling is enabled. 419 * 420 * Params: 421 * captureButtonPress = %TRUE to capture button presses 422 * 423 * Since: 3.4 424 */ 425 public void setCaptureButtonPress(bool captureButtonPress) 426 { 427 gtk_scrolled_window_set_capture_button_press(gtkScrolledWindow, captureButtonPress); 428 } 429 430 /** 431 * Sets the #GtkAdjustment for the horizontal scrollbar. 432 * 433 * Params: 434 * hadjustment = horizontal scroll adjustment 435 */ 436 public void setHadjustment(Adjustment hadjustment) 437 { 438 gtk_scrolled_window_set_hadjustment(gtkScrolledWindow, (hadjustment is null) ? null : hadjustment.getAdjustmentStruct()); 439 } 440 441 /** 442 * Turns kinetic scrolling on or off. 443 * Kinetic scrolling only applies to devices with source 444 * %GDK_SOURCE_TOUCHSCREEN. 445 * 446 * Params: 447 * kineticScrolling = %TRUE to enable kinetic scrolling 448 * 449 * Since: 3.4 450 */ 451 public void setKineticScrolling(bool kineticScrolling) 452 { 453 gtk_scrolled_window_set_kinetic_scrolling(gtkScrolledWindow, kineticScrolling); 454 } 455 456 /** 457 * Sets the minimum height that @scrolled_window should keep visible. 458 * Note that this can and (usually will) be smaller than the minimum 459 * size of the content. 460 * 461 * Params: 462 * height = the minimal content height 463 * 464 * Since: 3.0 465 */ 466 public void setMinContentHeight(int height) 467 { 468 gtk_scrolled_window_set_min_content_height(gtkScrolledWindow, height); 469 } 470 471 /** 472 * Sets the minimum width that @scrolled_window should keep visible. 473 * Note that this can and (usually will) be smaller than the minimum 474 * size of the content. 475 * 476 * Params: 477 * width = the minimal content width 478 * 479 * Since: 3.0 480 */ 481 public void setMinContentWidth(int width) 482 { 483 gtk_scrolled_window_set_min_content_width(gtkScrolledWindow, width); 484 } 485 486 /** 487 * Enables or disables overlay scrolling for this scrolled window. 488 * 489 * Params: 490 * overlayScrolling = whether to enable overlay scrolling 491 * 492 * Since: 3.16 493 */ 494 public void setOverlayScrolling(bool overlayScrolling) 495 { 496 gtk_scrolled_window_set_overlay_scrolling(gtkScrolledWindow, overlayScrolling); 497 } 498 499 /** 500 * Sets the placement of the contents with respect to the scrollbars 501 * for the scrolled window. 502 * 503 * The default is %GTK_CORNER_TOP_LEFT, meaning the child is 504 * in the top left, with the scrollbars underneath and to the right. 505 * Other values in #GtkCornerType are %GTK_CORNER_TOP_RIGHT, 506 * %GTK_CORNER_BOTTOM_LEFT, and %GTK_CORNER_BOTTOM_RIGHT. 507 * 508 * See also gtk_scrolled_window_get_placement() and 509 * gtk_scrolled_window_unset_placement(). 510 * 511 * Params: 512 * windowPlacement = position of the child window 513 */ 514 public void setPlacement(GtkCornerType windowPlacement) 515 { 516 gtk_scrolled_window_set_placement(gtkScrolledWindow, windowPlacement); 517 } 518 519 /** 520 * Sets the scrollbar policy for the horizontal and vertical scrollbars. 521 * 522 * The policy determines when the scrollbar should appear; it is a value 523 * from the #GtkPolicyType enumeration. If %GTK_POLICY_ALWAYS, the 524 * scrollbar is always present; if %GTK_POLICY_NEVER, the scrollbar is 525 * never present; if %GTK_POLICY_AUTOMATIC, the scrollbar is present only 526 * if needed (that is, if the slider part of the bar would be smaller 527 * than the trough — the display is larger than the page size). 528 * 529 * Params: 530 * hscrollbarPolicy = policy for horizontal bar 531 * vscrollbarPolicy = policy for vertical bar 532 */ 533 public void setPolicy(GtkPolicyType hscrollbarPolicy, GtkPolicyType vscrollbarPolicy) 534 { 535 gtk_scrolled_window_set_policy(gtkScrolledWindow, hscrollbarPolicy, vscrollbarPolicy); 536 } 537 538 /** 539 * Changes the type of shadow drawn around the contents of 540 * @scrolled_window. 541 * 542 * Params: 543 * type = kind of shadow to draw around scrolled window contents 544 */ 545 public void setShadowType(GtkShadowType type) 546 { 547 gtk_scrolled_window_set_shadow_type(gtkScrolledWindow, type); 548 } 549 550 /** 551 * Sets the #GtkAdjustment for the vertical scrollbar. 552 * 553 * Params: 554 * vadjustment = vertical scroll adjustment 555 */ 556 public void setVadjustment(Adjustment vadjustment) 557 { 558 gtk_scrolled_window_set_vadjustment(gtkScrolledWindow, (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 559 } 560 561 /** 562 * Unsets the placement of the contents with respect to the scrollbars 563 * for the scrolled window. If no window placement is set for a scrolled 564 * window, it defaults to %GTK_CORNER_TOP_LEFT. 565 * 566 * See also gtk_scrolled_window_set_placement() and 567 * gtk_scrolled_window_get_placement(). 568 * 569 * Since: 2.10 570 */ 571 public void unsetPlacement() 572 { 573 gtk_scrolled_window_unset_placement(gtkScrolledWindow); 574 } 575 576 int[string] connectedSignals; 577 578 void delegate(GtkPositionType, ScrolledWindow)[] onEdgeOvershotListeners; 579 /** 580 * The ::edge-overshot signal is emitted whenever user initiated scrolling 581 * makes the scrolledwindow firmly surpass (ie. with some edge resistance) 582 * the lower or upper limits defined by the adjustment in that orientation. 583 * 584 * A similar behavior without edge resistance is provided by the 585 * #GtkScrolledWindow::edge-reached signal. 586 * 587 * Note: The @pos argument is LTR/RTL aware, so callers should be aware too 588 * if intending to provide behavior on horizontal edges. 589 * 590 * Params: 591 * pos = edge side that was hit 592 * 593 * Since: 3.16 594 */ 595 void addOnEdgeOvershot(void delegate(GtkPositionType, ScrolledWindow) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 596 { 597 if ( "edge-overshot" !in connectedSignals ) 598 { 599 Signals.connectData( 600 this, 601 "edge-overshot", 602 cast(GCallback)&callBackEdgeOvershot, 603 cast(void*)this, 604 null, 605 connectFlags); 606 connectedSignals["edge-overshot"] = 1; 607 } 608 onEdgeOvershotListeners ~= dlg; 609 } 610 extern(C) static void callBackEdgeOvershot(GtkScrolledWindow* scrolledwindowStruct, GtkPositionType pos, ScrolledWindow _scrolledwindow) 611 { 612 foreach ( void delegate(GtkPositionType, ScrolledWindow) dlg; _scrolledwindow.onEdgeOvershotListeners ) 613 { 614 dlg(pos, _scrolledwindow); 615 } 616 } 617 618 void delegate(GtkPositionType, ScrolledWindow)[] onEdgeReachedListeners; 619 /** 620 * The ::edge-reached signal is emitted whenever user-initiated scrolling 621 * makes the scrolledwindow exactly reaches the lower or upper limits 622 * defined by the adjustment in that orientation. 623 * 624 * A similar behavior with edge resistance is provided by the 625 * #GtkScrolledWindow::edge-overshot signal. 626 * 627 * Note: The @pos argument is LTR/RTL aware, so callers should be aware too 628 * if intending to provide behavior on horizontal edges. 629 * 630 * Params: 631 * pos = edge side that was reached 632 * 633 * Since: 3.16 634 */ 635 void addOnEdgeReached(void delegate(GtkPositionType, ScrolledWindow) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 636 { 637 if ( "edge-reached" !in connectedSignals ) 638 { 639 Signals.connectData( 640 this, 641 "edge-reached", 642 cast(GCallback)&callBackEdgeReached, 643 cast(void*)this, 644 null, 645 connectFlags); 646 connectedSignals["edge-reached"] = 1; 647 } 648 onEdgeReachedListeners ~= dlg; 649 } 650 extern(C) static void callBackEdgeReached(GtkScrolledWindow* scrolledwindowStruct, GtkPositionType pos, ScrolledWindow _scrolledwindow) 651 { 652 foreach ( void delegate(GtkPositionType, ScrolledWindow) dlg; _scrolledwindow.onEdgeReachedListeners ) 653 { 654 dlg(pos, _scrolledwindow); 655 } 656 } 657 658 void delegate(GtkDirectionType, ScrolledWindow)[] onMoveFocusOutListeners; 659 /** 660 * The ::move-focus-out signal is a 661 * [keybinding signal][GtkBindingSignal] which gets 662 * emitted when focus is moved away from the scrolled window by a 663 * keybinding. The #GtkWidget::move-focus signal is emitted with 664 * @direction_type on this scrolled windows toplevel parent in the 665 * container hierarchy. The default bindings for this signal are 666 * `Tab + Ctrl` and `Tab + Ctrl + Shift`. 667 * 668 * Params: 669 * directionType = either %GTK_DIR_TAB_FORWARD or 670 * %GTK_DIR_TAB_BACKWARD 671 */ 672 void addOnMoveFocusOut(void delegate(GtkDirectionType, ScrolledWindow) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 673 { 674 if ( "move-focus-out" !in connectedSignals ) 675 { 676 Signals.connectData( 677 this, 678 "move-focus-out", 679 cast(GCallback)&callBackMoveFocusOut, 680 cast(void*)this, 681 null, 682 connectFlags); 683 connectedSignals["move-focus-out"] = 1; 684 } 685 onMoveFocusOutListeners ~= dlg; 686 } 687 extern(C) static void callBackMoveFocusOut(GtkScrolledWindow* scrolledwindowStruct, GtkDirectionType directionType, ScrolledWindow _scrolledwindow) 688 { 689 foreach ( void delegate(GtkDirectionType, ScrolledWindow) dlg; _scrolledwindow.onMoveFocusOutListeners ) 690 { 691 dlg(directionType, _scrolledwindow); 692 } 693 } 694 695 bool delegate(GtkScrollType, bool, ScrolledWindow)[] onScrollChildListeners; 696 /** 697 * The ::scroll-child signal is a 698 * [keybinding signal][GtkBindingSignal] 699 * which gets emitted when a keybinding that scrolls is pressed. 700 * The horizontal or vertical adjustment is updated which triggers a 701 * signal that the scrolled windows child may listen to and scroll itself. 702 * 703 * Params: 704 * scroll = a #GtkScrollType describing how much to scroll 705 * horizontal = whether the keybinding scrolls the child 706 * horizontally or not 707 */ 708 void addOnScrollChild(bool delegate(GtkScrollType, bool, ScrolledWindow) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 709 { 710 if ( "scroll-child" !in connectedSignals ) 711 { 712 Signals.connectData( 713 this, 714 "scroll-child", 715 cast(GCallback)&callBackScrollChild, 716 cast(void*)this, 717 null, 718 connectFlags); 719 connectedSignals["scroll-child"] = 1; 720 } 721 onScrollChildListeners ~= dlg; 722 } 723 extern(C) static int callBackScrollChild(GtkScrolledWindow* scrolledwindowStruct, GtkScrollType scroll, bool horizontal, ScrolledWindow _scrolledwindow) 724 { 725 foreach ( bool delegate(GtkScrollType, bool, ScrolledWindow) dlg; _scrolledwindow.onScrollChildListeners ) 726 { 727 if ( dlg(scroll, horizontal, _scrolledwindow) ) 728 { 729 return 1; 730 } 731 } 732 733 return 0; 734 } 735 }