gtkmm 4.16.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::BoxLayout Class Reference

Layout manager for placing all children in a single row or column. More...

#include <gtkmm/boxlayout.h>

Inheritance diagram for Gtk::BoxLayout:
Inheritance graph
[legend]

Public Member Functions

 BoxLayout (BoxLayout &&src) noexcept
 
BoxLayoutoperator= (BoxLayout &&src) noexcept
 
 ~BoxLayout () noexcept override
 
GtkBoxLayoutgobj ()
 Provides access to the underlying C GObject.
 
const GtkBoxLayoutgobj () const
 Provides access to the underlying C GObject.
 
GtkBoxLayoutgobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
void set_homogeneous (bool homogeneous=true)
 Sets whether the box layout will allocate the same size to all children.
 
bool get_homogeneous () const
 Returns whether the layout is set to be homogeneous.
 
void set_spacing (guint spacing)
 Sets how much spacing to put between children.
 
guint get_spacing () const
 Returns the space that box_layout puts between children.
 
void set_baseline_position (BaselinePosition position)
 Sets the baseline position of a box layout.
 
BaselinePosition get_baseline_position () const
 Gets the value set by set_baseline_position().
 
void set_baseline_child (int child)
 Sets the index of the child that determines the baseline in vertical layout.
 
int get_baseline_child () const
 Gets the value set by set_baseline_child().
 
Glib::PropertyProxy< bool > property_homogeneous ()
 Whether the box layout should distribute the available space equally among the children.
 
Glib::PropertyProxy_ReadOnly< bool > property_homogeneous () const
 Whether the box layout should distribute the available space equally among the children.
 
Glib::PropertyProxy< int > property_spacing ()
 The space to put between the children.
 
Glib::PropertyProxy_ReadOnly< int > property_spacing () const
 The space to put between the children.
 
Glib::PropertyProxy< int > property_baseline_child ()
 The child that determines the baseline of the box in vertical layout.
 
Glib::PropertyProxy_ReadOnly< int > property_baseline_child () const
 The child that determines the baseline of the box in vertical layout.
 
Glib::PropertyProxy< BaselinePositionproperty_baseline_position ()
 The position of the allocated baseline within the extra space allocated to each child.
 
Glib::PropertyProxy_ReadOnly< BaselinePositionproperty_baseline_position () const
 The position of the allocated baseline within the extra space allocated to each child.
 
- Public Member Functions inherited from Gtk::LayoutManager
 LayoutManager (LayoutManager &&src) noexcept
 
LayoutManageroperator= (LayoutManager &&src) noexcept
 
 ~LayoutManager () noexcept override
 
GtkLayoutManagergobj ()
 Provides access to the underlying C GObject.
 
const GtkLayoutManagergobj () const
 Provides access to the underlying C GObject.
 
GtkLayoutManagergobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
 
void measure (Widget &widget, Orientation orientation, int for_size, int & minimum, int & natural, int &minimum_baseline, int &natural_baseline) const
 Measures the size of the widget using manager, for the given orientation and size.
 
void allocate (Widget &widget, int width, int height, int baseline)
 Assigns the given width, height, and baseline to a widget, and computes the position and sizes of the children of the widget using the layout management policy of manager.
 
SizeRequestMode get_request_mode () const
 Retrieves the request mode of manager.
 
Widgetget_widget ()
 Retrieves the Gtk::Widget using the given Gtk::LayoutManager.
 
const Widgetget_widget () const
 Retrieves the Gtk::Widget using the given Gtk::LayoutManager.
 
void layout_changed ()
 Queues a resize on the Gtk::Widget using manager, if any.
 
Glib::RefPtr< LayoutChildget_layout_child (Widget &child)
 Retrieves a Gtk::LayoutChild instance for the Gtk::LayoutManager, creating one if necessary.
 
Glib::RefPtr< const LayoutChildget_layout_child (Widget &child) const
 Retrieves a Gtk::LayoutChild instance for the Gtk::LayoutManager, creating one if necessary.
 
- Public Member Functions inherited from Gtk::Orientable
 Orientable (Orientable &&src) noexcept
 
Orientableoperator= (Orientable &&src) noexcept
 
 ~Orientable () noexcept override
 
GtkOrientablegobj ()
 Provides access to the underlying C GObject.
 
const GtkOrientablegobj () const
 Provides access to the underlying C GObject.
 
void set_orientation (Orientation orientation)
 Sets the orientation of the orientable.
 
Orientation get_orientation () const
 Retrieves the orientation of the orientable.
 
Glib::PropertyProxy< Orientationproperty_orientation ()
 The orientation of the orientable.
 
Glib::PropertyProxy_ReadOnly< Orientationproperty_orientation () const
 The orientation of the orientable.
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
static Glib::RefPtr< BoxLayoutcreate (Orientation orientation=Orientation::HORIZONTAL)
 
- Static Public Member Functions inherited from Gtk::LayoutManager
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 
- Static Public Member Functions inherited from Gtk::Orientable
static void add_interface (GType gtype_implementer)
 
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 

Protected Member Functions

 BoxLayout (Orientation orientation=Orientation::HORIZONTAL)
 
- Protected Member Functions inherited from Gtk::LayoutManager
 LayoutManager ()
 There is no create() method that corresponds to this constructor, because only derived classes shall be created.
 
virtual SizeRequestMode get_request_mode_vfunc (const Widget &widget) const
 
virtual void measure_vfunc (const Widget &widget, Orientation orientation, int for_size, int & minimum, int & natural, int &minimum_baseline, int &natural_baseline) const
 
virtual void allocate_vfunc (const Widget &widget, int width, int height, int baseline)
 
virtual Glib::RefPtr< LayoutChildcreate_layout_child_vfunc (const Widget &widget, const Widget &for_child)
 
virtual void root_vfunc ()
 
virtual void unroot_vfunc ()
 
- Protected Member Functions inherited from Gtk::Orientable
 Orientable ()
 You should derive from this class to use it.
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gtk::BoxLayoutwrap (GtkBoxLayout *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Detailed Description

Layout manager for placing all children in a single row or column.

A Gtk::BoxLayout is a layout manager that arranges the children of any widget using it into a single row or column, depending on the value of its Gtk::Orientable::property_orientation(). Within the other dimension all children all allocated the same size. The Gtk::BoxLayout will respect Gtk::Widget::property_halign() and Gtk::Widget::property_valign() of each child widget.

If you want all children to be assigned the same size, you can use property_homogeneous().

If you want to specify the amount of space placed between each child, you can use the property_spacing().

Since gtkmm 3.96:

Constructor & Destructor Documentation

◆ BoxLayout() [1/2]

Gtk::BoxLayout::BoxLayout ( BoxLayout &&  src)
noexcept

◆ ~BoxLayout()

Gtk::BoxLayout::~BoxLayout ( )
overridenoexcept

◆ BoxLayout() [2/2]

Gtk::BoxLayout::BoxLayout ( Orientation  orientation = Orientation::HORIZONTAL)
explicitprotected

Member Function Documentation

◆ create()

static Glib::RefPtr< BoxLayout > Gtk::BoxLayout::create ( Orientation  orientation = Orientation::HORIZONTAL)
static

◆ get_baseline_child()

int Gtk::BoxLayout::get_baseline_child ( ) const

Gets the value set by set_baseline_child().

Since gtkmm 4.12:
Returns
The index of the child that determines the baseline in vertical layout, or -1.

◆ get_baseline_position()

BaselinePosition Gtk::BoxLayout::get_baseline_position ( ) const

Gets the value set by set_baseline_position().

Returns
The baseline position.

◆ get_homogeneous()

bool Gtk::BoxLayout::get_homogeneous ( ) const

Returns whether the layout is set to be homogeneous.

Return: true if the layout is homogeneous

◆ get_spacing()

guint Gtk::BoxLayout::get_spacing ( ) const

Returns the space that box_layout puts between children.

Returns
The spacing of the layout.

◆ get_type()

static GType Gtk::BoxLayout::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GtkBoxLayout * Gtk::BoxLayout::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkBoxLayout * Gtk::BoxLayout::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GtkBoxLayout * Gtk::BoxLayout::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ operator=()

BoxLayout & Gtk::BoxLayout::operator= ( BoxLayout &&  src)
noexcept

◆ property_baseline_child() [1/2]

Glib::PropertyProxy< int > Gtk::BoxLayout::property_baseline_child ( )

The child that determines the baseline of the box in vertical layout.

If the child does baseline positioning, then its baseline is lined up with the baseline of the box. If it doesn't, then the bottom edge of the child is used.

Since gtkmm 4.12:

Default value: -1

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_baseline_child() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::BoxLayout::property_baseline_child ( ) const

The child that determines the baseline of the box in vertical layout.

If the child does baseline positioning, then its baseline is lined up with the baseline of the box. If it doesn't, then the bottom edge of the child is used.

Since gtkmm 4.12:

Default value: -1

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_baseline_position() [1/2]

Glib::PropertyProxy< BaselinePosition > Gtk::BoxLayout::property_baseline_position ( )

The position of the allocated baseline within the extra space allocated to each child.

This property is only relevant for horizontal layouts containing at least one child with a baseline alignment.

Default value: Gtk::BaselinePosition::CENTER

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_baseline_position() [2/2]

Glib::PropertyProxy_ReadOnly< BaselinePosition > Gtk::BoxLayout::property_baseline_position ( ) const

The position of the allocated baseline within the extra space allocated to each child.

This property is only relevant for horizontal layouts containing at least one child with a baseline alignment.

Default value: Gtk::BaselinePosition::CENTER

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_homogeneous() [1/2]

Glib::PropertyProxy< bool > Gtk::BoxLayout::property_homogeneous ( )

Whether the box layout should distribute the available space equally among the children.

Default value: false

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_homogeneous() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::BoxLayout::property_homogeneous ( ) const

Whether the box layout should distribute the available space equally among the children.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_spacing() [1/2]

Glib::PropertyProxy< int > Gtk::BoxLayout::property_spacing ( )

The space to put between the children.

Default value: 0

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_spacing() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::BoxLayout::property_spacing ( ) const

The space to put between the children.

Default value: 0

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_baseline_child()

void Gtk::BoxLayout::set_baseline_child ( int  child)

Sets the index of the child that determines the baseline in vertical layout.

Since gtkmm 4.12:
Parameters
childThe child position, or -1.

◆ set_baseline_position()

void Gtk::BoxLayout::set_baseline_position ( BaselinePosition  position)

Sets the baseline position of a box layout.

The baseline position affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then the given position is used to allocate the baseline within the extra space available.

Parameters
positionA Gtk::BaselinePosition.

◆ set_homogeneous()

void Gtk::BoxLayout::set_homogeneous ( bool  homogeneous = true)

Sets whether the box layout will allocate the same size to all children.

Parameters
homogeneoustrue to set the box layout as homogeneous.

◆ set_spacing()

void Gtk::BoxLayout::set_spacing ( guint  spacing)

Sets how much spacing to put between children.

Parameters
spacingThe spacing to apply between children.

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gtk::BoxLayout > wrap ( GtkBoxLayout object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.