/*
 * 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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */


#include <gtkmm/bin.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/bin_p.h)

namespace Gtk
{

/** A Gtk::Bin with a decorative frame and optional label.
 *
 * The Frame widget surrounds its single child with a decorative frame and
 * an optional label.  If present, the label is drawn in a gap in the top
 * side of the frame. The position of the label can be controlled with
 * set_label_align().
 *
 * A Frame widget looks like this:
 * @image html frame1.png
 *
 * @ingroup Widgets
 * @ingroup Containers
 */
class Frame : public Bin
{
  _CLASS_GTKOBJECT(Frame,GtkFrame,GTK_FRAME,Gtk::Bin,GtkBin)
public:

  _CTOR_DEFAULT()
  _WRAP_CTOR(Frame(const Glib::ustring& label), gtk_frame_new)

  //TODO: Add a bool use_markup arg to set_label() as a convenience - it would have to use set_label_widget().

  /** Set the label to appear in the top edge of the frame.
   * Label alignment defaults to the upper left corner of the frame.
   */
  _WRAP_METHOD(void set_label(const Glib::ustring& label), gtk_frame_set_label)
  void unset_label();
  _WRAP_METHOD(Glib::ustring get_label() const, gtk_frame_get_label)

  _WRAP_METHOD(void set_label_widget(Widget& label_widget), gtk_frame_set_label_widget)
  _WRAP_METHOD(Widget* get_label_widget(), gtk_frame_get_label_widget)
  _WRAP_METHOD(const Widget* get_label_widget() const, gtk_frame_get_label_widget, constversion)

  _WRAP_METHOD(void set_label_align(float xalign = 0.0, float yalign = 0.5), gtk_frame_set_label_align)
  /** Sets the alignment of the frame widget’s label. The
   * default values for a newly created frame are Gtk::ALIGN_START and Gtk::ALIGN_CENTER.
   *
   * @param xalign The position of the label along the top edge
   * of the widget. A value of Gtk::ALIGN_START represents left alignment;
   * Gtk::ALIGN_END represents right alignment.
   * @param yalign The y alignment of the label. A value of Gtk::ALIGN_START aligns under 
   * the frame; Gtk::ALIGN_END aligns above the frame. If the values are
   * Gtk::ALIGN_START or Gtk::ALIGN_END the gap in the frame won’t be painted because the label
   * will be completely above or below the frame.
   */
  _WRAP_METHOD(void set_label_align(Align xalign, Align yalign = Gtk::ALIGN_CENTER), gtk_frame_set_label_align)

  _WRAP_METHOD(void get_label_align(float& xalign, float& yalign) const, gtk_frame_get_label_align)

  /** Sets shadow type of the frame.
   */
  _WRAP_METHOD(void set_shadow_type(ShadowType type), gtk_frame_set_shadow_type)
  _WRAP_METHOD(ShadowType get_shadow_type() const, gtk_frame_get_shadow_type)

  _WRAP_PROPERTY("label", Glib::ustring)
  _WRAP_PROPERTY("label-xalign", double)
  _WRAP_PROPERTY("label-yalign", double)
  _WRAP_PROPERTY("shadow-type", ShadowType)
  _WRAP_PROPERTY("label-widget", Widget*)

protected:
#m4 _CONVERSION(`GtkAllocation*',`Allocation&',`($2)(Glib::wrap($3))')
  _WRAP_VFUNC(void compute_child_allocation(Allocation& allocation), compute_child_allocation)

};

} // namespace Gtk
