Trait gtk::prelude::ScrolledWindowExt
source · [−]pub trait ScrolledWindowExt: 'static {
Show 57 methods
fn is_capture_button_press(&self) -> bool;
fn hadjustment(&self) -> Adjustment;
fn hscrollbar(&self) -> Option<Widget>;
fn is_kinetic_scrolling(&self) -> bool;
fn max_content_height(&self) -> i32;
fn max_content_width(&self) -> i32;
fn min_content_height(&self) -> i32;
fn min_content_width(&self) -> i32;
fn is_overlay_scrolling(&self) -> bool;
fn placement(&self) -> CornerType;
fn policy(&self) -> (PolicyType, PolicyType);
fn propagates_natural_height(&self) -> bool;
fn propagates_natural_width(&self) -> bool;
fn shadow_type(&self) -> ShadowType;
fn vadjustment(&self) -> Adjustment;
fn vscrollbar(&self) -> Option<Widget>;
fn set_capture_button_press(&self, capture_button_press: bool);
fn set_hadjustment(&self, hadjustment: Option<&impl IsA<Adjustment>>);
fn set_kinetic_scrolling(&self, kinetic_scrolling: bool);
fn set_max_content_height(&self, height: i32);
fn set_max_content_width(&self, width: i32);
fn set_min_content_height(&self, height: i32);
fn set_min_content_width(&self, width: i32);
fn set_overlay_scrolling(&self, overlay_scrolling: bool);
fn set_placement(&self, window_placement: CornerType);
fn set_policy(
&self,
hscrollbar_policy: PolicyType,
vscrollbar_policy: PolicyType
);
fn set_propagate_natural_height(&self, propagate: bool);
fn set_propagate_natural_width(&self, propagate: bool);
fn set_shadow_type(&self, type_: ShadowType);
fn set_vadjustment(&self, vadjustment: Option<&impl IsA<Adjustment>>);
fn unset_placement(&self);
fn hscrollbar_policy(&self) -> PolicyType;
fn set_hscrollbar_policy(&self, hscrollbar_policy: PolicyType);
fn vscrollbar_policy(&self) -> PolicyType;
fn set_vscrollbar_policy(&self, vscrollbar_policy: PolicyType);
fn window_placement(&self) -> CornerType;
fn set_window_placement(&self, window_placement: CornerType);
fn connect_edge_overshot<F: Fn(&Self, PositionType) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_edge_reached<F: Fn(&Self, PositionType) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn emit_move_focus_out(&self, direction_type: DirectionType);
fn connect_scroll_child<F: Fn(&Self, ScrollType, bool) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn emit_scroll_child(&self, scroll: ScrollType, horizontal: bool) -> bool;
fn connect_hadjustment_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_hscrollbar_policy_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_kinetic_scrolling_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_max_content_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_max_content_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_min_content_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_min_content_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_overlay_scrolling_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_propagate_natural_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_propagate_natural_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_shadow_type_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_vadjustment_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_vscrollbar_policy_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
fn connect_window_placement_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId;
}
Expand description
Required Methods
Return whether button presses are captured during kinetic
scrolling. See set_capture_button_press()
.
Returns
true
if button presses are captured during kinetic scrolling
fn hadjustment(&self) -> Adjustment
fn hadjustment(&self) -> Adjustment
Returns the horizontal scrollbar’s adjustment, used to connect the horizontal scrollbar to the child widget’s horizontal scroll functionality.
Returns
the horizontal Adjustment
fn hscrollbar(&self) -> Option<Widget>
fn hscrollbar(&self) -> Option<Widget>
fn is_kinetic_scrolling(&self) -> bool
fn is_kinetic_scrolling(&self) -> bool
fn max_content_height(&self) -> i32
fn max_content_height(&self) -> i32
v3_22
only.fn max_content_width(&self) -> i32
fn max_content_width(&self) -> i32
v3_22
only.fn min_content_height(&self) -> i32
fn min_content_height(&self) -> i32
fn min_content_width(&self) -> i32
fn min_content_width(&self) -> i32
fn is_overlay_scrolling(&self) -> bool
fn is_overlay_scrolling(&self) -> bool
fn placement(&self) -> CornerType
fn placement(&self) -> CornerType
Gets the placement of the contents with respect to the scrollbars
for the scrolled window. See set_placement()
.
Returns
the current placement value.
See also set_placement()
and
unset_placement()
.
fn policy(&self) -> (PolicyType, PolicyType)
fn policy(&self) -> (PolicyType, PolicyType)
Retrieves the current policy values for the horizontal and vertical
scrollbars. See set_policy()
.
Returns
hscrollbar_policy
location to store the policy
for the horizontal scrollbar, or None
vscrollbar_policy
location to store the policy
for the vertical scrollbar, or None
fn propagates_natural_height(&self) -> bool
fn propagates_natural_height(&self) -> bool
v3_22
only.Reports whether the natural height of the child will be calculated and propagated through the scrolled window’s requested natural height.
Returns
whether natural height propagation is enabled.
fn propagates_natural_width(&self) -> bool
fn propagates_natural_width(&self) -> bool
v3_22
only.Reports whether the natural width of the child will be calculated and propagated through the scrolled window’s requested natural width.
Returns
whether natural width propagation is enabled.
fn shadow_type(&self) -> ShadowType
fn shadow_type(&self) -> ShadowType
fn vadjustment(&self) -> Adjustment
fn vadjustment(&self) -> Adjustment
Returns the vertical scrollbar’s adjustment, used to connect the vertical scrollbar to the child widget’s vertical scroll functionality.
Returns
the vertical Adjustment
fn vscrollbar(&self) -> Option<Widget>
fn vscrollbar(&self) -> Option<Widget>
Changes the behaviour of self
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 signal::Widget::button-press-event
. If they don’t, and handle
additionally handle signal::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.
capture_button_press
true
to capture button presses
fn set_hadjustment(&self, hadjustment: Option<&impl IsA<Adjustment>>)
fn set_hadjustment(&self, hadjustment: Option<&impl IsA<Adjustment>>)
Sets the Adjustment
for the horizontal scrollbar.
hadjustment
the Adjustment
to use, or None
to create a new one
fn set_kinetic_scrolling(&self, kinetic_scrolling: bool)
fn set_kinetic_scrolling(&self, kinetic_scrolling: bool)
Turns kinetic scrolling on or off.
Kinetic scrolling only applies to devices with source
GDK_SOURCE_TOUCHSCREEN
.
kinetic_scrolling
true
to enable kinetic scrolling
fn set_max_content_height(&self, height: i32)
fn set_max_content_height(&self, height: i32)
v3_22
only.Sets the maximum height that self
should keep visible. The
self
will grow up to this height before it starts scrolling
the content.
It is a programming error to set the maximum content height to a value
smaller than property::ScrolledWindow::min-content-height
.
height
the maximum content height
fn set_max_content_width(&self, width: i32)
fn set_max_content_width(&self, width: i32)
v3_22
only.Sets the maximum width that self
should keep visible. The
self
will grow up to this width before it starts scrolling
the content.
It is a programming error to set the maximum content width to a value
smaller than property::ScrolledWindow::min-content-width
.
width
the maximum content width
fn set_min_content_height(&self, height: i32)
fn set_min_content_height(&self, height: i32)
Sets the minimum height that self
should keep visible.
Note that this can and (usually will) be smaller than the minimum
size of the content.
It is a programming error to set the minimum content height to a
value greater than property::ScrolledWindow::max-content-height
.
height
the minimal content height
fn set_min_content_width(&self, width: i32)
fn set_min_content_width(&self, width: i32)
Sets the minimum width that self
should keep visible.
Note that this can and (usually will) be smaller than the minimum
size of the content.
It is a programming error to set the minimum content width to a
value greater than property::ScrolledWindow::max-content-width
.
width
the minimal content width
fn set_overlay_scrolling(&self, overlay_scrolling: bool)
fn set_overlay_scrolling(&self, overlay_scrolling: bool)
Enables or disables overlay scrolling for this scrolled window.
overlay_scrolling
whether to enable overlay scrolling
fn set_placement(&self, window_placement: CornerType)
fn set_placement(&self, window_placement: CornerType)
Sets the placement of the contents with respect to the scrollbars for the scrolled window.
The default is CornerType::TopLeft
, meaning the child is
in the top left, with the scrollbars underneath and to the right.
Other values in CornerType
are CornerType::TopRight
,
CornerType::BottomLeft
, and CornerType::BottomRight
.
See also placement()
and
unset_placement()
.
window_placement
position of the child window
fn set_policy(
&self,
hscrollbar_policy: PolicyType,
vscrollbar_policy: PolicyType
)
fn set_policy(
&self,
hscrollbar_policy: PolicyType,
vscrollbar_policy: PolicyType
)
Sets the scrollbar policy for the horizontal and vertical scrollbars.
The policy determines when the scrollbar should appear; it is a value
from the PolicyType
enumeration. If PolicyType::Always
, the
scrollbar is always present; if PolicyType::Never
, the scrollbar is
never present; if PolicyType::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).
hscrollbar_policy
policy for horizontal bar
vscrollbar_policy
policy for vertical bar
fn set_propagate_natural_height(&self, propagate: bool)
fn set_propagate_natural_height(&self, propagate: bool)
v3_22
only.Sets whether the natural height of the child should be calculated and propagated through the scrolled window’s requested natural height.
propagate
whether to propagate natural height
fn set_propagate_natural_width(&self, propagate: bool)
fn set_propagate_natural_width(&self, propagate: bool)
v3_22
only.Sets whether the natural width of the child should be calculated and propagated through the scrolled window’s requested natural width.
propagate
whether to propagate natural width
fn set_shadow_type(&self, type_: ShadowType)
fn set_shadow_type(&self, type_: ShadowType)
Changes the type of shadow drawn around the contents of
self
.
type_
kind of shadow to draw around scrolled window contents
fn set_vadjustment(&self, vadjustment: Option<&impl IsA<Adjustment>>)
fn set_vadjustment(&self, vadjustment: Option<&impl IsA<Adjustment>>)
Sets the Adjustment
for the vertical scrollbar.
vadjustment
the Adjustment
to use, or None
to create a new one
fn unset_placement(&self)
fn unset_placement(&self)
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 CornerType::TopLeft
.
See also set_placement()
and
placement()
.
fn hscrollbar_policy(&self) -> PolicyType
fn set_hscrollbar_policy(&self, hscrollbar_policy: PolicyType)
fn vscrollbar_policy(&self) -> PolicyType
fn set_vscrollbar_policy(&self, vscrollbar_policy: PolicyType)
fn window_placement(&self) -> CornerType
fn set_window_placement(&self, window_placement: CornerType)
fn connect_edge_overshot<F: Fn(&Self, PositionType) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_edge_overshot<F: Fn(&Self, PositionType) + 'static>(
&self,
f: F
) -> SignalHandlerId
The ::edge-overshot signal is emitted whenever user initiated scrolling makes the scrolled window firmly surpass (i.e. with some edge resistance) the lower or upper limits defined by the adjustment in that orientation.
A similar behavior without edge resistance is provided by the
signal::ScrolledWindow::edge-reached
signal.
Note: The pos
argument is LTR/RTL aware, so callers should be aware too
if intending to provide behavior on horizontal edges.
pos
edge side that was hit
fn connect_edge_reached<F: Fn(&Self, PositionType) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_edge_reached<F: Fn(&Self, PositionType) + 'static>(
&self,
f: F
) -> SignalHandlerId
The ::edge-reached signal is emitted whenever user-initiated scrolling makes the scrolled window exactly reach the lower or upper limits defined by the adjustment in that orientation.
A similar behavior with edge resistance is provided by the
signal::ScrolledWindow::edge-overshot
signal.
Note: The pos
argument is LTR/RTL aware, so callers should be aware too
if intending to provide behavior on horizontal edges.
pos
edge side that was reached
fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
&self,
f: F
) -> SignalHandlerId
The ::move-focus-out signal is a
[keybinding signal][GtkBindingSignal] which gets
emitted when focus is moved away from the scrolled window by a
keybinding. The signal::Widget::move-focus
signal is emitted with
direction_type
on this scrolled window’s toplevel parent in the
container hierarchy. The default bindings for this signal are
Ctrl + Tab
to move forward and Ctrl + Shift + Tab
to move backward.
direction_type
either DirectionType::TabForward
or
DirectionType::TabBackward
fn emit_move_focus_out(&self, direction_type: DirectionType)
fn connect_scroll_child<F: Fn(&Self, ScrollType, bool) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_scroll_child<F: Fn(&Self, ScrollType, bool) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
The ::scroll-child signal is a [keybinding signal][GtkBindingSignal] which gets emitted when a keybinding that scrolls is pressed. The horizontal or vertical adjustment is updated which triggers a signal that the scrolled window’s child may listen to and scroll itself.
scroll
a ScrollType
describing how much to scroll
horizontal
whether the keybinding scrolls the child horizontally or not
fn emit_scroll_child(&self, scroll: ScrollType, horizontal: bool) -> bool
fn connect_hadjustment_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_hscrollbar_policy_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_kinetic_scrolling_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_max_content_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_max_content_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
v3_22
only.fn connect_max_content_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_max_content_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
v3_22
only.fn connect_min_content_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_min_content_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_overlay_scrolling_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_propagate_natural_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_propagate_natural_height_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
v3_22
only.fn connect_propagate_natural_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
fn connect_propagate_natural_width_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
v3_22
only.