/** * Represents a XUL panel in JSFL. The object can be set up and then used to invoke a XUL panel without writing an actual XUL file. * The XML can be generated purely in JSFL and passed in, or you can use convenience methods to add various controls without having * to writing XML strings in JSFL. * *

For full-on XUL reference, the Mozilla document is here: * https://developer.mozilla.org/en/XUL_Reference. Note that Flash supports a very small subset of this.

* **/ /** * Constructor * @param title The title of the window. This is only used if you own XML string is not passed in to the create * method. * @param buttons The remaining arguments are Strings of types of buttons to include. For convenience, use the static * constants XULWindow.ACCEPT and XULWindow.CANCEL. This is only used if you own XML string is not passed in to * the create method. **/ function XULWindow(title) { //fl.trace("Creating new XULWindow"); var that = this; this._title = title || "Options"; var buttons = []; var iLen = arguments.length; for (var i = 1; i < iLen; i++) { buttons.push(arguments[i]); } this._xml = ''; this._tab = 1; // fl.trace(this._xml); /** * Creates a XUL window panel. It is attached to the current document * * @param xul A String of raw XUL to create. If null, the window will be created according to the various control * creation methods. If not null, any other method calls would be ignored and the passed-in XUL is used. * @return An object containing information about the user input. The object will have a property called dismiss * that contains the name of the button that was clicked (either XULWindow.ACCEPT or * XULWindow.CANCEL). It will * also have other properties, named after the various controls' id values. The value contained by these properties * will be the value associated with the input of the control. **/ this.create = function(xul) { var doc = fl.getDocumentDOM(); if (!doc) { alert("There is no open document. XUL Windows need to be attached to a document. [XULWindow::create()]"); return; } var xulFilePath = fl.configURI + escape(this._title) + ".xul"; //fl.trace(xulFilePath); if (xul==null) xul = this._xml + ""; //fl.trace(xul); FLfile.write(xulFilePath, xul); var options = fl.getDocumentDOM().xmlPanel(xulFilePath); FLfile.remove(xulFilePath); return options//.dismiss; } /** * Creates a check box control with a label. * @param label String for the label next to the check box. * @param id String for the id of the checkbox. This is the name of the property on the returned object with data in it * @param checked Whether initially checked or not. **/ this.addCheckbox = function(label, id, checked) { this._xml += ''; } /** * Opens an <hbox> nodes so that all controls added after this method call are contained within the hbox. Should * be ultimately terminated with closeHBox * * @see #closeHBox **/ this.openHBox = function() { this._xml += ""; } /** * Closes a previously open <hbox>, enclosing all intermediate controls within an hbox node. * * @see #openHBox **/ this.closeHBox = function() { this._xml += ""; } /** * Opens an <vbox> nodes so that all controls added after this method call are contained within the vbox. Should * be ultimately terminated with closeVBox * * @see #closeVBox **/ this.openVBox = function() { this._xml += ""; } /** * Closes a previously open <vbox>, enclosing all intermediate controls within an vbox node. * * @see #openVBox **/ this.closeVBox = function() { this._xml += ""; } /** * @private * Adds a button to the panel, but I assume there might be more involved in getting one to do something than we can realistically * accomplish here. **/ this.addButton = function(label, id, accessKey, autocheck) { this._xml += '