public DragEventArgs(IColossalControl source, DragDropState state, object data, Vector2 position, IColossalControl target) { this.State = state; this.Data = data; this.Position = position; this.Source = source; this.Target = target; }
/// <summary> /// Attaches an already existing UI <paramref name="component"/> as a sub control. Moves the existing control as a child below this control. /// </summary> /// <remarks> /// This wraps the given UI <paramref name="component"/> with the SkylineToolkit control wrapper. /// </remarks> /// <param name="component"></param> /// <returns>The attached child control.</returns> public new IColossalControl AttachControl(UIComponent component) { component = this.UIComponent.AttachUIComponent(component.gameObject); Type constructedType = typeof(ColossalControl <>).MakeGenericType(component.GetType()); IColossalControl colossalControl = (IColossalControl)Activator.CreateInstance(constructedType, new object[] { component }); return(colossalControl); }
/// <summary> /// Finds a child control matching the given filter and control type. /// </summary> /// <remarks> /// The found <see cref="UIComponent"/>, if there's one, gets automatically wrapped up into a SkylineToolkit control wrapper. /// </remarks> /// <typeparam name="TControl">The type of the expected child control.</typeparam> /// <param name="filter">A filter used to search a sub control.</param> /// <returns>The found child control or null when found nothin.</returns> public IColossalControl FindColossalChild <TControl>(string filter) where TControl : UIComponent { UIComponent component = this.UIComponent.Find <TControl>(filter); Type constructedType = typeof(ColossalControl <>).MakeGenericType(component.GetType()); IColossalControl colossalControl = (IColossalControl)Activator.CreateInstance(constructedType, new object[] { component }); return(colossalControl); }
public new static TControl FromUIComponent <TControl>(UIComponent component) where TControl : IColossalControl { IColossalControl control = (TControl)ColossalControl <ColossalFramework.UI.UIComponent> .FromUIComponent(component); if (!typeof(TControl).IsAssignableFrom(control.GetType())) { throw new InvalidCastException(); } return((TControl)control); }
public ColossalControl(IColossalControl control) { if (control.UIComponent.GetType() != typeof(T)) { throw new InvalidCastException(String.Format("Can't wrap the given ColossalControl<{0}> with ColossalControl<{1}>.", control.GetType().Name, typeof(T).Name)); } this.GameObject = control.GameObject; this.UIComponent = (T)control.UIComponent; this.SubscribeEvents(); }
public override void AttachTo(IColossalControl control) { control.AttachControl(Panel); if (HorizontalScrollbar != null) { HorizontalScrollbar.AttachTo(control); } if (VerticalScrollbar != null) { VerticalScrollbar.AttachTo(control); } }
/// <summary> /// Finds a child control matching the given filter. /// </summary> /// <remarks> /// The found <see cref="UIComponent"/>, if there's one, gets automatically wrapped up into a SkylineToolkit control wrapper. /// </remarks> /// <param name="filter">A filter used to search a sub control.</param> /// <returns>The found child control or null when found nothin.</returns> public new IColossalControl FindChild(string filter) { UIComponent component = this.UIComponent.Find(filter); if (component == null) { return(null); } Type constructedType = typeof(ColossalControl <>).MakeGenericType(component.GetType()); IColossalControl colossalControl = (IColossalControl)Activator.CreateInstance(constructedType, new object[] { component }); return(colossalControl); }
/// <summary> /// Finds a child control matching the given filter and control type. /// </summary> /// <remarks> /// This uses the SkylineToolkit control wrappers. /// The found <see cref="UIComponent"/>, if there's one, gets automatically wrapped up into a SkylineToolkit control wrapper. /// </remarks> /// <typeparam name="TControl">The type of the expected child control.</typeparam> /// <param name="filter">A filter used to search a sub control.</param> /// <returns>The found child control or null when found nothin.</returns> public TControl FindChild <TControl>(string filter) where TControl : IColossalControl { Type componentType = GetUIComponentType(typeof(TControl)); UIComponent component = this.UIComponent.Find(filter, componentType); if (component == null) { return(default(TControl)); } Type constructedType = typeof(ColossalControl <>).MakeGenericType(component.GetType()); IColossalControl colossalControl = (IColossalControl)Activator.CreateInstance(constructedType, new object[] { component }); return((TControl)colossalControl); }
/// <summary> /// Creates a new control of given <paramref name="type"/> and attaches it as a child control. /// </summary> /// <remarks> /// This method accepts both SkylineToolkit and Colossal UI control/component classes. /// Original Colossal <see cref="UIComponent"/> types gets wrapped automatically with the control classes from SkylineToolkit. /// The returned control requires casting to the desired type. /// </remarks> /// <param name="type">The type of the new control.</param> /// <returns>The newly created control.</returns> public new IColossalControl AddControl(Type type) { if (typeof(ColossalControl <>).IsAssignableFrom(type)) { IColossalControl control = (IColossalControl)Activator.CreateInstance(type); this.UIComponent.AddUIComponent(control.UIComponent.GetType()); return(control); } if (typeof(UIComponent).IsAssignableFrom(type)) { UIComponent component = this.UIComponent.AddUIComponent(type); Type constructedType = typeof(ColossalControl <>).MakeGenericType(component.GetType()); IColossalControl colossalControl = (IColossalControl)Activator.CreateInstance(constructedType, new object[] { component }); return(colossalControl); } throw new InvalidCastException(); }
public ColossalUserControl(IColossalControl control) : base(control) { }
public TooltipEventArgs(IColossalControl tooltipControl) { this.TooltipControl = tooltipControl; }
public ScrollablePanel(IColossalControl control, bool subschribeEvents = false) : base(control, subschribeEvents) { }
public abstract void AttachTo(IColossalControl control);
/// <summary> /// Returns the type of the wrapped <see cref="UIComponent"/> from a ColossalControl wrapper. /// </summary> /// <param name="control">The SkylineToolkit UI Wrapper from which to receive the wrapped type.</param> /// <returns>The type of the wrapped <see cref="UIComponent"/>.</returns> protected static Type GetUIComponentType(IColossalControl control) { return(GetUIComponentType(control.GetType())); }
public ColossalUserControl(IColossalControl control, bool subscribeEvents = false) : base(control, subscribeEvents) { }
public TextField(IColossalControl control, bool subschribeEvents = false) : base(control, subschribeEvents) { }
public Sprite(IColossalControl control, bool subschribeEvents = false) : base(control, subschribeEvents) { }
public override void AttachTo(IColossalControl control) { control.AttachControl(Strip); control.AttachControl(Container); }
public DragHandle(IColossalControl control, bool subschribeEvents = false) : base(control, subschribeEvents) { }
public TabStrip(IColossalControl control, bool subschribeEvents = false) : base(control, subschribeEvents) { }
public ColossalTextControl(IColossalControl control) : base(control) { }
public void ScrollToControl(IColossalControl control) { this.ScrollToControl(control.UIComponent); }
public Button(IColossalControl control, bool subscribeEvents = false) : base(control, subscribeEvents) { }
public FocusEventArgs(IColossalControl focusedControl, IColossalControl lostFocusControl) { this.FocusedControl = focusedControl; this.LostFocusControl = lostFocusControl; }
public override void AttachTo(IColossalControl control) { control.AttachControl(Control); }