public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc) { //TODO: use template engine, //ideas: AngularJS style ? //1. create body node // and content //style 2, lambda and adhoc attach event if (pnode != null) return pnode; //--------------------------------------------------- pnode = htmldoc.CreateElement("div"); pnode.AddChild("img", img => { //init bool is_close = true; img.SetAttribute("src", "../../Demo/arrow_close.png"); img.AttachMouseDownEvent(e => { img.SetAttribute("src", is_close ? "../../Demo/arrow_open.png" : "../../Demo/arrow_close.png"); is_close = !is_close; e.StopPropagation(); }); }); //pnode.AddChild("img", img => //{ // //change style // bool is_close = true; // img.SetAttribute("src", "../../Demo/arrow_close.png"); // //3. attach event to specific span // img.AttachMouseDownEvent(e => // { // img.SetAttribute("src", is_close ? // "../../Demo/arrow_open.png" : // "../../Demo/arrow_close.png"); // is_close = !is_close; // e.StopPropagation(); // this.InvalidateGraphics(); // }); //}); pnode.AddChild("span", span => { span.AddTextContent(this.checkBoxText); }); return pnode; }
public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc) { if (pnode != null) return pnode; //create primary presentation node pnode = htmldoc.CreateElement("div"); pnode.SetAttribute("style", "font:10pt tahoma"); int j = treeNodes.Count; for (int i = 0; i < j; ++i) { pnode.AddChild(treeNodes[i].GetPrimaryPresentationNode(pnode)); } return pnode; }
DomElement CreateFloatPartDom(WebDom.Impl.HtmlDocument htmldoc) { //create land part var div = htmldoc.CreateElement("div"); div.SetAttribute("style", "position:absolute;left:0px;top:0px;width:300px;height:500px;"); for (int i = 0; i < 10; ++i) { div.AddChild("div", div2 => { div2.AddTextContent("HELLO!" + i); }); } return div; }
public override WebDom.DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc) { if (pnode != null) return pnode; //-------------------------------- pnode = htmldoc.CreateElement("div"); pnode.SetAttribute("style", "font:10pt tahoma;overflow:scroll;height:300px;"); int j = items.Count; if (j > 0) { for (int i = 0; i < j; ++i) { //itemnode pnode.AddChild(items[i].GetPresentationNode(pnode)); } } return pnode; }
public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc) { if (presentationNode != null) { return presentationNode; } //------------------- presentationNode = htmldoc.CreateElement("div"); presentationNode.AddChild("div", div => { div.SetAttribute("style", "font:10pt tahoma;"); div.AddChild("img", img => { //init img.SetAttribute("src", "../../Demo/arrow_close.png"); img.AttachMouseDownEvent(e => { //img.SetAttribute("src", this.IsOpen ? // "../../Demo/arrow_open.png" : // "../../Demo/arrow_close.png"); ////------------------------------ if (this.IsOpen) { img.SetAttribute("src", "../../Demo/arrow_close.png"); this.CloseHinge(); } else { img.SetAttribute("src", "../../Demo/arrow_open.png"); this.OpenHinge(); } //----------------------------- e.StopPropagation(); }); }); }); //------------------- this.floatPartDomElement = this.CreateFloatPartDom(htmldoc); return presentationNode; }
public override DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc) { if (pnode != null) return pnode; //---------------------------------- pnode = htmldoc.CreateElement("div"); pnode.SetAttribute("style", "display:inline-block;width:" + Width + "px;height:" + this.Height + "px;"); pnode.AddChild("div", div2 => { //init div2.SetAttribute("style", "padding:5px;background-color:#dddddd;"); div2.AddChild("span", span => { span.AddTextContent(this.buttonText); }); //------------------------------ div2.AttachMouseDownEvent(e => { #if DEBUG div2.dbugMark = 1; #endif // div2.SetAttribute("style", "padding:5px;background-color:#aaaaaa;"); EaseScriptElement ee = new EaseScriptElement(div2); ee.ChangeBackgroundColor(Color.FromArgb(0xaa, 0xaa, 0xaa)); //div2.SetAttribute("style", "padding:5px;background-color:#aaaaaa;"); e.StopPropagation(); }); div2.AttachMouseUpEvent(e => { #if DEBUG div2.dbugMark = 2; #endif //div2.SetAttribute("style", "padding:5px;background-color:#dddddd;"); EaseScriptElement ee = new EaseScriptElement(div2); ee.ChangeBackgroundColor(Color.FromArgb(0xdd, 0xdd, 0xdd)); e.StopPropagation(); }); }); return pnode; }
public override WebDom.DomElement GetPresentationDomNode(WebDom.Impl.HtmlDocument htmldoc) { if (pnode != null) return pnode; //------------------------------ pnode = htmldoc.CreateElement("div"); pnode.SetAttribute("style", "font:10pt tahoma"); //------------------------------ titleBar = htmldoc.CreateElement("div"); titleBar.AddTextContent("hello tabPage"); pnode.AddChild(titleBar); //------------------------------ tabTitleList = htmldoc.CreateElement("div"); pnode.AddChild(tabTitleList); //------------------------------ contentNode = htmldoc.CreateElement("div"); pnode.AddChild(contentNode); //------------------------------ return pnode; }