Class: Gtk::ScrolledWindow

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#add_with_viewport(child) ⇒ nil

Used to add children without native scrolling capabilities. This is simply a convenience function; it is equivalent to adding the unscrollable child to a viewport, then adding the viewport to the scrolled window. If a child has native scrolling, use gtk_container_add() instead of this function.

The viewport scrolls the child by moving its Gdk::Window, and takes the size of the child to be the size of its toplevel Gdk::Window. This will be very wrong for most widgets that support native scrolling; for example, if you add a widget such as Gtk::TreeView with a viewport, the whole widget will scroll, including the column headings. Thus, widgets with native scrolling support should not be used with the Gtk::Viewport proxy.

A widget supports scrolling natively if it implements the Gtk::Scrollable interface.

Parameters:

  • child (Gtk::Widget)

    the widget you want to scroll

Returns:

  • (nil)

#capture_button_pressTrueClass

Return whether button presses are captured during kinetic scrolling. See gtk_scrolled_window_set_capture_button_press().

Returns:

  • (TrueClass)

    true if button presses are captured during kinetic scrolling

#capture_button_press=(capture_button_press) ⇒ nil

Changes the behaviour of scrolled_window with regard to the initial event that possibly starts kinetic scrolling. When capture_button_press is set to true, the event is captured by the scrolled window, and then later replayed if it is meant to go to the child widget.

This should be enabled if any child widgets perform non-reversible actions on Gtk::Widget::button-press-event. If they don’t, and handle additionally handle Gtk::Widget::grab-broken-event, it might be better to set capture_button_press to false.

This setting only has an effect if kinetic scrolling is enabled.

Parameters:

  • capture_button_press (TrueClass)

    true to capture button presses

Returns:

  • (nil)

#get_policy(hscrollbar_policy, vscrollbar_policy) ⇒ nil

Retrieves the current policy values for the horizontal and vertical scrollbars. See gtk_scrolled_window_set_policy().

Parameters:

  • hscrollbar_policy (Gtk::PolicyType)

    location to store the policy for the horizontal scrollbar, or nil

  • vscrollbar_policy (Gtk::PolicyType)

    location to store the policy for the vertical scrollbar, or nil

Returns:

  • (nil)

#hadjustmentGtk::Adjustment

Returns hadjustment.

Returns:

#hadjustment=(hadjustment) ⇒ Gtk::Adjustment

Parameters:

Returns:

#hscrollbarGtk::Widget

Returns the horizontal scrollbar of scrolled_window.

Returns:

  • (Gtk::Widget)

    the horizontal scrollbar of the scrolled window.

#hscrollbar_policyGtk::PolicyType

Returns hscrollbar-policy.

Returns:

#hscrollbar_policy=(hscrollbar_policy) ⇒ Gtk::PolicyType

Parameters:

Returns:

#kinetic_scrollingTrueClass

Returns the specified kinetic scrolling behavior.

Returns:

  • (TrueClass)

    the scrolling behavior flags.

#kinetic_scrolling=(kinetic_scrolling) ⇒ TrueClass

Whether kinetic scrolling is enabled or not. Kinetic scrolling only applies to devices with source %GDK_SOURCE_TOUCHSCREEN.

Parameters:

  • kinetic_scrolling (TrueClass)

Returns:

  • (TrueClass)

    kinetic-scrolling

  • (TrueClass)

    kinetic-scrolling

#kinetic_scrolling?TrueClass

Whether kinetic scrolling is enabled or not. Kinetic scrolling only applies to devices with source %GDK_SOURCE_TOUCHSCREEN.

Returns:

  • (TrueClass)

    kinetic-scrolling

#max_content_heightInteger

The maximum content height of scrolled_window, or -1 if not set.

Returns:

  • (Integer)

    max-content-height

#max_content_height=(max_content_height) ⇒ Integer

The maximum content height of scrolled_window, or -1 if not set.

Parameters:

  • max_content_height (Integer)

Returns:

  • (Integer)

    max-content-height

  • (Integer)

    max-content-height

#max_content_widthInteger

The maximum content width of scrolled_window, or -1 if not set.

Returns:

  • (Integer)

    max-content-width

#max_content_width=(max_content_width) ⇒ Integer

The maximum content width of scrolled_window, or -1 if not set.

Parameters:

  • max_content_width (Integer)

Returns:

  • (Integer)

    max-content-width

  • (Integer)

    max-content-width

#min_content_heightInteger

The minimum content height of scrolled_window, or -1 if not set.

Returns:

  • (Integer)

    min-content-height

#min_content_height=(min_content_height) ⇒ Integer

The minimum content height of scrolled_window, or -1 if not set.

Parameters:

  • min_content_height (Integer)

Returns:

  • (Integer)

    min-content-height

  • (Integer)

    min-content-height

#min_content_widthInteger

The minimum content width of scrolled_window, or -1 if not set.

Returns:

  • (Integer)

    min-content-width

#min_content_width=(min_content_width) ⇒ Integer

The minimum content width of scrolled_window, or -1 if not set.

Parameters:

  • min_content_width (Integer)

Returns:

  • (Integer)

    min-content-width

  • (Integer)

    min-content-width

#new(hadjustment, vadjustment) ⇒ Gtk::Widget

Creates a new scrolled window.

The two arguments are the scrolled window’s adjustments; these will be shared with the scrollbars and the child widget to keep the bars in sync with the child. Usually you want to pass nil for the adjustments, which will cause the scrolled window to create them for you.

Parameters:

Returns:

#overlay_scrollingTrueClass

Returns whether overlay scrolling is enabled for this scrolled window.

Returns:

  • (TrueClass)

    true if overlay scrolling is enabled

#overlay_scrolling=(overlay_scrolling) ⇒ TrueClass

Whether overlay scrolling is enabled or not. If it is, the scrollbars are only added as traditional widgets when a mouse is present. Otherwise, they are overlayed on top of the content, as narrow indicators.

Note that overlay scrolling can also be globally disabled, with the Gtk::Settings::gtk-overlay-scrolling setting.

Parameters:

  • overlay_scrolling (TrueClass)

Returns:

  • (TrueClass)

    overlay-scrolling

  • (TrueClass)

    overlay-scrolling

#overlay_scrolling?TrueClass

Whether overlay scrolling is enabled or not. If it is, the scrollbars are only added as traditional widgets when a mouse is present. Otherwise, they are overlayed on top of the content, as narrow indicators.

Note that overlay scrolling can also be globally disabled, with the Gtk::Settings::gtk-overlay-scrolling setting.

Returns:

  • (TrueClass)

    overlay-scrolling

#placementGtk::CornerType

Gets the placement of the contents with respect to the scrollbars for the scrolled window. See gtk_scrolled_window_set_placement(). See also gtk_scrolled_window_set_placement() and gtk_scrolled_window_unset_placement().

Returns:

#placement=(window_placement) ⇒ nil

Sets the placement of the contents with respect to the scrollbars for the scrolled window.

The default is %GTK_CORNER_TOP_LEFT, meaning the child is in the top left, with the scrollbars underneath and to the right. Other values in Gtk::CornerType are %GTK_CORNER_TOP_RIGHT, %GTK_CORNER_BOTTOM_LEFT, and %GTK_CORNER_BOTTOM_RIGHT.

See also gtk_scrolled_window_get_placement() and gtk_scrolled_window_unset_placement().

Parameters:

Returns:

  • (nil)

#propagate_natural_heightTrueClass

Reports whether the natural height of the child will be calculated and propagated through the scrolled window’s requested natural height.

Returns:

  • (TrueClass)

    whether natural height propagation is enabled.

#propagate_natural_height=(propagate_natural_height) ⇒ TrueClass

Whether the natural height of the child should be calculated and propagated through the scrolled window’s requested natural height.

This is useful in cases where an attempt should be made to allocate exactly enough space for the natural size of the child.

Parameters:

  • propagate_natural_height (TrueClass)

Returns:

  • (TrueClass)

    propagate-natural-height

  • (TrueClass)

    propagate-natural-height

#propagate_natural_height?TrueClass

Whether the natural height of the child should be calculated and propagated through the scrolled window’s requested natural height.

This is useful in cases where an attempt should be made to allocate exactly enough space for the natural size of the child.

Returns:

  • (TrueClass)

    propagate-natural-height

#propagate_natural_widthTrueClass

Reports whether the natural width of the child will be calculated and propagated through the scrolled window’s requested natural width.

Returns:

  • (TrueClass)

    whether natural width propagation is enabled.

#propagate_natural_width=(propagate_natural_width) ⇒ TrueClass

Whether the natural width of the child should be calculated and propagated through the scrolled window’s requested natural width.

This is useful in cases where an attempt should be made to allocate exactly enough space for the natural size of the child.

Parameters:

  • propagate_natural_width (TrueClass)

Returns:

  • (TrueClass)

    propagate-natural-width

  • (TrueClass)

    propagate-natural-width

#propagate_natural_width?TrueClass

Whether the natural width of the child should be calculated and propagated through the scrolled window’s requested natural width.

This is useful in cases where an attempt should be made to allocate exactly enough space for the natural size of the child.

Returns:

  • (TrueClass)

    propagate-natural-width

#set_policy(hscrollbar_policy, vscrollbar_policy) ⇒ nil

Sets the scrollbar policy for the horizontal and vertical scrollbars.

The policy determines when the scrollbar should appear; it is a value from the Gtk::PolicyType enumeration. If %GTK_POLICY_ALWAYS, the scrollbar is always present; if %GTK_POLICY_NEVER, the scrollbar is never present; if %GTK_POLICY_AUTOMATIC, the scrollbar is present only if needed (that is, if the slider part of the bar would be smaller than the trough — the display is larger than the page size).

Parameters:

Returns:

  • (nil)

#shadow_typeGtk::ShadowType

Returns shadow-type.

Returns:

#shadow_type=(shadow_type) ⇒ Gtk::ShadowType

Parameters:

Returns:

#unset_placementnil

Unsets the placement of the contents with respect to the scrollbars for the scrolled window. If no window placement is set for a scrolled window, it defaults to %GTK_CORNER_TOP_LEFT.

See also gtk_scrolled_window_set_placement() and gtk_scrolled_window_get_placement().

Returns:

  • (nil)

#vadjustmentGtk::Adjustment

Returns vadjustment.

Returns:

#vadjustment=(vadjustment) ⇒ Gtk::Adjustment

Parameters:

Returns:

#vscrollbarGtk::Widget

Returns the vertical scrollbar of scrolled_window.

Returns:

  • (Gtk::Widget)

    the vertical scrollbar of the scrolled window.

#vscrollbar_policyGtk::PolicyType

Returns vscrollbar-policy.

Returns:

#vscrollbar_policy=(vscrollbar_policy) ⇒ Gtk::PolicyType

Parameters:

Returns:

#window_placementGtk::CornerType

Returns window-placement.

Returns:

#window_placement=(window_placement) ⇒ Gtk::CornerType

Parameters:

Returns:

#window_placement_set=(window_placement_set) ⇒ TrueClass

Whether “window-placement” should be used to determine the location of the contents with respect to the scrollbars.

Parameters:

  • window_placement_set (TrueClass)

Returns:

  • (TrueClass)

    window-placement-set

  • (TrueClass)

    window-placement-set

#window_placement_set?TrueClass

Whether “window-placement” should be used to determine the location of the contents with respect to the scrollbars.

Returns:

  • (TrueClass)

    window-placement-set