Struct gtk4::Paned [−][src]
pub struct Paned(_);
Expand description
Paned
has two panes, arranged either horizontally or vertically.
The division between the two panes is adjustable by the user by dragging a handle.
Child widgets are added to the panes of the widget with
set_start_child()
and set_end_child()
.
The division between the two children is set by default from the size
requests of the children, but it can be adjusted by the user.
A paned widget draws a separator between the two child widgets and a
small handle that the user can drag to adjust the division. It does not
draw any relief around the children or around the separator. (The space
in which the separator is called the gutter.) Often, it is useful to put
each child inside a Frame
so that the gutter appears as a
ridge. No separator is drawn if one of the children is missing.
Each child has two options that can be set, resize
and shrink
. If
resize
is true, then when the Paned
is resized, that child will
expand or shrink along with the paned widget. If shrink
is true, then
that child can be made smaller than its requisition by the user.
Setting shrink
to false
allows the application to set a minimum size.
If resize
is false for both children, then this is treated as if
resize
is true for both children.
The application can set the position of the slider as if it were set
by the user, by calling set_position()
.
CSS nodes
paned
├── <child>
├── separator[.wide]
╰── <child>
Paned
has a main CSS node with name paned, and a subnode for
the separator with name separator. The subnode gets a .wide style
class when the paned is supposed to be wide.
In horizontal orientation, the nodes are arranged based on the text direction, so in left-to-right mode, :first-child will select the leftmost child, while it will select the rightmost child in RTL layouts.
Creating a paned widget with minimum sizes.
⚠️ The following code is in c ⚠️
GtkWidget *hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
GtkWidget *frame1 = gtk_frame_new (NULL);
GtkWidget *frame2 = gtk_frame_new (NULL);
gtk_widget_set_size_request (hpaned, 200, -1);
gtk_paned_set_start_child (GTK_PANED (hpaned), frame1);
gtk_paned_set_start_child_resize (GTK_PANED (hpaned), TRUE);
gtk_paned_set_start_child_shrink (GTK_PANED (hpaned), FALSE);
gtk_widget_set_size_request (frame1, 50, -1);
gtk_paned_set_end_child (GTK_PANED (hpaned), frame2);
gtk_paned_set_end_child_resize (GTK_PANED (hpaned), FALSE);
gtk_paned_set_end_child_shrink (GTK_PANED (hpaned), FALSE);
gtk_widget_set_size_request (frame2, 50, -1);
Implements
WidgetExt
, glib::ObjectExt
, AccessibleExt
, BuildableExt
, ConstraintTargetExt
, OrientableExt
, WidgetExtManual
, AccessibleExtManual
Implementations
Creates a new builder-pattern struct instance to construct Paned
objects.
This method returns an instance of PanedBuilder
which can be used to create Paned
objects.
Sets the position of the divider between the two panes.
position
pixel position of divider, a negative value means that the position is unset
Sets whether the separator should be wide.
wide
the new value for the property::Paned::wide-handle
property
The largest possible value for the position property.
This property is derived from the size and shrinkability of the widget’s children.
The smallest possible value for the position property.
This property is derived from the size and shrinkability of the widget’s children.
true
if the position
property has been set.
true
if the position
property has been set.
pub fn connect_accept_position<F: Fn(&Self) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_accept_position<F: Fn(&Self) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted to accept the current position of the handle when moving it using key bindings.
This is a keybinding signal.
The default binding for this signal is Return or Space.
pub fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_cancel_position<F: Fn(&Self) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted to cancel moving the position of the handle using key bindings.
The position of the handle will be reset to the value prior to moving it.
This is a keybinding signal.
The default binding for this signal is Escape.
pub fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_cycle_child_focus<F: Fn(&Self, bool) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted to cycle the focus between the children of the paned.
This is a keybinding signal.
The default binding is F6.
reversed
whether cycling backward or forward
pub fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_cycle_handle_focus<F: Fn(&Self, bool) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted to cycle whether the paned should grab focus to allow the user to change position of the handle by using key bindings.
This is a keybinding signal.
The default binding for this signal is F8.
reversed
whether cycling backward or forward
pub fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_move_handle<F: Fn(&Self, ScrollType) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_toggle_handle_focus<F: Fn(&Self) -> bool + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted to accept the current position of the handle and then move focus to the next widget in the focus chain.
This is a keybinding signal.
The default binding is Tab.
pub fn connect_resize_end_child_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_resize_start_child_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_shrink_end_child_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_shrink_start_child_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for Paned
impl UnwindSafe for Paned
Blanket Implementations
Mutably borrows from an owned value. Read more
Upcasts an object to a superclass or interface T
. Read more
Upcasts an object to a reference of its superclass or interface T
. Read more
Tries to downcast to a subclass or interface implementor T
. Read more
Tries to downcast to a reference of its subclass or interface implementor T
. Read more
Tries to cast to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Tries to cast to reference to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Casts to T
unconditionally. Read more
Casts to &T
unconditionally. Read more
Returns true
if the object is an instance of (can be cast to) T
.
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
N: Into<&'a str>,
V: ToValue,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: Fn(&[Value]) -> Option<Value>,
Same as connect_unsafe
but takes a SignalId
instead of a signal name.
Emit signal by signal id.
Same as emit
but takes Value
for the arguments.
Emit signal by its name.
Same as emit_by_name
but takes Value
for the arguments.
Emit signal with details by signal id.
Same as emit_with_details
but takes Value
for the arguments.
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
N: Into<&'a str>,
M: Into<&'a str>,
Returns a SendValue
clone of self
.