WoW:UIOBJECT SimpleHTML: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(added synopsis of available tags)
Line 4: Line 4:
==Supported HTML==
==Supported HTML==
Unknown tags are ignored completely (must still be well-formed), unknown attributes for known tags are ignored gracefully. All HTML must be inside <tt>&lt;html&gt;&lt;body&gt;</tt> tags to be displayed (and html and body tags must be terminated for HTML to be parsed). SimpleHTML accepts both double and single quotes for specifying parameter values, double quotes are used in examples below.
Unknown tags are ignored completely (must still be well-formed), unknown attributes for known tags are ignored gracefully. All HTML must be inside <tt>&lt;html&gt;&lt;body&gt;</tt> tags to be displayed (and html and body tags must be terminated for HTML to be parsed). SimpleHTML accepts both double and single quotes for specifying parameter values, double quotes are used in examples below.
===Overview===
&lt;(h1|h2|h3|p) [align=(left|center|right)] /&gt;
&lt;img src=IMAGE_SOURCE [align=(left|center|right)] [width=NUM] [height=NUM] /&gt;
&lt;a href=LINK /&gt;
&lt;br /&gt;


===Supported tags===
===Supported tags===

Revision as of 02:35, 5 November 2007

Widget API < SimpleHTML

SimpleHTML widgets allow display of simple HTML markup as well as standard escape sequences. The two may be combined; if HTML is not valid (not well-formed XHTML), it will be displayed literaly.

Supported HTML

Unknown tags are ignored completely (must still be well-formed), unknown attributes for known tags are ignored gracefully. All HTML must be inside <html><body> tags to be displayed (and html and body tags must be terminated for HTML to be parsed). SimpleHTML accepts both double and single quotes for specifying parameter values, double quotes are used in examples below.

Overview

<(h1|h2|h3|p) [align=(left|center|right)] />
<img src=IMAGE_SOURCE [align=(left|center|right)] [width=NUM] [height=NUM] />
<a href=LINK />
<br />

Supported tags

h1, h2, h3, p
Text containers; following optional attributes
  • align - (left, center, right) controls positioning of the text element,
img
Image, only outside of text containers; following attributes are supported:
  • align - (left, center, right) controls positioning of the image.
  • width - (number) width of image in pixels.
  • height - (number) height of image in pixels.
  • src - (string) image source, for example Interface\Icons\Ability_Ambush
a
anchor (link only), only displayed inside text containers; following attributes
  • href - (string) link to pass OnHyperLink* widget handlers
br
line break, no attributes.


Example

<html><body>
 <h1>SimpleHTML Demo: Ambush</h1>
 <img src="Interface\Icons\Ability_Ambush" width="32" height="32" align="right"/>
 <p align="center">'You think this hurts? Just wait.'</p><br/><br/>
 <p>Among every ability a rogue has at his disposal,<br/>Ambush is without a doubt the hardest hitting Rogue ability.</p>
</body></html>

Standard escape sequences

SimpleHTML also supports the usual UI Escape Sequences, which can be used to change font color, or as an alternative syntax to specify hyperlinks.

Setting element styles

It is possible to set different fonts for the text-container elements (h1, h2, h3, and p), using:

SimpleHTML:SetFont('element', font); -- SimpleHTML:SetFont('h1', GameFontHighlightLarge);

(see the SetFont documenation for more details)

You can also define font properties for these elements in your XML files, eg:

<SimpleHTML ...>
 <FontStringHeader1 inherits="GameFontHighlightLarge"/>
</SimpleHTML>