1 /* $Id: scrolledwindow.hg,v 1.7 2006/08/17 18:03:34 murrayc Exp $ */
5 * Copyright (C) 1998-2002 The gtkmm Development Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <gtkmm/bin.h>
24 _PINCLUDE(gtkmm/private/bin_p.h)
34 /** Adds scrollbars to its child widget.
36 * This container accepts a single child widget. It adds scrollbars to the child widget and optionally draws a beveled frame around the child widget.
37 * The scrolled window can work in two ways:
38 * 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.
39 * 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.
41 * 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,
42 * the "value" field represents the position of the scrollbar, which must be between the "lower" field and "upper - page_size."
43 * The "page_size" field represents the size of the visible scrollable area.
44 * 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).
46 * 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.
51 class ScrolledWindow : public Bin
53 _CLASS_GTKOBJECT(ScrolledWindow,GtkScrolledWindow,GTK_SCROLLED_WINDOW,Gtk::Bin,GtkBin)
57 _WRAP_CTOR(ScrolledWindow(Adjustment& hadjustment, Adjustment& vadjustment), gtk_scrolled_window_new)
60 _WRAP_METHOD(void set_hadjustment(Gtk::Adjustment* hadjustment = 0), gtk_scrolled_window_set_hadjustment)
61 _WRAP_METHOD(void set_vadjustment(Gtk::Adjustment* vadjustment = 0), gtk_scrolled_window_set_vadjustment)
62 _WRAP_METHOD(void set_hadjustment(Gtk::Adjustment& hadjustment), gtk_scrolled_window_set_hadjustment)
63 _WRAP_METHOD(void set_vadjustment(Gtk::Adjustment& vadjustment), gtk_scrolled_window_set_vadjustment)
65 _WRAP_METHOD(Gtk::Adjustment* get_hadjustment(), gtk_scrolled_window_get_hadjustment)
66 _WRAP_METHOD(const Gtk::Adjustment* get_hadjustment() const, gtk_scrolled_window_get_hadjustment, constversion)
67 _WRAP_METHOD(Gtk::Adjustment* get_vadjustment(), gtk_scrolled_window_get_vadjustment)
68 _WRAP_METHOD(const Gtk::Adjustment* get_vadjustment() const, gtk_scrolled_window_get_vadjustment, constversion)
70 _WRAP_METHOD(void set_policy(PolicyType hscrollbar_policy, PolicyType vscrollbar_policy), gtk_scrolled_window_set_policy)
71 _WRAP_METHOD(void get_policy(PolicyType& hscrollbar_policy, PolicyType& vscrollbar_policy) const, gtk_scrolled_window_get_policy)
73 _WRAP_METHOD(void set_placement(CornerType window_placement), gtk_scrolled_window_set_placement)
74 _WRAP_METHOD(void unset_placement(), gtk_scrolled_window_unset_placement)
75 _WRAP_METHOD(CornerType get_placement() const, gtk_scrolled_window_get_placement)
77 _WRAP_METHOD(void set_shadow_type(ShadowType type), gtk_scrolled_window_set_shadow_type)
78 _WRAP_METHOD(ShadowType get_shadow_type() const, gtk_scrolled_window_get_shadow_type)
80 ///Puts the child inside a Gtk::Viewport if it doesn't have native scrolling capability.
81 virtual void add(Gtk::Widget& widget);
82 _IGNORE(gtk_scrolled_window_add_with_viewport)
84 #m4 _CONVERSION(`GtkWidget*',`VScrollbar*',`Glib::wrap((GtkVScrollbar*)$3)')
85 #m4 _CONVERSION(`GtkWidget*',`const VScrollbar*',`Glib::wrap((GtkVScrollbar*)$3)')
86 #m4 _CONVERSION(`GtkWidget*',`HScrollbar*',`Glib::wrap((GtkHScrollbar*)$3)')
87 #m4 _CONVERSION(`GtkWidget*',`const HScrollbar*',`Glib::wrap((GtkHScrollbar*)$3)')
88 _WRAP_METHOD(VScrollbar* get_vscrollbar(), gtk_scrolled_window_get_vscrollbar)
89 _WRAP_METHOD(const VScrollbar* get_vscrollbar() const, gtk_scrolled_window_get_vscrollbar)
91 _WRAP_METHOD(HScrollbar* get_hscrollbar(), gtk_scrolled_window_get_hscrollbar)
92 _WRAP_METHOD(const HScrollbar* get_hscrollbar() const, gtk_scrolled_window_get_hscrollbar)
94 _MEMBER_GET(vscrollbar_visible,vscrollbar_visible,bool,guint)
95 _MEMBER_GET(hscrollbar_visible,hscrollbar_visible,bool,guint)
98 _IGNORE_SIGNAL("scroll_child")
99 _IGNORE_SIGNAL("move_focus_out")
101 _WRAP_PROPERTY("hadjustment", Gtk::Adjustment*)
102 _WRAP_PROPERTY("vadjustment", Gtk::Adjustment*)
103 _WRAP_PROPERTY("hscrollbar-policy", PolicyType)
104 _WRAP_PROPERTY("vscrollbar-policy", PolicyType)
105 _WRAP_PROPERTY("window-placement", CornerType)
106 _WRAP_PROPERTY("shadow-type", ShadowType)
109 } /* namespace Gtk */