Source for file SimpleLinesTheme.class.php

Documentation is available at SimpleLinesTheme.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/Theme.class.php");
  4.  
  5. require_once(HARMONI."GUIManager/StyleCollection.class.php");
  6.  
  7. require_once(HARMONI."GUIManager/StyleProperties/BackgroundColorSP.class.php");
  8. require_once(HARMONI."GUIManager/StyleProperties/ColorSP.class.php");
  9. require_once(HARMONI."GUIManager/StyleProperties/BorderSP.class.php");
  10. require_once(HARMONI."GUIManager/StyleProperties/BorderTopSP.class.php");
  11. require_once(HARMONI."GUIManager/StyleProperties/BorderRightSP.class.php");
  12. require_once(HARMONI."GUIManager/StyleProperties/BorderBottomSP.class.php");
  13. require_once(HARMONI."GUIManager/StyleProperties/BorderLeftSP.class.php");
  14. require_once(HARMONI."GUIManager/StyleProperties/MarginSP.class.php");
  15. require_once(HARMONI."GUIManager/StyleProperties/PaddingSP.class.php");
  16. require_once(HARMONI."GUIManager/StyleProperties/FontSP.class.php");
  17. require_once(HARMONI."GUIManager/StyleProperties/FontFamilySP.class.php");
  18. require_once(HARMONI."GUIManager/StyleProperties/FontSizeSP.class.php");
  19. require_once(HARMONI."GUIManager/StyleProperties/FontWeightSP.class.php");
  20. require_once(HARMONI."GUIManager/StyleProperties/TextAlignSP.class.php");
  21. require_once(HARMONI."GUIManager/StyleProperties/TextDecorationSP.class.php");
  22. require_once(HARMONI."GUIManager/StyleProperties/DisplaySP.class.php");
  23.  
  24. /**
  25. * A very basic theme based on simple borders and colored blocks.
  26. * <br /><br />
  27. * A <code>Theme</code> is a combination of two things: first, it stores a variety
  28. * of reusable <code>StyleCollections</code> and second, it offers a mechanism for
  29. * printing an HTML web page.
  30. * <br /><br />
  31. * Each <code>Theme</code> has a set of style collections that correspond to
  32. * each component type.
  33. * <br /><br />
  34. * Each <code>Theme</code> has a single component (could be container) that will
  35. * be printed when <code>printPage()</code> is called.
  36. *
  37. * @package harmoni.gui.themes
  38. *
  39. * @copyright Copyright &copy; 2005, Middlebury College
  40. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  41. *
  42. * @version $Id: SimpleLinesTheme.class.php,v 1.2 2007/09/04 20:25:23 adamfranco Exp $
  43. */
  44. class SimpleLinesTheme extends Theme {
  45.  
  46. /**
  47. * The constructor. All initialization and Theme customization is performed
  48. * here.
  49. * @access public
  50. ***/
  51. function SimpleLinesTheme() {
  52. $this->Theme("Simple Lines Theme", "A basic theme based on simple borders and colored blocks.");
  53. // =====================================================================
  54. // global Theme style
  55. $body = new StyleCollection("body", null, "Global Style", "Style settings affecting the overall look and feel.");
  56. $body->addSP(new BackgroundColorSP("#AAA"));
  57. $body->addSP(new ColorSP("#000"));
  58. //$body->addSP(new FontFamilySP("Verdana"));
  59. $body->addSP(new PaddingSP("0px"));
  60. $body->addSP(new MarginSP("0px"));
  61. $this->addGlobalStyle($body);
  62.  
  63. $links = new StyleCollection("a", null, "Link Style", "Style settings affecting the look and feel of links.");
  64. $links->addSP(new TextDecorationSP("underline"));
  65. $this->addGlobalStyle($links);
  66.  
  67. $links_hover = new StyleCollection("a:hover", null, "Link Hover Style", "Style settings affecting the look and feel of hover links.");
  68. $links_hover->addSP(new TextDecorationSP("underline"));
  69. $this->addGlobalStyle($links_hover);
  70.  
  71. // =====================================================================
  72. // Block 1 style
  73. $block1 = new StyleCollection("*.block1", "block1", "Block 1", "The main block where normally all of the page content goes in.");
  74. $block1->addSP(new BackgroundColorSP("#FFFFFF"));
  75. $block1->addSP(new ColorSP("#000"));
  76. $block1->addSP(new BorderTopSP("1px", "solid", "#000"));
  77. $block1->addSP(new BorderRightSP("3px", "solid", "#000"));
  78. $block1->addSP(new BorderBottomSP("3px", "solid", "#000"));
  79. $block1->addSP(new BorderLeftSP("1px", "solid", "#000"));
  80. $block1->addSP(new PaddingSP("10px"));
  81. $block1->addSP(new MarginSP("10px"));
  82. $this->addStyleForComponentType($block1, BLOCK, 1);
  83. // =====================================================================
  84. // Block 2 style
  85. $block2 = new StyleCollection("*.block2", "block2", "Block 2", "A 2nd level block.");
  86. //$block2->addSP(new PaddingSP("10px"));
  87. $block2->addSP(new TextAlignSP("justify"));
  88. $this->addStyleForComponentType($block2, BLOCK, 2);
  89. // =====================================================================
  90. // Block 3 style
  91. $block3 = new StyleCollection("*.block3", "block3", "Block 3", "A 3rd level block.");
  92. //$block3->addSP(new BackgroundColorSP("#FFFFFF"));
  93. //$block3->addSP(new ColorSP("#000"));
  94. //$block3->addSP(new BorderSP("1px", "solid", "#000"));
  95. $block3->addSP(new PaddingSP("10px"));
  96. $block3->addSP(new TextAlignSP("justify"));
  97. $this->addStyleForComponentType($block3, BLOCK, 3);
  98. // =====================================================================
  99. // Block 4 style
  100. $block4 = new StyleCollection("*.block4", "block4", "Block 4", "A 4th level block.");
  101. $block4->addSP(new BackgroundColorSP("#D4D4D4"));
  102. $block4->addSP(new ColorSP("#000"));
  103. $block4->addSP(new BorderTopSP("1px", "solid", "#000"));
  104. $block4->addSP(new BorderRightSP("1px", "solid", "#000"));
  105. $block4->addSP(new BorderBottomSP("1px", "solid", "#000"));
  106. $block4->addSP(new BorderLeftSP("1px", "solid", "#000"));
  107. $block4->addSP(new PaddingSP("10px"));
  108. $block4->addSP(new MarginSP("10px"));
  109. $this->addStyleForComponentType($block4, BLOCK, 4);
  110. // =====================================================================
  111. // Heading 1 style
  112. $heading1 = new StyleCollection("*.heading1", "heading1", "Heading 1", "A 1st level heading.");
  113. $heading1->addSP(new ColorSP("#F00"));
  114. $heading1->addSP(new FontSizeSP("200%"));
  115. $this->addStyleForComponentType($heading1, HEADING, 1);
  116. // =====================================================================
  117. // Heading 2 style
  118. $heading2 = new StyleCollection("*.heading2", "heading2", "Heading 2", "A 2nd level heading.");
  119. $heading2->addSP(new BackgroundColorSP("#D4D4D4"));
  120. $heading2->addSP(new ColorSP("#007"));
  121. $heading2->addSP(new FontSizeSP("125%"));
  122. $heading2->addSP(new PaddingSP("10px"));
  123. $heading2->addSP(new MarginSP("10px"));
  124. $heading2->addSP(new BorderTopSP("1px", "solid", "#000"));
  125. $this->addStyleForComponentType($heading2, HEADING, 2);
  126.  
  127. // =====================================================================
  128. // Footer 1 style
  129. $footer1 = new StyleCollection("*.footer1", "footer1", "Footer 1", "A 1st level footer.");
  130. $footer1->addSP(new ColorSP("#959595"));
  131. $footer1->addSP(new MarginSP("10px"));
  132. $footer1->addSP(new FontSizeSP("125%"));
  133. $this->addStyleForComponentType($footer1, FOOTER, 1);
  134. // =====================================================================
  135. // Menu 1 style
  136. $menu1 = new StyleCollection("*.menu1", "menu1", "Menu 1", "A 1st level menu.");
  137. $menu1->addSP(new BackgroundColorSP("#D4D4D4"));
  138. $menu1->addSP(new ColorSP("#000"));
  139. $menu1->addSP(new BorderSP("1px", "solid", "#000"));
  140. $this->addStyleForComponentType($menu1, MENU, 1);
  141. // =====================================================================
  142. // Menu Heading 1 style
  143. $menuHeading1 = new StyleCollection("*.menuHeading1", "menuHeading1", "Menu Heading 1", "A 1st level menu heading.");
  144. $menuHeading1->addSP(new DisplaySP("block"));
  145. $menuHeading1->addSP(new BackgroundColorSP("#AAA"));
  146. $menuHeading1->addSP(new PaddingSP("10px"));
  147. //$menuHeading1->addSP(new FontWeightSP("bold"));
  148. $this->addStyleForComponentType($menuHeading1, MENU_ITEM_HEADING, 1);
  149. // =====================================================================
  150. // Menu Unselected Link 1 style
  151. $menuLink1_unselected = new StyleCollection("*.menuLink1_unselected a", "menuLink1_unselected", "Unselected Menu Link 1", "A 1st level unselected menu link.");
  152. $menuLink1_unselected->addSP(new DisplaySP("block"));
  153. $menuLink1_unselected->addSP(new BackgroundColorSP("#D4D4D4"));
  154. $menuLink1_unselected->addSP(new PaddingSP("10px"));
  155. $this->addStyleForComponentType($menuLink1_unselected, MENU_ITEM_LINK_UNSELECTED, 1);
  156. $menuLink1_hover = new StyleCollection("*.menuLink1_hover a:hover", "menuLink1_hover", "Menu Link 1 Hover", "A 1st level menu link hover behavior.");
  157. $menuLink1_hover->addSP(new BackgroundColorSP("#AAA"));
  158. $this->addStyleForComponentType($menuLink1_hover, MENU_ITEM_LINK_UNSELECTED, 1);
  159. // =====================================================================
  160. // Menu Selected Link 1 style
  161. $menuLink1_selected = new StyleCollection("*.menuLink1_selected a", "menuLink1_selected", "Selected Menu Link 1", "A 1st level selected menu link.");
  162. $menuLink1_selected->addSP(new DisplaySP("block"));
  163. $menuLink1_selected->addSP(new BackgroundColorSP("#AAA"));
  164. $menuLink1_selected->addSP(new PaddingSP("10px"));
  165. $this->addStyleForComponentType($menuLink1_selected, MENU_ITEM_LINK_SELECTED, 1);
  166. }
  167.  
  168.  
  169. }
  170.  
  171. ?>

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