1/* $Id: paned.hg,v 1.6 2006/04/12 11:11:25 murrayc Exp $ */
2
3
4/* paned.h
5 *
6 * Copyright (C) 1998-2002 The gtkmm Development Team
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free
20 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <gtkmm/container.h>
24#include <gtkmm/enums.h>
25
26_DEFS(gtkmm,gtk)
27_PINCLUDE(gtkmm/private/container_p.h)
28
29
30namespace Gtk
31{
32
33//TODO: Inherit/Implement Orientation when we can break ABI.
34
35/** This is the base class for widgets with two panes, arranged either
36 * horizontally (Gtk::HPaned) or vertically (Gtk::VPaned).
37 *
38 * Child widgets are added to the panes of the widget with pack1() and pack2().
39 * The division beween the two children is set by default from the size
40 * requests of the children, but it can be adjusted by the user.
41 *
42 * A paned widget draws a separator between the two child widgets and a small
43 * handle that the user can drag to adjust the division. It does not draw any
44 * relief around the children or around the separator. Often, it is useful to
45 * put each child inside a Gtk::Frame with the shadow type set to Gtk::SHADOW_IN
46 * so that the gutter appears as a ridge.
47 *
48 * Each child has two options that can be set - resize and shrink. If resize is
49 * true, then when the GtkPaned is resized, that child will expand or shrink
50 * along with the paned widget. If shrink is true, then when that child can be
51 * made smaller than it's requisition. Setting shrink to false allows the
52 * application to set a minimum size. If resize is false for both children,
53 * then this is treated as if resize is true for both children.
54 *
55 * The application can set the position of the slider as if it were set by the
56 * user, by calling set_position().
57 *
58 * @ingroup Widgets
59 * @ingroup Containers
60 */
61class Paned : public Container
62{
63  _CLASS_GTKOBJECT(Paned,GtkPaned,GTK_PANED,Gtk::Container,GtkContainer)
64  _IGNORE(gtk_paned_compute_position)
65
66public:
67  _CTOR_DEFAULT()
68
69  _WRAP_METHOD(void add1(Widget& child), gtk_paned_add1)
70  _WRAP_METHOD(void add2(Widget& child), gtk_paned_add2)
71
72  _WRAP_METHOD(void pack1(Widget& child, bool resize, bool shrink), gtk_paned_pack1)
73  void pack1(Widget& child, AttachOptions options = Gtk::EXPAND);
74
75  _WRAP_METHOD(void pack2(Widget& child, bool resize, bool shrink), gtk_paned_pack2)
76  void pack2(Widget& child, AttachOptions options  = Gtk::EXPAND);
77
78  _WRAP_METHOD(int get_position() const, gtk_paned_get_position)
79  _WRAP_METHOD(void set_position(int position), gtk_paned_set_position)
80
81  _WRAP_METHOD(Widget* get_child1(), gtk_paned_get_child1)
82  _WRAP_METHOD(const Widget* get_child1() const, gtk_paned_get_child1, constversion)
83
84  _WRAP_METHOD(Widget* get_child2(), gtk_paned_get_child2)
85  _WRAP_METHOD(const Widget* get_child2() const, gtk_paned_get_child2, constversion)
86
87  _WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_handle_window(), gtk_paned_get_handle_window, refreturn)
88  _WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_handle_window() const, gtk_paned_get_handle_window, refreturn, constversion)
89
90  //Keybinding signals:
91  _IGNORE_SIGNAL("toggle_handle_focus")
92  _IGNORE_SIGNAL("move_handle")
93  _IGNORE_SIGNAL("cycle_handle_focus")
94  _IGNORE_SIGNAL("accept_position")
95  _IGNORE_SIGNAL("cancel_position")
96  _IGNORE_SIGNAL("cycle_child_focus")
97
98
99  _WRAP_PROPERTY("position", int)
100  _WRAP_PROPERTY("position-set", bool)
101  _WRAP_PROPERTY("min-position", int)
102  _WRAP_PROPERTY("max-position", int)
103};
104
105/**
106 * The Gtk::HPaned widget is a container widget with two children arranged
107 * horizontally. The division between the two panes is adjustable by the
108 * user by dragging a handle. See Gtk::Paned for details.
109 *
110 * @ingroup Widgets
111 */
112class HPaned : public Paned
113{
114  _CLASS_GTKOBJECT(HPaned,GtkHPaned,GTK_HPANED,Gtk::Paned,GtkPaned)
115public:
116  _CTOR_DEFAULT()
117};
118
119/**
120 * The Gtk::VPaned widget is a container widget with two children arranged
121 * vertically. The division between the two panes is adjustable by the
122 * user by dragging a handle. See Gtk::Paned for details.
123 *
124 * @ingroup Widgets
125 */
126class VPaned : public Paned
127{
128  _CLASS_GTKOBJECT(VPaned,GtkVPaned,GTK_VPANED,Gtk::Paned,GtkPaned)
129public:
130  _CTOR_DEFAULT()
131
132};
133
134} // namespace Gtk
135