diff options
Diffstat (limited to 'Perl/demos/Tk/demos/zinc_lib/demo.pl')
-rw-r--r-- | Perl/demos/Tk/demos/zinc_lib/demo.pl | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/Perl/demos/Tk/demos/zinc_lib/demo.pl b/Perl/demos/Tk/demos/zinc_lib/demo.pl new file mode 100644 index 0000000..40ea0da --- /dev/null +++ b/Perl/demos/Tk/demos/zinc_lib/demo.pl @@ -0,0 +1,144 @@ +#!/usr/bin/perl +# $Id$ +# This software is under CENA Copyright. +# However, the copyright has been retained under GPL licence +# This demo launcher has been initially developped by Daniel Etienne <etienne@cena.fr> +# and modified by Christophe Mertz <mertz@cena.fr> +# Feel free to contribute and please read our call to help below : "We need You!" + +BEGIN { + unshift(@INC, "/usr/share/doc/zinc-perl/examples/"); +} + +use strict; +use Tk; +use SeeCode; + +my @examples = + ( + "Examples of items" => "items.pl", + "All Options and their types of all items" => "all_options.pl", + "Examples of line style and line termination" => "lines.pl", + "Groups and Priorities" => "groups_priority.pl", + "Interactions on graphical objects" => "", + "Simple Interactions on a track item" => "simple_interaction_track.pl", + "Maps, uses and creations" => "", + "Transformations examples" => "", + "Clipping examples (with simple or multiple contours)" => "clipping.pl", + "Curves with mutliple contours examples" => "contours.pl", + "A simple graphical button based on pixmaps" => "", + "A simple graphical button based on openGL (needs openGL)" => "", + "A Zinc Goodie: \"ZincDebug.pm\"" => "", + "Axial color variation on the X axis (needs openGL)" => "color-x.pl", + "Axial color variation on the Y axis (needs openGL)" => "color-y.pl", + "Circular color variation (needs openGL)" => "color-circular.pl", + "The triangles item (needs openGL)" => "triangles.pl", + "A simple animated application \"the Wheel of Fortune\". It is\n". + "An example of the use of groups, clipping and transformations" => "wheelOfFortune.pl", + "A simple radar display" => "simpleradar.pl", + ); + +my $defaultfont = '-adobe-helvetica-bold-r-normal-*-120-*-*-*-*-*-*'; +my $mw = MainWindow->new(); +$mw->title("Zinc Demonstrations"); +my $frame1 = $mw->Frame(-width => 520, -height => 400,-borderwidth => 3, + -relief => 'sunken')->pack(-padx => 5, -pady => 5, + -ipadx => 10, -ipady => 10); + +my $demoCounter=1; +for (my $i = 0; $i < @examples-1; $i += 2) { + my $demoTitle = $examples[$i]; + if ($examples[$i+1] ne "") { + $demoTitle = $demoCounter . ". " . $demoTitle; + $demoCounter++; + } + else { + $demoTitle = "x. " . $demoTitle; + } + + my $lb = + $frame1->Label(-text => $demoTitle, + -width => 55, + -anchor => 'w', + -justify => 'left', + )->grid(-column => 1, -row => ($i+1)/2, -pady => 10); + if ($examples[$i+1] ne "") { + my $cmd = Tk::findINC($examples[$i+1]); + $frame1->Button(-text => "Run", + -command => sub { + $lb->configure(-foreground => 'gray40'); + system("/usr/bin/perl $cmd &"); + }, + )->grid(-column => 2, -row => ($i+1)/2); + } + else { + $frame1->Button(-text => "ToBeDone", + -state => "disable", + )->grid(-column => 2, -row => ($i+1)/2); + } +} + +my $frame2 = $mw->Frame()->pack(-expand => 1, -side => 'bottom', -fill => 'both', + -ipady => 5); + + +$frame2->Button(-text => 'We need You!', + -width => 8, -height => 1, + -command => \&we_need_you, + )->pack(-side => 'top', -expand => 1); + +$frame2->Button(-text => 'Quit', + -width => 8, -height => 1, + -command => sub {exit;}, + )->pack(-side => 'top', -expand => 1); + +sub we_need_you { + my $WNY = MainWindow->new(); # WNY means We Need You! + $WNY->title("We need You!"); + # Create a top-level window that displays a call for help! + + my $t = $WNY->Scrolled(qw/Text -relief sunken -borderwidth 2 -setgrid true + -height 30 -scrollbars e/); + $t->pack(qw/-expand yes -fill both/); + + $t->insert('0.0', +'The TkZinc widget has been developped by the CENA for its own +need of prototyping environment. It is now heavily used by more +than a dozen living projects involving advanced HMI. As we +are convinced in the interest of Freee Software, Zinc is free +Software under LGPL. +Zinc is available at http://www.openatc.org/zinc or +http://freshmeat.net/projects/zincisnotcanvas/ + +People in charge of Zinc at CENA are good in producing good code. +They are not so good in producing extensive documentation and +examples. + +This simple demo is a first try to demontrate the hidden power +behind Zinc. + +If you feel happy with Zinc, feel free to contribute too! +One simple way is by producing simple samples like these +available in demo.pl + +Please send us your production at pii-contact@cena.fr and +we will add it in the next release of Zinc. + + The CENA community of Zinc developpers and users. +'); + + $t->mark(qw/set insert 0.0/); + my $frame = $WNY->Frame()->pack(-expand => 1, -side => 'bottom', -fill => 'both', + -ipady => 5); + $frame->Button(-text => 'Quit', + -width => 8, -height => 1, + -command => sub {$WNY->destroy;}, + )->pack(-side => 'top', -expand => 1); + + +} # end we_need_you + + +MainLoop; + + |