--- trunk/lib/Frey/IconBrowser.pm 2008/11/28 23:22:22 607 +++ trunk/lib/Frey/IconBrowser.pm 2008/11/28 23:28:12 608 @@ -14,9 +14,18 @@ default => 'static/icons/fugue/', ); +has show_names => ( + is => 'rw', + isa => 'Bool', + required => 1, + default => 1, +); + sub as_markup { my ($self) = @_; + $self->title( 'icons - ' . $self->path ); + my $extension = '\.(?:png)$'; opendir(my $dir, $self->path) || die "can't opendir ", $self->path, ": $!"; @@ -25,19 +34,46 @@ my ( $combined_path, $styles ) = $self->combine_images( map { $self->path . '/' . $_ } @icons ); - my $html; + my $width = 0; + foreach ( @icons ) { + my $l = length($_); + $width = $l if $l > $width; + } + + $width = 2 if ! $self->show_names; + + $self->add_css(qq| + h1 { font-size: 20px } + /* group */ + div.g { + float: left; + clear: both; + } + /* individual icon */ + div.i { + color: #888; + width: ${width}ex; + float: left; + } + |); + + my $html = '