3 * Namespace : System.Web.UI.MobileControls
4 * Class : DeviceSpecific
5 * Author : Gaurav Vaish
7 * Copyright : 2003 with Gaurav Vaish, and with
11 using System.Collections;
13 using System.Web.Mobile;
15 namespace System.Web.UI.MobileControls
17 public class DeviceSpecific : Control
19 private DeviceSpecificChoiceCollection choices;
20 private TemplateControl closestTemplateControl = null;
21 private bool haveSelectedChoice = false;
23 private DeviceSpecificChoice selectedChoice;
25 public DeviceSpecific()
29 internal void SetOwner(object owner)
34 internal void SetDesignerChoice(DeviceSpecificChoice choice)
36 this.selectedChoice = choice;
37 this.haveSelectedChoice = true;
40 internal void ApplyProperties()
42 if(SelectedChoice != null)
44 SelectedChoice.ApplyProperties();
48 public new event EventHandler DataBinding
52 base.DataBinding += value;
56 base.DataBinding -= value;
60 public new event EventHandler Disposed
64 base.Disposed += value;
68 base.Disposed -= value;
72 public new event EventHandler Init
84 public new event EventHandler Load
96 public new event EventHandler PreRender
100 base.PreRender += value;
104 base.PreRender -= value;
108 public new event EventHandler Unload
112 base.Unload += value;
116 base.Unload -= value;
120 public DeviceSpecificChoiceCollection Choices
126 choices = new DeviceSpecificChoiceCollection(this);
132 public TemplateControl ClosestTemplateControl
136 if(closestTemplateControl == null)
138 MobileControl ctrl = null;
139 if(Owner is System.Web.UI.MobileControls.Style)
141 ctrl = ((System.Web.UI.MobileControls.Style)Owner).Control;
144 ctrl = (MobileControl) Owner;
146 closestTemplateControl = ctrl.FindClosestTemplateControl();
148 return closestTemplateControl;
152 public override bool EnableViewState
156 return base.EnableViewState;
160 public bool HasTemplates
164 if(SelectedChoice != null)
166 return SelectedChoice.HasTemplates;
172 public MobilePage MobilePage
176 throw new NotImplementedException();
188 public DeviceSpecificChoice SelectedChoice
192 throw new NotImplementedException();
196 public override bool Visible
204 protected override void AddParsedSubObject(object obj)
206 if(obj is DeviceSpecificChoice)
208 DeviceSpecificChoice dsc = (DeviceSpecificChoice)obj;
213 public ITemplate GetTemplate(string templateName)
215 ITemplate retVal = null;
216 if(SelectedChoice != null)
218 retVal = (ITemplate) SelectedChoice.Templates[templateName];