Struct gtk4::Paned[][src]

pub struct Paned(_);
Expand description

Paned has two panes, arranged either horizontally or vertically.

An example GtkPaned

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 Paned widget.

orientation

the paned’s orientation.

Returns

a new Paned.

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.

Retrieves the end child of the given Paned.

See also: Paned:end-child

Returns

the end child widget

Obtains the position of the divider between the two panes.

Returns

position of the divider

Returns whether the end child can be resized.

Returns

true if the end child is resizable

Returns whether the start child can be resized.

Returns

true if the start child is resizable

Returns whether the end child can be shrunk.

Returns

true if the end child is shrinkable

Returns whether the start child can be shrunk.

Returns

true if the start child is shrinkable

Retrieves the start child of the given Paned.

See also: Paned:start-child

Returns

the start child widget

Gets whether the separator should be wide.

Returns

true if the paned should have a wide handle

Sets the end child of self to child.

child

the widget to add

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 the Paned:resize-end-child property

resize

true to let the end child be resized

Sets the Paned:resize-start-child property

resize

true to let the start child be resized

Sets the Paned:shrink-end-child property

resize

true to let the end child be shrunk

Sets the Paned:shrink-start-child property

resize

true to let the start child be shrunk

Sets the start child of self to child.

child

the widget to add

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.

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.

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.

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

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

Emitted to move the handle with key bindings.

This is a keybinding signal.

scroll_type

a ScrollType

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.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

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

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

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.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.