/// <summary> /// Initializes a new instance of a TabItem. /// </summary> public TabItem() : base() { _DefaultStyle = new CssCollection(); _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Initializes a new instance of a TreeBase. /// </summary> public TreeBase() : base() { _HoverStyle = new CssCollection(); _DefaultStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Initializes a new ToolbarCheckGroup instance. /// </summary> public ToolbarCheckGroup() : base() { _Items = new ToolbarCheckButtonCollection(this); _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Merges a CssCollection into this one. /// </summary> /// <param name="src">The source collection.</param> /// <param name="overwrite">If true, will overwrite attributes of the same name.</param> public void Merge(CssCollection src, bool overwrite) { foreach (string name in src) { if ((this[name] == null) || (overwrite)) { Add(name, src[name]); } } }
/// <summary> /// Initializes a new instance of a TabStrip. /// </summary> public TabStrip() : base() { _Items = new TabItemCollection(this); _CachedSelectedIndex = NotSet; _OldMultiPageIndex = -1; _TabDefaultStyle = new CssCollection(); _TabHoverStyle = new CssCollection(); _TabSelectedStyle = new CssCollection(); _SepDefaultStyle = new CssCollection(); _SepHoverStyle = new CssCollection(); _SepSelectedStyle = new CssCollection(); }
/// <summary> /// Initializes a new instance of a Toolbar control. /// </summary> public Toolbar() : base() { _Items = new ToolbarItemCollection(this); _DefaultStyle = new CssCollection(); _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); _Changed = new ArrayList(); _DataChanged = new ArrayList(); #if false // Databinding _ClearChildViewState = false; #endif }
/// <summary> /// Initializes a new instance of a TreeView. /// </summary> public TreeView() : base() { _TreeNodeTypes = new TreeNodeTypeCollection(this); _Nodes = new TreeNodeCollection(this); _bFocused = false; _bCreated = false; _HoverStyle = new CssCollection(); _DefaultStyle = new CssCollection(); _SelectedStyle = new CssCollection(); _scrollTop = _scrollLeft = -1; _parentTop = _parentLeft = -1; _eventList = new ArrayList(); }
/// <summary> /// Adds attributes for the anchor tag. /// </summary> /// <param name="writer">The HtmlTextWriter object that receives the content.</param> private void AddAnchorAttributes(HtmlTextWriter writer) { CssCollection currentStyle = CurrentStyle; writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + AnchorHref); if (AccessKey != String.Empty) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString()); } writer.AddAttribute("onclick", "return confirm('Are you sure?');"); string style = String.Empty; // Custom underline string textDec = currentStyle["text-decoration"]; if (textDec != null) { style += "text-decoration:" + textDec + ";"; } // Custom cursor string cursor = currentStyle["cursor"]; if (cursor != null) { style += "cursor:" + cursor + ";"; } // Re-apply custom styles if (style != String.Empty) { writer.AddAttribute("style", style); } // Re-apply the current color; string currentColor = currentStyle["color"]; if ((currentColor != null) && (currentColor != String.Empty)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Color, currentColor); } }
/// <summary> /// Clones this collection. /// </summary> /// <returns>A copy of this collection.</returns> public virtual object Clone() { CssCollection col = (CssCollection)Activator.CreateInstance(this.GetType(), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, null, new object[] { this }, null); col._bRenderFontTag = this._bRenderFontTag; col._bRenderBoldTag = this._bRenderBoldTag; col._bRenderItalicTag = this._bRenderItalicTag; col._IsTrackingViewState = this._IsTrackingViewState; col._Dirty = this._Dirty; col.ItemAdded = this.ItemAdded; col.ItemRemoved = this.ItemRemoved; col.Cleared = this.Cleared; return(col); }
/// <summary> /// Initializes a new ToolbarButton instance. /// </summary> public ToolbarButton() : base() { _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Called when an item is removed. /// </summary> /// <param name="c">The collection</param> /// <param name="e">Event arguments</param> private void OnRemove(CssCollection c, CssEventArgs e) { Style.Remove(e.Name); }
/// <summary> /// Called when an item is added. /// </summary> /// <param name="c">The collection</param> /// <param name="e">Event arguments</param> private void OnAdd(CssCollection c, CssEventArgs e) { Style.Add(e.Name, e.Value); }
/// <summary> /// Initializes a new ToolbarButton instance. /// </summary> public ToolbarButton() : base() { _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Render the downlevel version of the TreeNode. /// </summary> /// <param name="output">The HtmlTextWriter that will receive the markup.</param> protected override void RenderDownLevelPath(HtmlTextWriter output) { string href; String imageSrc = ""; int i; CssCollection cssStyle; char cJunction = CalcJunction(); object obj; // scratch object output.Write("<TR><TD valign='middle'>"); output.Write(" "); // // Walk up tree to draw lines/whitespace // Object obWalk = Parent; if (ParentTreeView.ShowLines == true) { int iCount = 0; string strLines = String.Empty; while (obWalk is TreeNode) { TreeNode elWalk = (TreeNode)obWalk; TreeNodeCollection kids = GetNodeCollection(elWalk.Parent); i = kids.IndexOf(elWalk) + 1; if (i < kids.Count) { if (iCount > 0) { strLines = "<IMG align='top' border='0' width='" + iCount * ParentTreeView.Indent + "px' height='1px' SRC='" + ParentTreeView.SystemImagesPath + "white.gif'>" + strLines; iCount = 0; } strLines = "<IMG align='top' border='0' SRC='" + ParentTreeView.SystemImagesPath + "I.gif'>" + strLines; } else { iCount++; } obWalk = elWalk.Parent; } if (iCount > 0) { strLines = "<IMG align='top' border='0' width='" + iCount * ParentTreeView.Indent + "px' height='1px' SRC='" + ParentTreeView.SystemImagesPath + "white.gif'>" + strLines; } output.Write(strLines); } else { if (cJunction != 'R' && cJunction != 'F') { int iIndent = 0; while (obWalk is TreeNode && ((TreeNode)obWalk).Parent != null) { iIndent += ParentTreeView.Indent; obWalk = ((TreeNode)obWalk).Parent; } output.Write("<IMG align='top' border='0' SRC='" + ParentTreeView.SystemImagesPath + "white.gif' WIDTH=" + iIndent + " HEIGHT=1>"); } } // is this a branch node? bool bParent = false; obj = FindNodeAttribute("Expandable"); if (obj == null) { obj = Expandable; // get default value if none is explicitly set } if (Nodes.Count > 0 || (ExpandableValue)obj == ExpandableValue.Always || ((ExpandableValue)obj == ExpandableValue.CheckOnce && !CheckedExpandable)) { bParent = true; } if (ParentTreeView.ShowLines == true || ParentTreeView.ShowPlus == true) { if (ParentTreeView.ShowLines == true) { switch (cJunction) { case 'L': imageSrc = "L"; break; case 'T': imageSrc = "T"; break; case 'R': imageSrc = "R"; break; case 'F': imageSrc = "F"; break; } } else { imageSrc = ""; } imageSrc = "'" + ParentTreeView.SystemImagesPath + imageSrc; if (bParent && ParentTreeView.ShowPlus == true) { if (Expanded == true) { imageSrc += "minus.gif'>"; } else { imageSrc += "plus.gif'>"; } if (ParentTreeView.Page != null) { href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()); } else { href = String.Empty; } output.AddAttribute(HtmlTextWriterAttribute.Href, href); output.RenderBeginTag(HtmlTextWriterTag.A); } else if (ParentTreeView.ShowLines == true) { imageSrc += ".gif'>"; } else { imageSrc = "'" + ParentTreeView.SystemImagesPath + "white.gif'>"; } output.Write("<IMG align='top' border='0' class='icon' SRC=" + imageSrc); if (bParent && ParentTreeView.ShowPlus == true) { output.RenderEndTag(); } } // Render a checkbox obj = FindNodeAttribute("CheckBox"); if (obj != null && (bool)obj == true) { string strOnclick = ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, "oncheck," + GetNodeIndex()); output.Write("<INPUT style='display:inline' align=middle type=checkbox " + (Checked ? " checked " : " ") + "onclick=\"" + strOnclick + "\" />"); } // if this node is a navigating leaf, use its nav information. obj = FindNodeAttribute("NavigateUrl"); if (obj != null && (!(ParentTreeView.SelectExpands && bParent && !Expanded))) { href = (string)obj; obj = FindNodeAttribute("Target"); if (obj != null) { output.AddAttribute(HtmlTextWriterAttribute.Target, (string)obj); obj = null; } } else if (ParentTreeView.Page != null) { if (!Selected) { href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, "onselectedindexchange," + ParentTreeView.SelectedNodeIndex + "," + GetNodeIndex()); if (bParent && ParentTreeView.SelectExpands == true) { href = href.Substring(0, href.Length - 2) + (";" + (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()) + "')"; } } else if (bParent && ParentTreeView.SelectExpands == true) { href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()); } else { href = String.Empty; } } else { href = String.Empty; } if (href != String.Empty) { output.AddAttribute(HtmlTextWriterAttribute.Href, href); output.RenderBeginTag(HtmlTextWriterTag.A); } obj = null; if (Selected == true) { obj = FindNodeAttribute("SelectedImageUrl"); } if (obj == null) { if (bParent == true && Expanded == true) { obj = FindNodeAttribute("ExpandedImageUrl"); } if (obj == null) { obj = FindNodeAttribute("ImageUrl"); } } if (obj != null) { output.Write("<IMG align='top' border='0' class='icon' SRC='" + (string)obj + "'>"); } cssStyle = new CssCollection("display:inline; font-size:10pt; font-face:Times; color: black; text-decoration:none; cursor: hand; overflow:hidden;"); object o = FindNodeAttribute("DefaultStyle"); if (o != null) { cssStyle.Merge((CssCollection)o, true); } if (Selected) { CssCollection temp = new CssCollection("color: #00FFFF; background-color: #08246B;"); o = FindNodeAttribute("SelectedStyle"); if (o != null) { temp.Merge((CssCollection)o, true); } cssStyle.Merge(temp, true); } /* * // Links will be blue by default. We want them to be the color specified in our style. * // So we have to override the link color by adding a font tag inside the A tag. * string curColor = cssStyle.GetColor(); * if (!Selected && (curColor != null) && (curColor != String.Empty)) * { * output.AddStyleAttribute(HtmlTextWriterStyle.Color, curColor); * } */ cssStyle.AddAttributesToRender(output); cssStyle.RenderBeginFontTag(output); cssStyle.RenderBeginModalTags(output); if (Text != null && Text != String.Empty) { output.Write(" " + Text); } cssStyle.RenderEndModalTags(output); cssStyle.RenderEndFontTag(output); if (href != String.Empty) { output.RenderEndTag(); } output.Write("</TD></TR>\n"); // Render child treenodes if (Expanded) { foreach (TreeNode item in Nodes) { item.Render(output, RenderPathID.DownLevelPath); } } }
/// <summary> /// Initializes a new instance of a Toolbar control. /// </summary> public Toolbar() : base() { _Items = new ToolbarItemCollection(this); _DefaultStyle = new CssCollection(); _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); _Changed = new ArrayList(); _DataChanged = new ArrayList(); #if false // Databinding _ClearChildViewState = false; #endif }
/// <summary> /// Render the downlevel version of the TreeNode. /// </summary> /// <param name="output">The HtmlTextWriter that will receive the markup.</param> protected override void RenderDownLevelPath(HtmlTextWriter output) { string href; String imageSrc = ""; int i; CssCollection cssStyle; char cJunction = CalcJunction(); object obj; // scratch object output.Write("<TR><TD valign='middle'>"); output.Write(" "); // // Walk up tree to draw lines/whitespace // Object obWalk = Parent; if (ParentTreeView.ShowLines == true) { int iCount = 0; string strLines = String.Empty; while (obWalk is TreeNode) { TreeNode elWalk = (TreeNode)obWalk; TreeNodeCollection kids = GetNodeCollection(elWalk.Parent); i = kids.IndexOf(elWalk) + 1; if (i < kids.Count) { if (iCount > 0) { strLines = "<IMG align='top' border='0' width='" + iCount * ParentTreeView.Indent + "px' height='1px' SRC='" + ParentTreeView.SystemImagesPath + "white.gif'>" + strLines; iCount = 0; } strLines = "<IMG align='top' border='0' SRC='" + ParentTreeView.SystemImagesPath + "I.gif'>" + strLines; } else iCount++; obWalk = elWalk.Parent; } if (iCount > 0) strLines = "<IMG align='top' border='0' width='" + iCount * ParentTreeView.Indent + "px' height='1px' SRC='" + ParentTreeView.SystemImagesPath + "white.gif'>" + strLines; output.Write(strLines); } else { if (cJunction != 'R' && cJunction != 'F') { int iIndent = 0; while (obWalk is TreeNode && ((TreeNode)obWalk).Parent != null) { iIndent += ParentTreeView.Indent; obWalk = ((TreeNode)obWalk).Parent; } output.Write("<IMG align='top' border='0' SRC='" + ParentTreeView.SystemImagesPath + "white.gif' WIDTH=" + iIndent + " HEIGHT=1>"); } } // is this a branch node? bool bParent = false; obj = FindNodeAttribute("Expandable"); if (obj == null) { obj = Expandable; // get default value if none is explicitly set } if (Nodes.Count > 0 || (ExpandableValue)obj == ExpandableValue.Always || ((ExpandableValue)obj == ExpandableValue.CheckOnce && !CheckedExpandable)) { bParent = true; } if (ParentTreeView.ShowLines == true || ParentTreeView.ShowPlus == true) { if (ParentTreeView.ShowLines == true) { switch (cJunction) { case 'L': imageSrc = "L"; break; case 'T': imageSrc = "T"; break; case 'R': imageSrc = "R"; break; case 'F': imageSrc = "F"; break; } } else imageSrc = ""; imageSrc = "'" + ParentTreeView.SystemImagesPath + imageSrc; if (bParent && ParentTreeView.ShowPlus == true) { if (Expanded == true) { imageSrc += "minus.gif'>"; } else { imageSrc += "plus.gif'>"; } if (ParentTreeView.Page != null) href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()); else href = String.Empty; output.AddAttribute(HtmlTextWriterAttribute.Href, href); output.RenderBeginTag(HtmlTextWriterTag.A); } else if (ParentTreeView.ShowLines == true) imageSrc += ".gif'>"; else imageSrc = "'" + ParentTreeView.SystemImagesPath + "white.gif'>"; output.Write("<IMG align='top' border='0' class='icon' SRC=" + imageSrc); if (bParent && ParentTreeView.ShowPlus == true) output.RenderEndTag(); } // Render a checkbox obj = FindNodeAttribute("CheckBox"); if (obj != null && (bool)obj == true) { string strOnclick = ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, "oncheck," + GetNodeIndex()); output.Write("<INPUT style='display:inline' align=middle type=checkbox " + (Checked ? " checked " : " ") + "onclick=\"" + strOnclick + "\" />"); } // if this node is a navigating leaf, use its nav information. obj = FindNodeAttribute("NavigateUrl"); if (obj != null && (!(ParentTreeView.SelectExpands && bParent && !Expanded))) { href = (string)obj; obj = FindNodeAttribute("Target"); if (obj != null) { output.AddAttribute(HtmlTextWriterAttribute.Target, (string)obj); obj = null; } } else if (ParentTreeView.Page != null) { if (!Selected) { href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, "onselectedindexchange," + ParentTreeView.SelectedNodeIndex + "," + GetNodeIndex()); if (bParent && ParentTreeView.SelectExpands == true) href = href.Substring(0, href.Length - 2) + (";" + (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()) + "')"; } else if (bParent && ParentTreeView.SelectExpands == true) href = "javascript:" + ParentTreeView.Page.GetPostBackEventReference(ParentTreeView, (Expanded ? "oncollapse," : "onexpand,") + GetNodeIndex()); else href = String.Empty; } else href = String.Empty; if (href != String.Empty) { output.AddAttribute(HtmlTextWriterAttribute.Href, href); output.RenderBeginTag(HtmlTextWriterTag.A); } obj = null; if (Selected == true) obj = FindNodeAttribute("SelectedImageUrl"); if (obj == null) { if (bParent == true && Expanded == true) obj = FindNodeAttribute("ExpandedImageUrl"); if (obj == null) obj = FindNodeAttribute("ImageUrl"); } if (obj != null) output.Write("<IMG align='top' border='0' class='icon' SRC='" + (string)obj + "'>"); cssStyle = new CssCollection("display:inline; font-size:10pt; font-face:Times; color: black; text-decoration:none; cursor: hand; overflow:hidden;"); object o = FindNodeAttribute("DefaultStyle"); if (o != null) { cssStyle.Merge((CssCollection)o, true); } if (Selected) { CssCollection temp = new CssCollection("color: #00FFFF; background-color: #08246B;"); o = FindNodeAttribute("SelectedStyle"); if (o != null) { temp.Merge((CssCollection)o,true); } cssStyle.Merge(temp, true); } /* // Links will be blue by default. We want them to be the color specified in our style. // So we have to override the link color by adding a font tag inside the A tag. string curColor = cssStyle.GetColor(); if (!Selected && (curColor != null) && (curColor != String.Empty)) { output.AddStyleAttribute(HtmlTextWriterStyle.Color, curColor); } */ cssStyle.AddAttributesToRender(output); cssStyle.RenderBeginFontTag(output); cssStyle.RenderBeginModalTags(output); if (Text != null && Text != String.Empty) output.Write(" " + Text); cssStyle.RenderEndModalTags(output); cssStyle.RenderEndFontTag(output); if (href != String.Empty) output.RenderEndTag(); output.Write("</TD></TR>\n"); // Render child treenodes if (Expanded) { foreach (TreeNode item in Nodes) { item.Render(output, RenderPathID.DownLevelPath); } } }
/// <summary> /// Initializes a new instance of a CssCollection. /// </summary> /// <param name="col">A collection to initialize this collection with.</param> public CssCollection(CssCollection col) : base() { Merge(col, true); }
/// <summary> /// Initializes a new instance of a TabItem. /// </summary> public TabItem() : base() { _DefaultStyle = new CssCollection(); _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Initializes a new ToolbarCheckGroup instance. /// </summary> public ToolbarCheckGroup() : base() { _Items = new ToolbarCheckButtonCollection(this); _HoverStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Initializes a new instance of a TreeBase. /// </summary> public TreeBase() : base() { _HoverStyle = new CssCollection(); _DefaultStyle = new CssCollection(); _SelectedStyle = new CssCollection(); }
/// <summary> /// Merges a CssCollection into this one. /// </summary> /// <param name="src">The source collection.</param> /// <param name="overwrite">If true, will overwrite attributes of the same name.</param> public void Merge(CssCollection src, bool overwrite) { foreach (string name in src) { if ((this[name] == null) || (overwrite)) { Add(name, src[name]); } } }
/// <summary> /// Initializes a new instance of a ToolbarItem. /// </summary> public ToolbarItem() : base() { _DefaultStyle = new CssCollection(); }
/// <summary> /// Initializes a new instance of a CssCollection. /// </summary> /// <param name="col">A collection to initialize this collection with.</param> public CssCollection(CssCollection col) : base() { Merge(col, true); }
/// <summary> /// Initializes a new instance of a ToolbarItem. /// </summary> public ToolbarItem() : base() { _DefaultStyle = new CssCollection(); }
/// <summary> /// Initializes a new instance of a TabStrip. /// </summary> public TabStrip() : base() { _Items = new TabItemCollection(this); _CachedSelectedIndex = NotSet; _OldMultiPageIndex = -1; _TabDefaultStyle = new CssCollection(); _TabHoverStyle = new CssCollection(); _TabSelectedStyle = new CssCollection(); _SepDefaultStyle = new CssCollection(); _SepHoverStyle = new CssCollection(); _SepSelectedStyle = new CssCollection(); }