Files
Umbraco-CMS/components/umbraco.controls/pane.cs
Shandem f6d0d043b5 DO NOT DOWNLOAD. DOWNLOAT LATEST STABLE FROM RELEASE TAB
Created 4.1.0 branch

[TFS Changeset #55082]
2009-06-19 07:39:16 +00:00

111 lines
3.4 KiB
C#

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace umbraco.uicontrols {
public class Pane : System.Web.UI.WebControls.Panel {
private TableRow tr = new TableRow();
private TableCell td = new TableCell();
private Table tbl = new Table();
public Pane() {
}
private string m_Text = string.Empty;
public string Text
{
get { return m_Text; }
set { m_Text = value; }
}
public void addProperty(string Caption, Control C) {
/*
tr = new TableRow();
td = new TableCell();
td.Text = Caption;
td.Attributes.Add("width", "15%");
td.Attributes.Add("valign", "top");
td.Attributes.Add("class", "propertyHeader");
tr.Cells.Add(td);
td = new TableCell();
td.Attributes.Add("class", "propertyContent");
td.Controls.Add(C);
tr.Cells.Add(td);
tbl.Rows.Add(tr);
if (!this.Controls.Contains(tbl)) {
this.Controls.Add(tbl);
}*/
PropertyPanel pp = new PropertyPanel();
pp.Controls.Add(C);
pp.Text = Caption;
this.Controls.Add(pp);
}
public void addProperty(Control ctrl) {
/*
tr = new TableRow();
td = new TableHeaderCell();
td.ColumnSpan = 2;
td.Attributes.Add("width", "100%");
td.Attributes.Add("valign", "top");
td.Attributes.Add("class", "propertyContent");
td.Controls.Add(ctrl);
tr.Cells.Add(td);
tbl.Rows.Add(tr);
if (!this.Controls.Contains(tbl)) {
this.Controls.Add(tbl);
}
*/
PropertyPanel pp = new PropertyPanel();
pp.Controls.Add(ctrl);
this.Controls.Add(pp);
}
protected override void OnLoad(System.EventArgs EventArguments) {
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "propertypanestyles", "<link rel='stylesheet' href='/umbraco_client/propertypane/style.css' />");
}
protected override void Render(System.Web.UI.HtmlTextWriter writer) {
this.CreateChildControls();
string styleString = "";
foreach (string key in this.Style.Keys) {
styleString += key + ":" + this.Style[key] + ";";
}
if (!string.IsNullOrEmpty(m_Text))
writer.WriteLine("<h2 class=\"propertypaneTitel\">" + m_Text + "</h2>");
writer.WriteLine("<div class=\"propertypane\" style='" + styleString + "'>");
writer.WriteLine("<div>");
try {
this.RenderChildren(writer);
} catch (Exception ex) {
writer.WriteLine("Error creating control <br />");
writer.WriteLine(ex.ToString());
}
writer.WriteLine("<div class='propertyPaneFooter'>-</div></div></div>");
}
}
}