public void AutocompliteDisplayedText(string text) { if (DisplayedText.Length <= 0) { DisplayedText = text + " "; return; } else { if (DisplayedText[DisplayedText.Length - 1] == ' ') { DisplayedText += text + " "; } else { bool flag = false; for (int i = DisplayedText.Length - 1; i >= 0; i--) { if (DisplayedText[i] == ' ') { DisplayedText = string.Format("{0} {1} ", DisplayedText.Remove(i), text); flag = true; break; } } if (!flag) { DisplayedText = string.Format("{0} ", text); } } } DisplayedText = DisplayedText.ToUpper(); }
protected override void HandleCopy() { if (selectionLength != 0) { var whatToCopy = DisplayedText.Substring( selectionStart, selectionLength); Clipboard.ClipboardImplementation.PushStringToClipboard( whatToCopy); } }
protected virtual void Dispose(bool disposing) { if (_isDisposed) { return; } if (disposing) { DisplayedText?.Dispose(); } _isDisposed = true; }
internal void RecalculateBoundingAndDisplayedText() { BoundingIgnoredSizeAndFlags = TextHandle.MeasureText(SpriteHandle, TextValue, FontDrawFlags.NoClip); DisplayedText = TextValue; Bounding = BoundingIgnoredSizeAndFlags; if (Bounding.Width - 4 > Width) { while (Bounding.Width - 4 > Width && DisplayedText.Length > 3) { DisplayedText = string.Concat(DisplayedText.Substring(0, DisplayedText.Length - 4), "..."); Bounding = TextHandle.MeasureText(SpriteHandle, DisplayedText, DrawFlags); } } // Recalculate the position rectangle RecalculatePositionRectangle(); // Preload the text TextHandle.PreloadText(DisplayedText); }
protected void UpdateToSelection() { if (selectionInstance != null && selectionLength > 0 && DisplayedText?.Length > 0) { selectionInstance.Visible = true; selectionInstance.XUnits = global::Gum.Converters.GeneralUnitType.PixelsFromSmall; var substring = DisplayedText.Substring(0, selectionStart); var firstMeasure = this.coreTextObject.BitmapFont.MeasureString(substring); selectionInstance.X = this.textComponent.X + firstMeasure; substring = DisplayedText.Substring(0, selectionStart + selectionLength); selectionInstance.Width = 1 + this.coreTextObject.BitmapFont.MeasureString(substring) - firstMeasure; } else if (selectionInstance != null) { selectionInstance.Visible = false; } }