using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using CMS.ExtendedControls;
using CMS.GlobalHelper;
using CMS.PortalControls;
public partial class CMSWebParts_Wireframe_Components_Image: CMSAbstractWebPart
{
#region "Properties"
///
/// Image URL
///
public string ImageUrl
{
get
{
return ValidationHelper.GetString(this.GetValue("ImageUrl"), "");
}
set
{
this.SetValue("ImageUrl", value);
}
}
///
/// Use bounding box
///
public bool UseBoundingBox
{
get
{
return ValidationHelper.GetBoolean(this.GetValue("UseBoundingBox"), false);
}
set
{
this.SetValue("UseBoundingBox", value);
}
}
///
/// Box CSS class
///
public string BoxCssClass
{
get
{
return ValidationHelper.GetString(this.GetValue("BoxCssClass"), "");
}
set
{
this.SetValue("BoxCssClass", value);
}
}
#endregion
///
/// Content loaded event handler.
///
public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();
}
///
/// Initializes the control properties.
///
protected void SetupControl()
{
if (StopProcessing)
{
// Do not process
}
else
{
imgElem.ImageUrl = UIHelper.GetImageUrl(this.Page, ImageUrl);
if (UseBoundingBox)
{
// Height
string h = WebPartHeight;
if (!String.IsNullOrEmpty(h))
{
pnlBox.Height = new Unit(h);
}
// Width
string w = WebPartWidth;
if (!String.IsNullOrEmpty(w))
{
pnlBox.Width = new Unit(w);
}
pnlBox.RenderChildrenOnly = false;
string boxCss = this.BoxCssClass;
if (!String.IsNullOrEmpty(boxCss))
{
pnlBox.CssClass += " " + boxCss;
}
resElem.ResizedElementID = pnlBox.ClientID;
resElem.RenderEnvelope = true;
}
else
{
// Height
string h = WebPartHeight;
if (!String.IsNullOrEmpty(h))
{
imgElem.Height = new Unit(h);
}
// Width
string w = WebPartWidth;
if (!String.IsNullOrEmpty(w))
{
imgElem.Width = new Unit(w);
}
// Resize image directly
resElem.ResizedElementID = imgElem.ClientID;
}
mRenderWebPartClass = false;
}
}
///
/// Reloads the control data.
///
public override void ReloadData()
{
base.ReloadData();
SetupControl();
}
}