Пример #1
0
 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();
 }
Пример #2
0
 protected override void HandleCopy()
 {
     if (selectionLength != 0)
     {
         var whatToCopy = DisplayedText.Substring(
             selectionStart, selectionLength);
         Clipboard.ClipboardImplementation.PushStringToClipboard(
             whatToCopy);
     }
 }
Пример #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (disposing)
            {
                DisplayedText?.Dispose();
            }

            _isDisposed = true;
        }
Пример #4
0
        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);
        }
Пример #5
0
        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;
            }
        }