public HElement ToHtml(string cssClassName, StringBuilder css) { HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); List<object> elements = new List<object>(); string container = GetExtended("container") as string; if (!StringHlp.IsEmpty(container)) elements.Add(h.data("name", container)); int index = -1; foreach (IHtmlControl control in controls) { index++; if (control is IEditExtension) { DefaultExtensionContainer defaults = new DefaultExtensionContainer((IEditExtension)control); defaults.Display("table-cell"); defaults.VAlign(true); } string childCssClassName = control.Name; if (StringHlp.IsEmpty(childCssClassName)) childCssClassName = string.Format("{0}_{1}", cssClassName, index + 1); HElement element = control.ToHtml(childCssClassName, css); bool isHide = (control.GetExtended("hide") as bool?) ?? false; if (!isHide) elements.Add(element); } return h.Div(HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray())); }
public HElement ToHtml(string cssClassName, StringBuilder css) { { DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.Display("inline-block"); defaults.Cursor(CursorStyle.Pointer); CssExt.CssAttribute(defaults, "white-space", "nowrap"); defaults.OnClick(";"); } HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); foreach (HStyle pseudo in pseudoClasses) HtmlHlp.AddStyleToCss(css, cssClassName, pseudo); List<object> elements = new List<object>(3); { elements.Add(h.Span(caption)); hevent onevent = GetExtended("onevent") as hevent; if (onevent != null) elements.Add(onevent); } return new HEventElement("div", HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray()) ); //return h.Div(HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray()) //); }
public HElement ToHtml(string cssClassName, StringBuilder css) { HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); foreach (HStyle pseudo in pseudoClasses) HtmlHlp.AddStyleToCss(css, cssClassName, pseudo); List<object> elements = new List<object>(); elements.Add(h.type("button")); elements.Add(h.value(caption)); hevent onevent = GetExtended("onevent") as hevent; if (onevent != null) elements.Add(onevent); DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.OnClick(";"); defaults.Cursor(CursorStyle.Pointer); return new HEventElement("input", HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray()) ); //return h.Input(HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray()) //); }
public HElement ToHtml(string cssClassName, StringBuilder css) { DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.Display("inline-block"); HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); foreach (HStyle pseudo in pseudoClasses) HtmlHlp.AddStyleToCss(css, cssClassName, pseudo); return h.Div(HtmlHlp.ContentForHElement(this, cssClassName, caption)); }
public HElement ToHtml(string cssClassName, StringBuilder css) { DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.VAlign(null); defaults.Padding("4px 8px"); defaults.Display("inline-block"); HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); HtmlHlp.AddHoverToCss(css, cssClassName, this); return h.Div(HtmlHlp.ContentForHElement(this, cssClassName, caption)); }
public HElement ToHtml(string cssClassName, StringBuilder css) { string checkClassName = string.Format("{0}_check", Name); string frameClassName = string.Format("{0}_frame", Name); HTone innerStyle = new HTone().Display("none"); HtmlHlp.AddClassToCss(css, checkClassName, innerStyle.CssExtensions); HtmlHlp.AddClassToCss(css, frameClassName, frameStyle.CssExtensions); HtmlHlp.AddExtensionsToCss(css, markStyle.CssExtensions, ".{0} input[type=checkbox]:checked ~ .{1}::before ", cssClassName, frameClassName ); { DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.Display("inline-block"); defaults.OnClick(string.Format( "e.preventDefault(); $('.{0}').is(':checked') ? $('.{0}').prop('checked', false) : $('.{0}').prop('checked', true);", checkClassName) ); } HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); foreach (HStyle pseudo in pseudoClasses) HtmlHlp.AddStyleToCss(css, cssClassName, pseudo); List<object> checkElements = new List<object>(); checkElements.Add(h.@class(checkClassName)); checkElements.Add(h.type("checkbox")); checkElements.Add(h.data("name", Name)); checkElements.Add(h.data("id", checkClassName)); if (value) checkElements.Add(h.@checked()); return h.Div(HtmlHlp.ContentForHElement(this, cssClassName, h.Input(checkElements.ToArray()), h.Div(h.@class(frameClassName)) )); }
public HElement ToHtml(string cssClassName, StringBuilder css) { { DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.Display("inline-block"); } HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); foreach (HStyle pseudo in pseudoClasses) HtmlHlp.AddStyleToCss(css, cssClassName, pseudo); List<object> elements = new List<object>(); elements.Add(h.type("checkbox")); elements.Add(h.data("name", Name)); elements.Add(h.data("id", Name)); if (isChecked) elements.Add(h.@checked()); return h.Input(HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray()) ); }
public HElement ToHtml(string cssClassName, StringBuilder css) { { DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.Display("inline-block"); defaults.OnClick(";"); } HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); foreach (HStyle pseudo in pseudoClasses) HtmlHlp.AddStyleToCss(css, cssClassName, pseudo); List<object> elements = new List<object>(); elements.Add(h.type("radio")); elements.Add(new HAttribute("name", groupName)); elements.Add(h.data("name", Name)); elements.Add(h.data("id", Name)); if (isChecked) elements.Add(h.@checked()); if (eventHandler != null) { hevent onevent = HtmlExt.InnerEvent(groupName, "", eventHandler, objectId); elements.Add(onevent); return new HEventElement("input", HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray())); } //elements.Add(h.value(objectId)); //hevent onevent = GetExtended("onevent") as hevent; //if (onevent != null) //{ // elements.Add(onevent); // return new HEventElement("input", HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray())); //} return h.Input(HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray())); }
public HElement ToHtml(string cssClassName, StringBuilder css) { { DefaultExtensionContainer defaults = new DefaultExtensionContainer(this); defaults.Align(null, null); defaults.Padding("6px 12px"); defaults.Display("inline-block"); defaults.Border("1px", "solid", Color.FromArgb(187, 187, 187), "2px"); defaults.LinearGradient("to top right", Color.FromArgb(221, 221, 221), Color.FromArgb(241, 241, 241)); defaults.Cursor(CursorStyle.Pointer); defaults.OnClick(";"); } { PseudoCssClass hover = GetExtended("hover") as PseudoCssClass; if (hover == null) { hover = new PseudoCssClass(".{0}:hover"); this.Hover(hover); } DefaultExtensionContainer defaults = new DefaultExtensionContainer(hover); //defaults.Border("1px", "solid", Color.FromArgb(60, 127, 177), "2px"); //defaults.LinearGradient("to top right", Color.FromArgb(167, 217, 177), Color.FromArgb(232, 246, 253)); defaults.Border("1px", "solid", Color.FromArgb(170, 170, 170), "2px"); defaults.LinearGradient("to top right", Color.FromArgb(204, 204, 204), Color.FromArgb(234, 234, 234)); } { PseudoCssClass active = GetExtended("active") as PseudoCssClass; if (active == null) { active = new PseudoCssClass(".{0}:active"); this.WithExtension(new ExtensionAttribute("active", active)); } DefaultExtensionContainer defaults = new DefaultExtensionContainer(active); defaults.Border("2px", "double", Color.FromArgb(44, 98, 139), "2px"); defaults.Padding("5px", "12px", "5px", "10px"); defaults.LinearGradient("to top right", Color.FromArgb(104, 179, 219), Color.FromArgb(229, 244, 252)); } HtmlHlp.AddClassToCss(css, cssClassName, CssExtensions); HtmlHlp.AddHoverToCss(css, cssClassName, this); HtmlHlp.AddPseudoClassToCss(css, "active", cssClassName, this); List<object> elements = new List<object>(); { HImage image = GetExtended("innerImage") as HImage; if (image != null) { DefaultExtensionContainer defaults = new DefaultExtensionContainer(image); defaults.VAlign(null); defaults.Margin("0px", "0px", "2px", "0px"); defaults.Display("inline"); //defaults.Align(true); elements.Add(image.ToHtml(string.Format("{0}_image", cssClassName), css)); elements.Add(h.Span(caption)); //string captionClassName = string.Format("{0}_caption", cssClassName); //elements.Add(h.Span(caption, h.@class(captionClassName)) //); //HtmlHlp.AddClassToCss(css, captionClassName, // new CssExtensionAttribute[] { new CssExtensionAttribute("display", "table-cell") }); } else elements.Add(caption); hevent onevent = GetExtended("onevent") as hevent; if (onevent != null) elements.Add(onevent); } return h.Div(HtmlHlp.ContentForHElement(this, cssClassName, elements.ToArray()) ); }
/// <summary> /// Создает HXPanel /// Оборачивает дочерние контролы не являющиеся панелями в HPanel /// По умолчанию выставляет всем дочерним панелям VAlign(null) /// </summary> public static HXPanel RowPanel(params IHtmlControl[] controls) { IHtmlControl[] panelControls = ArrayHlp.Convert(controls, delegate(IHtmlControl control) { if (!(control is HPanel || control is HXPanel)) control = new HPanel(control); DefaultExtensionContainer defaults = new DefaultExtensionContainer(control); defaults.VAlign(null); return control; }); return new HXPanel(panelControls); //.NoWrap(); }
public static HXPanel SimpleHeader(params IHtmlControl[] cells) { foreach (IHtmlControl cell in cells) { DefaultExtensionContainer defaults = new DefaultExtensionContainer(cell); defaults.Align(null); defaults.VAlign(null); defaults.FontBold(); } return new HXPanel(cells); }