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