Set up the preview widget.
- None
Author: MARCO
date: 03.12.2007
History
03.12.2007 version 1.01
22.10.2008 version 1.02
27.10.2008 version 1.03
02.12.2009 version 1.04 refactoring (eval)
Class data members
VERSION class maintenance version
debug local debug mode
wPreview ref to preview widget
opt_useToplevel
initialGeometryPreview size of preview
view_pointerxy flag, view mouse position
widgets list of widgets in the preview
xy mouse position
suppressCallbacks flag, if On then widget's callbacks are not activated
in the preview.
Summary
clearWidgets
unbind_xy_move
bind_xy_move
_init
init
switch2Frame
clear
_reorgArg
repaint
Clear the list of widgets
(class data member %widgets).
Bind the <Motion> callback to show
the mouse position.
It is the opposite of unbind_xy_move.
This method sends the destroy message to the preview
widget, sets the data member wPreview to undef and then sends the message clear
to itself.
This methods sends two messages to itself :
_init
repaint
This methods first resets the flag opt_useToplevel to false
and then sends the message init to itsself.
This method clean up the preview
DO get the list of widgets
For all widgets DO detach all balloons
For all children of the preview widget DO destroy
If preview is Modal
then construct a new preview of type ctkPreviewDialogBox
and show it
else send message clear to it
=cut
| sub clear {
|
| my $self =shift;
|
| &main::trace("clear");
|
| my $w_attr = &main::getW_attr;
|
| my $widgets = &main::getWidgets; |
if (Tk::Exists($wPreview)) {
map {
$main::b->detach($_) if(defined($_) && $_->can('class') && $w_attr->{$_->class}->{balloon})
} values %$widgets;
map {$_->destroy} $wPreview->children;
$self->unbind_xy_move($wPreview);
}
map {delete $widgets->{$_}} keys %$widgets;
$xy = '';
if (&main::getFile_opt()->{'modal'}) {
if ($opt_useToplevel) {
$wPreview->destroy() if(defined($wPreview));
$wPreview = &main::getmw()->ctkPreviewDialogBox();
$wPreview->protocol ('WM_DELETE_WINDOW',sub{1});
$wPreview->geometry($initialGeometryPreview);
$wPreview->Show();
} else {
$opt_useToplevel = 1;
$wPreview = undef;
$self->clear();
return 1
}
} else {
unless(defined($wPreview)) {
if ($opt_useToplevel) {
$wPreview = &main::getmw()->Toplevel(-title => &std::_title('preview'));
$wPreview->protocol ('WM_DELETE_WINDOW',sub{ctkPreview->switch2Frame});
$wPreview->geometry($initialGeometryPreview);
} else {
$wPreview=$main::main_frame->Frame(-relief=>'flat',-borderwidth=>0)
->pack(-side => 'top',-anchor => 'ne',-fill=>'both',-expand=>1);
}
}
}
$self->bind_xy_move($wPreview);
return 1
}
This method reorgs the given arglist.
It moves the -scrollbars option in front of the list.
Argument
list of options to be reordered
Return value
reordered arglist or l'lits depending on context
Paint the preview
DO call clear preview
DO set up eval subroutine
DO set my %tmp_vars = ($MW => $wPreview)
DO scan @ctkProject::tree and adapt some arguments
DO FOR all widgets on @ctkProject::tree
DO get id
DO skip widget if corresponding descriptor doesn't exist
DO skip non-visual widget
DO set up standard constructor
DO set up widget (eval stdConstructor)
DO set up geometry options
DO set up balloon
DO set up bindings (click, double-click, right click)
DO execute geometry manager
DO set $widgets{path} := tmp_vars{$id}
END
DO set $widgets{$MW} := $wPreview
Arguments
None
Return
True if no errors has been detected,
false otherwise.
Notes
None.