Source for file LineHeightSC.class.php

Documentation is available at LineHeightSC.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/StyleComponent.class.php");
  4. require_once(HARMONI."GUIManager/StyleComponents/LengthSC.class.php");
  5.  
  6. /**
  7. * The LineHeightSC represents CSS "line-height" values. The allowed
  8. * values are:
  9. * <ul style="font-family: monospace;">
  10. * <li> normal </li>
  11. * <li> [multiplier] - a non-negative number</li>
  12. * <li> [specific line height] - a length value (%, px, in, etc.) </li>
  13. * </ul>
  14. * <br /><br />
  15. * The <code>StyleComponent</code> (SC) is the most basic of the three building pieces
  16. * of CSS styles. It combines a CSS property value with a ValidatorRule to ensure that
  17. * the value follows a certain format.<br /><br />
  18. *
  19. * @package harmoni.gui.scs
  20. *
  21. * @copyright Copyright &copy; 2005, Middlebury College
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  23. *
  24. * @version $Id: LineHeightSC.class.php,v 1.8 2007/09/04 20:25:22 adamfranco Exp $
  25. */
  26. class LineHeightSC extends StyleComponent {
  27.  
  28. /**
  29. * The constructor.
  30. * @param string value The value to assign to this SC.
  31. * @access public
  32. ***/
  33. function LineHeightSC($value) {
  34. $options = array("normal");
  35.  
  36. $errDescription = "Could not validate the line-height StyleComponent value \"%s\".
  37. Allowed values are: ".implode(", ", $options).", a non-negative
  38. multiplier, or a specific line-height value
  39. (a length value, i.e. px, in, %, etc.).";
  40. $rule = RegexValidatorRule::getRule("^(normal|-?[0-9]+(\.[0-9]+)?(%|in|cm|mm|em|ex|pt|pc|px)|[0-9]+(\.[0-9]+)?)$");
  41. $displayName = "Line Height";
  42. $description = "Specifies the line height. This property allows one to modify
  43. the distance between text lines. For example, you can use it to achieve the effect
  44. of a double-spaced text. Allowed values are: ".implode(", ", $options).", a non-negative
  45. multiplier (use 2 for double-spaced text), or a specific line-height value
  46. (a length value, i.e. px, in, %, etc.).";
  47. $this->StyleComponent($value, $rule, $options, false, $errDescription, $displayName, $description);
  48. }
  49. }
  50.  
  51.  
  52. ?>

Documentation generated on Wed, 19 Sep 2007 10:24:53 -0400 by phpDocumentor 1.3.0RC3