Class Box

Description

Box

This class is the representation of a box. a box is a rectangular zone with abscisse, ordinate, width, height, etc.

  • author: guillaume luchet <guillaume@geelweb.org>
  • version: $Id: Box.php,v 1.3 2007/10/18 16:32:03 geelweb Exp $
  • copyright: Copyright (c) 2007, Guillaume Luchet
  • todo: add helper method (translate, rotate, etc)
  • license: BSD License

Located in /mains/Box.php (line 29)


	
			
Variable Summary
 mixed $height
 string $padding
 mixed $width
 mixed $x
 mixed $y
Method Summary
 void __construct ([array $params = array()])
 void setPadding (mixed $padding)
 mixed __get (string $property)
 mixed __set (string $property, mixed $value)
Variables
mixed $height (line 51)

height

Height of the box

  • access: public
string $padding = array(
'top' => 0,
'right' => 0,
'bottom' => 0,
'left' => 0)
(line 81)

padding

padding of the box

  • access: protected
mixed $width (line 41)

width

Width of the box

  • access: public
mixed $x (line 61)

x

Upper left corner abscisse of the box

  • access: public
mixed $y (line 71)

y

Upper left corner ordinate of the box

  • access: public
Methods
Constructor __construct (line 110)

__construct

Build the box

params:

  1.  array(
  2.      'height'  => 10,
  3.      'width'   => 20,
  4.      'x'       => 5,
  5.      'y'       => 5,
  6.      'padding' => array('left'=>10'top'=>12)
  7.  );

  • access: public
void __construct ([array $params = array()])
  • array $params: box params
setPadding (line 203)

setPadding

set the padding property

$padding can be:

  • numeric: all the elements of the $padding array take the value
  • comma separated string: the elements take the value of each value in
the order top, right, bottom, left
  • array of keys / values: for each element of the array, the element of the $padding array
width the key take the value

examples:

  1.  $box new Box();
  2.  $box->padding 10;
  3.  print_r($box->padding)// array('top'=>10, 'right'=>10, 'bottom'=>10, 'left'=>10);
  4.  
  5.  $box->padding '4, 5, 1, 10';
  6.  print_r($box->padding)// array('top'=>4, 'right'=>5, 'bottom'=>1, 'left'=>10);
  7.  
  8.  $box->padding '5, 10'// the unspecified values take the last value
  9.  print_r($box->padding)// array('top'=>5, 'right'=>10, 'bottom'=>10, 'left'=>10);
  10.  
  11.  $box->padding array('bottom'=>12)// the unspecified values not change
  12.  print_r($box->padding)// array('top'=>5, 'right'=>10, 'bottom'=>12, 'left'=>10);

  • access: public
void setPadding (mixed $padding)
  • mixed $padding
__get (line 159)

__get

  • access: public
mixed __get (string $property)
  • string $property
__set (line 140)

__set

  • access: public
mixed __set (string $property, mixed $value)
  • string $property
  • mixed $value

Documentation generated on Tue, 23 Oct 2007 11:31:53 +0200 by phpDocumentor 1.4.0