Curses::UI::Notebook(3pm) - phpMan

Command: man perldoc info search(apropos)  


Curses::UI::Notebook(3)        User Contributed Perl Documentation        Curses::UI::Notebook(3)



NAME
       Curses::UI::Notebook - Create and manipulate notebook widgets.

CLASS HIERARCHY
        Curses::UI::Widget
           |
           +----Curses::UI::Container
                   |
                   +----Curses::UI::Notebook

SYNOPSIS
           use Curses::UI;
           my $cui = new Curses::UI;
           my $win = $cui->add(undef, 'Window');

           my $notebook = $win->add(undef, 'Notebook');
           my $page1 = $notebook->add_page('page 1');
           $page1->add(
               undef, 'Label',
               -x    => 15,
               -y    => 6,
               -text => "Page #1.",
           );
           my $page2 = $notebook->add_page('page 2');
           $page2->add(
               undef, 'Label',
               -x    => 15,
               -y    => 6,
               -text => "Page #2.",
           );
           my $page3 = $notebook->add_page('page 3', -on_activate => \&sub );
           $page3->add(
               undef, 'Label',
               -x    => 15,
               -y    => 6,
               -text => "Page #3.",
           );
           $notebook->focus;
           $cui->mainloop;

DESCRIPTION
       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.]

STANDARD OPTIONS
       -x, -y, -width, -height, -pad, -padleft, -padright, -padtop, -padbottom, -ipad, -ipadleft,
       -ipadright, -ipadtop, -ipadbottom, -border, -sbborder, -bg, -fg, -intellidraw, -onchange,
       -onblur.

       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
       o   -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.

           By default, the following mappings are used:

               KEY                 ROUTINE
               ------------------  ----------
               KEY_HOME, Ctrl-A    first_page
               KEY_END, Ctrl-E     last_page
               KEY_NPAGE, Ctrl-N   next_page
               KEY_PPAGE, Ctrl-P   prev_page

       o   -routines < HASHREF >

           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

       o   -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
       o   new ( OPTIONS )

           Constructs a new notebook object using options in the hash OPTIONS.

       o   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.

       o   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.

       o   intellidraw ( )

       o   focus ( )

       o   onFocus ( CODEREF )

       o   onBlur ( CODEREF )

           See Curses::UI::Widget for explanations of these methods.

       o   add_page ( PAGE [ , -on_activate => sub_ref ] [, -on_delete => ] )

           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.

           The "-on_activate" parameter specifies an optional call-back that will be invoked when
           the page is activated. This call-back will be called with the notebook widget and page
           name as parameter.

           Likewise for "-on_delete" call-back. This one is invoked when the page is deleted.

       o   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.

       o   active_page ( )

           Returns the currently active page in the notebook object.

       o   first_page ( )

           Returns the first page in the notebook object.

       o   last_page ( )

           Returns the last page in the notebook object.

       o   prev_page ( )

           Returns the previous page in the notebook object.

       o   next_page ( )

           Returns the next page in the notebook object.

       o   activate_page ( PAGE )

           Makes the specified page in the notebook object active and returns it, redrawing the
           notebook object in the process.

       o   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.

SEE ALSO
       Curses::UI, Curses::UI::Container, Curses::UI::Widget

AUTHOR
       George A. Theall, <theall AT tifaware.com>

COPYRIGHT AND LICENSE
       Copyright (c) 2004, George A. Theall. All rights reserved.

       This script is free software; you can redistribute it and/or modify it under the same
       terms as Perl itself.



perl v5.16.3                                2011-09-01                    Curses::UI::Notebook(3)

Generated by $Id: phpMan.php,v 4.55 2007/09/05 04:42:51 chedong Exp $ Author: Che Dong
On Apache
Under GNU General Public License
2024-04-19 16:43 @3.12.161.77 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0!Valid CSS!