/* $Id: scrolledwindow.hg,v 1.7 2006/08/17 18:03:34 murrayc Exp $ */

/* scrolledwindow.h
 * 
 * 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 Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

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


namespace Gtk
{

class Adjustment;
class HScrollbar;
class VScrollbar;

/** Adds scrollbars to its child widget.
 *
 * This container accepts a single child widget. It adds scrollbars to the child widget and optionally draws a beveled frame around the child widget.
 * The scrolled window can work in two ways:
 * 1) Some widgets have native scrolling support; these widgets handle certain Gtk::Adjustment signals. Widgets with native scroll support include Gtk::TreeView, Gtk::TextView, and Gtk::Layout.
 * 2) For widgets that lack native scrolling support, such as Gtk::Table, Gtk::Box, and so on, the widget will be placed inside a Gtk::Viewport.
 *
 * The position of the scrollbars is controlled by the scroll adjustments. See Gtk::Adjustment for the fields in an adjustment - for Gtk::Scrollbar, used by Gtk::ScrolledWindow,
 * the "value" field represents the position of the scrollbar, which must be between the "lower" field and "upper - page_size."
 * The "page_size" field represents the size of the visible scrollable area.
 * The "step_increment" and "page_increment" fields are used when the user asks to step down (using the small stepper arrows) or page down (using for example the PageDown key).
 *
 * If a Gtk::ScrolledWindow doesn't behave quite as you would like, or doesn't have exactly the right layout, it's very possible to set up your own scrolling with Gtk::Scrollbar and, for example, a Gtk::Table.
 *
 * @ingroup Widgets
 * @ingroup Containers
 */
class ScrolledWindow : public Bin
{
  _CLASS_GTKOBJECT(ScrolledWindow,GtkScrolledWindow,GTK_SCROLLED_WINDOW,Gtk::Bin,GtkBin)

public:
  _CTOR_DEFAULT
  _WRAP_CTOR(ScrolledWindow(Adjustment& hadjustment, Adjustment& vadjustment), gtk_scrolled_window_new)
  

  _WRAP_METHOD(void set_hadjustment(Gtk::Adjustment* hadjustment = 0), gtk_scrolled_window_set_hadjustment)
  _WRAP_METHOD(void set_vadjustment(Gtk::Adjustment* vadjustment = 0), gtk_scrolled_window_set_vadjustment)
  _WRAP_METHOD(void set_hadjustment(Gtk::Adjustment& hadjustment), gtk_scrolled_window_set_hadjustment)
  _WRAP_METHOD(void set_vadjustment(Gtk::Adjustment& vadjustment), gtk_scrolled_window_set_vadjustment)

  _WRAP_METHOD(Gtk::Adjustment* get_hadjustment(), gtk_scrolled_window_get_hadjustment)
  _WRAP_METHOD(const Gtk::Adjustment* get_hadjustment() const, gtk_scrolled_window_get_hadjustment, constversion)
  _WRAP_METHOD(Gtk::Adjustment* get_vadjustment(), gtk_scrolled_window_get_vadjustment)
  _WRAP_METHOD(const Gtk::Adjustment* get_vadjustment() const, gtk_scrolled_window_get_vadjustment, constversion)

  _WRAP_METHOD(void set_policy(PolicyType hscrollbar_policy, PolicyType vscrollbar_policy), gtk_scrolled_window_set_policy)
  _WRAP_METHOD(void get_policy(PolicyType& hscrollbar_policy, PolicyType& vscrollbar_policy) const, gtk_scrolled_window_get_policy)

  _WRAP_METHOD(void set_placement(CornerType window_placement), gtk_scrolled_window_set_placement)
  _WRAP_METHOD(void unset_placement(), gtk_scrolled_window_unset_placement)
  _WRAP_METHOD(CornerType get_placement() const, gtk_scrolled_window_get_placement)

  _WRAP_METHOD(void set_shadow_type(ShadowType type), gtk_scrolled_window_set_shadow_type)
  _WRAP_METHOD(ShadowType get_shadow_type() const, gtk_scrolled_window_get_shadow_type)

  ///Puts the child inside a Gtk::Viewport if it doesn't have native scrolling capability.
  virtual void add(Gtk::Widget& widget);
  _IGNORE(gtk_scrolled_window_add_with_viewport)

#m4 _CONVERSION(`GtkWidget*',`VScrollbar*',`Glib::wrap((GtkVScrollbar*)$3)')
#m4 _CONVERSION(`GtkWidget*',`const VScrollbar*',`Glib::wrap((GtkVScrollbar*)$3)')
#m4 _CONVERSION(`GtkWidget*',`HScrollbar*',`Glib::wrap((GtkHScrollbar*)$3)')
#m4 _CONVERSION(`GtkWidget*',`const HScrollbar*',`Glib::wrap((GtkHScrollbar*)$3)')
  _WRAP_METHOD(VScrollbar* get_vscrollbar(), gtk_scrolled_window_get_vscrollbar)
  _WRAP_METHOD(const VScrollbar* get_vscrollbar() const, gtk_scrolled_window_get_vscrollbar)

  _WRAP_METHOD(HScrollbar* get_hscrollbar(), gtk_scrolled_window_get_hscrollbar)
  _WRAP_METHOD(const HScrollbar* get_hscrollbar() const, gtk_scrolled_window_get_hscrollbar)

  _MEMBER_GET(vscrollbar_visible,vscrollbar_visible,bool,guint)
  _MEMBER_GET(hscrollbar_visible,hscrollbar_visible,bool,guint)

  //Keybinding signals:
  _IGNORE_SIGNAL("scroll_child")
  _IGNORE_SIGNAL("move_focus_out")

  _WRAP_PROPERTY("hadjustment", Gtk::Adjustment*)
  _WRAP_PROPERTY("vadjustment", Gtk::Adjustment*)
  _WRAP_PROPERTY("hscrollbar-policy", PolicyType)
  _WRAP_PROPERTY("vscrollbar-policy", PolicyType)
  _WRAP_PROPERTY("window-placement", CornerType)
  _WRAP_PROPERTY("shadow-type", ShadowType)
};

} /* namespace Gtk */

