| 1 |
|
| 2 |
=head1 NAME |
| 3 |
|
| 4 |
Tk::NoteBook - display several windows in limited space with notebook metaphor. |
| 5 |
|
| 6 |
=for pm Tixish/NoteBook.pm |
| 7 |
|
| 8 |
=for category Tix Extensions |
| 9 |
|
| 10 |
=head1 SYNOPSIS |
| 11 |
|
| 12 |
use Tk::NoteBook; |
| 13 |
... |
| 14 |
$w = $frame->NoteBook(); |
| 15 |
$page1 = $w->add("page1", options); |
| 16 |
$page2 = $w->add("page2", options); |
| 17 |
... |
| 18 |
$page2 = $w->add("page2", options); |
| 19 |
|
| 20 |
=head1 DESCRIPTION |
| 21 |
|
| 22 |
The NoteBook widget provides a notebook metaphor to display several |
| 23 |
windows in limited space. The notebook is divided into a stack of pages |
| 24 |
of which only one is displayed at any time. The other pages can be |
| 25 |
selected by means of choosing the visual "tabs" at the top of the |
| 26 |
widget. Additionally, the <Tab> key may be used to traverse the pages. |
| 27 |
If B<-underline> is used, Alt- bindings will also work. |
| 28 |
|
| 29 |
The widget takes all the options that a Frame does. In addition, |
| 30 |
it supports the following options: |
| 31 |
|
| 32 |
=over 4 |
| 33 |
|
| 34 |
=item B<-dynamicgeometry> |
| 35 |
|
| 36 |
If set to false (default and recommended), the size of the NoteBook |
| 37 |
will match the size of the largest page. Otherwise the size will |
| 38 |
match the size of the current page causing the NoteBook to change |
| 39 |
size when different pages of different sizes are selected. |
| 40 |
|
| 41 |
=item B<-ipadx> |
| 42 |
|
| 43 |
The amount of internal horizontal padding around the pages. |
| 44 |
|
| 45 |
=item B<-ipady> |
| 46 |
|
| 47 |
The amount of internal vertical padding around the pages. |
| 48 |
|
| 49 |
=item B<-backpagecolor> |
| 50 |
|
| 51 |
The background color of the tabs and back page. |
| 52 |
|
| 53 |
=item B<-disabledforeground> |
| 54 |
|
| 55 |
XXX |
| 56 |
|
| 57 |
=item B<-focuscolor> |
| 58 |
|
| 59 |
The color of the focus border around the tabs. |
| 60 |
|
| 61 |
=item B<-font> |
| 62 |
|
| 63 |
The font of the tab labels. |
| 64 |
|
| 65 |
=item B<-inactivebackground> |
| 66 |
|
| 67 |
XXX |
| 68 |
|
| 69 |
=item B<-tabpadx> |
| 70 |
|
| 71 |
Horizonzal padding around the tab label. |
| 72 |
|
| 73 |
=item B<-tabpady> |
| 74 |
|
| 75 |
Vertical padding around the tab label. |
| 76 |
|
| 77 |
=back |
| 78 |
|
| 79 |
=head1 METHODS |
| 80 |
|
| 81 |
The following methods may be used with a NoteBook object in addition |
| 82 |
to standard methods. |
| 83 |
|
| 84 |
=over 4 |
| 85 |
|
| 86 |
=item B<add(>I<pageName>, I<options>B<)> |
| 87 |
|
| 88 |
Adds a page with name I<pageName> to the notebook. Returns an object |
| 89 |
of type B<Frame>. The recognized I<options> are: |
| 90 |
|
| 91 |
=over 4 |
| 92 |
|
| 93 |
=item B<-anchor> |
| 94 |
|
| 95 |
Specifies how the information in a tab is to be displayed. Must be |
| 96 |
one of B<n>, B<ne>, B<e>, B<se>, B<s>, B<sw>, B<w>, B<nw> or |
| 97 |
B<center>. |
| 98 |
|
| 99 |
=item B<-bitmap> |
| 100 |
|
| 101 |
Specifies a bitmap to display on the tab of this page. The bitmap |
| 102 |
is displayed only if none of the B<-label> or B<-image> options |
| 103 |
are specified. |
| 104 |
|
| 105 |
=item B<-image> |
| 106 |
|
| 107 |
Specifies an image to display on the tab of this page. The image |
| 108 |
is displayed only if the B<-label> option is not specified. |
| 109 |
|
| 110 |
=item B<-label> |
| 111 |
|
| 112 |
Specifies the text string to display on the tab of this page. |
| 113 |
|
| 114 |
=item B<-justify> |
| 115 |
|
| 116 |
When there are multiple lines of text displayed in a tab, this |
| 117 |
option determines the justification of the lines. |
| 118 |
|
| 119 |
=item B<-createcmd> |
| 120 |
|
| 121 |
Specifies a L<callback|Tk::callbacks> to be called the first time the page is |
| 122 |
shown on the screen. This option can be used to delay the creation |
| 123 |
of the contents of a page until necessary. It can be useful in |
| 124 |
situations where there are a large number of pages in a NoteBook |
| 125 |
widget; with B<-createcmd> you do not have to make the user wait |
| 126 |
until all pages are constructed before displaying the first page. |
| 127 |
|
| 128 |
=item B<-raisecmd> |
| 129 |
|
| 130 |
Specifies a L<callback|Tk::callbacks> to be called whenever this page is raised |
| 131 |
by the user. |
| 132 |
|
| 133 |
=item B<-state> |
| 134 |
|
| 135 |
Specifies whether this page can be raised by the user. Must be |
| 136 |
either B<normal> or B<disabled>. |
| 137 |
|
| 138 |
=item B<-underline> |
| 139 |
|
| 140 |
Specifies the integer index of a character to underline in the |
| 141 |
tab. This option is used by the default bindings to implement |
| 142 |
keyboard traversal for menu buttons and menu entries. 0 |
| 143 |
corresponds to the first character of text displayed on the |
| 144 |
widget, 1 to the next character and so on. |
| 145 |
|
| 146 |
=item B<-wraplength> |
| 147 |
|
| 148 |
This option specifies the maximum line length of the label string |
| 149 |
on this tab. If the line length of the label string exceeds this |
| 150 |
length, then it is wrapped onto the next line so that no line is |
| 151 |
longer than the specified length. The value may be specified in |
| 152 |
any standard forms for screen distances. If this value is less |
| 153 |
than or equal to 0, then no wrapping is done: lines will break |
| 154 |
only at newline characters in the text. |
| 155 |
|
| 156 |
=back |
| 157 |
|
| 158 |
=item B<delete(>I<pageName>B<)> |
| 159 |
|
| 160 |
Deletes the page identified by I<pageName>. |
| 161 |
|
| 162 |
=item B<pagecget(>I<pageName>, I<-option>B<)> |
| 163 |
|
| 164 |
Returns the current value of the configuration option given by |
| 165 |
I<-option> in the page given by I<pageName>. I<Option> may have any of |
| 166 |
the values accepted in the B<add> method. |
| 167 |
|
| 168 |
=item B<pageconfigure(>I<pageName>, I<options>B<)> |
| 169 |
|
| 170 |
Like configure for the page indicated by I<pageName>. I<Options> may |
| 171 |
be any of the options accepted by the B<add> method. |
| 172 |
|
| 173 |
=item B<pages> |
| 174 |
|
| 175 |
Returns a list consisting of the names of all currently defined |
| 176 |
pages, i.e., those created with the B<add> method. |
| 177 |
|
| 178 |
=item B<page_widget(>I<pageName>B<)> |
| 179 |
|
| 180 |
Returns the page with name I<pageName>. |
| 181 |
|
| 182 |
=item B<raise(>I<pageName>B<)> |
| 183 |
|
| 184 |
Raise the page identified by I<pageName>. |
| 185 |
|
| 186 |
=item B<raised()> |
| 187 |
|
| 188 |
Returns the name of the currently raised page. |
| 189 |
|
| 190 |
=item B<geometryinfo> |
| 191 |
|
| 192 |
Return the dimensions of the tab area. |
| 193 |
|
| 194 |
=item B<identify(>I<x>,I<y>B<)> |
| 195 |
|
| 196 |
Identify the tab's page name under the specified coordinates. Return |
| 197 |
an empty string if there's no tab. |
| 198 |
|
| 199 |
=item B<info(E<quot>pagesE<quot>)> |
| 200 |
|
| 201 |
Return a list of all pages. |
| 202 |
|
| 203 |
=item B<info(E<quot>focusE<quot>)> |
| 204 |
|
| 205 |
Return the page name of the tab with the current focus. |
| 206 |
|
| 207 |
=item B<info(E<quot>focusnextE<quot>)> |
| 208 |
|
| 209 |
Return the page name of the tab which would receive the next focus. |
| 210 |
|
| 211 |
=item B<info(E<quot>focusprevE<quot>)> |
| 212 |
|
| 213 |
Return the page name of the tab which had the previous focus. |
| 214 |
|
| 215 |
=item B<info(E<quot>activeE<quot>)> |
| 216 |
|
| 217 |
Return the page name of the active tab. |
| 218 |
|
| 219 |
=back |
| 220 |
|
| 221 |
=head1 BUGS |
| 222 |
|
| 223 |
The options C<-width> and C<-height> do not work. |
| 224 |
|
| 225 |
=head1 AUTHORS |
| 226 |
|
| 227 |
B<Rajappa Iyer> <[email protected]> |
| 228 |
Nick Ing-Simmons <[email protected]> |
| 229 |
|
| 230 |
This code and documentation was derived from NoteBook.tcl in |
| 231 |
Tix4.0 written by Ioi Lam. It may be distributed under the same |
| 232 |
conditions as Perl itself. |
| 233 |
|
| 234 |
=cut |
| 235 |
|