Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TScroll.php

Documentation is available at TScroll.php

  1. <?php
  2. namespace Adianti\Widget\Container;
  3.  
  4. use Adianti\Widget\Base\TElement;
  5. use Adianti\Widget\Base\TStyle;
  6. use Adianti\Widget\Util\TSourceCode;
  7.  
  8. /**
  9.  * Scrolled Window: Allows to add another containers inside, creating scrollbars when its content is bigger than its visual area
  10.  * 
  11.  * @version    7.4
  12.  * @package    widget
  13.  * @subpackage container
  14.  * @author     Pablo Dall'Oglio
  15.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  16.  * @license    http://www.adianti.com.br/framework-license
  17.  */
  18. class TScroll extends TElement
  19. {
  20.     private $width;
  21.     private $height;
  22.     private $margin;
  23.     private $transparency;
  24.     
  25.     /**
  26.      * Class Constructor
  27.      */
  28.     public function __construct()
  29.     {
  30.         $this->{'id''tscroll_' mt_rand(10000000001999999999);
  31.         $this->margin 2;
  32.         $this->transparency FALSE;
  33.         parent::__construct('div');
  34.     }
  35.     
  36.     /**
  37.      * Set the scroll size
  38.      * @param  $width   Panel's width
  39.      * @param  $height  Panel's height
  40.      */
  41.     public function setSize($width$height)
  42.     {
  43.         $this->width  $width;
  44.         $this->height $height;
  45.     }
  46.     
  47.     /**
  48.      * Set the scrolling margin
  49.      * @param  $margin Margin
  50.      */
  51.     public function setMargin($margin)
  52.     {
  53.         $this->margin $margin;
  54.     }
  55.     
  56.     /** 
  57.      * compability reasons
  58.      */
  59.     public function setTransparency($bool)
  60.     {
  61.         $this->transparency $bool;
  62.     }
  63.     
  64.     /**
  65.      * Shows the tag
  66.      */
  67.     public function show()
  68.     {
  69.         if (!$this->transparency)
  70.         {
  71.             $this->{'style'.= ';border: 1px solid #c2c2c2';
  72.             $this->{'style'.= ';background: #ffffff';
  73.         }
  74.         $this->{'style'.= ";padding: {$this->margin}px";
  75.         
  76.         if (!empty($this->width))
  77.         {
  78.             $this->{'style'.= is_numeric($this->width";width:{$this->width}px";width:{$this->width}";
  79.         }
  80.         
  81.         if (!empty($this->height))
  82.         {
  83.             $this->{'style'.= is_numeric($this->height";height:{$this->height}px";height:{$this->height}";
  84.         }
  85.         
  86.         $this->{'class'.= " tscroll";
  87.         parent::show();
  88.     }
  89. }