Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::AspectFrame Class Reference

A GtkAspectFrame C++ wrapper class. More...

`#include <xfc/gtk/aspectframe.hh>`

Inheritance diagram for Xfc::Gtk::AspectFrame:

List of all members.

## Public Member Functions

Constructors

- AspectFrame ()
    Construct an AspectFrame with xalign 0.5, yalign 0.5, ratio 1.0 and obey_child true.
- AspectFrame (float xalign, float yalign)
    Construct an AspectFrame with the specified xalign and yalign values.
- AspectFrame (float xalign, float yalign, float ratio)
    Construct an AspectFrame with the specified xalign, yalign and ratio values.
- AspectFrame (const String &label, float xalign, float yalign, float ratio)
    Construct a labelled AspectFrame with the specified xalign, yalign and ratio values.
- virtual ~AspectFrame ()
    Destructor.

Accessors

- GtkAspectFrame * gtk_aspect_frame () const
    Get a pointer to the GtkAspectFrame structure.
- operator GtkAspectFrame * () const
    Conversion operator; safely converts an AspectFrame to a GtkAspectFrame pointer.

Methods

- void set (float xalign, float yalign, float ratio, bool obey_child)
    Sets the parameters for an existing AspectFrame.

## Protected Member Functions

Constructors

- AspectFrame (GtkAspectFrame *aspect_frame, bool owns_reference=false)
    Construct a new AspectFrame from an existing GtkAspectFrame.

## Detailed Description

A GtkAspectFrame C++ wrapper class.

The 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. AspectFrame derives from Frame, so it can draw a label and a frame around the child. The frame will be "shrink-wrapped" to the size of the child.

See also: the AspectFrame HOWTO and example.

## Constructor & Destructor Documentation

Xfc::Gtk::AspectFrame::AspectFrame | ( | GtkAspectFrame * | aspect_frame,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new AspectFrame from an existing GtkAspectFrame.

Parameters:

  | aspect_frame | A pointer to a GtkAspectFrame.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The aspect_frame can be a newly created GtkAspectFrame or an existing GtkAspectFrame. (see G::Object::Object).

Xfc::Gtk::AspectFrame::AspectFrame | ( | float | xalign,
|  | float | yalign
| ) |

Construct an AspectFrame with the specified xalign and yalign values.

Parameters:

  | xalign | The horizontal alignment of the child within the allocation of the AspectFrame; this ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | yalign | The vertical alignment of the child within the allocation of the AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned).

This constructor takes the aspect ratio from the requistion of the child. This is the same as setting obey_child to true.

Xfc::Gtk::AspectFrame::AspectFrame | ( | float | xalign,
|  | float | yalign,
|  | float | ratio
| ) |

Construct an AspectFrame with the specified xalign, yalign and ratio values.

Parameters:

  | xalign | The horizontal alignment of the child within the allocation of the AspectFrame; this ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | yalign | The vertical alignment of the child within the allocation of the AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | ratio | The desired aspect ratio.

This constructor takes the aspect ratio from ratio and sets obey_child to false.

Xfc::Gtk::AspectFrame::AspectFrame | ( | const String & | label,
|  | float | xalign,
|  | float | yalign,
|  | float | ratio
| ) |

Construct a labelled AspectFrame with the specified xalign, yalign and ratio values.

Parameters:

  | label | The label text.
  | xalign | The horizontal alignment of the child within the allocation of the AspectFrame; this ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | yalign | The vertical alignment of the child within the allocation of the AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | ratio | The desired aspect ratio.

This constructor takes the aspect ratio from ratio and sets obey_child to false.

## Member Function Documentation

void Xfc::Gtk::AspectFrame::set | ( | float | xalign,
|  | float | yalign,
|  | float | ratio,
|  | bool | obey_child
| ) |

Sets the parameters for an existing AspectFrame.

Parameters:

  | xalign | The horizontal alignment of the child within the allocation of the AspectFrame; this ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | yalign | The vertical alignment of the child within the allocation of the AspectFrame. This ranges from 0.0 (left aligned) to 1.0 (right aligned).
  | ratio | The desired aspect ratio.
  | obey_child | If true, ratio is ignored, and the aspect ratio is taken from the requistion of the child.

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

- aspectframe.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3