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

A frame that constrains its child to a particular aspect ratio. More...

Inherits Gtk::Frame.

Collaboration diagram for Gtk::AspectFrame:
[legend]

List of all members.

## Public Member Functions
virtual | ~AspectFrame ()
GtkAspectFrame* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkAspectFrame* | gobj () const
| Provides access to the underlying C GtkObject.
| AspectFrame (const Glib::ustring& label=Glib::ustring(), AlignmentEnum xalign=Gtk::ALIGN_CENTER, AlignmentEnum yalign=Gtk::ALIGN_CENTER, float ratio=1.0, bool obey_child=false)
| Constructor to create a new AspectFrame object.
| AspectFrame (const Glib::ustring& label, float xalign, float yalign, float ratio=1.0, bool obey_child=false)
| Constructor to create a new AspectFrame object.
void | set (float xalign, float yalign, float ratio, bool obey_child=true)
| Set the properties of this AspectFrame.
void | set (AlignmentEnum xalign, AlignmentEnum yalign, float ratio, bool obey_child=true)
| Set the properties of this AspectFrame.
Glib::PropertyProxy< float > | property_xalign ()
| X alignment of the child.
Glib::PropertyProxy_ReadOnly < float > | property_xalign () const
| X alignment of the child.
Glib::PropertyProxy< float > | property_yalign ()
| Y alignment of the child.
Glib::PropertyProxy_ReadOnly < float > | property_yalign () const
| Y alignment of the child.
Glib::PropertyProxy< float > | property_ratio ()
| Aspect ratio if obey_child is FALSE.
Glib::PropertyProxy_ReadOnly < float > | property_ratio () const
| Aspect ratio if obey_child is FALSE.
Glib::PropertyProxy< bool > | property_obey_child ()
| Force aspect ratio to match that of the frame's child.
Glib::PropertyProxy_ReadOnly < bool > | property_obey_child () const
| Force aspect ratio to match that of the frame's child.
## Related Functions
(Note that these are not member functions.)
Gtk::AspectFrame* | wrap (GtkAspectFrame* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A frame that constrains its child to a particular aspect ratio.

The Gtk::AspectFrame is useful when you want pack a widget so that it can resize but always retains the same aspect ratio. For instance, one might be drawing a small preview of a larger image. Because it derives from Gtk::Frame, it can draw a label and a frame around the child. The frame will be "shrink-wrapped" to the size of the child.

## Constructor & Destructor Documentation

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

Gtk::AspectFrame::AspectFrame | ( | const Glib::ustring & | label = `Glib::ustring()`,
|  | AlignmentEnum | xalign = `Gtk::ALIGN_CENTER`,
|  | AlignmentEnum | yalign = `Gtk::ALIGN_CENTER`,
|  | float | ratio = `1.0`,
|  | bool | obey_child = `false` |
| ) |  |  | `[explicit]`

Constructor to create a new AspectFrame object.

Parameters:

  | label | Label text.
  | xalign | Horizontal alignment of the child within the allocation of this AspectFrame. For possible values, see Gtk::AlignmentEnum.
  | yalign | Vertical alignment of the child within the allocation of this AspectFrame. For possible values, see Gtk::AlignmentEnum.
  | ratio | The desired aspect ratio.
  | obey_child | If `true`, ratio is ignored and the aspect ratio is taken from the requisition of the child.

Gtk::AspectFrame::AspectFrame | ( | const Glib::ustring & | label,
|  | float | xalign,
|  | float | yalign,
|  | float | ratio = `1.0`,
|  | bool | obey_child = `false` |
| ) |  |  | `[explicit]`

Constructor to create a new AspectFrame object.

Parameters:

  | label | Label text.
  | xalign | Horizontal alignment of the child within the allocation of this AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | yalign | Vertical alignment of the child within the allocation of this AspectFrame. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned).
  | ratio | The desired aspect ratio.
  | obey_child | If `true`, ratio is ignored and the aspect ratio is taken from the requisition of the child.

## Member Function Documentation

const GtkAspectFrame* Gtk::AspectFrame::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Frame.

GtkAspectFrame* Gtk::AspectFrame::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Frame.

Glib::PropertyProxy_ReadOnly<bool> Gtk::AspectFrame::property_obey_child | ( |  | ) | const

Force aspect ratio to match that of the frame's 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<bool> Gtk::AspectFrame::property_obey_child | ( |  | ) |

Force aspect ratio to match that of the frame's 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::AspectFrame::property_ratio | ( |  | ) | const

Aspect ratio if obey_child is FALSE.

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::AspectFrame::property_ratio | ( |  | ) |

Aspect ratio if obey_child is FALSE.

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::AspectFrame::property_xalign | ( |  | ) | const

X alignment of 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::AspectFrame::property_xalign | ( |  | ) |

X alignment of 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::AspectFrame::property_yalign | ( |  | ) | const

Y alignment of 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::AspectFrame::property_yalign | ( |  | ) |

Y alignment of 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::AspectFrame::set | ( | AlignmentEnum | xalign,
|  | AlignmentEnum | yalign,
|  | float | ratio,
|  | bool | obey_child = `true` |
| ) |  |  |

Set the properties of this AspectFrame.

Parameters:

  | xalign | Horizontal alignment of the child within the allocation of this AspectFrame. For possible values, see Gtk::AlignmentEnum.
  | yalign | Vertical alignment of the child within the allocation of this AspectFrame. For possible values, see Gtk::AlignmentEnum.
  | ratio | The desired aspect ratio.
  | obey_child | If `true`, ratio is ignored and the aspect ratio is taken from the requisition of the child.

void Gtk::AspectFrame::set | ( | float | xalign,
|  | float | yalign,
|  | float | ratio,
|  | bool | obey_child = `true` |
| ) |  |  |

Set the properties of this AspectFrame.

Parameters:

  | xalign | Horizontal alignment of the child within the allocation of this AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | yalign | Vertical alignment of the child within the allocation of this AspectFrame. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned).
  | ratio | The desired aspect ratio.
  | obey_child | If `true`, ratio is ignored and the aspect ratio is taken from the requisition of the child.

## Friends And Related Function Documentation

Gtk::AspectFrame* wrap | ( | GtkAspectFrame * | 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:

- gtkmm/aspectframe.h