Class QHtmlAttributeManagerBase
A base class for objects that manage html attributes. Uses array functions and defines a couple of arrays to manage the attributes. Values will be html escaped when printed.
Includes: - helper functions to manage the class, style, and data-* attributes specially. - helper functions to manage 'name-*' classes that are found in css frameworks like Bootstrap and Foundation. - helpers for __get and __set functions, partially for backwards compatibility and also to make the setting of some attributes and styles easier (so you don't have to remember how to set them).
Usage: Use the helper functions to setup your styles, classes, data-* and other attributes, then call renderHtmlAttributes() to render the attributes to insert them into a tag.
- QBaseClass
- QHtmlAttributeManagerBase
Direct known subclasses
QHtmlAttributeManagerIndirect known subclasses
CalculatorWidget, MyControl, QActionControl, QProgressbarBase, QProgressbarGen, QRadioButton, QRadioButtonList, QResizable, QResizableBase, QResizableGen, QSampleControl, QSelectable, QSelectableBase, QAutocomplete, QSelectableGen, QSelectMenu, QSelectMenuBase, QSelectMenuGen, QSlider, QSliderBase, QSliderGen, QSortable, QSortableBase, QSortableGen, QAutocompleteBase, QSpinner, QSpinnerBase, QSpinnerGen, QTabs, QTabsBase, QTabsGen, QTag, QTagStyler, QTestControl, QTextBox, QAutocompleteGen, QTextBoxBase, QTreeNav, QUrlTextBox, QWaitIcon, QWriteBox, RecordsSummary, SampleComposite, SelectableLabel, QBlockControl, QButton, QButtonBase, QCalendar, QCheckBox, QCheckBoxList, NavPanel, QControl, QControlBase, QControlLabel, QControlProxy, QCsvTextBox, QDataGrid, QDataGridBase, QDataGridLegacy, QDataGridLegacyBase, QDataGridLegacyRow, PersonEditPanel, QDataGridLegacyRowStyle, QDataRepeater, QDatepicker, QDatepickerBase, QDatepickerBox, QDatepickerBoxBase, QDatepickerBoxGen, QDatepickerGen, QDateTimePicker, QDateTimeTextBox, ProjectEditPanel, QDialog, QDialogBase, QDialogBox, QDialogGen, QDraggable, QDraggableBase, QDraggableGen, QDroppable, QDroppableBase, QDroppableGen, ProjectPickerListBox, QEmailTextBox, QFieldset, QFileAsset, QFileAssetBase, QFileAssetDialog, QFileControl, QFloatTextBox, QHListControl, QHtmlTable, QHtmlTableBase, ProjectViewPanel, QImageBase, QImageBrowser, QImageBrowserBase, QImageBrowserNav, QImageBrowserThumbnails, QImageButton, QImageControl, QImageControlBase, QImageFileAsset, QImageLabel, QAccordion, QImageLabelBase, QImageRollover, QIntegerTextBox, QJqButton, QJqButtonBase, QJqButtonGen, QJqCheckBox, QJqCheckBoxBase, QJqCheckBoxGen, QJqRadioButton, QAccordionBase, QJqRadioButtonBase, QJqRadioButtonGen, QJsTimer, QJsTimerBase, QLabel, QLinkButton, QListBox, QListBoxBase, QListControl, QListItemStyle, QAccordionGen, QMenu, QMenuBase, QMenuGen, QModelConnectorEditDlg, QNumericTextBox, QPaginatedControl, QPaginator, QPaginatorBase, QPanel, QProgressbar
public
boolean
|
|
public
|
|
public
null
|
|
public
array
|
#
GetHtmlAttributes( array|null $attributeOverrides = null, array|null $styleOverrides = null, array|null $selection = null )
Returns an attribute array, with styles rendered. |
public
boolean
|
|
public
|
#
SetDataAttribute( $strName, $strValue )
Sets the given value as an html "data-*" attribute. The named value will be retrievable in jQuery by using '.data("$strName");' |
public
null
|
|
public
|
|
public
boolean
|
#
SetCssStyle( string $strName, string $strValue, boolean $blnIsLength = false )
Sets the Css named value to the given property. |
public
boolean
|
|
public
boolean
|
|
public
string|null
|
|
public
|
#
SetCssBoxValue( string $strPrefix, string|array $mixValue )
Sets a box style, like margin or padding. Can accept: - string, which will pass the string verbatim to the shortcut prefix (e.g. margin: 0px 1px) - array, which can accept two styles: - [top, right, bottom, left], or - ['top'=>top, 'bottom'=>bottom, etc.] |
public
|
#
SetCssClass( $strNewClass )
Sets the CSS class to the given value(s). Multiple class names can be separated with a space. If you preceed the class names with a plus(+) they will be added to the current class. If a minus (-) they will be removed. |
public
boolean
|
#
AddCssClass( string $strNewClass )
Adds a css class name to the 'class' property. Prevents duplication. |
public
|
#
RemoveCssClass( string $strCssClass )
This will remove a css class name from the 'class' property (if it exists). |
public
|
#
RemoveCssClassesByPrefix( string $strPrefix )
Many CSS frameworks use families of classes, which are built up from a base family name. For example, Bootstrap uses 'col-lg-6' to represent a column that is 6 units wide on large screens and Foundation uses 'large-6' to do the same thing. This utility removes classes that start with a particular prefix to remove whatever sizing class was specified. |
public
boolean
|
|
protected
|
#
Override(
Permanently overrides the current styles with a new set of attributes and styles. |
public
|
#
MarkAsModified( )
Mark the parent class as modified. The host class must implement this if this functionality is desired. |
public
string
|
#
RenderHtmlAttributes( null|string $attributeOverrides = null, null|string $styleOverrides = null )
Returns the html for the attributes. Allows the given arrays to override the attributes and styles before rendering. |
public
string
|
#
RenderCssStyles( null|string $styleOverrides = null )
Returns the styles rendered as a css style string. |
protected
string
|
#
RenderTag( $strTag, null|array $attributeOverrides = null, null|array $styleOverrides = null, null|string $strInnerHtml = null, boolean $blnIsVoidElement = false, $blnNoSpace = false )
Helper function to render the current attributes and styles in a tag. Overrides will be merged in with current values before creating the output, but they will not affect the current values. |
public
mixed
|
|
public
mixed
|
OverrideAttributes(),
__call()
|
protected
array
|
$attributes
attributes stored in PHP native format so they can be retrieved. Escaping happens when they are drawn. |
#
array()
|
protected
array
|
$styles
|
#
array()
|
public
string
|
$AccessKey
allows you to specify what Alt-Letter combination will automatically focus that control on the form |
public
string
|
$BackColor
sets the CSS background-color of the control |
public
string
|
$BorderColor
sets the CSS border-color of the control |
public
string
|
$BorderWidth
sets the CSS border-width of the control |
public
string
|
$BorderStyle
is used to set CSS border-style by |
public
string
|
$BorderCollapse
defines the BorderCollapse css style for a table |
public
string
|
$CssClass
sets or returns the CSS class for this control. When setting, if you precede the class name with a plus sign (+), it will add the class(es) to the currently existing classes, rather than replace them. Can add or set more than one class at once by separating names with a space. |
public
string
|
$Cursor
is used to set CSS cursor property by |
public
boolean
|
$Display
shows or hides the control using the CSS display property. In either case, the control is still rendered on the page. See the Visible property if you wish to not render a control. |
public
string
|
$DisplayStyle
is used to set CSS display property by |
public
boolean
|
$Enabled
specifies whether or not this is enabled (it will grey out the control and make it inoperable if set to true) |
public
boolean
|
$FontBold
sets the font bold or normal |
public
boolean
|
$FontItalic
sets the Font italic or normal |
public
string
|
$FontNames
sets the name of used fonts |
public
boolean
|
$FontOverline
|
public
string
|
$FontSize
sets the font-size of the control |
public
boolean
|
$FontStrikeout
|
public
boolean
|
$FontUnderline
sets the font underlined |
public
string
|
$ForeColor
sets the CSS color property, which controls text color |
public
string
|
$Height
|
public
string
|
$Left
CSS left property |
public
integer
|
$Opacity
sets the opacity of the control (0-100) |
public
string
|
$Overflow
is used to set CSS overflow property by |
public
string
|
$Position
is used to set CSS position property by |
public
integer
|
$TabIndex
specifies the index/tab order on a form |
public
string
|
$ToolTip
specifies the text to be displayed when the mouse is hovering over the control |
public
string
|
$Top
|
public
string
|
$Width
|
public
string
|
$HorizontalAlign
sets the CSS text-align property |
public
string
|
$VerticalAlign
sets the CSS vertical-align property |
public
boolean
|
$NoWrap
sets the CSS white-space property to nowrap |
public
boolean
|
$ReadOnly
is the "readonly" html attribute (making a textbox "ReadOnly" is similar to setting the textbox to Enabled Readonly textboxes are selectedable, and their values get posted. Disabled textboxes are not selectable and values do not post. |
public
string
|
$AltText
text used for 'alt' attribute in images |
public
string
|
$OrderedListType
type for ordered lists. Expects a QOrderedListType. |
public
string
|
$UnorderedListStyle
style for unordered lists. Expects a QUnorderedListType. |
public write-only
mixed
|
$Padding
sets the CSS padding property. Will accepts a string, which is passed verbatim, or an array, either numerically indexed, in which case it is in top, right, bottom, left order, or keyed with the names 'top', 'right', 'bottom', 'left'. |
public write-only
mixed
|
$Margin
sets the CSS margin property. Will accepts a string, which is passed verbatim, or an array, either numerically indexed, in which case it is in top, right, bottom, left order, or keyed with the names 'top', 'right', 'bottom', 'left' |
public write-only
array
|
$Data
a key/value array of data-* items to set. Keys can be in camelCase notation, in which case they will be converted to dashed notation. Use GetDataAttribute() to retrieve the value of a data attribute. |