This package implements a notebook widget similar to that found in
Motif. A notebook holds several windows, or pages, only one of
which is visible at any given time; tabs at the top of the widget list
the pages that are available. In this way, a great deal of information
can be fit into a relatively small screen area. [Windows users might
recognize this as a tabbed dialog.]
See Curses::UI::Widget for a discussion of each of
these options.
Note that -border is enabled and both -ipadleft and -ipadright
are set to 1 by default when creating notebook objects.
WIDGET-SPECIFIC OPTIONS
* -bindings < HASHREF >
The keys in this hash reference are keystrokes and the values are
routines to which they should be bound. In the event a key is empty,
the corresponding routine will become the default routine that
process_bindings applies to unmatched keystrokes it receives.
The keys in this hash reference are routines and the values are either
scalar values or code references. process_bindings maps keystrokes
to routines and then to either a scalar value, which it returns, or a
code reference, which it executes.
By default, the following mappings are used:
ROUTINE ACTION
---------- -------------------------
first_page make first page active
last_page make last page active
next_page make next page active
prev_page make previous page active
* -wraparound < BOOLEAN >
If BOOLEAN has a true value, wraparound is enabled. This means that
advancing to the next page will cycle from the last back to the first
page and similarly, advancing to the previous page will cycle from the
first back to the last page.
By default, it is true.
METHODS
* new ( OPTIONS )
Constructs a new notebook object using options in the hash OPTIONS.
* layout ( )
Lays out the notebook object, makes sure it fits on the available
screen, and creates the curses windows for the border / tab labels as
well as the effective drawing area.
* draw ( BOOLEAN )
Draws the notebook object along with the active page's window. If BOOLEAN
is true, the screen is not updated after drawing.
By default, BOOLEAN is true so the screen is updated.
* intellidraw ( )
* focus ( )
* onFocus ( CODEREF )
* onBlur ( CODEREF )
See Curses::UI::Widget for explanations of these
methods.
* add_page ( PAGE )
Adds the specified page to the notebook object and creates an associated
window object. Returns the window object or undef on failure.
Note: the add fails if the page would otherwise cause the tab window to
overflow or is already part of the notebook object.
* delete_page ( PAGE )
Deletes the specified page from the notebook object and destroys its
associated window object. If the page was active, the first page is
made active.
* active_page ( )
Returns the currently active page in the notebook object.
* first_page ( )
Returns the first page in the notebook object.
* last_page ( )
Returns the last page in the notebook object.
* prev_page ( )
Returns the previous page in the notebook object.
* next_page ( )
Returns the next page in the notebook object.
* activate_page ( PAGE )
Makes the specified page in the notebook object active and returns it,
redrawing the notebook object in the process.
* mouse_button1 ( )
Processes mouse button #1 clicks. If the user left-clicks on one of the
tabs, activate_page is called with the corresponding page to make it
active; otherwise, the click is passed along to the active window.