Source for file TextSpacingSC.class.php

Documentation is available at TextSpacingSC.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 TextSpacingSC represents CSS "word-spacing" and "letter-spacing" values.
  8. * The allowed values are:
  9. * <ul style="font-family: monospace;">
  10. * <li> normal </li>
  11. * <li> [specific length value] - a length value (i.e. units are %, px, in, etc.
  12. * but % CANNOT be used for this type!) </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: TextSpacingSC.class.php,v 1.11 2007/09/04 20:25:23 adamfranco Exp $
  25. */
  26. class TextSpacingSC extends StyleComponent {
  27.  
  28. /**
  29. * The constructor.
  30. * @param string value The value to assign to this SC.
  31. * @access public
  32. ***/
  33. function TextSpacingSC($value) {
  34. $options = array("normal");
  35.  
  36. $errDescription = "Could not validate the text-spacing StyleComponent value \"%s\".
  37. Allowed values are: ".implode(", ", $options)."
  38. or a specific distance value (in length units, i.e. px,
  39. in, etc. but NOT %).";
  40. $rule= RegexValidatorRule::getRule("^(normal|-?[0-9]+(\.[0-9]+)?(in|cm|mm|em|ex|pt|pc|px))$");
  41. $displayName = "Text Spacing";
  42. $description = "Affects the text spacing between words. Allowed values are: ".implode(", ", $options)."
  43. or a specific distance value (in length units, i.e. px,
  44. in, etc. but NOT %).";
  45. $this->StyleComponent($value, $rule, $options, false, $errDescription, $displayName, $description);
  46. }
  47. }
  48.  
  49.  
  50. ?>

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