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

NAME

PostScript::ScheduleGrid::Role::Style - Something that customizes a cell's appearance

VERSION

This document describes version 0.05 of PostScript::ScheduleGrid::Role::Style, released August 22, 2015 as part of PostScript-ScheduleGrid version 0.05.

DESCRIPTION

This role describes a style for displaying the contents of a cell in the grid. The class must provide a define_style method.

If a style has PostScript definitions that are invariant, it may define them by adding a function block under its class name (with :: replaced by _). If it needs more than one function block, it may append a hyphen and an arbitrary identifier.

The definitions must begin with the class name (with PostScript::ScheduleGrid::Style:: replaced by s and any remaining :: replaced by _. That prefix may be followed by a hypen and any legal PostScript identifier. For example, PostScript::ScheduleGrid::Style::Stripe can define PostScript identifiers beginning with sStripe-.

The name function created by the define_style method will be called with no parameters. The clipping path is set to the boundaries of the cell, and the current font is the grid's cell_font. The graphics state has been saved and will be restored after the cell's text is drawn.

The function must perform whatever drawing it wants to, and leave the color and font set for the cell's text.

ATTRIBUTES

name

This is the name of the PostScript function that the Style must define. It may also use any identifiers beginning with name followed by a hyphen for any purposes it likes.

METHODS

_ps_eval

  $style->_ps_eval(\$string, ...);

This method is provided by this role. It substitutes values from the object into each $string (which is modified in-place). Any number of string references may be passed.

The following substitutions are performed on each $string:

First, any $ followed by an identifier are replaced by calling that method on the object and passing its return value to PostScript::File's str function.

Second, any %{...} is replaced with the result of evaluating ... (which may not contain braces).

define_style

  $style->define_style($schedule_grid);

This method must return a string containg PostScript code to define the function specified by name. $schedule_grid is the PostScript::ScheduleGrid object using the style.

CONFIGURATION AND ENVIRONMENT

PostScript::ScheduleGrid::Role::Style requires no configuration files or environment variables.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

AUTHOR

Christopher J. Madsen <perl AT cjmweb.net>

Please report any bugs or feature requests to <bug-PostScript-ScheduleGrid AT rt.cpan.org> or through the web interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=PostScript-ScheduleGrid.

You can follow or contribute to PostScript-ScheduleGrid's development at https://github.com/madsen/postscript-schedulegrid.

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by Christopher J. Madsen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.