home *** CD-ROM | disk | FTP | other *** search
- <PUBLIC:COMPONENT>
-
- <PUBLIC:PROPERTY NAME="ct_toolbar_button" GET="fnIdentify"/>
-
- <PUBLIC:PROPERTY NAME="ct_checkbutton" INTERNALNAME="bCheckButton" />
- <PUBLIC:PROPERTY NAME="ct_state" INTERNALNAME="bState" />
-
-
- <PUBLIC:PROPERTY NAME="ct_dropdown" INTERNALNAME="bDropDown" />
-
- <PUBLIC:PROPERTY NAME="ct_onclick" INTERNALNAME="szOnClick" />
-
-
- <PUBLIC:METHOD NAME="UpdateButton"/>
- <PUBLIC:METHOD NAME="fnDraw"/>
-
-
- <PUBLIC:METHOD NAME="ct_mouseover" INTERNALNAME="fnMouseOverSelf"/>
- <PUBLIC:METHOD NAME="ct_mouseout" INTERNALNAME="fnMouseOutSelf"/>
-
-
- <PUBLIC:ATTACH EVENT="onpropertychange" ONEVENT="fnPropertyChange()" FOR="element"/>
-
- <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="fnDraw()" FOR=element/>
-
- <PUBLIC:ATTACH EVENT="onmousedown" ONEVENT="fnMouseDown()" FOR="element"/>
- <PUBLIC:ATTACH EVENT="onmouseup" ONEVENT="fnMouseUp()" FOR="element"/>
-
- <PUBLIC:ATTACH EVENT="onclick" ONEVENT="fnMouseClick()" FOR="element"/>
-
- <PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="fnMouseOver()" FOR="element"/>
- <PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="fnMouseOut()" FOR="element"/>
-
- <PUBLIC:ATTACH EVENT="ondragstart" ONEVENT="fnDragStart()" FOR="element"/>
-
- <SCRIPT LANGUAGE="JScript">
-
- var szOnClick = ""; // script to execute on ONCLICK event
-
- var bCheckButton = 0; // the button is the check button (it fixes in pressed state)
- var bDropDown = 0; // the button is the down arrow that call drop down list to select from
- // ex. Back in Internet Explorer
- var bDisabled = 0; // the button is disabled (does not response to actions)
- var bState = 0; // mouse button is pressed (but not released) on the button
- var bActive = 0; // mouse is over the button
- var bPressed = 0; // the button have been pressed previously
-
- function UpdateButton (bDis, bDropD)
- {
- bDisabled = bDis;
- bDropDown = bDropD;
- fnDraw();
- }
-
-
- function fnIdentify()
- {
- // this used for property ct_toolbar_button which is used to identify this behavior
- // always return 1
-
- return 1;
- }
-
- //
- // use "eltSibling" in the code string passed to this function to refer to sibling object
- //
- function fnExecCodeOnSibling(szCode)
- {
- var eltSibling = (bDropDown ? previousSibling : nextSibling);
- //
- if(eltSibling && (eltSibling.ct_toolbar_button == 1))
- {
- if((bDropDown && (bDropDown!=0)) || (eltSibling.ct_dropdown == 1))
- eval(szCode);
- }
- }
-
- function fnDraw()
- {
-
- if(parseInt(bCheckButton) == 0)
- bState = 0;
-
-
-
- //
- // it's more correct to leave background setting to toolbar (as it can be image and so on)
- // element.runtimeStyle.backgroundColor = "#C0C0C0";
-
- if(parseInt(bDisabled) == 1)
- {
-
-
- //element.runtimeStyle.filter = "Gray Chroma(color = #C0C0C0) Alpha(Opacity=25)";
- //DropShadow(color=white, offx=1, offy=1)
- if((parseInt(bCheckButton) == 1) && (parseInt(bState) == 1))
- {
- element.runtimeStyle.borderRight = "1px solid white";
- element.runtimeStyle.borderBottom = "1px solid white";
- element.runtimeStyle.borderTop = "1px solid black";
- element.runtimeStyle.borderLeft = "1px solid black";
- }
- else
- {
- element.runtimeStyle.border = "1px solid #C0C0C0";
- }
- }
- else
- {
- if ((parseInt(bState) == 1) || (parseInt(bPressed) == 1))
- {
- element.runtimeStyle.borderRight = "1px solid white";
- element.runtimeStyle.borderBottom = "1px solid white";
- element.runtimeStyle.borderTop = "1px solid black";
- element.runtimeStyle.borderLeft = "1px solid black";
-
- //if(bActive && (bActive != 0))
- //element.runtimeStyle.filter = "";
- //else
- //element.runtimeStyle.filter = "Gray";
-
- }
- else
- {
- if(parseInt(bActive) == 1)
- {
- //element.runtimeStyle.filter = "";
- element.runtimeStyle.borderRight = "1px solid black";
- element.runtimeStyle.borderBottom = "1px solid black";
- element.runtimeStyle.borderTop = "1px solid white";
- element.runtimeStyle.borderLeft = "1px solid white";
- }
- else
- {
- //element.runtimeStyle.filter = "Gray Chroma(color = #c0c0c0)";
- element.runtimeStyle.border = "1px solid #c0c0c0";
- }
- }
- }
-
- }
-
-
- function fnPropertyChange()
- {
- switch(window.event.propertyName)
- {
- case "ct_dropdown":
- break;
-
- case "ct_checkbutton":
- break;
-
- case "ct_state":
- break;
-
- default:
- return;
- }
-
- fnDraw();
- }
-
- function fnMouseDown()
- {
- if(window.event.button & 1) // pressed left button
- {
- if(parseInt(bDisabled) == 0)
- {
- bPressed = 1;
- fnDraw();
- if(parseInt(bDropDown) == 1)
- {
- if(szOnClick.length > 0)
- {
- window.execScript(szOnClick);
- }
- }
- }
- }
- }
-
- function fnMouseUp()
- {
- if(window.event.button & 1) // pressed left button
- {
- if(parseInt(bDisabled) == 0)
- {
- if (parseInt(bPressed) == 1)
- {
- if(parseInt(bCheckButton) == 1)
- {
- if(parseInt(bState) == 1)
- bState = 0;
- else
- bState = 1;
- }
- if(parseInt(bDropDown) == 0)
- {
- if(szOnClick.length > 0)
- {
- window.execScript(szOnClick);
- }
- }
- bPressed = 0;
- fnDraw();
- }
- }
- }
- }
-
- //
- // called from sibling button if required
- //
- function fnMouseOverSelf()
- {
- if(parseInt(bDisabled) == 0)
- {
- bActive = 1;
- fnDraw();
- }
- }
-
- function fnMouseOver()
- {
- if(parseInt(bDisabled) == 0)
- {
- fnMouseOverSelf();
- fnExecCodeOnSibling("eltSibling.ct_mouseover();")
- }
- }
-
- //
- // called from sibling button if required
- //
- function fnMouseOutSelf()
- {
- if(parseInt(bDisabled) == 0)
- {
- bActive = 0;
- bPressed = 0;
- fnDraw();
- }
- }
-
- function fnMouseOut()
- {
- if(parseInt(bDisabled) == 0)
- {
- fnMouseOutSelf();
- fnExecCodeOnSibling("eltSibling.ct_mouseout();")
- }
- }
-
- function fnMouseOut()
- {
- if(parseInt(bDisabled) == 0)
- {
- bActive = 0;
- bPressed = 0;
- fnDraw();
- //
- fnExecCodeOnSibling("eltSibling.ct_mouseout();")
- }
- }
-
- function fnMouseClick()
- {
-
- }
-
- function fnDragStart()
- {
- window.event.returnValue = false;
- }
-
- </SCRIPT>
- </PUBLIC:COMPONENT>
-