XUL ( XML User-interface Language ) es un llenguatge per programar interfícies. Suposo que molta gent n’ha sentit a parlar perque es el llenguatge amb que es programes els plug-ins de Firefox. Esta desenvolupat per Mozilla, es multiplataforma i entre d’altres s’han programat el Mozilla Firefox, Thunderbird, Songbird, etc.
Aquí un petit “Hi world” molt il·lustratiu:
<“xml-stylesheet href=”chrome://global/skin/” type=”text/css””>
<window
id=”Hola”
title=”Ejemplo: hola mundo”
orient=”vertical”
persist=”screenX screenY width height”
xmlns= “http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul”
width=”300″ height=”300″>
<toolbox flex=”1″>
<menubar>
<menu label=”File”>
<menupopup id=”file-popup”>
<menuitem label=”New”/>
<menuitem label=”Open”/>
<menuitem label=”Save”/>
<menuseparator/>
<menuitem label=”Exit”/>
</menupopup>
</menu>
<menu label=”Edit”>
<menupopup id=”edit-popup”>
<menuitem label=”Undo”/>
<menuitem label=”Redo”/>
</menupopup>
</menu>
</menubar>
<toolbar id=”nav-toolbar”>
<toolbarbutton label=”Back”/>
<toolbarbutton label=”Forward”/>
</toolbar>
</toolbox>
<description id=’desc’ style=’font-size:24pt’>Hola mundo</description>
<textbox id=”some-text” value=’Hi horld’/>
<button label=”Alert” oncommand=”alert(‘You pressed me!’); return false;”/>
<button label=”Nova Finestra” oncommand=”window.open(‘a1.xul’, ‘bmarks’, ‘chrome’); return false;”/>
<button label=”Canvia Desc” oncommand=”document.getElementById(‘desc’).value=’Welcome’; return false;”/>
<button label=”Lostsys” oncommand=”window.location=’http://www.lostsys.com’; return false;”/>
<tree flex=”1″>
<treecols>
<treecol id=”name” label=”Filename” flex=”1″/>
<treecol id=”location” label=”Location” flex=”2″/>
<treecol id=”size” label=”Size” flex=”1″/>
</treecols>
<treechildren>
<treeitem>
<treerow>
<treecell label=”mozilla”/>
<treecell label=”/usr/local”/>
<treecell label=”2520 bytes”/>
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell label=”root”/>
<treecell label=”/”/>
<treecell label=”1520 bytes”/>
</treerow>
</treeitem>
</treechildren>
</tree>
<splitter collapse=”before” resizeafter=”grow”/>
</window>
Per ha executar-lo només s’ha d’obrir amb Firefox.
Aquí un link amb força material per començar a programar amb XUL.