1 /* ************************************************************************
3 qooxdoo - the new era of web development
8 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org
11 LGPL 2.1: http://www.gnu.org/licenses/lgpl.html
14 * Sebastian Werner (wpbasti)
15 * Andreas Ecker (ecker)
17 ************************************************************************ */
19 /* ************************************************************************
22 ************************************************************************ */
24 qx.OO.defineClass("qx.ui.embed.IconHtmlEmbed", qx.ui.embed.HtmlEmbed,
25 function(vHtml, vIcon, vIconWidth, vIconHeight)
27 qx.ui.embed.HtmlEmbed.call(this, vHtml);
29 if (typeof vIcon != "undefined")
33 if (typeof vIconWidth != "undefined") {
34 this.setIconWidth(vIconWidth);
37 if (typeof vIconHeight != "undefined") {
38 this.setIconHeight(vIconWidth);
47 ---------------------------------------------------------------------------
49 ---------------------------------------------------------------------------
53 Any URI String supported by qx.ui.basic.Image to display a icon
55 qx.OO.addProperty({ name : "icon", type : "string", impl : "html" });
58 The width of the icon.
59 If configured, this makes qx.ui.embed.IconHtmlEmbed a little bit faster as it does not need to wait until the image loading is finished.
61 qx.OO.addProperty({ name : "iconWidth", type : "number", impl : "html" });
64 The height of the icon
65 If configured, this makes qx.ui.embed.IconHtmlEmbed a little bit faster as it does not need to wait until the image loading is finished.
67 qx.OO.addProperty({ name : "iconHeight", type : "number", impl : "html" });
70 Space in pixels between the icon and the HTML.
72 qx.OO.addProperty({ name : "spacing", type : "number", defaultValue : 4, impl : "html" });
79 ---------------------------------------------------------------------------
81 ---------------------------------------------------------------------------
84 qx.Proto._mshtml = qx.sys.Client.getInstance().isMshtml();
86 qx.Proto._syncHtml = function()
90 if (qx.util.Validation.isValidString(this.getIcon()))
92 vHtml.push("<img src=\"");
93 vHtml.push(qx.manager.object.AliasManager.getInstance().resolvePath(this._mshtml ? "static/image/blank.gif" : this.getIcon()));
94 vHtml.push("\" style=\"vertical-align:middle;");
96 if (qx.util.Validation.isValidNumber(this.getSpacing()))
98 vHtml.push("margin-right:");
99 vHtml.push(this.getSpacing());
103 if (qx.util.Validation.isValidNumber(this.getIconWidth()))
105 vHtml.push("width:");
106 vHtml.push(this.getIconWidth());
110 if (qx.util.Validation.isValidNumber(this.getIconHeight()))
112 vHtml.push("height:");
113 vHtml.push(this.getIconHeight());
119 vHtml.push("filter:");
120 vHtml.push("progid:DXImageTransform.Microsoft.AlphaImageLoader(src='");
121 vHtml.push(qx.manager.object.AliasManager.getInstance().resolvePath(this.getIcon()));
122 vHtml.push("',sizingMethod='scale')");
129 if (qx.util.Validation.isValidString(this.getHtml())) {
130 vHtml.push(this.getHtml());
133 this.getElement().innerHTML = vHtml.join("");