Main Page Widgets Namespaces Book

# Gtk::Alignment Class Reference
[Widgets, Container Widgets]

Inheritance diagram for Gtk::Alignment:

[legend]

List of all members.

## Detailed Description

A widget which controls the alignment and size of its child.

Normally, a widget is allocated at least as much size as it requests, and, most widgets expand to fill any extra allocated space, but sometimes this behavior is not desired. The alignment widget allows the programmer to specify how a widget should expand and position itself to fill the area it is allocated.

It has four settings: xscale, yscale, xalign, and yalign: The scale settings specify how much the child widget should expand to fill the space allocated to the Gtk::Alignment. The values can range from 0 (meaning the child doesn't expand at all) to 1 (meaning the child expands to fill all of the available space). The align settings place the child widget within the available area. The values range from 0 (top or left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have no effect.

## Public Member Functions

| Alignment (AlignmentEnum xalign, AlignmentEnum yalign=Gtk::ALIGN_CENTER, float xscale=1.0, float yscale=1.0)
| Constructor to create an Alignment object.
| Alignment (float xalign=0.5, float yalign=0.5, float xscale=1.0, float yscale=1.0)
| Constructor to create an Alignment object.
void | get_padding (guint& padding_top, guint& padding_bottom, guint& padding_left, guint& padding_right)
| Gets the padding on the different sides of the widget.
const GtkAlignment* | gobj () const
| Provides access to the underlying C GtkObject.
GtkAlignment* | gobj ()
| Provides access to the underlying C GtkObject.
Glib::PropertyProxy_ReadOnly <guint> | property_bottom_padding () const
| The padding to insert at the bottom of the widget.
Glib::PropertyProxy<guint> | property_bottom_padding ()
| The padding to insert at the bottom of the widget.
Glib::PropertyProxy_ReadOnly <guint> | property_left_padding () const
| The padding to insert at the left of the widget.
Glib::PropertyProxy<guint> | property_left_padding ()
| The padding to insert at the left of the widget.
Glib::PropertyProxy_ReadOnly <guint> | property_right_padding () const
| The padding to insert at the right of the widget.
Glib::PropertyProxy<guint> | property_right_padding ()
| The padding to insert at the right of the widget.
Glib::PropertyProxy_ReadOnly <guint> | property_top_padding () const
| The padding to insert at the top of the widget.
Glib::PropertyProxy<guint> | property_top_padding ()
| The padding to insert at the top of the widget.
Glib::PropertyProxy_ReadOnly <float> | property_xalign () const
| Horizontal position of child in available space.
Glib::PropertyProxy<float> | property_xalign ()
| Horizontal position of child in available space.
Glib::PropertyProxy_ReadOnly <float> | property_xscale () const
| If available horizontal space is bigger than needed for the child.
Glib::PropertyProxy<float> | property_xscale ()
| If available horizontal space is bigger than needed for the child.
Glib::PropertyProxy_ReadOnly <float> | property_yalign () const
| Vertical position of child in available space.
Glib::PropertyProxy<float> | property_yalign ()
| Vertical position of child in available space.
Glib::PropertyProxy_ReadOnly <float> | property_yscale () const
| If available vertical space is bigger than needed for the child.
Glib::PropertyProxy<float> | property_yscale ()
| If available vertical space is bigger than needed for the child.
void | set (AlignmentEnum xalign, AlignmentEnum yalign=Gtk::ALIGN_CENTER, float xscale=1.0, float yscale=1.0)
| Sets the Alignment values.
void | set (float xalign=0.5, float yalign=0.5, float xscale=1.0, float yscale=1.0)
| Sets the Alignment values.
void | set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right)
| Sets the padding on the different sides of the widget.
virtual | ~Alignment ()

## Related Functions

(Note that these are not member functions.)
Gtk::Alignment* | wrap (GtkAlignment* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Constructor & Destructor Documentation

virtual Gtk::Alignment::~Alignment | ( |  | ) | `[virtual]`

Gtk::Alignment::Alignment | ( | float | xalign = `0.5`,
|  | float | yalign = `0.5`,
|  | float | xscale = `1.0`,
|  | float | yscale = `1.0` |
| ) |  |  | `[explicit]`

Constructor to create an Alignment object.

Parameters:

  | xalign | The initial horizontal alignment of the child.
  | yalign | The initial vertical alignment of the child.
  | xscale | The initial amount that the child expands horizontally to fill up unused space.
  | yscale | The initial amount that the child expands vertically to fill up unused space.

Gtk::Alignment::Alignment | ( | AlignmentEnum | xalign,
|  | AlignmentEnum | yalign = `Gtk::ALIGN_CENTER`,
|  | float | xscale = `1.0`,
|  | float | yscale = `1.0` |
| ) |  |  | `[explicit]`

Constructor to create an Alignment object.

Parameters:

  | xalign | A Gtk::AlignmentEnum describing the initial horizontal alignment of the child.
  | yalign | A Gtk::AlignmentEnum describing the initial vertical alignment of the child.
  | xscale | The initial amount that the child expands horizontally to fill up unused space.
  | yscale | The initial amount that the child expands vertically to fill up unused space.

## Member Function Documentation

void Gtk::Alignment::get_padding | ( | guint & | padding_top,
|  | guint & | padding_bottom,
|  | guint & | padding_left,
|  | guint & | padding_right |
| ) |  |  |

Gets the padding on the different sides of the widget.

See set_padding().

Since gtkmm 2.4:

Parameters:

  | padding_top | Location to store the padding for the top of the widget, or `0`.
  | padding_bottom | Location to store the padding for the bottom of the widget, or `0`.
  | padding_left | Location to store the padding for the left of the widget, or `0`.
  | padding_right | Location to store the padding for the right of the widget, or `0`.

const GtkAlignment* Gtk::Alignment::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

GtkAlignment* Gtk::Alignment::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

Glib::PropertyProxy_ReadOnly<guint> Gtk::Alignment::property_bottom_padding | ( |  | ) | const

The padding to insert at the bottom of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<guint> Gtk::Alignment::property_bottom_padding | ( |  | ) |

The padding to insert at the bottom of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy_ReadOnly<guint> Gtk::Alignment::property_left_padding | ( |  | ) | const

The padding to insert at the left of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<guint> Gtk::Alignment::property_left_padding | ( |  | ) |

The padding to insert at the left of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy_ReadOnly<guint> Gtk::Alignment::property_right_padding | ( |  | ) | const

The padding to insert at the right of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<guint> Gtk::Alignment::property_right_padding | ( |  | ) |

The padding to insert at the right of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy_ReadOnly<guint> Gtk::Alignment::property_top_padding | ( |  | ) | const

The padding to insert at the top of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<guint> Gtk::Alignment::property_top_padding | ( |  | ) |

The padding to insert at the top of the widget.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy_ReadOnly<float> Gtk::Alignment::property_xalign | ( |  | ) | const

Horizontal position of child in available space.

0.0 is left aligned

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<float> Gtk::Alignment::property_xalign | ( |  | ) |

Horizontal position of child in available space.

0.0 is left aligned

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy_ReadOnly<float> Gtk::Alignment::property_xscale | ( |  | ) | const

If available horizontal space is bigger than needed for the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<float> Gtk::Alignment::property_xscale | ( |  | ) |

If available horizontal space is bigger than needed for the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy_ReadOnly<float> Gtk::Alignment::property_yalign | ( |  | ) | const

Vertical position of child in available space.

0.0 is top aligned

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<float> Gtk::Alignment::property_yalign | ( |  | ) |

Vertical position of child in available space.

0.0 is top aligned

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy_ReadOnly<float> Gtk::Alignment::property_yscale | ( |  | ) | const

If available vertical space is bigger than needed for the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

Glib::PropertyProxy<float> Gtk::Alignment::property_yscale | ( |  | ) |

If available vertical space is bigger than needed for the child.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

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

void Gtk::Alignment::set | ( | AlignmentEnum | xalign,
|  | AlignmentEnum | yalign = `Gtk::ALIGN_CENTER`,
|  | float | xscale = `1.0`,
|  | float | yscale = `1.0` |
| ) |  |  |

Sets the Alignment values.

Parameters:

  | xalign | The horizontal alignment of the child of this Alignment, from 0 (left) to 1 (right).
  | yalign | The vertical alignment of the child of this Alignment, from 0 (top) to 1 (bottom).
  | xscale | The amount that the child expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all the space allocated for the Alignment.
  | yscale | The amount that the child widget expands vertically to fill up unused space from 0 to 1. The values are similar to xscale.

void Gtk::Alignment::set | ( | float | xalign = `0.5`,
|  | float | yalign = `0.5`,
|  | float | xscale = `1.0`,
|  | float | yscale = `1.0` |
| ) |  |  |

Sets the Alignment values.

Parameters:

  | xalign | The horizontal alignment of the child of this Alignment, from 0 (left) to 1 (right).
  | yalign | The vertical alignment of the child of this Alignment, from 0 (top) to 1 (bottom).
  | xscale | The amount that the child expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all the space allocated for the Alignment.
  | yscale | The amount that the child widget expands vertically to fill up unused space from 0 to 1. The values are similar to xscale.

void Gtk::Alignment::set_padding | ( | guint | padding_top,
|  | guint | padding_bottom,
|  | guint | padding_left,
|  | guint | padding_right |
| ) |  |  |

Sets the padding on the different sides of the widget.

The padding adds blank space to the sides of the widget. For instance, this can be used to indent the child widget towards the right by adding padding on the left.

Since gtkmm 2.4:

Parameters:

  | padding_top | The padding at the top of the widget.
  | padding_bottom | The padding at the bottom of the widget.
  | padding_left | The padding at the left of the widget.
  | padding_right | The padding at the right of the widget.

## Friends And Related Function Documentation

Gtk::Alignment* wrap | ( | GtkAlignment * | 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.

The documentation for this class was generated from the following file:

- alignment.h