gtkmm: Gtk::CenterLayout Class Reference

gtkmm 4.13.2

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::CenterLayout Class Reference

A centering layout. More...

`#include <gtkmm/centerlayout.h>`

Inheritance diagram for Gtk::CenterLayout:
[legend]

## Public Member Functions
| CenterLayout (CenterLayout && src) noexcept
CenterLayout & | operator= (CenterLayout && src) noexcept
| ~CenterLayout () noexcept override
GtkCenterLayout * | gobj ()
| Provides access to the underlying C GObject. More...
const GtkCenterLayout * | gobj () const
| Provides access to the underlying C GObject. More...
GtkCenterLayout * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
void | set_orientation (Orientation orientation)
| Sets the orientation of self. More...
Orientation | get_orientation () const
| Gets the current orienration of the layout manager. More...
void | set_baseline_position (BaselinePosition baseline_position)
| Sets the new baseline position of self. More...
BaselinePosition | get_baseline_position () const
| Returns the baseline position of the layout. More...
void | set_start_widget (Widget * widget)
| Sets the new start widget of self. More...
Widget * | get_start_widget ()
| Returns the start widget of the layout. More...
const Widget * | get_start_widget () const
| Returns the start widget of the layout. More...
void | set_center_widget (Widget * widget)
| Sets the new center widget of self. More...
Widget * | get_center_widget ()
| Returns the center widget of the layout. More...
const Widget * | get_center_widget () const
| Returns the center widget of the layout. More...
void | set_end_widget (Widget * widget)
| Sets the new end widget of self. More...
Widget * | get_end_widget ()
| Returns the end widget of the layout. More...
const Widget * | get_end_widget () const
| Returns the end widget of the layout. More...
void | set_shrink_center_last (bool shrink_center_last=true)
| Sets whether to shrink the center widget after other children. More...
bool | get_shrink_center_last () const
| Gets whether self shrinks the center widget after other children. More...
Glib::PropertyProxy< bool > | property_shrink_center_last ()
| Whether to shrink the center widget after other children. More...
Glib::PropertyProxy_ReadOnly< bool > | property_shrink_center_last () const
| Whether to shrink the center widget after other children. More...
Public Member Functions inherited from Gtk::LayoutManager
| LayoutManager (LayoutManager && src) noexcept
LayoutManager & | operator= (LayoutManager && src) noexcept
| ~LayoutManager () noexcept override
GtkLayoutManager * | gobj ()
| Provides access to the underlying C GObject. More...
const GtkLayoutManager * | gobj () const
| Provides access to the underlying C GObject. More...
GtkLayoutManager * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
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. More...
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. More...
SizeRequestMode | get_request_mode () const
| Retrieves the request mode of manager. More...
Widget * | get_widget ()
| Retrieves the `Gtk::Widget` using the given `Gtk::LayoutManager`. More...
const Widget * | get_widget () const
| Retrieves the `Gtk::Widget` using the given `Gtk::LayoutManager`. More...
void | layout_changed ()
| Queues a resize on the `Gtk::Widget` using manager, if any. More...
Glib::RefPtr< LayoutChild > | get_layout_child (Widget & child)
| Retrieves a `Gtk::LayoutChild` instance for the `Gtk::LayoutManager`, creating one if necessary. More...
Glib::RefPtr< const LayoutChild > | get_layout_child (Widget & child) const
| Retrieves a `Gtk::LayoutChild` instance for the `Gtk::LayoutManager`, creating one if necessary. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data_with_c_callback (const Quark &key, void *data, GDestroyNotify notify)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< CenterLayout > | create ()
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. More...

## Protected Member Functions
| CenterLayout ()
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. More...
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< LayoutChild > | create_layout_child_vfunc (const Widget & widget, const Widget & for_child)
virtual void | root_vfunc ()
virtual void | unroot_vfunc ()
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::CenterLayout > | wrap (GtkCenterLayout * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gtk::LayoutManager
Glib::RefPtr< Gtk::LayoutManager > | wrap (GtkLayoutManager * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

A centering layout.

A Gtk::CenterLayout is a layout manager that manages up to three children. The start widget is allocated at the start of the layout (left in LRT layouts and right in RTL ones), and the end widget at the end.

The center widget is centered regarding the full width of the layout.

Since gtkmm 3.96:

## Constructor & Destructor Documentation

## ◆ CenterLayout() [1/2]

Gtk::CenterLayout::CenterLayout | ( | CenterLayout && | src | ) |
| noexcept

## ◆ ~CenterLayout()

Gtk::CenterLayout::~CenterLayout | ( |  | ) |
| overridenoexcept

## ◆ CenterLayout() [2/2]

Gtk::CenterLayout::CenterLayout | ( |  | ) |
| protected

## Member Function Documentation

## ◆ create()

static Glib::RefPtr< CenterLayout > Gtk::CenterLayout::create | ( |  | ) |
| static

## ◆ get_baseline_position()

BaselinePosition Gtk::CenterLayout::get_baseline_position | ( |  | ) | const

Returns the baseline position of the layout.

Returns
  The current baseline position of self.

## ◆ get_center_widget() [1/2]

Widget * Gtk::CenterLayout::get_center_widget | ( |  | ) |

Returns the center widget of the layout.

Returns
  The current center widget of self.

## ◆ get_center_widget() [2/2]

const Widget * Gtk::CenterLayout::get_center_widget | ( |  | ) | const

Returns the center widget of the layout.

Returns
  The current center widget of self.

## ◆ get_end_widget() [1/2]

Widget * Gtk::CenterLayout::get_end_widget | ( |  | ) |

Returns the end widget of the layout.

Returns
  The current end widget of self.

## ◆ get_end_widget() [2/2]

const Widget * Gtk::CenterLayout::get_end_widget | ( |  | ) | const

Returns the end widget of the layout.

Returns
  The current end widget of self.

## ◆ get_orientation()

Orientation Gtk::CenterLayout::get_orientation | ( |  | ) | const

Gets the current orienration of the layout manager.

Returns
  The current orientation of self.

## ◆ get_shrink_center_last()

bool Gtk::CenterLayout::get_shrink_center_last | ( |  | ) | const

Gets whether self shrinks the center widget after other children.

Since gtkmm 4.12:

Returns
  Whether to shrink the center widget after others.

## ◆ get_start_widget() [1/2]

Widget * Gtk::CenterLayout::get_start_widget | ( |  | ) |

Returns the start widget of the layout.

Returns
  The current start widget of self.

## ◆ get_start_widget() [2/2]

const Widget * Gtk::CenterLayout::get_start_widget | ( |  | ) | const

Returns the start widget of the layout.

Returns
  The current start widget of self.

## ◆ get_type()

static GType Gtk::CenterLayout::get_type | ( |  | ) |
| static

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

## ◆ gobj() [1/2]

GtkCenterLayout * Gtk::CenterLayout::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkCenterLayout * Gtk::CenterLayout::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkCenterLayout * Gtk::CenterLayout::gobj_copy | ( |  | ) |

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

## ◆ operator=()

CenterLayout & Gtk::CenterLayout::operator= | ( | CenterLayout && | src | ) |
| noexcept

## ◆ property_shrink_center_last() [1/2]

Glib::PropertyProxy< bool > Gtk::CenterLayout::property_shrink_center_last | ( |  | ) |

Whether to shrink the center widget after other children.

By default, when there's no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width.

If set to `false`, start and end widgets keep natural width and the center widget starts shrinking instead.

Since gtkmm 4.12:

Default value: `true`

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_shrink_center_last() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::CenterLayout::property_shrink_center_last | ( |  | ) | const

Whether to shrink the center widget after other children.

By default, when there's no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width.

If set to `false`, start and end widgets keep natural width and the center widget starts shrinking instead.

Since gtkmm 4.12:

Default value: `true`

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_position()

void Gtk::CenterLayout::set_baseline_position | ( | BaselinePosition | baseline_position | ) |

Sets the new baseline position of self.

Parameters

  baseline_position | The new baseline position.

## ◆ set_center_widget()

void Gtk::CenterLayout::set_center_widget | ( | Widget * | widget | ) |

Sets the new center widget of self.

To remove the existing center widget, pass `nullptr`.

Parameters

  widget | The new center widget.

## ◆ set_end_widget()

void Gtk::CenterLayout::set_end_widget | ( | Widget * | widget | ) |

Sets the new end widget of self.

To remove the existing center widget, pass `nullptr`.

Parameters

  widget | The new end widget.

## ◆ set_orientation()

void Gtk::CenterLayout::set_orientation | ( | Orientation | orientation | ) |

Sets the orientation of self.

Parameters

  orientation | The new orientation.

## ◆ set_shrink_center_last()

void Gtk::CenterLayout::set_shrink_center_last | ( | bool | shrink_center_last = `true` | ) |

Sets whether to shrink the center widget after other children.

By default, when there's no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width.

If set to `false`, start and end widgets keep natural width and the center widget starts shrinking instead.

Since gtkmm 4.12:

Parameters

  shrink_center_last | Whether to shrink the center widget after others.

## ◆ set_start_widget()

void Gtk::CenterLayout::set_start_widget | ( | Widget * | widget | ) |

Sets the new start widget of self.

To remove the existing start widget, pass `nullptr`.

Parameters

  widget | The new start widget.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::CenterLayout > wrap | ( | GtkCenterLayout * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

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

Parameters

  object | The C instance.
  take_copy | False 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.