Curses:...otebook(3)
π NAME π
Okay bestie, this is the manual page for Curses::UI::Notebook from User Contributed Perl Documentation, and it does exactly what it says on the tin: Create and manipulate notebook widgets. β¨
π¦ CLASS HIERARCHY π¦
The family tree is giving very structured, very iconic:
Curses::UI::Widget
|
+----Curses::UI::Container
|
+----Curses::UI::Notebook
πΈ SYNOPSIS πΈ
Hereβs the whole vibe in code, bestie β copy it exactly:
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 the one found in Motif. A notebook holds several windows, or pages, and only one of them is visible at any given time. Tabs at the top of the widget list the pages that are available. The way this fits a great deal of information into a relatively small screen area is lowkey genius. π
Windows users might recognize this as a tabbed dialog. Yes, bestie, itβs that familiar tabby energy. πͺβ¨
β¨ STANDARD OPTIONS β¨
These are the standard options in the squad, and Curses::UI::Widget has the full discussion of each one:
-xβ standard option; the details live inCurses::UI::Widget.-yβ standard option; the details live inCurses::UI::Widget.-widthβ standard option; the details live inCurses::UI::Widget.-heightβ standard option; the details live inCurses::UI::Widget.-padβ standard option; the details live inCurses::UI::Widget.-padleftβ standard option; the details live inCurses::UI::Widget.-padrightβ standard option; the details live inCurses::UI::Widget.-padtopβ standard option; the details live inCurses::UI::Widget.-padbottomβ standard option; the details live inCurses::UI::Widget.-ipadβ standard option; the details live inCurses::UI::Widget.-ipadleftβ standard option; the details live inCurses::UI::Widget.-ipadrightβ standard option; the details live inCurses::UI::Widget.-ipadtopβ standard option; the details live inCurses::UI::Widget.-ipadbottomβ standard option; the details live inCurses::UI::Widget.-borderβ standard option; the details live inCurses::UI::Widget.-sbborderβ standard option; the details live inCurses::UI::Widget.-bgβ standard option; the details live inCurses::UI::Widget.-fgβ standard option; the details live inCurses::UI::Widget.-intellidrawβ standard option; the details live inCurses::UI::Widget.-onchangeβ standard option; the details live inCurses::UI::Widget.-onblurβ standard option; the details live inCurses::UI::Widget.
π«Ά Notebook-specific default tea:-borderis enabled, and both-ipadleftand-ipadrightare set to1by default when creating notebook objects. No cap. π
π WIDGET-SPECIFIC OPTIONS π
-bindings < HASHREF >β the keys in this hash reference are keystrokes, and the values are routines they should be bound to. If a key is empty, the corresponding routine becomes the default routine thatprocess_bindingsapplies to unmatched keystrokes it receives.
By default, these 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
-routines < HASHREF >β the keys in this hash reference are routines, and the values are either scalar values or code references.process_bindingsmaps keystrokes to routines and then to either a scalar value, which it returns, or a code reference, which it executes.
By default, these 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 >β ifBOOLEANhas a true value, wraparound is enabled. This means advancing to the next page cycles from the last page back to the first page, and similarly, advancing to the previous page cycles from the first page back to the last page.
By default, it is true. π
π METHODS π
new ( OPTIONS )β constructs a new notebook object using options in the hashOPTIONS.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. IfBOOLEANis true, the screen is not updated after drawing.
By default, BOOLEAN is true so the screen is updated. Yes, that is what it says, bestie. π«
intellidraw ( )β seeCurses::UI::Widgetfor the explanation.focus ( )β seeCurses::UI::Widgetfor the explanation.onFocus ( CODEREF )β seeCurses::UI::Widgetfor the explanation.onBlur ( CODEREF )β seeCurses::UI::Widgetfor the explanation.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 orundefon 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 the -on_delete call-back. This one is invoked when the page is deleted.
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_pageis called with the corresponding page to make it active; otherwise, the click is passed along to the active window. π±οΈβ¨
π¦ SEE ALSO π¦
Curses::UICurses::UI::ContainerCurses::UI::Widget
π AUTHOR π
George A. Theall, <theall@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.
Okay bestie, this page came from source/version perl v5.42.2 and is dated 2023-07-03. Periodt. πππ¦
π¦ where this page comes from
- alpine 3.24: perl-curses-ui-doc 0.9609-r3 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms