public ToolStripItem Render(object item, TSIContext context) { Type tipo = ((item != null) ? item.GetType() : null); // Si esta en la tsiCache y lo puede renderizar, utiliza la tsiCache (por tipo). if ((tipo != null) && this.tsiCache.ContainsKey(tipo)) { TSIRender render = this.tsiCache[tipo]; if (render.IsRenderable(item)) { return(render.Render(item, context)); } } // Se busca entre los tsiRenders. foreach (TSIRender render in this.tsiRenders) { if (render.IsRenderable(item)) { // Si no esta en la tsiCache, se añade a la tsiCache (por tipo). if ((tipo != null) && !this.tsiCache.ContainsKey(tipo)) { this.tsiCache.Add(tipo, render); } return(render.Render(item, context)); } } return(null); }
public override LabelValueToolStrip Render(IProperty property, TSIContext context) { LabelValueToolStrip tsItem = new LabelValueToolStrip(); Set(tsItem, property, context); tsItem.Enabled = property.Enabled; tsItem.ValueIsEditable = property.Editable; tsItem.Label = property.NameUI; int labelWidth = 50; int valueWidth = 50; if (context.PropertiesProvider != null) { PropertyProperties props = context.PropertiesProvider.FindProperties <PropertyProperties>(property) ?? PropertyProperties.Empty; labelWidth = props.LabelWidth; valueWidth = props.ValueWidth; } tsItem.LabelWidth = labelWidth; tsItem.ValueWidth = valueWidth; // Se asocian el ToolStripItem a la propiedad. Link.Build(tsItem, property, context); return(tsItem); }
public override ToolStripLabel Render(Label action, TSIContext context) { ToolStripLabel tsItem = new ToolStripLabel(); Set(tsItem, action, context); return(tsItem); }
public override ToolStripDropDownItem Render(IComposedComponentUI composed, TSIContext context) { ToolStripDropDownItem tsDropDownItem = new ToolStripDropDownButton(); Set(tsDropDownItem, composed, context); tsDropDownItem.DisplayStyle = context.CurrentDisplayStyle; // Se asocian el ToolStripItem a la accion. Link.Build(tsDropDownItem, composed, context); return(tsDropDownItem); }
public override ToolStripMenuItem Render(IAction action, TSIContext context) { ToolStripMenuItem tsItem = new ToolStripMenuItem(); tsItem.Tag = action; Set(tsItem, action, context); tsItem.DisplayStyle = context.CurrentDisplayStyle; // Se asocian el ToolStripItem a la accion. Link.Build(tsItem, action, context); return(tsItem); }
public override ToolStripItem Render(object obj, TSIContext context) { ToolStripItem tsItem = new ToolStripMenuItem(); tsItem.Tag = null; tsItem.Name = "<Error>"; tsItem.DisplayStyle = ToolStripItemDisplayStyle.None; tsItem.Text = "<Error>"; tsItem.AutoToolTip = false; tsItem.ToolTipText = "<Error>"; tsItem.Image = null; //tsItem.Click = null; return(tsItem); }
protected static void Set(ToolStripItem tsItem, IAction accion, TSIContext context) { Set(tsItem, (IComponentUI)accion, context); tsItem.Enabled = accion.Enabled; // NOTA: la primera vez que se pinta, se actualiza 'Enabled'. PaintEventHandler[] update = new PaintEventHandler[1]; update[0] = (sender, args) => { ActionUtils.NotifyUpdateState(accion); tsItem.Enabled = accion.Enabled; tsItem.Paint -= update[0]; }; tsItem.Paint += update[0]; }
protected static void Set(ToolStripItem tsItem, IComponentUI component, TSIContext context) { tsItem.Tag = component; tsItem.Name = component.Name; tsItem.Text = component.NameUI; tsItem.ToolTipText = component.DescriptionUI; tsItem.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; tsItem.AutoToolTip = false; tsItem.TextImageRelation = context.TextImageRelation; if (component.IconUI != null) { tsItem.Image = component.IconUI.ToImage(context.CurrentIconSize); } else if (context.CurrentDisplayStyle == ToolStripItemDisplayStyle.Image) { tsItem.Image = MainResources.icon_not_found.ToImage(context.CurrentIconSize); } tsItem.AutoSize = true; tsItem.ImageScaling = ToolStripItemImageScaling.None; }
public IEnumerable <ToolStripItem> RenderRange(TSIContext context, IEnumerable <object> components) { return(components.Select(c => this.Render(c, context))); }
/// <summary> /// Renderiza el objeto. /// </summary> /// <param name="obj">Objeto.</param> /// <param name="context">Contexto.</param> /// <returns>ToolStripItem.</returns> public abstract ToolStripItem Render(object obj, TSIContext context);
public override ToolStripSeparator Render(Separator accion, TSIContext context) { ToolStripSeparator tsItem = new ToolStripSeparator(); return(tsItem); }
private Link(ToolStripDropDownItem tsItem, IComposedComponentUI item, TSIContext context) : base(tsItem, item, context) { this.TSItem.DropDown.Name = item.Name; this.UpdateComponents(); }
/// <summary> /// Crea una asociacion. /// </summary> public static void Build(LabelValueToolStrip tsItem, IProperty item, TSIContext context) { new Link(tsItem, item, context); }
private Link(ToolStripMenuItem tsItem, IAction item, TSIContext context) : base(tsItem, item, context) { }
/// <summary> /// Crea una asociacion. /// </summary> public static void Build(ToolStripMenuItem tsItem, IAction item, TSIContext context) { new Link(tsItem, item, context); }
/// <summary> /// Crea una asociacion. /// </summary> public static void Build(ToolStripDropDownItem tsItem, IComposedComponentUI item, TSIContext context) { new Link(tsItem, item, context); }
private Link(LabelValueToolStrip tsItem, IProperty item, TSIContext context) : base(tsItem, item, context) { this.UpdateControl(); }
protected Link(TTSItem tsItem, T item, TSIContext context) { this.context = (TSIContext)context.Clone(); this.TSItem = tsItem; this.Item = item; }
private Link(ToolStripDropDownItem tsItem, IComposedAction item, TSIContext context) : base(tsItem, item, context) { this.TSItem.DropDown.Name = tsItem.Name; this.UpdateActions(); }