QControlBase::GetStyleAttributes PHP Method

GetStyleAttributes() public method

a control's HTML "style" attribute
public GetStyleAttributes ( )
    public function GetStyleAttributes()
    {
        $strToReturn = "";
        if ($this->strWidth) {
            if (is_numeric($this->strWidth)) {
                $strToReturn .= sprintf("width:%spx;", $this->strWidth);
            } else {
                $strToReturn .= sprintf("width:%s;", $this->strWidth);
            }
        }
        if ($this->strHeight) {
            if (is_numeric($this->strHeight)) {
                $strToReturn .= sprintf("height:%spx;", $this->strHeight);
            } else {
                $strToReturn .= sprintf("height:%s;", $this->strHeight);
            }
        }
        if ($this->strDisplayStyle && $this->strDisplayStyle != QDisplayStyle::NotSet) {
            $strToReturn .= sprintf("display:%s;", $this->strDisplayStyle);
        }
        if ($this->strForeColor) {
            $strToReturn .= sprintf("color:%s;", $this->strForeColor);
        }
        if ($this->strBackColor) {
            $strToReturn .= sprintf("background-color:%s;", $this->strBackColor);
        }
        if ($this->strBorderColor) {
            $strToReturn .= sprintf("border-color:%s;", $this->strBorderColor);
        }
        if (strlen(trim($this->strBorderWidth)) > 0) {
            $strBorderWidth = null;
            try {
                $strBorderWidth = QType::Cast($this->strBorderWidth, QType::Integer);
            } catch (QInvalidCastException $objExc) {
            }
            if (is_null($strBorderWidth)) {
                $strToReturn .= sprintf('border-width:%s;', $this->strBorderWidth);
            } else {
                $strToReturn .= sprintf('border-width:%spx;', $this->strBorderWidth);
            }
            if (!$this->strBorderStyle || $this->strBorderStyle == QBorderStyle::NotSet) {
                // For "No Border Style" -- apply a "solid" style because width is set
                $strToReturn .= "border-style:solid;";
            }
        }
        if ($this->strBorderStyle && $this->strBorderStyle != QBorderStyle::NotSet) {
            $strToReturn .= sprintf("border-style:%s;", $this->strBorderStyle);
        }
        if ($this->strFontNames) {
            $strToReturn .= sprintf("font-family:%s;", $this->strFontNames);
        }
        if ($this->strFontSize) {
            if (is_numeric($this->strFontSize)) {
                $strToReturn .= sprintf("font-size:%spx;", $this->strFontSize);
            } else {
                $strToReturn .= sprintf("font-size:%s;", $this->strFontSize);
            }
        }
        if ($this->blnFontBold) {
            $strToReturn .= "font-weight:bold;";
        }
        if ($this->blnFontItalic) {
            $strToReturn .= "font-style:italic;";
        }
        $strTextDecoration = "";
        if ($this->blnFontUnderline) {
            $strTextDecoration .= "underline ";
        }
        if ($this->blnFontOverline) {
            $strTextDecoration .= "overline ";
        }
        if ($this->blnFontStrikeout) {
            $strTextDecoration .= "line-through ";
        }
        if ($strTextDecoration) {
            $strTextDecoration = trim($strTextDecoration);
            $strToReturn .= sprintf("text-decoration:%s;", $strTextDecoration);
        }
        if ($this->strCursor && $this->strCursor != QCursor::NotSet) {
            $strToReturn .= sprintf("cursor:%s;", $this->strCursor);
        }
        if ($this->strOverflow && $this->strOverflow != QOverflow::NotSet) {
            $strToReturn .= sprintf("overflow:%s;", $this->strOverflow);
        }
        if (!is_null($this->intOpacity)) {
            if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) {
                $strToReturn .= sprintf('filter:alpha(opacity=%s);', $this->intOpacity);
            } else {
                $strToReturn .= sprintf('opacity:%s;', $this->intOpacity / 100.0);
            }
        }
        if ($this->strCustomStyleArray) {
            foreach ($this->strCustomStyleArray as $strKey => $strValue) {
                $strToReturn .= sprintf('%s:%s;', $strKey, $strValue);
            }
        }
        return $strToReturn;
    }