The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PlotCalendar::Day - Generate ascii or html for a single day in a calendar

SYNOPSIS

Creates a Day object for plotting as ASCII, HTML, or in a Perl/Tk Canvas. Intended to be gathered together by Month.pm to create a traditional calendar.

DESCRIPTION

Measurements in pixels because - well, because. It seemed simpler when I made the decision. And it works for both Tk and HTML.

The day is laid out like this :

    ------------------------------------------
    |         |        |                     |
    | digit   | digit  | Main day name       |
    |         |        |                     |
    |         |        |                     |
    |         |        |                     |
    |---------|--------|                     | <- bgcolmain
    |                                        |
    |                                        |
    |                                        |
    | Optional text                          |
    |      .                                 |
    |                                        |
    | Optional Text                          |
    |      .                                 |
    |      .                                 |
    |      .                                 | 
    |      .                                 |
    | Optional text                          |
    |      .                                 |
    |      .                                 |
    |      .                                 |
    |      .                                 |
    ------------------------------------------

    Globals : height, width, dayfont, mainfont, optfont, fgcol,
    bgcolmain, digit

    Optionals : dayname, optext[...]

    Font sizes in HTML translate as (rounding up) :
        6->-1
        8->+0
        10->+1
        12->+2
        14->+3

Various quantities can be set globally, or over-ridden for specific cases.

This is really meant to be called by month.pm to construct a calendar, but calling it with a *really big size* is a way to "zoom in" on a given day

EXAMPLE

        require PlotCalendar::Day;

        my $digit=10 ; # do it for the tenth
        my $day = PlotCalendar::Day->new($digit);

        #        These are values with default settings, so these are optional

    ------------ size of whole thing in pixels, X,Y
        $day -> size(100,100);
    ------------ Global foreground and background colors
        $day -> color('BLACK','#33cc00',);
        $day -> color('WHITE','RED',);
    ------------ Font sizes for digits, dayname, and optional text
        $day -> font('14','10','8');
    ------------ styles for digits, dayname, and optional text
    ------------ b=bold, i=italic, u=underline, n=normal
        $day -> style('bi','nbu','i');
    ------------ Clip text to avoid wrapping? (yes/no)
        $day -> cliptext('yes');

        #       HTML only options
        
    ------------ is it allowed to expand vertically if there is too much text?
        $day -> htmlexpand('yes');

        #       These values are defaulted to blank

    ------------ day name
        $day -> dayname('Groundhog Day');
    ------------ if set, name is a hotlink
        $day -> nameref('<A href="http://ooga.booga.com/">');
    ------------ if set, text string is a hotlink. Note that an array is getting
    ------------ passed. Text is passed as an array also. Each line of text is
    ------------ an array element. THis example hotlinks only the first 2 lines.
        $day -> textref('<A href="http://booga.booga.com/">','<A href="mailto:>');
    ------------ Text strings, passed as elemnts of an array
        $day -> text('text string 1','text string 2','abcdefghijklmno 0 1 2 3 4 5 6 7 8 9 0',);
    ------------ override default text colors and set each string individually
        $day -> textcolor('BLUE','RED','GREEN',);
    ------------ override default text sizes and set each string individually
        $day -> textsize('8','10','8',);
    ------------ override default text styles and set each string individually
        $day -> textstyle('b','u','bi',);

    ------------ wrap a reference around the entire cell
        $day->htmlref('<A href="http://this_is_a_url/">');

    ------------ unload what I set
        my @size = $day->size;
        my @color = $day->color;
        my @font = $day->font;
        my @text = $day->text;
        my $dayname = $day->dayname;

        #       So, what do we have now?

    ------------ Create an ascii text cell
        #my $text = $day -> gettext;

    ------------ Create and return html for a cell in a table
        my $html = $day -> gethtml;

    ------------ Create and return Tk code (not implemented yet)
        #my $tk = $day -> gettk;

        print "<HTML><BODY>\n";
        print "<H1>Normal Day</H1>\n";
        print "<TABLE BORDER=1><TR>\n";
        print $html;
        print "</TR></TABLE>\n";

AUTHOR

        Alan Jackson
        March 1999
        ajackson@icct.net