123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- /**
- * XHtmlHtml
- */
- XHtmlHtml.prototype = new XFormsElement;
- function XHtmlHtml (strParentId, strId, strTag)
- {
- if (!strId)
- {
- return;
- }
-
- XFormsElement.call(this, strParentId, strId, strTag);
- };
- /**
- * XHtmlHead
- */
- XHtmlHead.prototype = new XFormsElement;
- function XHtmlHead (strParentId, strId, strTag)
- {
- if (!strId)
- {
- return;
- }
-
- XFormsElement.call(this, strParentId, strId, strTag);
- };
- /**
- * XHtmlBody
- */
- XHtmlBody.prototype = new XFormsGroup;
- function XHtmlBody (strParentId, strAlert, strHelp, strHint, strAccesskey, bAutoRefresh, strClass, bDisabled, strId, nNavindex,
- strOverflow, strPrintBottomMargin, strPrintLeftMargin, strPrintRightMargin, strPrintTopMargin, strScroll, strStyle, strTag, strVisibility)
- {
- if (!strId)
- {
- return;
- }
-
- XFormsGroup.call(this, strParentId, strAlert, strHelp, strHint, strAccesskey, ""/*strBind*/, strClass, bDisabled, strId, nNavindex,
- strOverflow, ""/*bPopup*/, ""/*strRef*/, strScroll, ""/*strShowEffect*/, strStyle, strTag, strVisibility);
-
- this.m_bShowPopupMenu = true;
- this.m_bSetPopupMenu = false;
-
- /**
- * Property
- */
- // Attribute
- this.attribute["autorefresh"] = bAutoRefresh;
- this.attribute["print-bottommargin"] = strPrintBottomMargin;
- this.attribute["print-leftmargin"] = strPrintLeftMargin;
- this.attribute["print-rightmargin"] = strPrintRightMargin;
- this.attribute["print-topmargin"] = strPrintTopMargin;
- };
- XHtmlBody.prototype.refresh = function ()
- {
- var arKeyset = this.children.keys();
- for (var i=0; i<arKeyset.length; i++)
- {
- var strId = arKeyset[i];
- var objChild = this.children.item(strId);
-
- if (null != objChild && objChild instanceof XFormsElement && objChild.refresh)
- {
- objChild.refresh();
- }
- }
- };
- XHtmlBody.prototype.init = function ()
- {
- XFormsGroup.prototype.init.call(this);
- body.attribute["width"] = document.body.clientWidth;
- body.attribute["height"] = document.body.clientHeight;
- this.m_heControl.borderWidth = "0px";
- this.m_heControl.style.position = "absolute";
- };
- XHtmlBody.prototype.onMouseDown = function (event)
- {
- XFormsGroup.prototype.onMouseDown.call(this, event);
-
- var objWindow = window;
- var nPositionX = 0;
- var nPositionY = 0;
- while (window.top != objWindow && null != objWindow)
- {
- var heOffsetParent = objWindow.frameElement;
- while (null != heOffsetParent)
- {
- nPositionX += heOffsetParent.offsetLeft;
- nPositionY += heOffsetParent.offsetTop;
- if (heOffsetParent != objWindow.frameElement && heOffsetParent != objWindow.document.body)
- {
- nPositionX += heOffsetParent.clientLeft;
- nPositionY += heOffsetParent.clientTop;
- }
- nPositionX -= (is_android ? 0 : heOffsetParent.scrollLeft);
- nPositionY -= (is_android ? 0 : heOffsetParent.scrollTop);
-
- heOffsetParent = heOffsetParent.offsetParent;
- }
- objWindow = objWindow.parent;
- }
- nPositionX = nPositionX + event.x + window.top.document.body.scrollLeft;
- nPositionY = nPositionY + event.y + window.top.document.body.scrollTop;
- var bTargetContext = false;
- if (window.top.document.getElementById("HE___TF_ContextMenu"))
- {
- var xnContextMenu = window.top.document.getElementById("HE___TF_ContextMenu");
- var nContextLeft = xnContextMenu.offsetLeft - window.top.document.body.scrollLeft;
- var nContextTop = xnContextMenu.offsetTop - window.top.document.body.scrollTop;
- var nContextRight = nContextLeft + xnContextMenu.offsetWidth;
- var nContextBottom = nContextTop + xnContextMenu.offsetHeight;
- if (nPositionX < nContextLeft || nPositionX > nContextRight || nPositionY < nContextTop || nPositionY > nContextBottom)
- {
- window.top.document.body.removeChild(xnContextMenu);
- }
- else
- {
- bTargetContext = true;
- }
- }
- if (event.button == 3)
- {
- if (this.m_bShowPopupMenu && !this.m_bSetPopupMenu && !bTargetContext)
- {
- window.top.document.oncontextmenu = null;
- if (window != window.top) document.oncontextmenu = null;
- }
- else
- {
- window.top.document.oncontextmenu = new Function("return false");
- if (window != window.top) document.oncontextmenu = new Function("return false");
- }
- if (this.m_bShowPopupMenu && this.m_bSetPopupMenu && !bTargetContext) document.allElement.item("__TF_ContextMenu").createContextMenu(nPositionX, nPositionY);
- }
- };
|