| 1 |
/* Copyright (C) 1998-2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/container.h> |
| 18 |
#include <gtkmm/orientable.h> |
| 19 |
#include <gtkmm/enums.h> |
| 20 |
|
| 21 |
_DEFS(gtkmm,gtk) |
| 22 |
_PINCLUDE(gtkmm/private/container_p.h) |
| 23 |
|
| 24 |
namespace Gtk |
| 25 |
{ |
| 26 |
|
| 27 |
/** A widget with two adjustable panes. |
| 28 |
* |
| 29 |
* Gtk::Paned has two panes, arranged either |
| 30 |
* horizontally or vertically. The division between |
| 31 |
* the two panes is adjustable by the user by dragging |
| 32 |
* a handle. |
| 33 |
|
| 34 |
* Child widgets are added to the panes of the widget with pack1() and pack2(). |
| 35 |
* The division beween the two children is set by default from the size |
| 36 |
* requests of the children, but it can be adjusted by the user. |
| 37 |
* |
| 38 |
* A paned widget draws a separator between the two child widgets and a small |
| 39 |
* handle that the user can drag to adjust the division. It does not draw any |
| 40 |
* relief around the children or around the separator. (The space |
| 41 |
* in which the separator is called the gutter.) Often, it is useful to |
| 42 |
* put each child inside a Gtk::Frame with the shadow type set to Gtk::SHADOW_IN |
| 43 |
* so that the gutter appears as a ridge. No separator is drawn if one of |
| 44 |
* the children is missing. |
| 45 |
* |
| 46 |
* Each child has two options that can be set - resize and shrink. If resize is |
| 47 |
* true, then when the GtkPaned is resized, that child will expand or shrink |
| 48 |
* along with the paned widget. If shrink is true, then when that child can be |
| 49 |
* made smaller than it's requisition. Setting shrink to false allows the |
| 50 |
* application to set a minimum size. If resize is false for both children, |
| 51 |
* then this is treated as if resize is true for both children. |
| 52 |
* |
| 53 |
* The application can set the position of the slider as if it were set by the |
| 54 |
* user, by calling set_position(). |
| 55 |
* |
| 56 |
* @ingroup Widgets |
| 57 |
* @ingroup Containers |
| 58 |
*/ |
| 59 |
class GTKMM_API Paned |
| 60 |
: public Container, |
| 61 |
public Orientable |
| 62 |
{ |
| 63 |
_CLASS_GTKOBJECT(Paned,GtkPaned,GTK_PANED,Gtk::Container,GtkContainer,,,GTKMM_API) |
| 64 |
_IMPLEMENTS_INTERFACE(Orientable) |
| 65 |
|
| 66 |
public: |
| 67 |
|
| 68 |
//Note that we try to use the same defaul parameter value as the default property value. |
| 69 |
_WRAP_CTOR(Paned(Orientation orientation = ORIENTATION_HORIZONTAL), gtk_paned_new) |
| 70 |
|
| 71 |
_WRAP_METHOD(void add1(Widget& child), gtk_paned_add1) |
| 72 |
_WRAP_METHOD(void add2(Widget& child), gtk_paned_add2) |
| 73 |
|
| 74 |
_WRAP_METHOD(void pack1(Widget& child, bool resize, bool shrink), gtk_paned_pack1) |
| 75 |
void pack1(Widget& child, AttachOptions options = Gtk::EXPAND); |
| 76 |
|
| 77 |
_WRAP_METHOD(void pack2(Widget& child, bool resize, bool shrink), gtk_paned_pack2) |
| 78 |
void pack2(Widget& child, AttachOptions options = Gtk::EXPAND); |
| 79 |
|
| 80 |
_WRAP_METHOD(int get_position() const, gtk_paned_get_position) |
| 81 |
_WRAP_METHOD(void set_position(int position), gtk_paned_set_position) |
| 82 |
|
| 83 |
_WRAP_METHOD(Widget* get_child1(), gtk_paned_get_child1) |
| 84 |
_WRAP_METHOD(const Widget* get_child1() const, gtk_paned_get_child1, constversion) |
| 85 |
|
| 86 |
_WRAP_METHOD(Widget* get_child2(), gtk_paned_get_child2) |
| 87 |
_WRAP_METHOD(const Widget* get_child2() const, gtk_paned_get_child2, constversion) |
| 88 |
|
| 89 |
_WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_handle_window(), gtk_paned_get_handle_window, refreturn) |
| 90 |
_WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_handle_window() const, gtk_paned_get_handle_window, refreturn, constversion) |
| 91 |
|
| 92 |
_WRAP_METHOD(void set_wide_handle(bool wide = true), gtk_paned_set_wide_handle) |
| 93 |
_WRAP_METHOD(bool get_wide_handle() const, gtk_paned_get_wide_handle) |
| 94 |
|
| 95 |
//Keybinding signals: |
| 96 |
_IGNORE_SIGNAL("toggle_handle_focus") |
| 97 |
_IGNORE_SIGNAL("move_handle") |
| 98 |
_IGNORE_SIGNAL("cycle_handle_focus") |
| 99 |
_IGNORE_SIGNAL("accept_position") |
| 100 |
_IGNORE_SIGNAL("cancel_position") |
| 101 |
_IGNORE_SIGNAL("cycle_child_focus") |
| 102 |
|
| 103 |
|
| 104 |
_WRAP_PROPERTY("position", int) |
| 105 |
_WRAP_PROPERTY("position-set", bool) |
| 106 |
_WRAP_PROPERTY("min-position", int) |
| 107 |
_WRAP_PROPERTY("max-position", int) |
| 108 |
_WRAP_PROPERTY("wide-handle", bool) |
| 109 |
|
| 110 |
_WRAP_CHILD_PROPERTY("resize", bool) |
| 111 |
_WRAP_CHILD_PROPERTY("shrink", bool) |
| 112 |
}; |
| 113 |
|
| 114 |
} // namespace Gtk |
| 115 |
|
| 116 |
#ifndef GTKMM_DISABLE_DEPRECATED |
| 117 |
//Include the deprecated header, |
| 118 |
//whose classes were previously in this header, |
| 119 |
//to preserve the "API" of the includes. |
| 120 |
#include <gtkmm/hvpaned.h> |
| 121 |
#endif // GTKMM_DISABLE_DEPRECATED |