Source for file HorizontalAlignmentPositionSC.class.php

Documentation is available at HorizontalAlignmentPositionSC.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/StyleComponent.class.php");
  4.  
  5. /**
  6. * The HorizontalAlignmentPosition represents CSS relative and absolute position values, as well as certain alignments. The allowed
  7. * formats are:
  8. * <ul style="font-family: monospace;">
  9. * <li> Percentage - "12%" </li>
  10. * <li> Ems - "12em" </li>
  11. * <li> X-Height - "25ex" </li>
  12. * <li> Pixels - "120px" </li>
  13. * <li> Inches - "2.3in" </li>
  14. * <li> Centimeters - "23cm" </li>
  15. * <li> Millimeters - "1232mm" </li>
  16. * <li> Points - "22pt" </li>
  17. * <li> Picas - "54pc" </li>
  18. * <li> or either: top/center/bottom </li>
  19. * <li> or either: left/center/right </li>
  20. * </ul>
  21. * <br /><br />
  22. * The <code>StyleComponent</code> (SC) is the most basic of the three building pieces
  23. * of CSS styles. It combines a CSS property value with a ValidatorRule to ensure that
  24. * the value follows a certain format.<br /><br />
  25. *
  26. * @package harmoni.gui.scs
  27. *
  28. * @copyright Copyright &copy; 2005, Middlebury College
  29. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  30. *
  31. * @version $Id: HorizontalAlignmentPositionSC.class.php,v 1.4 2007/09/04 20:25:22 adamfranco Exp $
  32. */
  33. class HorizontalAlignmentPositionSC extends StyleComponent {
  34.  
  35. /**
  36. * The constructor.
  37. * @param string value The value to assign to this SC.
  38. * @access public
  39. ***/
  40. function HorizontalAlignmentPositionSC($value) {
  41. $errDescription = "Could not validate the length StyleComponent value \"%s\". ";
  42. $errDescription .= "Allowed units are: %, in, cm, mm, em, ex, pt, pc, px, or any of:";
  43. $options = array("left", "center", "right");
  44. $errDescription .= " ".implode(", ", $options).".";
  45. $rule = CSSLengthValidatorRuleWithOptions::getRule($options);
  46. $displayName = "HorizontalAlignmentPosition";
  47. $description = "Specifies the length (width, size, etc) in percentages (%),
  48. inches (in), centimeters (cm), millimeters (mm), ems (em), X-height (ex),
  49. points (pt), picas (pc), or pixels (px) or an alignment: ".implode(", ",$options).".";
  50. $this->StyleComponent($value, $rule, $options, null, $errDescription, $displayName, $description);
  51. }
  52. }
  53.  
  54. ?>

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