org.gnu.gtk

Class Notebook


public class Notebook
extends Container

A Notebook widget is a container whose children are pages that can be switched between using tab labels along one edge.

There are many configuration options for a Notebook. Among other things you can choose on which edge the tabs appear, whether, if there are too many tabs to fit th notebook should be made bigger or scrolling arrows added, and whether there will be a popup menu allowing the user to switch between pages.

Field Summary

Fields inherited from class org.gnu.glib.GObject

eventsInitialized

Constructor Summary

Notebook()
Construct a new Notebook object with no pages.
Notebook(Handle handle)
Construct a new Notebook from a handle to a native resource.

Method Summary

void
addListener(NotebookListener listener)
Register an object to receive event notification.
void
appendPage(Widget child, Widget tabLabel)
Append a page to the Notebook.
void
appendPage(Widget child, Widget tabLabel, Widget menuLabel)
Append a page to the Notebook.
protected void
fireNotebookEvent(NotebookEvent event)
int
getCurrentPage()
Returns the page number of the current page.
Class
getEventListenerClass(String signal)
EventType
getEventType(String signal)
int
getNumPages()
Return the number of pages currently on the notebook.
Widget
getPage(int pageNum)
Returns the child Widget contained int he page number pageNum.
static Type
getType()
Retrieve the runtime type used by the GLib library.
protected static void
gtk_notebook_append_page(Handle notebook, Handle child, Handle tabLabel)
protected static void
gtk_notebook_append_page_menu(Handle notebook, Handle child, Handle tabLabel, Handle menuLabel)
protected static int
gtk_notebook_get_current_page(Handle notebook)
protected static Handle
gtk_notebook_get_menu_label(Handle notebook, Handle child)
protected static String
gtk_notebook_get_menu_label_text(Handle notebook, Handle child)
protected static int
gtk_notebook_get_n_pages(Handle notebook)
protected static Handle
gtk_notebook_get_nth_page(Handle notebook, int pageNum)
protected static boolean
gtk_notebook_get_scrollable(Handle notebook)
protected static boolean
gtk_notebook_get_show_border(Handle notebook)
protected static boolean
gtk_notebook_get_show_tabs(Handle notebook)
protected static Handle
gtk_notebook_get_tab_label(Handle notebook, Handle child)
protected static String
gtk_notebook_get_tab_label_text(Handle notebook, Handle child)
protected static int
gtk_notebook_get_tab_pos(Handle notebook)
protected static int
gtk_notebook_get_type()
protected static void
gtk_notebook_insert_page(Handle notebook, Handle child, Handle tabLabel, int position)
protected static void
gtk_notebook_insert_page_menu(Handle notebook, Handle child, Handle tabLabel, Handle menuLabel, int position)
protected static Handle
gtk_notebook_new()
protected static void
gtk_notebook_next_page(Handle notebook)
protected static int
gtk_notebook_page_num(Handle notebook, Handle child)
protected static void
gtk_notebook_popup_disable(Handle notebook)
protected static void
gtk_notebook_popup_enable(Handle notebook)
protected static void
gtk_notebook_prepend_page(Handle notebook, Handle child, Handle tabLabel)
protected static void
gtk_notebook_prepend_page_menu(Handle notebook, Handle child, Handle tabLabel, Handle menuLabel)
protected static void
gtk_notebook_prev_page(Handle notebook)
protected static void
gtk_notebook_query_tab_label_packing(Handle notebook, Handle child, boolean[] expand, boolean[] fill, int[] packType)
protected static void
gtk_notebook_remove_page(Handle notebook, int pageNum)
protected static void
gtk_notebook_reorder_child(Handle notebook, Handle child, int position)
protected static void
gtk_notebook_set_current_page(Handle notebook, int pageNum)
protected static void
gtk_notebook_set_menu_label(Handle notebook, Handle child, Handle menuLabel)
protected static void
gtk_notebook_set_menu_label_text(Handle notebook, Handle child, String menuText)
protected static void
gtk_notebook_set_scrollable(Handle notebook, boolean scrollable)
protected static void
gtk_notebook_set_show_border(Handle notebook, boolean showBorder)
protected static void
gtk_notebook_set_show_tabs(Handle notebook, boolean showTabs)
protected static void
gtk_notebook_set_tab_label(Handle notebook, Handle child, Handle tabLabel)
protected static void
gtk_notebook_set_tab_label_packing(Handle notebook, Handle child, boolean expand, boolean fill, int packType)
protected static void
gtk_notebook_set_tab_label_text(Handle notebook, Handle child, String tabText)
protected static void
gtk_notebook_set_tab_pos(Handle notebook, int pos)
void
insertPage(Widget child, Widget tabLabel, int position)
Insert a page into the Notebook at the given position.
void
insertPage(Widget child, Widget tabLabel, Widget menuLabel, int position)
Insert a page into the Notebook at the given position.
void
nextPage()
Switches to the next page.
int
pageNum(Widget child)
Finds the index of the page which contains the given child.
void
popupDisable()
disables the popup menu.
void
popupEnable()
Enables the popup menu.
void
prependPage(Widget child, Widget tabLabel)
Prepend a page to the Notebook.
void
prependPage(Widget child, Widget tabLabel, Widget menuLabel)
Prepend a page to the Notebook.
void
prevPage()
Switches to the previous page.
void
removeListener(NotebookListener listener)
Unregister an object that was receiving notebook event notification.
void
removePage(int pageNumber)
Removes a page fro the Notegook given its index in the notebook.
void
reorderChild(Widget child, int position)
Reorders the page containing child, so that it appears in position position.
void
setCurrentPage(int pageNum)
sets the page at offset pageNum to the current page.
void
setMenuLabel(Widget child, String menuText)
Creates a new label and sets it as the menu label of child.
void
setMenuLabel(Widget child, Widget menuLabel)
Changes the menu label for the page containing child.
void
setScrollable(boolean scrollable)
Sets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.
void
setShowBorder(boolean showBorder)
Sets whether a bevel will be drawn around the notebook pages.
void
setShowTabs(boolean showTabs)
sets whether to show the tabs for the notebook or not.
void
setTabLabel(Widget child, String tabText)
Creates a new label and sets it as the labelf or the page containing child.
void
setTabLabel(Widget child, Widget tabLabel)
Changes the tab label for child.
void
setTabLabelPacking(Widget child, boolean expand, boolean fill, PackType packType)
Sets the packing parameters for the tab label of the page containing child.
void
setTabPosition(PositionType pos)
Sets the edge at which the tabs for switching pages in the Notebook are drawn.

Methods inherited from class org.gnu.gtk.Container

add, addListener, fireContainerEvent, getBorderWidth, getChildren, getEventListenerClass, getEventType, getResizeMode, getType, gtk_container_add, gtk_container_check_resize, gtk_container_child_type, gtk_container_get_border_width, gtk_container_get_children, gtk_container_get_focus_chain, gtk_container_get_focus_hadjustment, gtk_container_get_focus_vadjustment, gtk_container_get_resize_mode, gtk_container_get_type, gtk_container_propagate_expose, gtk_container_remove, gtk_container_resize_children, gtk_container_set_border_width, gtk_container_set_focus_chain, gtk_container_set_focus_child, gtk_container_set_focus_hadjustment, gtk_container_set_focus_vadjustment, gtk_container_set_reallocate_redraws, gtk_container_set_resize_mode, gtk_container_unset_focus_chain, remove, removeListener, resizeChildren, setBorderWidth, setResizeMode

Methods inherited from class org.gnu.gtk.Widget

activate, addListener, addListener, addListener, addListener, addListener, addListener, addListener, addListener, canActivateAccel, createContext, createLayout, destroy, draw, drawArea, drawArea, findListener, finish, fireBooleanLifeCycleEvent, fireDragDestinationEvent, fireDragSourceEvent, fireExposeEvent, fireFocusEvent, fireKeyEvent, fireLifeCycleEvent, fireMouseEvent, fireMouseMotionEvent, getAccessible, getColormap, getContext, getData, getDisplay, getEventListenerClass, getEventType, getModifierStyle, getName, getParent, getParentWindow, getPointer, getRootWindow, getScreen, getSensitive, getStyle, getToplevel, getType, getWindow, grabDefault, grabFocus, gtk_drag_dest_set, gtk_drag_dest_unset, gtk_drag_finish, gtk_drag_get_data, gtk_drag_highlight, gtk_drag_source_set, gtk_drag_source_set_icon, gtk_drag_source_set_icon_pixbuf, gtk_drag_source_set_icon_stock, gtk_drag_source_unset, gtk_drag_unhighlight, gtk_widget_activate, gtk_widget_add_accelerator, gtk_widget_add_events, gtk_widget_add_mnemonic_label, gtk_widget_can_activate_accel, gtk_widget_child_focus, gtk_widget_child_notify, gtk_widget_class_path, gtk_widget_create_pango_context, gtk_widget_create_pango_layout, gtk_widget_destroy, gtk_widget_destroyed, gtk_widget_ensure_style, gtk_widget_event, gtk_widget_freeze_child_notify, gtk_widget_get_accessible, gtk_widget_get_ancestor, gtk_widget_get_child_requisition, gtk_widget_get_child_visible, gtk_widget_get_colormap, gtk_widget_get_composite_name, gtk_widget_get_default_colormap, gtk_widget_get_default_direction, gtk_widget_get_default_style, gtk_widget_get_default_visual, gtk_widget_get_direction, gtk_widget_get_display, gtk_widget_get_events, gtk_widget_get_extension_events, gtk_widget_get_modifier_style, gtk_widget_get_name, gtk_widget_get_pango_context, gtk_widget_get_parent, gtk_widget_get_parent_window, gtk_widget_get_pointer, gtk_widget_get_root_window, gtk_widget_get_screen, gtk_widget_get_sensitive, gtk_widget_get_settings, gtk_widget_get_size_request, gtk_widget_get_style, gtk_widget_get_toplevel, gtk_widget_get_type, gtk_widget_get_visual, gtk_widget_get_window, gtk_widget_grab_default, gtk_widget_grab_focus, gtk_widget_has_screen, gtk_widget_hide, gtk_widget_hide_all, gtk_widget_hide_on_delete, gtk_widget_intersect, gtk_widget_is_ancestor, gtk_widget_is_focus, gtk_widget_list_accel_closures, gtk_widget_list_mnemonic_labels, gtk_widget_map, gtk_widget_mnemonic_activate, gtk_widget_modify_base, gtk_widget_modify_bg, gtk_widget_modify_fg, gtk_widget_modify_font, gtk_widget_modify_style, gtk_widget_modify_text, gtk_widget_path, gtk_widget_pop_colormap, gtk_widget_pop_composite_child, gtk_widget_push_colormap, gtk_widget_push_composite_child, gtk_widget_queue_draw, gtk_widget_queue_draw_area, gtk_widget_queue_resize, gtk_widget_realize, gtk_widget_ref, gtk_widget_region_intersect, gtk_widget_remove_accelerator, gtk_widget_remove_mnemonic_label, gtk_widget_render_icon, gtk_widget_reparent, gtk_widget_reset_rc_styles, gtk_widget_send_expose, gtk_widget_set_accel_path, gtk_widget_set_app_paintable, gtk_widget_set_child_visible, gtk_widget_set_colormap, gtk_widget_set_composite_name, gtk_widget_set_default_colormap, gtk_widget_set_default_direction, gtk_widget_set_direction, gtk_widget_set_double_buffered, gtk_widget_set_events, gtk_widget_set_extension_events, gtk_widget_set_name, gtk_widget_set_parent, gtk_widget_set_parent_window, gtk_widget_set_redraw_on_allocate, gtk_widget_set_scroll_adjustments, gtk_widget_set_sensitive, gtk_widget_set_size_request, gtk_widget_set_state, gtk_widget_set_style, gtk_widget_shape_combine_mask, gtk_widget_show, gtk_widget_show_all, gtk_widget_show_now, gtk_widget_size_allocate, gtk_widget_size_request, gtk_widget_style_get_property, gtk_widget_thaw_child_notify, gtk_widget_translate_coordinates, gtk_widget_unmap, gtk_widget_unparent, gtk_widget_unrealize, gtk_widget_unref, handleButtonPressed, handleButtonReleased, handleDelete, handleDragDataGet, handleDragDestination, handleExpose, handleFocusIn, handleFocusOut, handleHide, handleKeyPressed, handleKeyReleased, handleMap, handleMouseEnter, handleMouseLeave, handleMouseMotion, handleNoExpose, handleRealize, handleScroll, handleShow, handleUnmap, hasFocus, hasScreen, hide, hideAll, highlight, intersect, isAncestor, makeWidget, modifyStyle, popColormap, pushColormap, realize, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, removeListener, reparent, setBackgroundColor, setBaseColor, setColormap, setDoubleBuffered, setDragDestination, setDragIcon, setDragIconPixbuf, setDragIconStock, setDragSource, setFont, setForegroundColor, setMinimumSize, setName, setNoDragDestination, setNoDragSource, setSensitive, setTextColor, shapeCombineMask, show, showAll, unHighlight

Methods inherited from class org.gnu.gtk.GtkObject

destroy, getFlags, getType, gtk_object_destroy, gtk_object_get_type, gtk_object_sink, setFlags, sink

Methods inherited from class org.gnu.glib.GObject

addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, equals, freezeNotify, getBooleanProperty, getData, getData, getDoubleProperty, getEventListenerClass, getEventType, getFloatProperty, getGObjectFromHandle, getHandle, getIntFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getNullHandle, getPixbufProperty, getProperty, getStringFromHandle, getStringProperty, hasProperty, hashCode, instantiateJGObjectFromGType, notify, removeEventHandler, removeListener, retrieveGObject, setBooleanProperty, setData, setData, setDoubleProperty, setFloatProperty, setHandle, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify

Constructor Details

Notebook

public Notebook()
Construct a new Notebook object with no pages.


Notebook

public Notebook(Handle handle)
Construct a new Notebook from a handle to a native resource.

Method Details

addListener

public void addListener(NotebookListener listener)
Register an object to receive event notification.

Parameters:
listener - The object that has implemented the NotebookListener interface that is to receive the notebook events.


appendPage

public void appendPage(Widget child,
                       Widget tabLabel)
Append a page to the Notebook.

Parameters:
child - The child widget to add to the newly created page.
tabLabel - The Widget to be used as the label for the page or null


appendPage

public void appendPage(Widget child,
                       Widget tabLabel,
                       Widget menuLabel)
Append a page to the Notebook.

Parameters:
child - The child widget to add to the newly created page.
tabLabel - The Widget to be used as the label for the page or null
menuLabel - The widget to use as a label for the page-switching menu, if that is enabled. If null and tabLabel is a Label or null then the menu label will be a newly created label with the same text as the tabLabel.


fireNotebookEvent

protected void fireNotebookEvent(NotebookEvent event)


getCurrentPage

public int getCurrentPage()
Returns the page number of the current page.


getEventListenerClass

public Class getEventListenerClass(String signal)
Overrides:
getEventListenerClass in interface Container


getEventType

public EventType getEventType(String signal)
Overrides:
getEventType in interface Container


getNumPages

public int getNumPages()
Return the number of pages currently on the notebook.


getPage

public Widget getPage(int pageNum)
Returns the child Widget contained int he page number pageNum.


getType

public static Type getType()
Retrieve the runtime type used by the GLib library.
Overrides:
getType in interface Container


gtk_notebook_append_page

protected static final void gtk_notebook_append_page(Handle notebook,
                                                     Handle child,
                                                     Handle tabLabel)


gtk_notebook_append_page_menu

protected static final void gtk_notebook_append_page_menu(Handle notebook,
                                                          Handle child,
                                                          Handle tabLabel,
                                                          Handle menuLabel)


gtk_notebook_get_current_page

protected static final int gtk_notebook_get_current_page(Handle notebook)


gtk_notebook_get_menu_label

protected static final Handle gtk_notebook_get_menu_label(Handle notebook,
                                                          Handle child)


gtk_notebook_get_menu_label_text

protected static final String gtk_notebook_get_menu_label_text(Handle notebook,
                                                               Handle child)


gtk_notebook_get_n_pages

protected static final int gtk_notebook_get_n_pages(Handle notebook)


gtk_notebook_get_nth_page

protected static final Handle gtk_notebook_get_nth_page(Handle notebook,
                                                        int pageNum)


gtk_notebook_get_scrollable

protected static final boolean gtk_notebook_get_scrollable(Handle notebook)


gtk_notebook_get_show_border

protected static final boolean gtk_notebook_get_show_border(Handle notebook)


gtk_notebook_get_show_tabs

protected static final boolean gtk_notebook_get_show_tabs(Handle notebook)


gtk_notebook_get_tab_label

protected static final Handle gtk_notebook_get_tab_label(Handle notebook,
                                                         Handle child)


gtk_notebook_get_tab_label_text

protected static final String gtk_notebook_get_tab_label_text(Handle notebook,
                                                              Handle child)


gtk_notebook_get_tab_pos

protected static final int gtk_notebook_get_tab_pos(Handle notebook)


gtk_notebook_get_type

protected static final int gtk_notebook_get_type()


gtk_notebook_insert_page

protected static final void gtk_notebook_insert_page(Handle notebook,
                                                     Handle child,
                                                     Handle tabLabel,
                                                     int position)


gtk_notebook_insert_page_menu

protected static final void gtk_notebook_insert_page_menu(Handle notebook,
                                                          Handle child,
                                                          Handle tabLabel,
                                                          Handle menuLabel,
                                                          int position)


gtk_notebook_new

protected static final Handle gtk_notebook_new()


gtk_notebook_next_page

protected static final void gtk_notebook_next_page(Handle notebook)


gtk_notebook_page_num

protected static final int gtk_notebook_page_num(Handle notebook,
                                                 Handle child)


gtk_notebook_popup_disable

protected static final void gtk_notebook_popup_disable(Handle notebook)


gtk_notebook_popup_enable

protected static final void gtk_notebook_popup_enable(Handle notebook)


gtk_notebook_prepend_page

protected static final void gtk_notebook_prepend_page(Handle notebook,
                                                      Handle child,
                                                      Handle tabLabel)


gtk_notebook_prepend_page_menu

protected static final void gtk_notebook_prepend_page_menu(Handle notebook,
                                                           Handle child,
                                                           Handle tabLabel,
                                                           Handle menuLabel)


gtk_notebook_prev_page

protected static final void gtk_notebook_prev_page(Handle notebook)


gtk_notebook_query_tab_label_packing

protected static final void gtk_notebook_query_tab_label_packing(Handle notebook,
                                                                 Handle child,
                                                                 boolean[] expand,
                                                                 boolean[] fill,
                                                                 int[] packType)


gtk_notebook_remove_page

protected static final void gtk_notebook_remove_page(Handle notebook,
                                                     int pageNum)


gtk_notebook_reorder_child

protected static final void gtk_notebook_reorder_child(Handle notebook,
                                                       Handle child,
                                                       int position)


gtk_notebook_set_current_page

protected static final void gtk_notebook_set_current_page(Handle notebook,
                                                          int pageNum)


gtk_notebook_set_menu_label

protected static final void gtk_notebook_set_menu_label(Handle notebook,
                                                        Handle child,
                                                        Handle menuLabel)


gtk_notebook_set_menu_label_text

protected static final void gtk_notebook_set_menu_label_text(Handle notebook,
                                                             Handle child,
                                                             String menuText)


gtk_notebook_set_scrollable

protected static final void gtk_notebook_set_scrollable(Handle notebook,
                                                        boolean scrollable)


gtk_notebook_set_show_border

protected static final void gtk_notebook_set_show_border(Handle notebook,
                                                         boolean showBorder)


gtk_notebook_set_show_tabs

protected static final void gtk_notebook_set_show_tabs(Handle notebook,
                                                       boolean showTabs)


gtk_notebook_set_tab_label

protected static final void gtk_notebook_set_tab_label(Handle notebook,
                                                       Handle child,
                                                       Handle tabLabel)


gtk_notebook_set_tab_label_packing

protected static final void gtk_notebook_set_tab_label_packing(Handle notebook,
                                                               Handle child,
                                                               boolean expand,
                                                               boolean fill,
                                                               int packType)


gtk_notebook_set_tab_label_text

protected static final void gtk_notebook_set_tab_label_text(Handle notebook,
                                                            Handle child,
                                                            String tabText)


gtk_notebook_set_tab_pos

protected static final void gtk_notebook_set_tab_pos(Handle notebook,
                                                     int pos)


insertPage

public void insertPage(Widget child,
                       Widget tabLabel,
                       int position)
Insert a page into the Notebook at the given position.

Parameters:
child - The child widget to add to the newly created page.
tabLabel - The Widget to be used as the label for the page or null
position - The index (starting at 0) at which to insert the page.


insertPage

public void insertPage(Widget child,
                       Widget tabLabel,
                       Widget menuLabel,
                       int position)
Insert a page into the Notebook at the given position.

Parameters:
child - The child widget to add to the newly created page.
tabLabel - The Widget to be used as the label for the page or null
menuLabel - The widget to use as a label for the page-switching menu, if that is enabled. If null and tabLabel is a Label or null then the menu label will be a newly created label with the same text as the tabLabel.
position - The index (starting at 0) at which to insert the page.


nextPage

public void nextPage()
Switches to the next page. Nothing happens if the current page is the last page.


pageNum

public int pageNum(Widget child)
Finds the index of the page which contains the given child.

Parameters:
child - The widget to locate.

Returns:
The index of the page which contaons the given child.


popupDisable

public void popupDisable()
disables the popup menu.


popupEnable

public void popupEnable()
Enables the popup menu.


prependPage

public void prependPage(Widget child,
                        Widget tabLabel)
Prepend a page to the Notebook.

Parameters:
child - The child widget to add to the newly created page.
tabLabel - The Widget to be used as the label for the page or null


prependPage

public void prependPage(Widget child,
                        Widget tabLabel,
                        Widget menuLabel)
Prepend a page to the Notebook.

Parameters:
child - The child widget to add to the newly created page.
tabLabel - The Widget to be used as the label for the page or null
menuLabel - The widget to use as a label for the page-switching menu, if that is enabled. If null and tabLabel is a Label or null then the menu label will be a newly created label with the same text as the tabLabel.


prevPage

public void prevPage()
Switches to the previous page. Nothing happens if the current page is the first page.


removeListener

public void removeListener(NotebookListener listener)
Unregister an object that was receiving notebook event notification.

Parameters:
listener - The object that is to no longer receive notebook events.


removePage

public void removePage(int pageNumber)
Removes a page fro the Notegook given its index in the notebook.

Parameters:
pageNumber - The offset (starting with 0) for the page to remove.


reorderChild

public void reorderChild(Widget child,
                         int position)
Reorders the page containing child, so that it appears in position position. If position is greater than or equal to the number of children in the list or negative, child will be moved to the end of the list.

Parameters:
child - The widget to move.
position - The index (starting with 0) to move the child.


setCurrentPage

public void setCurrentPage(int pageNum)
sets the page at offset pageNum to the current page.


setMenuLabel

public void setMenuLabel(Widget child,
                         String menuText)
Creates a new label and sets it as the menu label of child.


setMenuLabel

public void setMenuLabel(Widget child,
                         Widget menuLabel)
Changes the menu label for the page containing child.


setScrollable

public void setScrollable(boolean scrollable)
Sets whether the tab label area will have arrows for scrolling if there are too many tabs to fit in the area.


setShowBorder

public void setShowBorder(boolean showBorder)
Sets whether a bevel will be drawn around the notebook pages.


setShowTabs

public void setShowTabs(boolean showTabs)
sets whether to show the tabs for the notebook or not.


setTabLabel

public void setTabLabel(Widget child,
                        String tabText)
Creates a new label and sets it as the labelf or the page containing child.


setTabLabel

public void setTabLabel(Widget child,
                        Widget tabLabel)
Changes the tab label for child.


setTabLabelPacking

public void setTabLabelPacking(Widget child,
                               boolean expand,
                               boolean fill,
                               PackType packType)
Sets the packing parameters for the tab label of the page containing child.

See Also:
Box


setTabPosition

public void setTabPosition(PositionType pos)
Sets the edge at which the tabs for switching pages in the Notebook are drawn.