// (c) Copyright 2001, TIBCO Software Inc. All rights reserved. // LEGAL NOTICE: This source code is provided to specific authorized end // users pursuant to a separate license agreement. You MAY NOT use this // source code if you do not have a separate license from TIBCO Software // Inc. Except as expressly set forth in such license agreement, this // source code, or any portion thereof, may not be used, modified, // reproduced, transmitted, or distributed in any form or by any means, // electronic or mechanical, without written permission from TIBCO // Software Inc. //--------------------------------------------------------------------------- // THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, // EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT // THE PROGRAM IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR // PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND // PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD ANY PART OF THE PROGRAM // PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT TIBCO) ASSUME THE COST OF ANY // NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY // CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF THE PROGRAM IS // AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. //--------------------------------------------------------------------------- // APMenus.js //_____________________ // // APMenu //_____________________ function APMenu(name) { if (! window.APMenus) { window.APMenus = new Array(); } // Members this.mName = name; this.mIndex = window.APMenus.length; window.APMenus[this.mIndex] = this; this.mActivated = false; this.mTimeOutLength = 200; this.mX = 0; this.mY = 0; this.mZ = 0; this.mLayer = ''; this.mItemParent= ''; this.mItemHilited = ''; this.mOnLeave = ''; this.mMouseOnBase = false; this.mClassName = 'tibMenu'; this.mClassNameStub = 'tibMenuStub'; this.mClassNameItemSelectedHi = 'tibMenuSelectedHi'; this.mClassNameItemSelectedLo = 'tibMenuSelectedLo'; this.mClassNameItemDeSelectedHi = 'tibMenuDeSelectedHi'; this.mClassNameItemDeSelectedLo = 'tibMenuDeSelectedLo'; this.mClassNameSeparator = 'tibMenuSeparator'; this.mItems = new Array(); // Methods this.addItem = APMenu_addItem; this.addItemByValues = APMenu_addItemByValues; this.addSubMenu = APMenu_addSubMenu; this.addSeparatorLine = APMenu_addSeparatorLine; this.hide = APMenu_hide; this.hideIfOut = APMenu_hideIfOut; this.show = APMenu_show; this.showAt = APMenu_showAt; this.showInFrontOf = APMenu_showInFrontOf; this.showRightOf = APMenu_showRightOf; this.showUnder = APMenu_showUnder; this.onMouseOver = APMenu_onMouseOver; this.onMouseOut = APMenu_onMouseOut; this.activate = APMenu_activate; this.isOut = APMenu_isOut; this.isIn = APMenu_isIn; this.isShown = APMenu_isShown; this.moveTo = APMenu_moveTo; this.moveBy = APMenu_moveBy; this.writeStub = APMenu_writeStub; this.findMenuByName = APMenu_findMenuByName; this.findMenuByItemText = APMenu_findMenuByItemText; window.APMenus_getObjectCoords = APMenu_getObjectCoords; //__________ // getCoords: Returns an object whose x, y, z, width, height properties // are the coordinates and size of the argument element. // function APMenu_getObjectCoords(anElement) { var coords = new Object(); coords.x = anElement.offsetLeft; coords.y = anElement.offsetTop; coords.z = (anElement.style ? anElement.style.zIndex : anElement.zIndex); coords.width = anElement.offsetWidth; coords.height = anElement.offsetHeight; parentCoords = anElement.offsetParent; while (parentCoords) { coords.x += parentCoords.offsetLeft; coords.y += parentCoords.offsetTop; parentCoords = parentCoords.offsetParent; } return coords; } //________ // moveTo: Moves the menu layer to the coordinates // given as argument. // function APMenu_moveTo(x, y, z) { this.mX = x; this.mY = y; this.mZ = z; this.activate(); var layerStyle = this.mLayer.style; if (layerStyle) { layerStyle.left = this.mX; layerStyle.top = this.mY; layerStyle.zIndex = this.mZ; } else { this.mLayer.left = this.mX; this.mLayer.top = this.mY; this.mLayer.zIndex = this.mZ; } } //________ // moveBy: Moves the menu layer by the increments // given as argument. // function APMenu_moveBy(x, y, z) { this.mX += x; this.mY += y; this.mZ += z; this.activate(); var layerStyle = this.mLayer.style; if (layerStyle) { layerStyle.left = this.mX; layerStyle.top = this.mY; layerStyle.zIndex = this.mZ; } else { this.mLayer.left = this.mX; this.mLayer.top = this.mY; this.mLayer.zIndex = this.mZ; } } //_________ // addItem: Adds an APMenuItem to this menu. // Returns the menu item. // function APMenu_addItem(item) { this.mItems[this.mItems.length] = item; item.mMenu = this; if (item.isSelected()) { this.mSelectedText = item.mText; } return item; } //_________________ // addItemByValues: Creates an APMenuItem from the arguments // and adds it to this menu. // Returns the menu item. // function APMenu_addItemByValues(text, link, selected) { return this.addItem(new APMenuItem(text, link, selected)); } //____________ // addSubMenu: Adds a submenu to this menu. // Returns the corresponding menu item. // function APMenu_addSubMenu(text, submenu) { var item = new APMenuItem(text, '', false); item.setSubMenu(submenu); this.addItem(item); return item; } //____________ // addSeparatorLine: Adds a separator line in this menu. // function APMenu_addSeparatorLine() { return this.addItemByValues( '