Crea  Modifica  FrontPage  Indici  Cerca  Ultime modifiche  History  RSS  Login

Gtk::Paned

class Gtk::Paned

Gtk::Paned is the base class for widgets with two panes, arranged either horizontally (Gtk::HPaned) or vertically (Gtk::VPaned). Child widgets are added to the panes of the widget with Gtk::Paned#pack1 and Gtk::Paned#pack2. The division beween the two children is set by default from the size requests of the children, but it can be adjusted by the user.

A paned widget draws a separator between the two child widgets and a small handle that the user can drag to adjust the division. It does not draw any relief around the children or around the separator. (The space in which the separator is called the gutter.) Often, it is useful to put each child inside a Gtk::Frame with the shadow type set to Gtk::SHADOW_IN so that the gutter appears as a ridge.

Each child has two options that can be set, resize and shrink. If resize is true, then when the Gtk::Paned is resized, that child will expand or shrink along with the paned widget. If shrink is true, then when that child can be made smaller than it's requisition by the user. Setting shrink to false allows the application to set a minimum size. If resize is false for both children, then this is treated as if resize is true for both children.

The application can set the position of the slider as if it were set by the user, by calling Gtk::Paned#position=.

<URL:http://developer.gnome.org/doc/API/2.0/gtk/panes.png>

Example 1. Creating a paned widget with minimum sizes.

require 'gtk2'

hpaned = Gtk::HPaned.new
frame1 = Gtk::Frame.new
frame2 = Gtk::Frame.new
frame1.shadow_type = Gtk::SHADOW_IN
frame2.shadow_type = Gtk::SHADOW_IN

hpaned.set_size_request(200, -1)
hpaned.pack1(frame1, true, false)
hpaned.pack2(frame2, false, false)
frame1.set_size_request(50, -1)

Gtk::Window.new.add(hpaned).set_default_size(300, 100).show_all

Gtk.main 

Instance Methods

add1(child)
Adds a child to the top or left pane with default parameters. This is equivalent to Gtk::Paned#pack1 (child, false, true).
  • child: the child to add
  • Returns: self
add2(child)
Adds a child to the bottom or right pane with default parameters. This is equivalent to Gtk::Paned#pack2 (child, false, true).
  • child: the child to add
  • Returns: self
pack1(child, resize, shrink)
Adds a child to the top or left pane.
  • child: the child to add.
  • resize: true if this child should expand when the paned widget is resized.
  • shrink: true if this child can be made smaller than its requsition.
pack2(child, resize, shrink)
Adds a child to the bottom or right pane.
  • child: the child to add.
  • resize: true if this child should expand when the paned widget is resized.
  • shrink: true if this child can be made smaller than its requsition.
child1
Obtains the first child of the paned widget. Since 2.4
  • Returns: first child(Gtk::Widget), or nil if it is not set.
child2
Obtains the second child of the paned widget. Since 2.4
  • Returns: second child(Gtk::Widget), or nil if it is not set.
position
Obtains the position of the divider between the two panes.
  • Returns: position of the divider
position=(position)
Sets the position of the divider between the two panes.
  • position: pixel position of divider, a negative value means that the position is unset.
  • Returns: position
set_position(position)
Same as Gtk::Paned#position=.
  • position: pixel position of divider, a negative value means that the position is unset.
  • Returns: self
position_set?
Gets the value whether the position property should be used.
  • Returns: true if the position property should be used.
position_set=(val)
Sets the value whether the position property should be used.
  • val: true if the position property should be used.
  • Returns: val
set_position_set(val)
Same as Gtk::Paned#position_set=.
  • val: true if the position property should be used.
  • Returns: val
child1_resize?
Gets the value whether the child1 is resizable.
  • Returns: true if the child1 is resizable.
child1_shrink?
Gets the value whether the child1 is shrinkable.
  • Returns: true if the child1 is shrinkable.
child2_resize?
Gets the value whether the child2 is resizable.
  • Returns: true if the child2 is resizable.
child2_shrink?
Gets the value whether the child2 is shrinkable.
  • Returns: true if the child2 is shrinkable.
accept_position
Emits a "accept_position" signal.
  • Returns: self
cancel_position
Emits a "cancel_position" signal.
  • Returns: self
cycle_child_focus(val)
Emits a "cycle_child_focus" signal.
  • val: true or false
  • Returns: self
cycle_handle_focus(val)
Emits a "cycle_handle_focus" signal.
  • val: true or false
  • Returns: self
move_handle(scroll_type)
Emits a "move_handle" signal.
toggle_handle_focus
Emits a "toggle_handle_focus" signal.
  • Returns: self
max_position
Gets the Largest possible value for the "position" property. Since 2.4
  • Returns: Largest possible value for the "position" property
min_position
Gets the Smallest possible value for the "position" property. Since 2.4
  • Returns: Smallest possible value for the "position" property

Properties

max-position: Integer (Read)
Largest possible value for the "position" property Since 2.4
  • Allowed values: >= 0
  • Default value: 2147483647
min-position: Integer (Read)
Smallest possible value for the "position" property Since 2.4
  • Allowed values: >= 0
  • Default value: 0
position: Integer (Read/Write)
Position of paned separator in pixels (0 means all the way to the left/top)
  • Allowed values: >= 0
  • Default value: 0
position-set: true or false (Read/Write)
true if the Position property should be used
  • Default value: false

Style Properties

handle-size: Integer (Read)
Width of handle
  • Allowed values: >= 0
  • Default value: 5

Child Properties

resize: true or false (Read/Write)
The "resize" child property determines whether the child expands and shrinks along with the paned widget. Since 2.4
  • Default value: true
shrink: true or false (Read/Write)
The "shrink" child property determines whether the child can be made smaller than its requisition. Since 2.4
  • Default value: true

ChangeLog

  • 2007-01-30: Apply GTK+-2.10 - Masao
Ultima modifica:2007/01/30 03:06:32
Parola chiave:
Referenze:[Gtk::Container] [Gtk::VPaned] [Gtk::HPaned] [Gtk::Paned]