protected GuiControl() { Color = Color.White; TextColor = Color.White; IsEnabled = true; IsVisible = true; Controls = new GuiControlCollection(this); Origin = Vector2.One * 0.5f; }
protected GuiControl(GuiSkin skin) { Skin = skin; Color = Color.White; TextColor = Color.White; IsEnabled = true; IsVisible = true; Controls = new GuiControlCollection(this); Origin = Vector2.Zero; var style = skin?.GetStyle(GetType()); style?.Apply(this); }
protected List <T> FindControls <T>(GuiControlCollection controls) where T : GuiControl { var results = new List <T>(); foreach (var control in controls) { if (control is T) { results.Add(control as T); } if (control.Controls.Any()) { results = results.Concat(FindControls <T>(control.Controls)).ToList(); } } return(results); }
protected GuiControl(GuiSkin skin) { Skin = skin; Color = Color.White; TextColor = Color.White; IsEnabled = true; IsVisible = true; Controls = new GuiControlCollection(this) { ItemAdded = x => UpdateRootIsLayoutRequired(), ItemRemoved = x => UpdateRootIsLayoutRequired() }; Origin = Vector2.Zero; var style = skin?.GetStyle(GetType()); style?.Apply(this); }