TStyle encapsulates the CSS style applied to a control.
С версии: 3.0
Автор: Qiang Xue (qiang.xue@gmail.com)
Наследование: extends Prado\TComponent
 /**
  * Merges the style with a new one.
  * If a style field is not set in this style, it will be overwritten by
  * the new one.
  * @param TStyle the new style
  */
 public function mergeWith($style)
 {
     parent::mergeWith($style);
     if ($style instanceof TWizardNavigationButtonStyle) {
         if ($style->_imageUrl !== null) {
             $this->_imageUrl = $style->_imageUrl;
         }
         if ($style->_buttonText !== null) {
             $this->_buttonText = $style->_buttonText;
         }
         if ($style->_buttonType !== null) {
             $this->_buttonType = $style->_buttonType;
         }
     }
 }
Пример #2
0
 /**
  * Adds attributes related to CSS styles to renderer.
  * This method overrides the parent implementation.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function addAttributesToRender($writer)
 {
     if (!$this->getWrap()) {
         $writer->addStyleAttribute('white-space', 'nowrap');
     }
     if (($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) {
         $writer->addAttribute('align', strtolower($horizontalAlign));
     }
     if (($verticalAlign = $this->getVerticalAlign()) !== TVerticalAlign::NotSet) {
         $writer->addAttribute('valign', strtolower($verticalAlign));
     }
     parent::addAttributesToRender($writer);
 }
Пример #3
0
 /**
  * @return TStyle the style for the active tab div
  */
 public function getActiveTabStyle()
 {
     if (($style = $this->getViewState('ActiveTabStyle', null)) === null) {
         $style = new TStyle();
         $style->setCssClass('tab-active');
         $this->setViewState('ActiveTabStyle', $style, null);
     }
     return $style;
 }
Пример #4
0
 /**
  * Merges the style with a new one.
  * If a style field is not set in this style, it will be overwritten by
  * the new one.
  * @param TStyle the new style
  */
 public function mergeWith($style)
 {
     parent::mergeWith($style);
     if ($style instanceof TPanelStyle) {
         if ($this->_backImageUrl === null && $style->_backImageUrl !== null) {
             $this->_backImageUrl = $style->_backImageUrl;
         }
         if ($this->_direction === null && $style->_direction !== null) {
             $this->_direction = $style->_direction;
         }
         if ($this->_horizontalAlign === null && $style->_horizontalAlign !== null) {
             $this->_horizontalAlign = $style->_horizontalAlign;
         }
         if ($this->_scrollBars === null && $style->_scrollBars !== null) {
             $this->_scrollBars = $style->_scrollBars;
         }
         if ($this->_wrap === null && $style->_wrap !== null) {
             $this->_wrap = $style->_wrap;
         }
     }
 }
Пример #5
0
 /**
  * Adds attributes related to CSS styles to renderer.
  * This method overrides the parent implementation.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function addAttributesToRender($writer)
 {
     if (($url = trim($this->getBackImageUrl())) !== '') {
         $writer->addStyleAttribute('background-image', 'url(' . $url . ')');
     }
     if (($horizontalAlign = $this->getHorizontalAlign()) !== THorizontalAlign::NotSet) {
         $writer->addStyleAttribute('text-align', strtolower($horizontalAlign));
     }
     if (($cellPadding = $this->getCellPadding()) >= 0) {
         $writer->addAttribute('cellpadding', "{$cellPadding}");
     }
     if (($cellSpacing = $this->getCellSpacing()) >= 0) {
         $writer->addAttribute('cellspacing', "{$cellSpacing}");
     }
     if ($this->getBorderCollapse()) {
         $writer->addStyleAttribute('border-collapse', 'collapse');
     }
     switch ($this->getGridLines()) {
         case TTableGridLines::Horizontal:
             $writer->addAttribute('rules', 'rows');
             break;
         case TTableGridLines::Vertical:
             $writer->addAttribute('rules', 'cols');
             break;
         case TTableGridLines::Both:
             $writer->addAttribute('rules', 'all');
             break;
     }
     parent::addAttributesToRender($writer);
 }
Пример #6
0
 /**
  * @return TStyle the style for the active header div
  */
 public function getActiveHeaderStyle()
 {
     if (($style = $this->getViewState('ActiveHeaderStyle', null)) === null) {
         $style = new TStyle();
         $style->setCssClass('accordion-header-active');
         $this->setViewState('ActiveHeaderStyle', $style, null);
     }
     return $style;
 }