private void CreateScreenIpsos() { TextIpsoInScreen = new RenderingLibrary.Graphics.Text(null); TextIpsoInScreen.Name = "TextInstance"; ButtonIpsoInScreen = new RenderingLibrary.Graphics.Sprite(null); ButtonIpsoInScreen.Name = "ButtonInstance"; TextIpsoInScreen.Parent = ButtonIpsoInScreen; }
private void CreateButtonIpsos() { // IPSOs in Button TextIpsoInButton = new RenderingLibrary.Graphics.Text(null); TextIpsoInButton.Name = "TextInstance"; ButtonIpsoInButton = new RenderingLibrary.Graphics.Sprite(null); ButtonIpsoInButton.Name = "Button"; TextIpsoInButton.Parent = ButtonIpsoInButton; TextIpsoInText = new RenderingLibrary.Graphics.Text(null); TextIpsoInText.Name = "Text"; }
protected override void ReactToVisualChanged() { var listBoxInstance = Visual.GetGraphicalUiElementByName("ListBoxInstance"); textComponent = base.Visual.GetGraphicalUiElementByName("TextInstance"); #if DEBUG if (listBoxInstance == null) { throw new Exception("Gum object must have an object called \"ListBoxInstance\""); } if (textComponent == null) { throw new Exception("Gum object must have an object called \"Text\""); } #endif coreTextObject = textComponent.RenderableComponent as RenderingLibrary.Graphics.Text; if (listBoxInstance.FormsControlAsObject == null) { listBox = new ListBox(listBoxInstance); } else { listBox = listBoxInstance.FormsControlAsObject as ListBox; #if DEBUG if (listBox == null) { var message = $"The ListBoxInstance Gum component inside the combo box {Visual.Name} is of type {listBoxInstance.FormsControlAsObject.GetType().Name}, but it should be of type ListBox"; throw new Exception(message); } #endif } Visual.Click += this.HandleClick; Visual.Push += this.HandlePush; Visual.LosePush += this.HandleLosePush; Visual.RollOn += this.HandleRollOn; Visual.RollOff += this.HandleRollOff; listBox.Visual.EffectiveParentGue.RaiseChildrenEventsOutsideOfBounds = true; listBox.SelectionChanged += HandleSelectionChanged; listBox.IsVisible = false; Text = null; base.ReactToVisualChanged(); }
protected override void ReactToVisualChanged() { Visual.Push += this.HandlePush; Visual.Click += this.HandleClick; Visual.RollOn += this.HandleRollOn; Visual.RollOff += this.HandleRollOff; // optional text = Visual.GetGraphicalUiElementByName("TextInstance"); coreText = text?.RenderableComponent as RenderingLibrary.Graphics.Text; // Just in case it needs to set the state to "enabled" UpdateState(); base.ReactToVisualChanged(); }
protected override void ReactToVisualChanged() { textComponent = base.Visual.GetGraphicalUiElementByName("TextInstance"); caretComponent = base.Visual.GetGraphicalUiElementByName("CaretInstance"); // optional: selectionInstance = base.Visual.GetGraphicalUiElementByName("SelectionInstance"); coreTextObject = textComponent.RenderableComponent as RenderingLibrary.Graphics.Text; #if DEBUG if (textComponent == null) { throw new Exception("Gum object must have an object called \"Text\""); } if (coreTextObject == null) { throw new Exception("The Text instance must be of type Text"); } if (caretComponent == null) { throw new Exception("Gum object must have an object called \"Caret\""); } #endif Visual.Click += this.HandleClick; Visual.Push += this.HandlePush; Visual.RollOn += this.HandleRollOn; Visual.RollOver += this.HandleRollOver; Visual.DragOver += this.HandleDrag; Visual.RollOff += this.HandleRollOff; Visual.SizeChanged += HandleVisualSizeChanged; this.textComponent.XUnits = global::Gum.Converters.GeneralUnitType.PixelsFromSmall; base.ReactToVisualChanged(); OffsetTextToKeepCaretInView(); HasFocus = false; }