java-gnome version 4.0.19

org.gnome.gtk
Class Notebook

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.freedesktop.bindings.Proxy
          extended by org.gnome.glib.Object
              extended by org.gnome.gtk.Object
                  extended by org.gnome.gtk.Widget
                      extended by org.gnome.gtk.Container
                          extended by org.gnome.gtk.Notebook

public class Notebook
extends Container

A tabbed notebook container. These are common sights in web browsers and text editors and are the recommended way to create user interfaces that must manage multiple documents if creating a completely independent window per document (the preferred GNOME approach) is inappropriate.

Note that Notebooks are a poor way to organize pages of application preferences; if your program has that many options there is probably something very wrong with your design in the first place. Do you really need to present that many different configuration settings to the user?

Since:
4.0.3
Author:
Sebastian Mancke, Andrew Cowie, Stefan Prelle, Stefan Schweizer

Nested Class Summary
static interface Notebook.ChangeCurrentPage
          The handler interface for notification of changes in the current page.
static interface Notebook.SwitchPage
          The signal emitted when the user or the program switches to a new page.
 
Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.ButtonPressEvent, Widget.ButtonReleaseEvent, Widget.EnterNotifyEvent, Widget.ExposeEvent, Widget.FocusInEvent, Widget.FocusOutEvent, Widget.Hide, Widget.KeyPressEvent, Widget.KeyReleaseEvent, Widget.LeaveNotifyEvent, Widget.MapEvent, Widget.MotionNotifyEvent, Widget.PopupMenu, Widget.ScrollEvent, Widget.UnmapEvent, Widget.VisibilityNotifyEvent
 
Nested classes/interfaces inherited from class org.gnome.gtk.Object
Object.Destroy
 
Constructor Summary
Notebook()
          Constructs a new Notebook.
 
Method Summary
 int appendPage(Widget child, Widget tabLabel)
          Append a new tab to the Notebook after the current tab.
 void connect(Notebook.ChangeCurrentPage handler)
          Connects a Notebook.ChangeCurrentPage handler to the Notebook.
 void connect(Notebook.SwitchPage handler)
          Connects a Notebook.SwitchPage handler to this Notebook.
 int getCurrentPage()
          Returns the number of the active page
 Widget getPage(int pageNum)
          Get the Widget which is the page at a given index.
 int getPageCount()
          Returns the number of pages in the Notebook.
 int getPageNumber(Widget child)
          Returns the page number of the given Widget.
 int insertPage(Widget child, Widget tabLabel, int position)
          Insert a tab at the supplied position in the Notebook.
 int prependPage(Widget child, Widget tabLabel)
          Insert a tab to the Notebook before the current tab.
 void removePage(int pageNum)
          Remove a tab.
 void setCurrentPage(int pageNum)
          Activate/show the page at the supplied position.
 void setScrollable(boolean setting)
          Sets whether all the tabs will be visible, thus increasing the size the Notebook takes, or instead only show as many tabs as the current size of the Notebook allows.
 void setShowBorder(boolean setting)
          Do you want a border drawn around the Notebook?
 void setShowTabs(boolean setting)
          Should the tabs of the Notebook actually be there?
 void setTabPosition(PositionType position)
          Specify where the Notebook tabs will be located.
 
Methods inherited from class org.gnome.gtk.Container
add, getChildren, remove, setBorderWidth
 
Methods inherited from class org.gnome.gtk.Widget
activate, addEvents, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, connect, getAllocation, getCanDefault, getCanFocus, getHasFocus, getName, getParent, getRequisition, getSensitive, getToplevel, getWindow, grabAdd, grabDefault, grabFocus, grabRemove, hide, isSensitive, modifyBackground, modifyBase, modifyFont, modifyText, queueDraw, queueDrawArea, realize, setCanDefault, setCanFocus, setColormap, setEvents, setName, setSensitive, setSizeRequest, setTooltipMarkup, setTooltipText, show, showAll
 
Methods inherited from class org.gnome.gtk.Object
connect, destroy
 
Methods inherited from class org.freedesktop.bindings.Pointer
toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Notebook

public Notebook()
Constructs a new Notebook.

Since:
4.0.3
Method Detail

appendPage

public int appendPage(Widget child,
                      Widget tabLabel)
Append a new tab to the Notebook after the current tab.

Parameters:
child - The Widget to be shown on the new Notebook page.
tabLabel - The Label Widget you want to use for the tab itself.
Since:
4.0.3

connect

public void connect(Notebook.ChangeCurrentPage handler)
Connects a Notebook.ChangeCurrentPage handler to the Notebook.

Since:
4.0.3

connect

public void connect(Notebook.SwitchPage handler)
Connects a Notebook.SwitchPage handler to this Notebook.

Since:
4.0.10

getCurrentPage

public int getCurrentPage()
Returns the number of the active page

Since:
4.0.9

getPage

public Widget getPage(int pageNum)
Get the Widget which is the page at a given index. Page numbers start at 0.

Since:
4.0.9

getPageCount

public int getPageCount()
Returns the number of pages in the Notebook.

Since:
4.0.9

getPageNumber

public int getPageNumber(Widget child)
Returns the page number of the given Widget.

Returns:
The page number or -1 if child is not in the Notebook.
Since:
4.0.9

insertPage

public int insertPage(Widget child,
                      Widget tabLabel,
                      int position)
Insert a tab at the supplied position in the Notebook.

Parameters:
child - The Widget shown on the new Notebook page.
tabLabel - The Label Widget to use on the tab itself.
position - The position at which to insert the page.
Returns:
the position in the Notebook of the inserted tab.
Since:
4.0.3

prependPage

public int prependPage(Widget child,
                       Widget tabLabel)
Insert a tab to the Notebook before the current tab.

Parameters:
child - The Widget shown on the new Notebook page.
tabLabel - The Label Widget for the tab
Returns:
the position of the prepended tab.
Since:
4.0.3

removePage

public void removePage(int pageNum)
Remove a tab.

Parameters:
pageNum - The position number (from 0) of the page to remove.
Since:
4.0.3

setCurrentPage

public void setCurrentPage(int pageNum)
Activate/show the page at the supplied position.

Parameters:
pageNum - Position of the page to activate
Since:
4.0.3

setScrollable

public void setScrollable(boolean setting)
Sets whether all the tabs will be visible, thus increasing the size the Notebook takes, or instead only show as many tabs as the current size of the Notebook allows. In this later case, an pair of arrows for scrolling among all tabs will be show in the tab label area.

It is desirable to call this with a true value if the Notebook has many pages. Otherwise, the tabs will artificially increase the size of the Notebook, sometimes even leading to a Window that cannot fit in the screen space.

Since:
4.0.12

setShowBorder

public void setShowBorder(boolean setting)
Do you want a border drawn around the Notebook?

The border decoration drawn around the Notebook pages only optional if you've turned tabs off with setShowTabs().

Since:
4.0.10

setShowTabs

public void setShowTabs(boolean setting)
Should the tabs of the Notebook actually be there?

The default is true, as you'd expect.

Turning this off might be useful if you're trying to create the effect of toggling user interface from one set of controls to another in the same space on screen. That might seem nifty, but keep in mind that you're going to have to come up with a convincingly clear UI for your users to be able to change modes, else they won't have any clue that there are any other states to change to.

Since:
4.0.10

setTabPosition

public void setTabPosition(PositionType position)
Specify where the Notebook tabs will be located. TOP is the default.

Since:
4.0.6


java-gnome