/* Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * 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, see <https://www.gnu.org/licenses/>.
 */

#include <gtkmm/widget.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_p.h)

namespace Gtk
{

/** 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. The frame
 * will be "shrink-wrapped" to the size of the child.
 *
 * @ingroup Widgets
 * @ingroup Containers
 */
class GTKMM_API AspectFrame : public Widget
{
  _CLASS_GTKOBJECT(AspectFrame, GtkAspectFrame, GTK_ASPECT_FRAME, Gtk::Widget, GtkWidget, , , GTKMM_API)

public:

  /** Constructor to create a new %AspectFrame object.
   * @param xalign Horizontal alignment of the child within the allocation of this
   *   %AspectFrame.  For possible values, see Gtk::Align.
   * @param yalign Vertical alignment of the child within the allocation of this
   *   %AspectFrame. For possible values, see Gtk::Align.
   * @param ratio The desired aspect ratio.
   * @param obey_child If <tt>true</tt>, @a ratio is ignored and the aspect ratio
   *   is taken from the requisition of the child.
   */
  _WRAP_CTOR(AspectFrame(Align xalign = Gtk::Align::CENTER, Align yalign = Gtk::Align::CENTER,
    float ratio = 1.0, bool obey_child = false), gtk_aspect_frame_new)

  /** Constructor to create a new %AspectFrame object.
   * @param xalign Horizontal alignment of the child within the allocation of this
   *   %AspectFrame.  This ranges from 0.0 (left aligned) to 1.0 (right aligned).
   * @param yalign Vertical alignment of the child within the allocation of this
   *   %AspectFrame. This ranges from 0.0 (top aligned) to 1.0 (bottom aligned).
   * @param ratio The desired aspect ratio.
   * @param obey_child If <tt>true</tt>, @a ratio is ignored and the aspect ratio
   *   is taken from the requisition of the child.
   */
  _WRAP_CTOR(AspectFrame(float xalign, float yalign,
    float ratio = 1.0, bool obey_child = false), gtk_aspect_frame_new)

  /** Sets the horizontal alignment of the child within the allocation
   * of this %AspectFrame.
   * @param xalign Horizontal alignment of the child within the allocation of
   *   this %AspectFrame. For possible values, see Gtk::Align.
   */
  _WRAP_METHOD(void set_xalign(Align xalign), gtk_aspect_frame_set_xalign)
  _WRAP_METHOD(void set_xalign(float xalign), gtk_aspect_frame_set_xalign)
  _WRAP_METHOD(float get_xalign() const, gtk_aspect_frame_get_xalign)

  /** Sets the vertical alignment of the child within the allocation
   * of this %AspectFrame.
   * @param yalign Vertical alignment of the child within the allocation of
   *   this %AspectFrame. For possible values, see Gtk::Align.
   */
  _WRAP_METHOD(void set_yalign(Align yalign), gtk_aspect_frame_set_yalign)
  _WRAP_METHOD(void set_yalign(float yalign), gtk_aspect_frame_set_yalign)
  _WRAP_METHOD(float get_yalign() const, gtk_aspect_frame_get_yalign)
  _WRAP_METHOD(void set_ratio(float ratio), gtk_aspect_frame_set_ratio)
  _WRAP_METHOD(float get_ratio() const, gtk_aspect_frame_get_ratio)
  _WRAP_METHOD(void set_obey_child(bool obey_child = true), gtk_aspect_frame_set_obey_child)
  _WRAP_METHOD(bool get_obey_child() const, gtk_aspect_frame_get_obey_child)
  _WRAP_METHOD(void set_child(Widget& child), gtk_aspect_frame_set_child)
  void unset_child();
  _WRAP_METHOD(Widget* get_child(), gtk_aspect_frame_get_child)
  _WRAP_METHOD(const Widget* get_child() const, gtk_aspect_frame_get_child, constversion)

  _WRAP_PROPERTY("xalign", float)
  _WRAP_PROPERTY("yalign", float)
  _WRAP_PROPERTY("ratio", float)
  _WRAP_PROPERTY("obey-child", bool)
  _WRAP_PROPERTY("child", Widget*)
};

} //namespace Gtk
