Arranges its children in two panes, horizontally or vertically.
<picture> <source srcset="panes-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkPaned" src="panes.png"> </picture> 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 [methodGtk.Paned.set_start_child] and [methodGtk.Paned.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 [classGtk.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 GtkPaned 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 [methodGtk.Paned.set_position].
# Shortcuts and Gestures
The following signals have default keybindings:
[signalGtk.Paned::accept-position] - [signalGtk.Paned::cancel-position]
[signalGtk.Paned::cycle-child-focus] -
[signalGtk.Paned::cycle-handle-focus] - [signalGtk.Paned::move-handle] - [signalGtk.Paned::toggle-handle-focus]
# CSS nodes
paned âââ <child> âââ separator[.wide] â°ââ <child>
GtkPaned 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.
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_resize_start_child (GTK_PANED (hpaned), TRUE);
gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
gtk_widget_set_size_request (frame1, 50, -1);
gtk_paned_set_end_child (GTK_PANED (hpaned), frame2);
gtk_paned_set_resize_end_child (GTK_PANED (hpaned), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
gtk_widget_set_size_request (frame2, 50, -1); ```
<group>Layout containers</group>
<gtkada_demo>create_paned.adb</gtkada_demo>
function "+"
(Widget : access Gtk_Paned_Record'Class)
return Gtk.Accessible.Gtk_Accessible
function "+"
(Widget : access Gtk_Paned_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_Paned_Record'Class)
return Gtk.Constraint_Target.Gtk_Constraint_Target
function "+"
(Widget : access Gtk_Paned_Record'Class)
return Gtk.Orientable.Gtk_Orientable
function "-"
(Interf : Gtk.Accessible.Gtk_Accessible)
return Gtk_Paned
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Paned
function "-"
(Interf : Gtk.Constraint_Target.Gtk_Constraint_Target)
return Gtk_Paned
function "-"
(Interf : Gtk.Orientable.Gtk_Orientable)
return Gtk_Paned
procedure Announce
(Self : not null access Gtk_Paned_Record;
Message : UTF8_String;
Priority : Gtk.Accessible.Gtk_Accessible_Announcement_Priority)
type Cb_GObject_Boolean is not null access function
(Self : access Glib.Object.GObject_Record'Class)
return Boolean;
type Cb_GObject_Boolean_Boolean is not null access function
(Self : access Glib.Object.GObject_Record'Class;
Reversed : Boolean) return Boolean;
type Cb_GObject_Gtk_Scroll_Type_Boolean is not null access function
(Self : access Glib.Object.GObject_Record'Class;
Scroll_Type : Gtk.Enums.Gtk_Scroll_Type) return Boolean;
type Cb_Gtk_Paned_Boolean is not null access function
(Self : access Gtk_Paned_Record'Class) return Boolean;
type Cb_Gtk_Paned_Boolean_Boolean is not null access function
(Self : access Gtk_Paned_Record'Class;
Reversed : Boolean) return Boolean;
type Cb_Gtk_Paned_Gtk_Scroll_Type_Boolean is not null access function
(Self : access Gtk_Paned_Record'Class;
Scroll_Type : Gtk.Enums.Gtk_Scroll_Type) return Boolean;
End_Child_Property : constant Glib.Properties.Property_Object;
Type: Gtk.Widget.Gtk_Widget The second child.
function Get_Accessible_Id
(Self : not null access Gtk_Paned_Record) return UTF8_String
function Get_Accessible_Parent
(Self : not null access Gtk_Paned_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Accessible_Role
(Self : not null access Gtk_Paned_Record)
return Gtk.Accessible.Gtk_Accessible_Role
function Get_At_Context
(Self : not null access Gtk_Paned_Record)
return Gtk.Atcontext.Gtk_Atcontext
function Get_Bounds
(Self : not null access Gtk_Paned_Record;
X : out Glib.Gint;
Y : out Glib.Gint;
Width : out Glib.Gint;
Height : out Glib.Gint) return Boolean
function Get_End_Child
(Paned : not null access Gtk_Paned_Record)
return Gtk.Widget.Gtk_Widget
Retrieves the end child of the given GtkPaned.
the end child widget. Has transfer-ownership='none'.
function Get_First_Accessible_Child
(Self : not null access Gtk_Paned_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Next_Accessible_Sibling
(Self : not null access Gtk_Paned_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Orientation
(Self : not null access Gtk_Paned_Record)
return Gtk.Enums.Gtk_Orientation
function Get_Platform_State
(Self : not null access Gtk_Paned_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State) return Boolean
function Get_Position
(Paned : not null access Gtk_Paned_Record) return Glib.Gint
Obtains the position of the divider between the two panes.
the position of the divider, in pixels
function Get_Resize_End_Child
(Paned : not null access Gtk_Paned_Record) return Boolean
Returns whether the [propertyGtk.Paned:end-child] can be resized.
true if the end child is resizable
function Get_Resize_Start_Child
(Paned : not null access Gtk_Paned_Record) return Boolean
Returns whether the [propertyGtk.Paned:start-child] can be resized.
true if the start child is resizable
function Get_Shrink_End_Child
(Paned : not null access Gtk_Paned_Record) return Boolean
Returns whether the [propertyGtk.Paned:end-child] can shrink.
true if the end child is shrinkable
function Get_Shrink_Start_Child
(Paned : not null access Gtk_Paned_Record) return Boolean
Returns whether the [propertyGtk.Paned:start-child] can shrink.
true if the start child is shrinkable
function Get_Start_Child
(Paned : not null access Gtk_Paned_Record)
return Gtk.Widget.Gtk_Widget
Retrieves the start child of the given GtkPaned.
the start child widget. Has transfer-ownership='none'.
function Get_Type return Glib.GType
function Get_Wide_Handle
(Paned : not null access Gtk_Paned_Record) return Boolean
Gets whether the separator should be wide.
True if the paned should have a wide handle
procedure Gtk_New
(Paned : out Gtk_Paned;
Orientation : Gtk.Enums.Gtk_Orientation)
Creates a new GtkPaned widget. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the paned's orientation.
type Gtk_Paned is access all Gtk_Paned_Record'Class;
function Gtk_Paned_New
(Orientation : Gtk.Enums.Gtk_Orientation) return Gtk_Paned
Creates a new GtkPaned widget.
the paned's orientation.
type Gtk_Paned_Record is new Gtk_Widget_Record with null record;
package Implements_Gtk_Accessible is new Glib.Types.Implements
(Gtk.Accessible.Gtk_Accessible, Gtk_Paned_Record, Gtk_Paned);
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Paned_Record, Gtk_Paned);
package Implements_Gtk_Constraint_Target is new Glib.Types.Implements
(Gtk.Constraint_Target.Gtk_Constraint_Target, Gtk_Paned_Record, Gtk_Paned);
package Implements_Gtk_Orientable is new Glib.Types.Implements
(Gtk.Orientable.Gtk_Orientable, Gtk_Paned_Record, Gtk_Paned);
procedure Initialize
(Paned : not null access Gtk_Paned_Record'Class;
Orientation : Gtk.Enums.Gtk_Orientation)
Creates a new GtkPaned widget. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
the paned's orientation.
Max_Position_Property : constant Glib.Properties.Property_Int;
The largest possible value for the [propertyGtk.Paned:position] property.
This property is derived from the size and shrinkability of the widget's children.
Min_Position_Property : constant Glib.Properties.Property_Int;
The smallest possible value for the [propertyGtk.Paned:position] property.
This property is derived from the size and shrinkability of the widget's children.
procedure On_Accept_Position
(Self : not null access Gtk_Paned_Record;
Call : Cb_GObject_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
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 <kbd>Return</kbd> or <kbd>Space</kbd>.
Callback parameters:
procedure On_Accept_Position
(Self : not null access Gtk_Paned_Record;
Call : Cb_Gtk_Paned_Boolean;
After : Boolean := False)
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 <kbd>Return</kbd> or <kbd>Space</kbd>.
Callback parameters:
procedure On_Cancel_Position
(Self : not null access Gtk_Paned_Record;
Call : Cb_GObject_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
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 <kbd>Escape</kbd>.
Callback parameters:
procedure On_Cancel_Position
(Self : not null access Gtk_Paned_Record;
Call : Cb_Gtk_Paned_Boolean;
After : Boolean := False)
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 <kbd>Escape</kbd>.
Callback parameters:
procedure On_Cycle_Child_Focus
(Self : not null access Gtk_Paned_Record;
Call : Cb_GObject_Boolean_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted to cycle the focus between the children of the paned.
This is a keybinding signal.
The default binding is <kbd>F6</kbd>.
Callback parameters: -- @param Reversed whether cycling backward or forward
procedure On_Cycle_Child_Focus
(Self : not null access Gtk_Paned_Record;
Call : Cb_Gtk_Paned_Boolean_Boolean;
After : Boolean := False)
Emitted to cycle the focus between the children of the paned.
This is a keybinding signal.
The default binding is <kbd>F6</kbd>.
Callback parameters: -- @param Reversed whether cycling backward or forward
procedure On_Cycle_Handle_Focus
(Self : not null access Gtk_Paned_Record;
Call : Cb_GObject_Boolean_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
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 <kbd>F8</kbd>.
Callback parameters: -- @param Reversed whether cycling backward or forward
procedure On_Cycle_Handle_Focus
(Self : not null access Gtk_Paned_Record;
Call : Cb_Gtk_Paned_Boolean_Boolean;
After : Boolean := False)
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 <kbd>F8</kbd>.
Callback parameters: -- @param Reversed whether cycling backward or forward
procedure On_Move_Handle
(Self : not null access Gtk_Paned_Record;
Call : Cb_GObject_Gtk_Scroll_Type_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted to move the handle with key bindings.
This is a keybinding signal.
The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>PgUp</kbd>, <kbd>PgDn</kbd>, <kbd>Home</kbd>, <kbd>End</kbd>.
Callback parameters: -- @param Scroll_Type a GtkScrollType
procedure On_Move_Handle
(Self : not null access Gtk_Paned_Record;
Call : Cb_Gtk_Paned_Gtk_Scroll_Type_Boolean;
After : Boolean := False)
Emitted to move the handle with key bindings.
This is a keybinding signal.
The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>PgUp</kbd>, <kbd>PgDn</kbd>, <kbd>Home</kbd>, <kbd>End</kbd>.
Callback parameters: -- @param Scroll_Type a GtkScrollType
procedure On_Toggle_Handle_Focus
(Self : not null access Gtk_Paned_Record;
Call : Cb_GObject_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
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 <kbd>Tab</kbd>.
Callback parameters:
procedure On_Toggle_Handle_Focus
(Self : not null access Gtk_Paned_Record;
Call : Cb_Gtk_Paned_Boolean;
After : Boolean := False)
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 <kbd>Tab</kbd>.
Callback parameters:
Position_Property : constant Glib.Properties.Property_Int;
Position of the separator in pixels, from the left/top.
Position_Set_Property : constant Glib.Properties.Property_Boolean;
Whether the [propertyGtk.Paned:position] property has been set.
procedure Reset_Property
(Self : not null access Gtk_Paned_Record;
Property : Gtk.Accessible.Gtk_Accessible_Property)
procedure Reset_Relation
(Self : not null access Gtk_Paned_Record;
Relation : Gtk.Accessible.Gtk_Accessible_Relation)
procedure Reset_State
(Self : not null access Gtk_Paned_Record;
State : Gtk.Accessible.Gtk_Accessible_State)
Resize_End_Child_Property : constant Glib.Properties.Property_Boolean;
Determines whether the second child expands and shrinks along with the paned widget.
Resize_Start_Child_Property : constant Glib.Properties.Property_Boolean;
Determines whether the first child expands and shrinks along with the paned widget.
procedure Set_Accessible_Parent
(Self : not null access Gtk_Paned_Record;
Parent : Gtk.Accessible.Gtk_Accessible;
Next_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Set_End_Child
(Paned : not null access Gtk_Paned_Record;
Child : access Gtk.Widget.Gtk_Widget_Record'Class)
Sets the end child of Paned to Child. If Child is NULL, the existing child will be removed. The end child is the bottom child of a vertical paned, or the right child of a horizontal paned.
the widget to add
procedure Set_Orientation
(Self : not null access Gtk_Paned_Record;
Orientation : Gtk.Enums.Gtk_Orientation)
procedure Set_Position
(Paned : not null access Gtk_Paned_Record;
Position : Glib.Gint)
Sets the position of the divider between the two panes. The position of the divider is expressed in pixels. A negative value restores the default behaviour, where the position is computed from the requisitions of the children.
pixel position of divider, a negative value means that the position is unset
procedure Set_Resize_End_Child
(Paned : not null access Gtk_Paned_Record;
Resize : Boolean)
Sets whether the [propertyGtk.Paned:end-child] can be resized.
true to let the end child be resized
procedure Set_Resize_Start_Child
(Paned : not null access Gtk_Paned_Record;
Resize : Boolean)
Sets whether the [propertyGtk.Paned:start-child] can be resized.
true to let the start child be resized
procedure Set_Shrink_End_Child
(Paned : not null access Gtk_Paned_Record;
Resize : Boolean)
Sets whether the [propertyGtk.Paned:end-child] can shrink.
true to let the end child be shrunk
procedure Set_Shrink_Start_Child
(Paned : not null access Gtk_Paned_Record;
Resize : Boolean)
Sets whether the [propertyGtk.Paned:start-child] can shrink.
true to let the start child be shrunk
procedure Set_Start_Child
(Paned : not null access Gtk_Paned_Record;
Child : access Gtk.Widget.Gtk_Widget_Record'Class)
Sets the start child of Paned to Child. If Child is NULL, the existing child will be removed. The start child is the top child of a vertical paned, or the left child of a horizontal paned.
the widget to add
procedure Set_Wide_Handle
(Paned : not null access Gtk_Paned_Record;
Wide : Boolean)
Sets whether the separator should be wide.
the new value for the [propertyGtk.Paned:wide-handle] property
Shrink_End_Child_Property : constant Glib.Properties.Property_Boolean;
Determines whether the second child can be made smaller than its requisition.
Shrink_Start_Child_Property : constant Glib.Properties.Property_Boolean;
Determines whether the first child can be made smaller than its requisition.
Signal_Accept_Position : constant Glib.Signal_Name := "accept-position";
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 <kbd>Return</kbd> or <kbd>Space</kbd>.
Callback parameters:
Signal_Cancel_Position : constant Glib.Signal_Name := "cancel-position";
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 <kbd>Escape</kbd>.
Callback parameters:
Signal_Cycle_Child_Focus : constant Glib.Signal_Name := "cycle-child-focus";
Emitted to cycle the focus between the children of the paned.
This is a keybinding signal.
The default binding is <kbd>F6</kbd>.
Callback parameters: -- @param Reversed whether cycling backward or forward
Signal_Cycle_Handle_Focus : constant Glib.Signal_Name := "cycle-handle-focus";
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 <kbd>F8</kbd>.
Callback parameters: -- @param Reversed whether cycling backward or forward
Signal_Move_Handle : constant Glib.Signal_Name := "move-handle";
Emitted to move the handle with key bindings.
This is a keybinding signal.
The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>Ctrl</kbd>+<kbd>â</kbd>, <kbd>â</kbd>, <kbd>PgUp</kbd>, <kbd>PgDn</kbd>, <kbd>Home</kbd>, <kbd>End</kbd>.
Callback parameters: -- @param Scroll_Type a GtkScrollType
Signal_Toggle_Handle_Focus : constant Glib.Signal_Name := "toggle-handle-focus";
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 <kbd>Tab</kbd>.
Callback parameters:
Start_Child_Property : constant Glib.Properties.Property_Object;
Type: Gtk.Widget.Gtk_Widget The first child.
procedure Update_Next_Accessible_Sibling
(Self : not null access Gtk_Paned_Record;
New_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Update_Platform_State
(Self : not null access Gtk_Paned_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State)
Wide_Handle_Property : constant Glib.Properties.Property_Boolean;
Whether the GtkPaned should provide a stronger visual separation.
For example, this could be set when a paned contains two [classGtk.Notebook]s, whose tab rows would otherwise merge visually.