Tk::IDEpanedwindow - Subclass of L<Tk::Panedwindow> to Control Pane Resize Behavior |
Tk::IDEpanedwindow - Subclass of the Tk::Panedwindow manpage to Control Pane Resize Behavior
use Tk::IDEpanedwindow;
# Create panedwindow (Just like Tk::Panedwindow) $panedwidnow = $widget->IDEpanedwindow( ? options ? );
# Pack the widget $panedwidnow->pack(qw/-side top -expand yes -fill both /);
# Create two frames to insert my $label1 = $panedwidnow->Label(-text => "This is the\nleft side", -background => 'yellow'); my $Frame2 = $panedwidnow->Frame(); # Insert the frames, with expand factors = 1 (both frames will grow/shrink with the size # of the window) $pwH->add($label1, -expandfactor => 1, $Frame2, -expandfactor => 1);
This is a subclass of the the Tk::Panedwindow manpage widget that adds a expandfactors option that controls how the paned-windows are resized when the overall widget is resized.
The parent class the Tk::Panedwindow manpage only changes the last pane when the entire widget is resized. Using the -expandfactors option of this widget, you can control how each paned-window is resized when the overall widget is resized.
Note: The idea for the I<-expandfactors> option is borrowed from the TCL/TK widget I<TixPanedWindow>.
In addition to the options from the parent class the Tk::Panedwindow manpage, this widget provides the following options:
Each Expand Factor must be a non-negative number. The default value is 0. The expand/shrink factor is used to calculate how much each pane should grow or shrink when the size of the PanedWindow main window is changed. When the main window expands/shrinks by n pixels, then pane i will grow/shrink by about n * factor(i) / summation(factors), where factor(i) is the expand/shrink factor of pane i and summation(factors) is the summation of the expand/shrink factors of all the panes. If summation(factors) is 0.0, however, only the last visible pane will be grown or shrunk.
Note: The behavior of this -expandfactors option is borrowed from the TCL/TK widget TixPanedWindow.
Even though frame sizes are number of pixels (integers), we keep track of the fractional part of the calculated frame sizes from resize-event to resize-event. This keeps the sizes of the frames in proportion to each other better than throwing away the fractional part would.
Over-ridden add method add a new widget to the collection managed by the the Tk::IDEpanedwindow manpage.
This method adds a -expandfactor option to the normal options recognized by the parent L<Tk::Panedwindow>.
Usage:
$widget->add(?window ...? ?option value ...?);
Over-ridden forget method to delete a widget from the paned-window.
This deletes the widget from our own I<slaves> list before calling the parent method.
Usage:
$widget->forget($window);
Gets (and optionally sets) the slaves attribute.
B<Usage:>
my @slaves = $self->slaves(); # Get slaves $self->slaves(@slaves); # Set slaves
Internal method to get / calculate the new widget Sizes (Width or height) of a panewindow widget, based on total pw size, widget sizes, and expand factors. This is called when the size of the panedwindow widget changes.
Usage:
@newSizes = $self->_getNewSizes($newSize, $sizes); where: $newSize: Total new size of the panewindow widget (Along the paned direction) $sizes: Array ref of old sizes (i.e. not yet adjusted for the new total-size) for each window managed by the panedwindow.
Method to adjust the sizes of each pane in the paned-window direction.
Usage:
$self->adjustSizes($newSizes); where: $newSizes: Array ref of new sizes for each window managed by the panedwindow.
Tk::IDEpanedwindow - Subclass of L<Tk::Panedwindow> to Control Pane Resize Behavior |