# HList and ItemStyle, multicolumn listbox with individual cell styles.
# Copyright (C) 1999 Slaven Rezic. All rights reserved.
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
# Mail: eserte@cs.tu-berlin.de
# WWW: http://user.cs.tu-berlin.de/~eserte/
my $TOP = $MW->WidgetDemo(
-text
=> 'HList and ItemStyle, multicolumn listbox with individual cell styles.',
-geometry_manager
=> 'grid',
)->grid(qw
/-sticky nsew/);
$h->header('create', $_, -text
=> 'Column ' . $_);
foreach ('Xcamel.gif', 'anim.gif', 'icon.gif', 'Camel.xpm') {
push @img, $TOP->Photo(-file
=> Tk
->findINC($_)),
my(@fonts) = ('-*-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*',
'-*-Courier-Medium-R-Normal--*-180-*-*-*-*-*-*',
'-*-times-medium-r-normal--*-240-*-*-*-*-*-*',
'-Adobe-Courier-Bold-O-Normal--*-120-*-*-*-*-*-*',
my(@colors) = qw(red green blue yellow red cyan black);
$colors[rand($#colors+1)];
return undef; # XXX disable for now
('Button', 'Entry')[rand(2)];
my $e = $h->addchild("");
my $window = $rnd_window->();
my $image = $rnd_image->();
if ($bg eq $fg) { $fg = 'white' }
my $style_type = ($window ?
'window' :
($image ?
'imagetext' : 'text'));
my $style = $h->ItemStyle($style_type);
if ($style_type eq 'window') {
$style->configure(-pady
=> 0, -padx
=> 0);
if ($window eq 'Button') {
$btn->configure(-activeforeground
=> $rnd_color->());
$style->configure(-foreground
=> $fg,
-itemtype
=> $style_type,
($style_type eq 'imagetext'
?
(-image
=> $image) : ()
?
(-widget
=> $btn) : (-text
=> 'Cell ' . $y . '/' . $col)