private TemplatedControlDesigner owner; // The owner templated control designer. /// <include file='doc\TemplateEditingFrame.uex' path='docs/doc[@for="TemplateEditingFrame.TemplateEditingFrame"]/*' /> /// <devdoc> /// <para> /// Initializes a new instance of the <see cref='System.Web.UI.Design.TemplateEditingFrame'/> class. /// </para> /// </devdoc> public TemplateEditingFrame(TemplatedControlDesigner owner, string frameName, string[] templateNames, Style controlStyle, Style[] templateStyles) { Debug.Assert(owner != null, "Null TemplatedControlDesigner as owner!"); Debug.Assert(frameName != null && frameName.Length > 0, "Invalid template editing frame name!"); Debug.Assert(templateNames != null && templateNames.Length > 0, "Invalid templates names!"); Debug.Assert(templateStyles == null || templateStyles.Length == templateNames.Length, "Invalid template styles"); this.owner = owner; this.frameName = frameName; this.controlStyle = controlStyle; this.templateStyles = templateStyles; this.verb = null; // Clone the template names passed in since the owner might change those dynamically. this.templateNames = (string[])templateNames.Clone(); if (owner.Behavior != null) { NativeMethods.IHTMLElement viewElement = (NativeMethods.IHTMLElement)((IControlDesignerBehavior)owner.Behavior).DesignTimeElementView; Debug.Assert(viewElement != null, "Invalid read-only HTML element associated to the control!"); this.htmlElemParent = viewElement; } this.htmlElemControlName = null; }
public TemplateEditingFrame(TemplatedControlDesigner owner, string frameName, string[] templateNames, Style controlStyle, Style[] templateStyles) { this.owner = owner; this.frameName = frameName; this.controlStyle = controlStyle; this.templateStyles = templateStyles; this.verb = null; this.templateNames = (string[]) templateNames.Clone(); if (owner.BehaviorInternal != null) { System.Design.NativeMethods.IHTMLElement designTimeElementView = (System.Design.NativeMethods.IHTMLElement) ((IControlDesignerBehavior) owner.BehaviorInternal).DesignTimeElementView; this.htmlElemParent = designTimeElementView; } this.htmlElemControlName = null; }
public TemplateEditingFrame(TemplatedControlDesigner owner, string frameName, string[] templateNames, Style controlStyle, Style[] templateStyles) { this.owner = owner; this.frameName = frameName; this.controlStyle = controlStyle; this.templateStyles = templateStyles; this.verb = null; this.templateNames = (string[])templateNames.Clone(); if (owner.BehaviorInternal != null) { System.Design.NativeMethods.IHTMLElement designTimeElementView = (System.Design.NativeMethods.IHTMLElement)((IControlDesignerBehavior)owner.BehaviorInternal).DesignTimeElementView; this.htmlElemParent = designTimeElementView; } this.htmlElemControlName = null; }
public TemplateEditingDialog(TemplatedControlDesigner designer, WebFormsEditor parentEditor, IServiceProvider serviceProvider) : base(serviceProvider) { this._savedGroupIndex = -1; this._savedTemplateIndex = -1; if (designer == null) { throw new ArgumentNullException("designer"); } this._designer = designer; this._parentEditor = parentEditor; this._templateEditingServiceProvider = new TemplateEditingServiceProvider(serviceProvider); this.InitializeComponent(); this.Text = "Edit " + this._designer.Component.Site.Name + " Templates"; }
ITemplateEditingFrame ITemplateEditingService.CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames, Style controlStyle, Style[] templateStyles) { if (designer == null) { throw new ArgumentNullException("designer"); } if ((frameName == null) || (frameName.Length == 0)) { throw new ArgumentNullException("frameName"); } if ((templateNames == null) || (templateNames.Length == 0)) { throw new ArgumentException("templateNames"); } if ((templateStyles != null) && (templateStyles.Length != templateNames.Length)) { throw new ArgumentException("templateStyles"); } return new TemplateEditingFrame(frameName, templateNames, controlStyle, templateStyles); }
public ITemplateEditingFrame CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames, Style controlStyle, Style[] templateStyles) { if (designer == null) { throw new ArgumentNullException("designer"); } if ((frameName == null) || (frameName.Length == 0)) { throw new ArgumentNullException("frameName"); } if ((templateNames == null) || (templateNames.Length == 0)) { throw new ArgumentException("templateNames"); } if ((templateStyles != null) && (templateStyles.Length != templateNames.Length)) { throw new ArgumentException("templateStyles"); } frameName = this.CreateFrameName(frameName); return(new TemplateEditingFrame(designer, frameName, templateNames, controlStyle, templateStyles)); }
/// <include file='doc\TemplatedControlDesigner.uex' path='docs/doc[@for="TemplatedControlDesigner.OnSetParent"]/*' /> /// <devdoc> /// <para> /// Notification that is called when the associated control is parented. /// </para> /// </devdoc> public override void OnSetParent() { Control control = (Control)Component; Debug.Assert(control.Parent != null, "Valid parent should be present!"); bool enable = false; IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); Debug.Assert(host != null); ITemplateEditingService teService = (ITemplateEditingService)host.GetService(typeof(ITemplateEditingService)); if (teService != null) { enable = true; Control parent = control.Parent; Control page = control.Page; while ((parent != null) && (parent != page)) { IDesigner designer = host.GetDesigner(parent); TemplatedControlDesigner templatedDesigner = designer as TemplatedControlDesigner; if (templatedDesigner != null) { enable = teService.SupportsNestedTemplateEditing; break; } parent = parent.Parent; } } EnableTemplateEditing(enable); }
private void ExitNestedTemplates(bool fSave) { try { IComponent viewControl = base.ViewControl; IDesignerHost service = (IDesignerHost)viewControl.Site.GetService(typeof(IDesignerHost)); ControlCollection controls = ((Control)viewControl).Controls; for (int i = 0; i < controls.Count; i++) { IDesigner designer = service.GetDesigner(controls[i]); if (designer is TemplatedControlDesigner) { TemplatedControlDesigner designer2 = (TemplatedControlDesigner)designer; if (designer2.InTemplateModeInternal) { designer2.ExitTemplateModeInternal(false, true, fSave); } } } } catch (Exception) { } }
/// <include file='doc\TemplatedControlDesigner.uex' path='docs/doc[@for="TemplatedControlDesigner.ExitNestedTemplates"]/*' /> /// <devdoc> /// This method ensures that for a particular templated control designer when exiting /// its template mode handles nested templates (if any). This is done by exiting the /// inner most template frames first before exiting itself. Inside-Out Model. /// </devdoc> private void ExitNestedTemplates(bool fSave) { try { IComponent component = Component; IDesignerHost host = (IDesignerHost)component.Site.GetService(typeof(IDesignerHost)); ControlCollection children = ((Control)component).Controls; for (int i = 0; i < children.Count; i++) { IDesigner designer = host.GetDesigner((IComponent)children[i]); if (designer is TemplatedControlDesigner) { TemplatedControlDesigner innerDesigner = (TemplatedControlDesigner)designer; if (innerDesigner.InTemplateMode) { innerDesigner.ExitTemplateMode(/*fSwitchingTemplates*/ false, /*fNested*/ true, /*fSave*/ fSave); } } } } catch (Exception ex) { Debug.Fail(ex.ToString()); } }
public TemplatedControlDesignerTemplateDefinition(string name, Style style, TemplatedControlDesigner parent, ITemplateEditingFrame frame) : base(parent, name, parent.Component, name, style) { this._parent = parent; this._frame = frame; base.Properties[typeof(Control)] = (Control)this._parent.Component; }
public TemplateEditingVerb(string text, int index, TemplatedControlDesigner designer) : base(text, designer.TemplateEditingVerbHandler) { _index = index; }
public ITemplateEditingFrame CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames) { return(CreateFrame(designer, frameName, templateNames, null, null)); }
public TemplateEditingVerb (string text, int index, TemplatedControlDesigner designer) : base (text, designer.TemplateEditingVerbHandler) { _index = index; }
public TemplateEditingVerb(string text, int index, TemplatedControlDesigner designer) : this(text, index, designer.TemplateEditingVerbHandler) { }
public ITemplateEditingFrame CreateFrame (TemplatedControlDesigner designer, string frameName, string[] templateNames) { return CreateFrame (designer, frameName, templateNames, null, null); }
public ITemplateEditingFrame CreateFrame (TemplatedControlDesigner designer, string frameName, string[] templateNames, Style controlStyle, Style[] templateStyles) { throw new NotImplementedException (); }
public TemplatedControlDesignerTemplateDefinition(string name, Style style, TemplatedControlDesigner parent, ITemplateEditingFrame frame) : base(parent, name, parent.Component, name, style) { this._parent = parent; this._frame = frame; base.Properties[typeof(Control)] = (Control) this._parent.Component; }
public ITemplateEditingFrame CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames, Style controlStyle, Style[] templateStyles) { throw new NotImplementedException(); }
ITemplateEditingFrame ITemplateEditingService.CreateFrame(TemplatedControlDesigner designer, string frameName, string[] templateNames) { return ((ITemplateEditingService) this).CreateFrame(designer, frameName, templateNames, null, null); }