示例#1
0
    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));
    }
示例#2
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())
      );
    }