public class Notebook extends Container
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?
Modifier and Type | Class and Description |
---|---|
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.
|
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 |
---|
Notebook()
Constructs a new Notebook.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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 int appendPage(Widget child, Widget tabLabel)
child
- The Widget to be shown on the new Notebook page.tabLabel
- The Label Widget you want to use for the tab itself.public void connect(Notebook.ChangeCurrentPage handler)
Notebook.ChangeCurrentPage
handler to the
Notebook.public void connect(Notebook.SwitchPage handler)
Notebook.SwitchPage
handler to this Notebook.public int getCurrentPage()
public Widget getPage(int pageNum)
0
.public int getPageCount()
public int getPageNumber(Widget child)
-1
if child
is not
in the Notebook.public int insertPage(Widget child, Widget tabLabel, int position)
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.public int prependPage(Widget child, Widget tabLabel)
child
- The Widget shown on the new Notebook page.tabLabel
- The Label Widget for the tabpublic void removePage(int pageNum)
pageNum
- The position number (from 0) of the page to remove.public void setCurrentPage(int pageNum)
pageNum
- Position of the page to activatepublic void setScrollable(boolean setting)
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.
public void setShowBorder(boolean setting)
The border decoration drawn around the Notebook pages only optional if
you've turned tabs off with setShowTabs()
.
public void setShowTabs(boolean setting)
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.
public void setTabPosition(PositionType position)
TOP
is the default.