Ejemplo n.º 1
0
    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())
      //);
    }
Ejemplo n.º 2
0
    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())
      //);
    }
Ejemplo n.º 3
0
    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())
      );
    }