# Copyright (c) 1999-2005 bivio Software, Inc. All rights reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: Align.pm,v 2.3 2005/09/23 05:42:57 nagler Exp $ package Bivio::UI::Align; use strict; use Bivio::Base 'Bivio::Type::Enum'; # C is a enum of alignment names to html alignment # values (via C). # # The alignments and their values are: # # # N (north, top): valign=top align=center # # NE (northeast): valign=top align=right # # E (east, right): align=right # # SE (southeast): valign=bottom align=right # # S (south, bottom): valign=bottom align=center # # SW (southwest): valign=bottom align=left # # W (west, left): # # NW (northwest): valign=top align=left # # CENTER: align=center # # LEFT: align=left # # RIGHT: align=right # # TOP: valign=top align=center # # BOTTOM: valign=bottom align=center our($VERSION) = sprintf('%d.%02d', q$Revision: 0.0$ =~ /\d+/g); __PACKAGE__->compile([ 'N' => [ 1, 'north', ' valign="top" align="center"', ], 'NE' => [ 2, 'northeast', ' valign="top" align="right"', ], 'E' => [ 3, 'east', ' align="right"', ], 'SE' => [ 4, 'southeast', ' valign="bottom" align="right"', ], 'S' => [ 5, 'south', ' valign="bottom" align="center"', ], 'SW' => [ 6, 'southwest', ' valign="bottom" align="left"', ], 'W' => [ 7, 'west', ' align="left"', ], 'NW' => [ 8, 'northwest', ' valign="top" align="left"', ], CENTER => [ 9, undef, ' align="center"', ], LEFT => [ 10, undef, ' align="left"', ], RIGHT => [ 11, undef, ' align="right"', ], TOP => [ 12, undef, ' valign="top"', ], BOTTOM => [ 13, undef, ' valign="bottom"', ], ]); sub as_html { # (self, any) : string # Returns the alignment in html as C and C attributes # of C tag. Prefixed with leading space. # # If I returns false (zero or C), returns two empty # strings. my($proto, $thing) = @_; return $thing ? $proto->from_any($thing)->get_long_desc : ''; } 1;