Compare Revisions

CustomizableUI.jsm

Change Revisions

Revision 549831:

Revision 549831 by GijsKruitbosch on

Revision 587203:

Revision 587203 by Noitidart on

Title:
CustomizableUI.jsm
CustomizableUI.jsm
Slug:
Mozilla/JavaScript_code_modules/CustomizableUI.jsm
Mozilla/JavaScript_code_modules/CustomizableUI.jsm
Content:

Revision 549831
Revision 587203
n1350    <h6>n1350    <h6 id="Parameters_35">
n1361    <h6>n1361    <h6 id="Return_value_15">
tt1619    <h2 id="Properties">
1620      Examples
1621    </h2>
1622    <h3 id="Area_constants">
1623      Custom Type - Simple
1624    </h3>
1625    <p>
1626      This shows a simple example of how to make widget with type
 > custom.
1619    <p>1627    </p>
1620      &nbsp;1628    <pre>
1629        CustomizableUI.createWidget({ //must run createWidget bef
 >ore windowListener.register because the register function needs t
 >he button added first
1630                id: 'navigator-throbber',
1631                type: 'custom',
1632                defaultArea: CustomizableUI.AREA_NAVBAR,
1633                onBuild: function(aDocument) {
1634                        var toolbaritem = aDocument.createElement
 >NS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul
 >', 'toolbaritem');
1635                        var image = aDocument.createElementNS('ht
 >tp://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'im
 >age');
1636                        
1637                        var props = {
1638                                id: 'navigator-throbber',
1639                                title: 'Activity Indicator',
1640                                align: 'center',
1641                                pack: 'center',
1642                                mousethrough: 'always',
1643                                removable: 'true',
1644                                sdkstylewidget: 'true',
1645                                overflows: false
1646                        };
1647                        for (var p in props) {
1648                                toolbaritem.setAttribute(p, props
 >[p]);
1649                        }
1650                        
1651                        toolbaritem.appendChild(image);
1652                        return toolbaritem;
1653                }
1654        });
1655</pre>
1656    <h3 id="Area_constants">
1657      Custom Type - Involved
1658    </h3>
1659    <p>
1660      The browser uses type custom for it's zoom controls and edi
 >t controls in the Panel. The code is more advanced. It can be fou
 >nd summarized at this gist: <a href="https://gist.github.com/Noit
 >idart/10902477">https://gist.github.com/Noitidart/10902477</a>

Back to History