⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 window.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 5 页
字号:
    } else if (show) {        var slot = 0;        for (var i = 0; i < headerControls.length; i++) {            if (headerControls[i] == controlName) break;            if (this[headerControls[i]]) slot++;        }        this.addAutoChild(controlName, null, null, this.header, slot);        this[controlName].show();    }    },//> @method Window.setShowCloseButton()// Dynamically update +link{window.showCloseButton} to show / hide the closeButton// @see window.headerControls// @see window.showCloseButton// @visibility external//<setShowCloseButton : function (show) {    this.setShowHeaderControl("closeButton", show, "showCloseButton");},//> @method Window.setShowMinimizeButton()// Dynamically update +link{window.showMinimizeButton} to show / hide the minimizeButton// @see window.headerControls// @see window.showMinimizeButton// @visibility external//<setShowMinimizeButton : function (show) {    this.setShowHeaderControl("minimizeButton", show, "showMinimizeButton");},//> @method Window.setShowMaximizeButton()// Dynamically update +link{window.showMaximizeButton} to show / hide the maximizeButton// @see window.headerControls// @see window.showMaximizeButton// @visibility external//<setShowMaximizeButton : function (show) {    this.setShowHeaderControl("maximizeButton", show, "showMaximizeButton");},//> @method Window.setShowHeaderIcon()// Dynamically update +link{window.showHeaderIcon} to show / hide the headerIcon// @see window.headerControls// @see window.showHeaderIcon// @visibility external//<setShowHeaderIcon : function (show) {    this.setShowHeaderControl("headerIcon", show, "showHeaderIcon");},getDynamicDefaults : function (childName) {    if (isc.endsWith(childName, isc.Button.Class)) {        return { canFocus : this.canFocusInHeaderButtons };    }},// custom autoChild maker function for the headerLabel, because it is currently wrapped inside// a Canvas used for clippingheaderLabel_autoMaker : function () {	// if we're not showing a headerLabel,	if (!this.showTitle) {		// clear the headerLabel property		this.headerLabel = null;		// and get outta dodge		return;	}	        var headerLabelParent = isc.Canvas.create({        autoDraw:false,        _generated:true,                contents: isc.Canvas.blankImgHTML(1000,100),        overflow:"hidden"    });    var dragRepo = this.canDragReposition;	// if the Window is moveable, make the header draggable	if (dragRepo) {		headerLabelParent.canDragReposition = true;        headerLabelParent.dragTarget = this;        // HACK: for a Window, canDragReposition means you can reposition using the header.  We        // have to turn it off for the widget as a whole or any widget that lets drag events        // bubble will cause strange effects.        this.canDragReposition = false;	}    var headerLabel = this.headerLabel = this.createAutoChild(                        "headerLabel",                         {                               height:"100%",                            contents:this.title,                            dragTarget:this,                            // Override getCurrentCursor so we show the drag reposition cursor                            // rather than the default pointer.                            getCurrentCursor : function () {                                if (this.parentElement)                                     return this.parentElement.getCurrentCursor();                                return this.Super("getCurrentCursor", arguments);                            }                        });     headerLabelParent.addChild(headerLabel);    this.header.addMember(headerLabelParent);},//>	@method	Window.setTitle()   ([])//          Sets the title text that appears in the window header; the header will be redrawn//          if necessary.//      @visibility external//		@group	header//		@param	newTitle	(string : null)	new title//<setTitle : function (newTitle) {	if (newTitle) this.title = newTitle;	if (!this.header) return;    // if a header label exists, set the title on that, otherwise set it on the header    if (this.headerLabel) this.headerLabel.setContents(this.title);    else this.header.setContents(this.title);},// Toolbar Methods// -----------------------------------------------------------------------------------------------// These are methods that construct the toolbar.////>	@method	Window.setButtons()// Set the buttons for the toolbar////		@param	newButtons	(array : null)	buttons for the toolbar//<setButtons : function (newButtons) {	this.toolbarButtons = newButtons;	if (this.toolbar)	this.toolbar.setButtons(newButtons);},// Footer Methods// -----------------------------------------------------------------------------------------------// These are methods that construct the footer. Window.setFooter() is the main method. // It calls the make() methods of its constituent components to set them up and lay// them out.////>	@method	window.setFooter()//		@group	appearance//			initialize the footer and its components.//			if placement parameters are given, then lay out the footer.////		@param left		(number) left position of footer//		@param top		(number) right position of footer//		@param width	(number) width of footer//		@param height	(number) height of footer//<makeFooter : function () {	// if not showing a footer, bail	if (!this.showFooter) return;	    this.addAutoChild("footer", {height:this.footerHeight});        if (!this.footer) return;        // spacer places the resizer at the far right    this.footer.addMember(isc.LayoutSpacer.create());    // status bar fills entire width (not a member: extends under resizer)    // Note that this means the resizer may obscure the borders of the statusBar. This is    // currently handled by the resizer media	this.addAutoChild("statusBar", {        height: this.footer.getHeight(),        visibility : this.minimized ? isc.Canvas.HIDDEN : isc.Canvas.INHERIT    });    // Note that we currently do not set layoutAlign:center on the resizer so it will sit    // at the top of the footer. Media for the resizer is currently set such that this looks    // right.    if (this.canDragResize) {        this.addAutoChild("resizer", {	    	dragTarget:this,            // hide initially if we're minimized            visibility : this.minimized ? isc.Canvas.HIDDEN : isc.Canvas.INHERIT        });        // needs to be above the statusBar        if (this.resizer) this.resizer.bringToFront();    }},//>	@method	Window.setStatus()  ([])//			Sets the text in the status bar of the window, redrawing if necessary.//		@param statusString (string) new text for the status bar//		@group	appearance//      @visibility external//<setStatus : function (statusString) {	if (this.statusBar == null) return;	var leftPadding = (this.statusBar.leftPadding ? isc.Canvas.spacerHTML(this.statusBar.leftPadding,1) : "");	this.statusBar.setContents(leftPadding + statusString);},//>	@method	Window.setSrc() ([])// Sets the URL of the contents to display in the body of the window, redrawing if// necessary.//      @visibility external//		@group	appearance, body//		@param url (string) URL of new contents to be displayed in the window body//<setSrc : function (url) {	this.src = url;	if (this.body) this.body.setContentsURL(url);},// Misc Make Methods// -----------------------------------------------------------------------------------------------// make methods for the body////>	@method	Window.makeBody()	(A)//		@group	appearance, body//		 make the body of the Window//<makeBody : function() {	// if not showing the body, bail	if (!this.showBody) return;        // Body contents can be assigned using the following methods:	// - The src property can be set to a URL. this will be assigned to the body	//	 canvas' contentsURL property.	// - The items property can be set to a string. this will be assigned to the	//	 contents property of the body canvas.	// - The items property can be set to an existing canvas or an array of canvases.	//	 These will be assigned as the body canvas' children.	var children, contents, contentsURL;	if (this.src) {		contentsURL = this.src;		} else {		// determine whether to display the window contents as contents or children of the body        // canvas        var items = this.items;        if (isc.isA.Array(items)) {            // contents are Canvii - duplicate the Array to keep body.children as a distinct            // array from this.items.            children = items.duplicate();        } else if (isc.isA.Canvas(items)) {            // contents is a single Canvas            children = items;        } else {            // contents is HTML content            contents = items;        }	}        // if the bodyConstructor hasn't been set, use the appropriate constructor based on    // the kind of content we have:     // - contentsURL: use an HTMLFlow    // - contents (as a string): use a Canvas    // - children     //      - if autoSizing, or explicit contentLayout, use a Layout    //      - otherwise use a Canvas    if (!this.bodyConstructor) {        if (contentsURL) {            // body will be a normal Canvas (containing an IFrame if contentsURL specified)               this.bodyConstructor = "HTMLFlow";        } else if (contents) {            this.bodyConstructor = "Canvas";                    } else if (!this.autoSize) {            // if the Window dictates body size, and contentLayout hasn't been set to none, use            // a Layout            if (this.contentLayout != "none") this.bodyConstructor = "Layout";            // if contentLayout is set to none, use a Canvas            else this.bodyConstructor = "Canvas";        } else {            // use a Layout with a none/none policy for autoSize:true            // so that contents will not be resized when they're first drawn            // when the window is drag resized, the body's policy will be set to fill/fill            this.bodyConstructor = "Layout";            var policyProps = {vPolicy:"none", hPolicy:"none"};                        if (!this.bodyProperties) this.bodyProperties = policyProps;            else isc.addProperties(this.bodyProperties, policyProps);         }    }        // NOTE: create items instead of allowing it to happen as the body initializes its children    // array, so that any autoChildren are created in the context of the Window itself, not the    // body    this.createCanvii(children);        if (isc.Browser.isMoz && contentsURL != null) {        if (!this.body) this.body = {};        this.body.useClipDiv = false;    }	// create the body canvas    this.addAutoChild("body", {			children : children,			contents : contents || "&nbsp;",            // XXX watch tab can't handle showing non-generated children of generated components.            // We should fix that.  For now, just flag the body as non-generated            _generated: false,            defaultHeight : this.autoSize ? 50 : 100,			contentsURL : contentsURL,            contentsType : this.contentsType,                        hideUsingDisplayNone: (isc.Browser.isMoz && contentsURL ? true : false),			styleName : this.bodyStyle,			backgroundColor : this.bodyColor,            // hide initially if we're minimized            visibility : this.minimized ? isc.Canvas.HIDDEN : isc.Canvas.INHERIT,                        // for when the body is a Layout/Stack            orientation : this.contentLayout,            // when Window size dictates body size, scroll as needed.  Otherwise, expand to body            // contents            overflow:this.autoSize ? "visible" : "auto"	});},setBodyColor : function (color) {     this.bodyColor = color;    if (this.body) this.body.setBackgroundColor(color) },hasInherentHeight : function () { return this.autoSize; },hasInherentWidth : function () { return this.autoSize; },//>	@method	Window.addItem()	([A])//			Adds a widget to the window. //      @visibility external//		@group	windowItems//      @param  item    (Canvas)    the widget to be added//      @return (array) array of widgets added//<addItem : function (item, position) {    return this.addItems([item], position);},//>	@method	Window.removeItem() ([A])//			Removes a widget from the window.//      @visibility external//		@group	windowItems//      @param  item    (Canvas)    the widget to be removed//      @return (array) the array of widgets removed//<removeItem : function (item) {    return this.removeItems([item]);},//>	@method	Window.addItems([A])	//			Adds an array of widgets to the window.//      @visibility external//		@group	windowItems//      @param  items    (Array of Canvas)    an array of widgets to be added//      @return (array)  array of widgets added

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -