public class Paned extends Container implements Orientable
HPaned
) or vertically (VPaned
). A Paned will have two children, referred as child 1
and 2
.
This Widget is mainly used to divide the Window area in two parts. The user can adjust the size of the panes by dragging the separator that appears between them. This way, the user can choose at any time how much size allocate for each of the two child Widgets.
A typical usage of the Paned Container is to provide some kind of navigator facilities to a application, generally with a list of bookmarks or an index. In those cases, a HPaned is used to divide the application Window in two columns, one at the left, with the index in a TreeView, and another, wider, at the right, with the contents.
Note that Paned should only be used when we really need to allow users to
dynamically change the way size is distributed between the two children.
Otherwise, a HBox
or VBox
would be a better
choice.
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.Destroy, Widget.Draw, Widget.EnterNotifyEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.QueryTooltip, Widget.ScrollEvent, Widget.SizeAllocate, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
Constructor and Description |
---|
Paned(Orientation orientation)
Construct a new Paned of the given orientation.
|
Modifier and Type | Method and Description |
---|---|
void |
add1(Widget child)
Adds a child Widget to the top (in case of VPaned) or to the left (in
case of HPaned) pane.
|
void |
add2(Widget child)
Adds a child Widget to the bottom (in case of VPaned) or to the right
(in case of HPaned) pane.
|
Widget |
getChild1()
Get the child Widget in the top (in case of a VPaned) or in the left
(in case of an HPaned) pane.
|
Widget |
getChild2()
Get the child Widget at the bottom (in case of VPaned) or at the right
(in case of HPaned) pane.
|
Orientation |
getOrientation()
Get the orientation of this Orientable.
|
int |
getPosition()
Obtains the position of the divider between the two panes.
|
void |
pack1(Widget child,
boolean resize,
boolean shrink)
Adds a child Widget to the top (in case of VPaned) or to the left (in
case of HPaned) pane.
|
void |
pack2(Widget child,
boolean resize,
boolean shrink)
Adds a child Widget to the bottom (in case of a VPaned) or to the right
(in case of an HPaned) pane.
|
void |
setOrientation(Orientation orientation)
Set the orientation of this Orientable.
|
void |
setPosition(int position)
Sets the position of the divider between the two panes.
|
add, getChildren, remove, setBorderWidth
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, destroy, getAllocatedHeight, getAllocatedWidth, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getPreferredHeightForWidthMinimum, getPreferredHeightForWidthNatural, getPreferredHeightMinimum, getPreferredHeightNatural, getPreferredWidthForHeightMinimum, getPreferredWidthForHeightNatural, getPreferredWidthMinimum, getPreferredWidthNatural, getRequestMode, getRequisition, getSensitive, getStyleContext, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, overrideBackground, overrideColor, overrideFont, queueDraw, queueDrawArea, realize, setAlignHorizontal, setAlignVertical, setCanDefault, setCanFocus, setEvents, setExpandHorizontal, setExpandVertical, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
public Paned(Orientation orientation)
public void add1(Widget child)
This call is equivalent to pack1(child, false, true)
.
public void add2(Widget child)
This call is equivalent to pack2(child, false, true)
.
public Widget getChild1()
public Widget getChild2()
public Orientation getOrientation()
Orientable
getOrientation
in interface Orientable
public int getPosition()
public void pack1(Widget child, boolean resize, boolean shrink)
child
- the Widget to be addedresize
- Whether this pane (and thus its Widget) should be resized
when the Paned is resize.shrink
- Whether the user can make the pane smaller than the size
requested by the child Widget. This can be useful to let the
user hide one of the two panels, but depending of the child
Widget type it can lead to poor visual results. Use with
caution.public void pack2(Widget child, boolean resize, boolean shrink)
pack1()
for details.public void setOrientation(Orientation orientation)
Orientable
setOrientation
in interface Orientable
public void setPosition(int position)
Note that the main utility of a Paned is to let user to set the position, so in most cases you don't want to call this method. It can be useful to set the initial position, if you feel that the default value chosen by Gtk is not suitable for your application.
position
- The position of the divider, in pixels. A negative value
means that the position is not being forced.