* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
*/
#include "config.h"
+
#include "gtkaspectframe.h"
+
+#include "gtksizerequest.h"
+
#include "gtkprivate.h"
#include "gtkintl.h"
-struct _GtkAspectFramePriv
+struct _GtkAspectFramePrivate
{
GtkAllocation center_allocation;
TRUE,
GTK_PARAM_READWRITE));
- g_type_class_add_private (class, sizeof (GtkAspectFramePriv));
+ g_type_class_add_private (class, sizeof (GtkAspectFramePrivate));
}
static void
gtk_aspect_frame_init (GtkAspectFrame *aspect_frame)
{
- GtkAspectFramePriv *priv;
+ GtkAspectFramePrivate *priv;
aspect_frame->priv = G_TYPE_INSTANCE_GET_PRIVATE (aspect_frame,
GTK_TYPE_ASPECT_FRAME,
- GtkAspectFramePriv);
+ GtkAspectFramePrivate);
priv = aspect_frame->priv;
priv->xalign = 0.5;
GParamSpec *pspec)
{
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object);
- GtkAspectFramePriv *priv = aspect_frame->priv;
+ GtkAspectFramePrivate *priv = aspect_frame->priv;
switch (prop_id)
{
GParamSpec *pspec)
{
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (object);
- GtkAspectFramePriv *priv = aspect_frame->priv;
+ GtkAspectFramePrivate *priv = aspect_frame->priv;
switch (prop_id)
{
* the #GtkAspectFrame. This ranges from 0.0 (left aligned)
* to 1.0 (right aligned)
* @yalign: Vertical alignment of the child within the allocation of
- * the #GtkAspectFrame. This ranges from 0.0 (left aligned)
- * to 1.0 (right aligned)
+ * the #GtkAspectFrame. 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 requistion of the child.
gboolean obey_child)
{
GtkAspectFrame *aspect_frame;
- GtkAspectFramePriv *priv;
+ GtkAspectFramePrivate *priv;
aspect_frame = g_object_new (GTK_TYPE_ASPECT_FRAME, NULL);
* the #GtkAspectFrame. This ranges from 0.0 (left aligned)
* to 1.0 (right aligned)
* @yalign: Vertical alignment of the child within the allocation of
- * the #GtkAspectFrame. This ranges from 0.0 (left aligned)
- * to 1.0 (right aligned)
+ * the #GtkAspectFrame. 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 requistion of the child.
gfloat ratio,
gboolean obey_child)
{
- GtkAspectFramePriv *priv;
+ GtkAspectFramePrivate *priv;
g_return_if_fail (GTK_IS_ASPECT_FRAME (aspect_frame));
GtkAllocation *child_allocation)
{
GtkAspectFrame *aspect_frame = GTK_ASPECT_FRAME (frame);
- GtkAspectFramePriv *priv = aspect_frame->priv;
+ GtkAspectFramePrivate *priv = aspect_frame->priv;
GtkBin *bin = GTK_BIN (frame);
+ GtkWidget *child;
gdouble ratio;
- if (bin->child && gtk_widget_get_visible (bin->child))
+ child = gtk_bin_get_child (bin);
+ if (child && gtk_widget_get_visible (child))
{
GtkAllocation full_allocation;
{
GtkRequisition child_requisition;
- gtk_widget_get_child_requisition (bin->child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
if (child_requisition.height != 0)
{
ratio = ((gdouble) child_requisition.width /