PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/library/PhpExt/Layout/BorderLayoutData.php

http://php-ext.googlecode.com/
PHP | 393 lines | 141 code | 28 blank | 224 comment | 0 complexity | 7c21005e3dbf31f3382c300e67dcd09f MD5 | raw file
  1. <?php
  2. /**
  3. * PHP-Ext Library
  4. * http://php-ext.googlecode.com
  5. * @author Sergei Walter <sergeiw[at]gmail[dot]com>
  6. * @copyright 2008 Sergei Walter
  7. * @license http://www.gnu.org/licenses/lgpl.html
  8. * @link http://php-ext.googlecode.com
  9. *
  10. * Reference for Ext JS: http://extjs.com
  11. *
  12. */
  13. /**
  14. * @see PhpExt_Layout_ContainerLayoutData
  15. */
  16. include_once 'PhpExt/Layout/ContainerLayoutData.php';
  17. /**
  18. * Used when using {@link PhpExt_Layout_BorderLayout} as the container's layout.
  19. *
  20. * @see PhpExt_Layout_BorderLayout
  21. * @see PhpExt_Container::setLayout()
  22. * @package PhpExt
  23. * @subpackage Layout
  24. */
  25. class PhpExt_Layout_BorderLayoutData extends PhpExt_Layout_ContainerLayoutData
  26. {
  27. const REGION_NORTH = 'north';
  28. const REGION_WEST = 'west';
  29. const REGION_CENTER = 'center';
  30. const REGION_EAST = 'east';
  31. const REGION_SOUTH = 'south';
  32. // AnimCollapse
  33. /**
  34. * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated panel that will close again once the user mouses out of that panel (or clicks out if autoHide = false). Setting animFloat to false will prevent the open and close of these floated panels from being animated (defaults to true).
  35. * @param boolean $value
  36. * @return PhpExt_Layout_BorderLayoutData
  37. */
  38. public function setAnimCollapse($value) {
  39. $this->setLayoutProperty("animCollapse", $value);
  40. return $this;
  41. }
  42. /**
  43. * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated panel that will close again once the user mouses out of that panel (or clicks out if autoHide = false). Setting animFloat to false will prevent the open and close of these floated panels from being animated (defaults to true).
  44. * @return boolean
  45. */
  46. public function getAnimCollapse() {
  47. return $this->getLayoutProperty("animCollapse");
  48. }
  49. // AutoHide
  50. /**
  51. * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated panel. If autoHide is true, the panel will automatically hide after the user mouses out of the panel. If autoHide is false, the panel will continue to display until the user clicks outside of the panel (defaults to true).
  52. * @param boolean $value
  53. * @return PhpExt_Layout_BorderLayoutData
  54. */
  55. public function setAutoHide($value) {
  56. $this->setLayoutProperty("autoHide", $value);
  57. return $this;
  58. }
  59. /**
  60. * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated panel. If autoHide is true, the panel will automatically hide after the user mouses out of the panel. If autoHide is false, the panel will continue to display until the user clicks outside of the panel (defaults to true).
  61. * @return boolean
  62. */
  63. public function getAutoHide() {
  64. return $this->getLayoutProperty("autoHide");
  65. }
  66. // CMargins
  67. /**
  68. * An object containing margins to apply to the region's collapsed element in the format {left: (left margin), top: (top margin), right: (right margin), bottom: (bottom margin)}
  69. * @param object $value
  70. * @return PhpExt_Layout_BorderLayoutData
  71. */
  72. public function setCMargins($value) {
  73. $this->setLayoutProperty("cmargins", $value);
  74. return $this;
  75. }
  76. /**
  77. * An object containing margins to apply to the region's collapsed element in the format {left: (left margin), top: (top margin), right: (right margin), bottom: (bottom margin)}
  78. * @return object
  79. */
  80. public function getCMargins() {
  81. return $this->getLayoutProperty("cmargins");
  82. }
  83. // CollapseMode
  84. /**
  85. * By default, collapsible regions are collapsed by clicking the expand/collapse tool button that renders into the region's title bar. Optionally, when collapseMode is set to 'mini' the region's split bar will also display a small collapse button in the center of the bar. In 'mini' mode the region will collapse to a thinner bar than in normal mode. By default collapseMode is undefined, and the only two supported values are undefined and 'mini'. Note that if a collapsible region does not have a title bar, then collapseMode must be set to 'mini' in order for the region to be collapsible by the user as the tool button will not be rendered.
  86. * @param string $value
  87. * @return PhpExt_Layout_BorderLayoutData
  88. */
  89. public function setCollapseMode($value) {
  90. $this->setLayoutProperty("collapseMode", $value);
  91. return $this;
  92. }
  93. /**
  94. * By default, collapsible regions are collapsed by clicking the expand/collapse tool button that renders into the region's title bar. Optionally, when collapseMode is set to 'mini' the region's split bar will also display a small collapse button in the center of the bar. In 'mini' mode the region will collapse to a thinner bar than in normal mode. By default collapseMode is undefined, and the only two supported values are undefined and 'mini'. Note that if a collapsible region does not have a title bar, then collapseMode must be set to 'mini' in order for the region to be collapsible by the user as the tool button will not be rendered.
  95. * @return string
  96. */
  97. public function getCollapseMode() {
  98. return $this->getLayoutProperty("collapseMode");
  99. }
  100. // Collapsible
  101. /**
  102. * True to allow the user to collapse this region (defaults to false). If true, an expand/collapse tool button will automatically be rendered into the title bar of the region, otherwise the button will not be shown. Note that a title bar is required to display the toggle button -- if no region title is specified, the region will only be collapsible if collapseMode is set to 'mini'.
  103. * @param boolean $value
  104. * @return PhpExt_Layout_BorderLayoutData
  105. */
  106. public function setCollapsible($value) {
  107. $this->setLayoutProperty("collapsible", $value);
  108. return $this;
  109. }
  110. /**
  111. * True to allow the user to collapse this region (defaults to false). If true, an expand/collapse tool button will automatically be rendered into the title bar of the region, otherwise the button will not be shown. Note that a title bar is required to display the toggle button -- if no region title is specified, the region will only be collapsible if collapseMode is set to 'mini'.
  112. * @return boolean
  113. */
  114. public function getCollapsible() {
  115. return $this->getLayoutProperty("collapsible");
  116. }
  117. // Floatable
  118. /**
  119. * True to allow clicking a collapsed region's bar to display the region's panel floated above the layout, false to force the user to fully expand a collapsed region by clicking the expand button to see it again (defaults to true).
  120. * @param boolean $value
  121. * @return PhpExt_Layout_BorderLayoutData
  122. */
  123. public function setFloatable($value) {
  124. $this->setLayoutProperty("flotable", $value);
  125. return $this;
  126. }
  127. /**
  128. * True to allow clicking a collapsed region's bar to display the region's panel floated above the layout, false to force the user to fully expand a collapsed region by clicking the expand button to see it again (defaults to true).
  129. * @return boolean
  130. */
  131. public function getFloatable() {
  132. return $this->getLayoutProperty("flotable");
  133. }
  134. // Margins
  135. /**
  136. * An object containing margins to apply to the region in the format {left: (left margin), top: (top margin), right: (right margin), bottom: (bottom margin)} or a string with the margin values in the format "left top right bottom"
  137. * @param mixed $value
  138. * @return PhpExt_Layout_BorderLayoutData
  139. */
  140. public function setMargins($value) {
  141. $this->setLayoutProperty("margins", $value);
  142. return $this;
  143. }
  144. /**
  145. * An object containing margins to apply to the region in the format {left: (left margin), top: (top margin), right: (right margin), bottom: (bottom margin)} or a string with the margin values in the format "left top right bottom"
  146. * @return mixed
  147. */
  148. public function getMargins() {
  149. return $this->getLayoutProperty("margins");
  150. }
  151. // MinHeight
  152. /**
  153. * The minimum allowable height in pixels for this region (defaults to 50)
  154. * @param integer $value
  155. * @return PhpExt_Layout_BorderLayoutData
  156. */
  157. public function setMinHeight($value) {
  158. $this->setLayoutProperty("minHeight", $value);
  159. return $this;
  160. }
  161. /**
  162. * The minimum allowable height in pixels for this region (defaults to 50)
  163. * @return integer
  164. */
  165. public function getMinHeight() {
  166. return $this->getLayoutProperty("minHeight");
  167. }
  168. // MinWidth
  169. /**
  170. * The minimum allowable width in pixels for this region (defaults to 50)
  171. * @param integer $value
  172. * @return PhpExt_Layout_BorderLayoutData
  173. */
  174. public function setMinWidth($value) {
  175. $this->setLayoutProperty("minWidth", $value);
  176. return $this;
  177. }
  178. /**
  179. * The minimum allowable width in pixels for this region (defaults to 50)
  180. * @return integer
  181. */
  182. public function getMinWidth() {
  183. return $this->getLayoutProperty("minWidth");
  184. }
  185. // Region
  186. /**
  187. * The region to render the related component. Posible values are:
  188. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_NORTH}</li>
  189. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_WEST}</li>
  190. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_CENTER}</li>
  191. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_EAST}</li>
  192. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_SOUTH}</li>
  193. * @param string $value
  194. * @return PhpExt_Layout_BorderLayoutData
  195. */
  196. public function setRegion($value) {
  197. $this->setLayoutProperty("region", $value);
  198. return $this;
  199. }
  200. /**
  201. * The region to render the related component. Posible values are:
  202. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_NORTH}</li>
  203. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_WEST}</li>
  204. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_CENTER}</li>
  205. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_EAST}</li>
  206. * <li>{@link PhpExt_Layout_BorderLayoutData::REGION_SOUTH}</li>
  207. * @return string
  208. */
  209. public function getRegion() {
  210. return $this->getLayoutProperty("region");
  211. }
  212. // Split
  213. /**
  214. * True to display a Ext.SplitBar between this region and its neighbor, allowing the user to resize the regions dynamically (defaults to false). When split = true, it is common to specify a minSize and maxSize for the region.
  215. * @param boolean $value
  216. * @return PhpExt_Layout_BorderLayoutData
  217. */
  218. public function setSplit($value) {
  219. $this->setLayoutProperty("split", $value);
  220. return $this;
  221. }
  222. /**
  223. * True to display a Ext.SplitBar between this region and its neighbor, allowing the user to resize the regions dynamically (defaults to false). When split = true, it is common to specify a minSize and maxSize for the region.
  224. * @return boolean
  225. */
  226. public function getSplit() {
  227. return $this->getLayoutProperty("split");
  228. }
  229. // SplitTip
  230. /**
  231. * The tooltip to display when the user hovers over a non-collapsible region's split bar (defaults to "Drag to resize."). Only applies if useSplitTips = true.
  232. * @param string $value
  233. * @return PhpExt_Layout_BorderLayoutData
  234. */
  235. public function setSplitTip($value) {
  236. $this->setLayoutProperty("splitTip", $value);
  237. return $this;
  238. }
  239. /**
  240. * The tooltip to display when the user hovers over a non-collapsible region's split bar (defaults to "Drag to resize."). Only applies if useSplitTips = true.
  241. * @return string
  242. */
  243. public function getSplitTip() {
  244. return $this->getLayoutProperty("splitTip");
  245. }
  246. // UseSplitTips
  247. /**
  248. * True to display a tooltip when the user hovers over a region's split bar (defaults to false). The tooltip text will be the value of either splitTip or collapsibleSplitTip as appropriate.
  249. * @param boolean $value
  250. * @return PhpExt_Layout_BorderLayoutData
  251. */
  252. public function setUseSplitTips($value) {
  253. $this->setLayoutProperty("useSplitTips", $value);
  254. return $this;
  255. }
  256. /**
  257. * True to display a tooltip when the user hovers over a region's split bar (defaults to false). The tooltip text will be the value of either splitTip or collapsibleSplitTip as appropriate.
  258. * @return boolean
  259. */
  260. public function getUseSplitTips() {
  261. return $this->getLayoutProperty("useSplitTips");
  262. }
  263. /**#@+
  264. * Inherited from SpliBar Config Options:
  265. *
  266. * The border layout inherits the properties from the splitbar for the regions split element.
  267. *
  268. */
  269. // MaxSize
  270. /**
  271. * The maximum size of the resizing element. (Defaults to 2000)
  272. * @param integer $value
  273. * @return PhpExt_Layout_BorderLayoutData
  274. */
  275. public function setMaxSize($value) {
  276. $this->setLayoutProperty("maxSize", $value);
  277. return $this;
  278. }
  279. /**
  280. * The maximum size of the resizing element. (Defaults to 2000)
  281. * @return integer
  282. */
  283. public function getMaxSize() {
  284. return $this->getLayoutProperty("maxSize");
  285. }
  286. // MinSize
  287. /**
  288. * The minimum size of the resizing element. (Defaults to 0)
  289. * @param integer $value
  290. * @return PhpExt_Layout_BorderLayoutData
  291. */
  292. public function setMinSize($value) {
  293. $this->setLayoutProperty("minSize", $value);
  294. return $this;
  295. }
  296. /**
  297. * The minimum size of the resizing element. (Defaults to 0)
  298. * @return integer
  299. */
  300. public function getMinSize() {
  301. return $this->getLayoutProperty("minSize");
  302. }
  303. // UseShim
  304. /**
  305. * Whether to create a transparent shim that overlays the page when dragging, enables dragging across iframes.
  306. * @param boolean $value
  307. * @return PhpExt_Layout_BorderLayoutData
  308. */
  309. public function setUseShim($value) {
  310. $this->setLayoutProperty("useShim", $value);
  311. return $this;
  312. }
  313. /**
  314. * Whether to create a transparent shim that overlays the page when dragging, enables dragging across iframes.
  315. * @return boolean
  316. */
  317. public function getUseShim() {
  318. return $this->getLayoutProperty("useShim");
  319. }
  320. /**#@-*/
  321. public function __construct($region) {
  322. parent::__construct();
  323. $this->setRegion($region);
  324. }
  325. /**
  326. * Creates a region
  327. *
  328. * @return PhpExt_Layout_BorderLayoutData
  329. */
  330. public static function createNorthRegion() {
  331. return new PhpExt_Layout_BorderLayoutData(PhpExt_Layout_BorderLayoutData::REGION_NORTH);
  332. }
  333. /**
  334. * Creates a region
  335. *
  336. * @return PhpExt_Layout_BorderLayoutData
  337. */
  338. public static function createWestRegion() {
  339. return new PhpExt_Layout_BorderLayoutData(PhpExt_Layout_BorderLayoutData::REGION_WEST);
  340. }
  341. /**
  342. * Creates a region
  343. *
  344. * @return PhpExt_Layout_BorderLayoutData
  345. */
  346. public static function createCenterRegion() {
  347. return new PhpExt_Layout_BorderLayoutData(PhpExt_Layout_BorderLayoutData::REGION_CENTER);
  348. }
  349. /**
  350. * Creates a region
  351. *
  352. * @return PhpExt_Layout_BorderLayoutData
  353. */
  354. public static function createEastRegion() {
  355. return new PhpExt_Layout_BorderLayoutData(PhpExt_Layout_BorderLayoutData::REGION_EAST);
  356. }
  357. /**
  358. * Creates a region
  359. *
  360. * @return PhpExt_Layout_BorderLayoutData
  361. */
  362. public static function createSouthRegion() {
  363. return new PhpExt_Layout_BorderLayoutData(PhpExt_Layout_BorderLayoutData::REGION_SOUTH);
  364. }
  365. }