<div dir="ltr">Good rationale :)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 30 July 2013 12:29, Manuel Quiñones <span dir="ltr"><<a href="mailto:manuq@laptop.org" target="_blank">manuq@laptop.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">MenuPalette landed in sugar-web. It is a palette that contains<br>
clickable items. Like the ones in GTK, they have a label of text and<br>
can have an icon. When an item is clicked, the palette emits a signal<br>
with information that contains the clicked element. The API to create<br>
a MenuPalette is this:<br>
<br>
<br>
menuData = [{label: "One", id: "one-button", icon: true},<br>
{label: "Two", id: "two-button", icon: true},<br>
...];<br>
<br>
menuPalette = new menupalette.MenuPalette(invoker, undefined, menuData);<br>
<br>
<br>
The icon is added in CSS right now, like:<br>
<br>
.palette #one-button span {<br>
background-image: url(../icons/one.svg);<br>
}<br>
<br>
<br>
But when we have an icon lookup, it would be nice to pass the name of<br>
the icon with the data, directly.<br>
<br>
Note that this is a different approach we are taking in the toolbars,<br>
where you can define the buttons in the HTML. Daniel N asked me for<br>
an explanation.<br>
<br>
I think writting HTML directly makes sense for simple and static<br>
content. Like adding a <button> element copy/pasting another one from<br>
index.html as explained here:<br>
<br>
<a href="http://developer.sugarlabs.org/activity.md.html#adding%20a%20button%20to%20the%20toolbar" target="_blank">http://developer.sugarlabs.org/activity.md.html#adding%20a%20button%20to%20the%20toolbar</a><br>
<br>
And also it makes the developer understand how HTML, CSS and JS work<br>
together. Of course that doesn't inhibit the developer to add the<br>
button from JS, as explained here:<br>
<br>
<a href="http://developer.sugarlabs.org/activity.md.html#adding%20html%20content%20dinamically" target="_blank">http://developer.sugarlabs.org/activity.md.html#adding%20html%20content%20dinamically</a><br>
<br>
For the palette in question, its content is a bit complex: it can have<br>
icons or not, and <span> elements are used for that. So I decided to<br>
provide a cleaner API and hide the details of the structure.<br>
Structure that is very likely to change as we improve palettes, but<br>
the data is less likely to change.<br>
<br>
Opinions?<br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
--<br>
.. manuq ..<br>
_______________________________________________<br>
Sugar-devel mailing list<br>
<a href="mailto:Sugar-devel@lists.sugarlabs.org">Sugar-devel@lists.sugarlabs.org</a><br>
<a href="http://lists.sugarlabs.org/listinfo/sugar-devel" target="_blank">http://lists.sugarlabs.org/listinfo/sugar-devel</a><br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Daniel Narvaez<br>
</div>