Prima::Notebooks - multipage widgets |
Prima::Notebooks - multipage widgets
The module contains several widgets useful for organizing multipage ( notebook )
containers. Prima::Notebook
provides basic functionality of a widget container.
Prima::TabSet
is a page selector control, and Prima::TabbedNotebook
combines
these two into a ready-to-use multipage control with interactive navigation.
my $nb = Prima::TabbedNotebook-> create( tabs => [ 'First page', 'Second page', 'Second page' ], ); $nb-> insert_to_page( 1, 'Prima::Button' ); $nb-> insert_to_page( 2, [ [ 'Prima::Button', bottom => 10 ], [ 'Prima::Button', bottom => 150 ], ]); $nb-> Notebook-> backColor( cl::Green );
Provides basic widget container functionality. Acts as merely
a grouping widget, hiding and showing the children widgets when
pageIndex
property is changed.
insert
call are assigned to. If set to undef
, the default
page is the current page.
Default value: undef
.
pageCount - 1
.
owner
property set to the
caller widget, and returns the list of references to the newly
created widgets.
See insert in the Prima::Widget manpage for details.
pageCount
; setting INDEX equal
to pageCount
is equivalent to appending a page
to the end of the page list.
insert
method.
See insert in the Prima::Widget manpage for details.
The semantics of setting CLASS and PROFILE, as well as
the return values are fully equivalent to insert
method.
See insert in the Prima::Widget manpage for details.
set
on WIDGET with PROFILE and
updates the internal visible, enabled, and current flags
if these are present in PROFILE.
pageIndex
value is changed from
OLD_PAGE_INDEX to NEW_PAGE_INDEX. Current implementation
invokes this notification while the notebook widget
is in locked state, so no redraw requests are honored during
the notification execution.
Since the notebook operates directly on children widgets'
::visible
and ::enable
properties, there is a problem when
a widget associated with a non-active page must be explicitly hidden
or disabled. As a result, such a widget would become visible and enabled anyway.
This happens because Prima API does not cache property requests. For example,
after execution of the following code
$notebook-> pageIndex(1); my $widget = $notebook-> insert_to_page( 0, ... ); $widget-> visible(0); $notebook-> pageIndex(0);
$widget
will still be visible. As a workaround, widget_set
method
can be suggested, to be called together with the explicit state calls.
Changing
$widget-> visible(0);
code to
$notebook-> widget_set( $widget, visible => 0);
solves the problem, but introduces an inconsistency in API.
Prima::TabSet
class implements functionality of an interactive
page switcher. A widget is presented as a set of horizontal
bookmark-styled tabs with text identifiers.
backColor
.
Default value: 1
tabIndex
, except when the widget is navigated
by arrow keys, and tab selection does not occur until the user
presses the return key.
Default value: 1
Change
notification
is triggered.
tabIndex
property is changed.
POLYGON1
[2,3] [4,5] o..........o . . [0,1]. TAB_TEXT . [6,7] o................o
POLYGON2
[0,1] [2,3] o................o [6,7]o..............o[4,5]
Depending on topMost
property value, POLYGON1 and POLYGON2 change
their mutual vertical orientation.
The notification is always called from within begin_paint/end_paint
block.
begin_paint_info/end_paint_info
block.
The class combines functionality of Prima::TabSet
and Prima::Notebook
,
providing the interactive multipage widget functionality. The page indexing
scheme is two-leveled: the first level is equivalent to the Prima::TabSet
-
provided tab scheme. Each first-level tab, in turn, contains one or more second-level
pages, which can be switched using native Prima::TabbedNotebook
controls.
First-level tab is often referred as tab, and second-level as page.
insert
call are assigned to. If set to undef
, the default
page is the current page.
Default value: undef
.
tabIndex
can change its value,
and Change
notification is triggered.
$nb-> tabs('1st', ('2nd') x 3);
results in creation of a notebook of four pages and two first-level
tabs. The tab '2nd'
contains three second-level pages.
The property implicitly operates the underlying notebook's pageCount
property.
When changed at run-time, its effect on the children widgets is therefore the same.
See pageCount for more information.
The class forwards the following methods of Prima::Notebook
, which are described
in the Prima::Notebook manpage: attach_to_page
, insert_to_page
, insert
, insert_transparent
,
delete_widget
, detach_from_page
, move_widget
, contains_widget
,
widget_get
, widget_set
, widgets_from_page
.
pageIndex
property is changes it s value from
OLD_PAGE_INDEX to NEW_PAGE_INDEX.
Dmitry Karasik, <dmitry@karasik.eu.org>.
Prima, the Prima::Widget manpage, examples/notebook.pl.
Prima::Notebooks - multipage widgets |